diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index dd93962010e..83bca8f716a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} USER vscode -RUN curl -sSf https://rye-up.com/get | RYE_VERSION="0.24.0" RYE_INSTALL_OPTION="--yes" bash +RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.24.0" RYE_INSTALL_OPTION="--yes" bash ENV PATH=/home/vscode/.rye/shims:$PATH RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc0298ed9e7..e853349a718 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,27 +18,17 @@ jobs: - name: Install Rye run: | - curl -sSf https://rye-up.com/get | bash + curl -sSf https://rye.astral.sh/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 - - - name: Run ruff - run: | - rye run check:ruff + run: rye sync --all-features - - name: Run type checking - run: | - rye run typecheck - - - name: Ensure importable - run: | - rye run python -c 'import cloudflare' + - name: Run lints + run: ./scripts/lint test: name: test runs-on: ubuntu-latest @@ -48,7 +38,7 @@ jobs: - name: Install Rye run: | - curl -sSf https://rye-up.com/get | bash + curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: RYE_VERSION: 0.24.0 @@ -68,7 +58,7 @@ jobs: - name: Install Rye run: | - curl -sSf https://rye-up.com/get | bash + curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: RYE_VERSION: 0.24.0 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 4cc6b598c5a..6528ad30f81 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -18,7 +18,7 @@ jobs: - name: Install Rye run: | - curl -sSf https://rye-up.com/get | bash + curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: RYE_VERSION: 0.24.0 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f9ed78f868f..782f39f19fa 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.0.0-beta.9" + ".": "3.0.0-beta.10" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index b162e099397..b45dbe1d84d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1274 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-07ec76fab00de3d6227209faf0af1ed586cde9e2f243c13d3db555da20f13d99.yml +configured_endpoints: 1348 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-49d54760f87326f9200c777f867e4ea579c92a43f481207ae252db9748c9b07b.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index d0adbeed795..3525bc456e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,312 @@ # Changelog +## 3.0.0-beta.10 (2024-06-18) + +Full Changelog: [v3.0.0-beta.9...v3.0.0-beta.10](https://github.com/cloudflare/cloudflare-python/compare/v3.0.0-beta.9...v3.0.0-beta.10) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#1000](https://github.com/cloudflare/cloudflare-python/issues/1000)) ([c97f907](https://github.com/cloudflare/cloudflare-python/commit/c97f907888fa632d353590c34923a37f719645ff)) +* **api:** OpenAPI spec update via Stainless API ([#1001](https://github.com/cloudflare/cloudflare-python/issues/1001)) ([2f1ef0f](https://github.com/cloudflare/cloudflare-python/commit/2f1ef0fd1cfee7f2949a996e517a447ab14b8ebc)) +* **api:** OpenAPI spec update via Stainless API ([#1002](https://github.com/cloudflare/cloudflare-python/issues/1002)) ([f51ca7b](https://github.com/cloudflare/cloudflare-python/commit/f51ca7bcd209a1093278f87b03b0faf8f4e7a406)) +* **api:** OpenAPI spec update via Stainless API ([#1003](https://github.com/cloudflare/cloudflare-python/issues/1003)) ([226559c](https://github.com/cloudflare/cloudflare-python/commit/226559c098f9ac4ab349fe7a8e4f764b5ff909e2)) +* **api:** OpenAPI spec update via Stainless API ([#1004](https://github.com/cloudflare/cloudflare-python/issues/1004)) ([c3c6156](https://github.com/cloudflare/cloudflare-python/commit/c3c615636067d1f4849d444dd79e36cecbafbeec)) +* **api:** OpenAPI spec update via Stainless API ([#1005](https://github.com/cloudflare/cloudflare-python/issues/1005)) ([ec8a580](https://github.com/cloudflare/cloudflare-python/commit/ec8a580bb436b5df5b8d5340c7ade0ad303536e5)) +* **api:** OpenAPI spec update via Stainless API ([#1006](https://github.com/cloudflare/cloudflare-python/issues/1006)) ([1b3c186](https://github.com/cloudflare/cloudflare-python/commit/1b3c1867a1b4fcc03d67a510505fb669c2449ac0)) +* **api:** OpenAPI spec update via Stainless API ([#1007](https://github.com/cloudflare/cloudflare-python/issues/1007)) ([1451caa](https://github.com/cloudflare/cloudflare-python/commit/1451caa51bba02360dd2c6ce3c0f8b8423c67062)) +* **api:** OpenAPI spec update via Stainless API ([#1008](https://github.com/cloudflare/cloudflare-python/issues/1008)) ([6b66d16](https://github.com/cloudflare/cloudflare-python/commit/6b66d162abbf562dc203c4389d30247e154fc29c)) +* **api:** OpenAPI spec update via Stainless API ([#1009](https://github.com/cloudflare/cloudflare-python/issues/1009)) ([cba721d](https://github.com/cloudflare/cloudflare-python/commit/cba721dfb452ecc2a7e2891907512cdd3df6d49e)) +* **api:** OpenAPI spec update via Stainless API ([#1010](https://github.com/cloudflare/cloudflare-python/issues/1010)) ([edf3d01](https://github.com/cloudflare/cloudflare-python/commit/edf3d01b2ccf3e3037423363d63c5ffb76288e42)) +* **api:** OpenAPI spec update via Stainless API ([#1012](https://github.com/cloudflare/cloudflare-python/issues/1012)) ([044d8e5](https://github.com/cloudflare/cloudflare-python/commit/044d8e54543e2a2ae1b7545407c675eb7543e6a0)) +* **api:** OpenAPI spec update via Stainless API ([#713](https://github.com/cloudflare/cloudflare-python/issues/713)) ([a0eeb87](https://github.com/cloudflare/cloudflare-python/commit/a0eeb874726c9d5178b97635ce2d4ee206d76b5d)) +* **api:** OpenAPI spec update via Stainless API ([#714](https://github.com/cloudflare/cloudflare-python/issues/714)) ([7fb3d7e](https://github.com/cloudflare/cloudflare-python/commit/7fb3d7ef1c03925d19bfd4a4f903d1466a324e30)) +* **api:** OpenAPI spec update via Stainless API ([#715](https://github.com/cloudflare/cloudflare-python/issues/715)) ([03f1c56](https://github.com/cloudflare/cloudflare-python/commit/03f1c568d06be069ca7bb5993e9254229d794815)) +* **api:** OpenAPI spec update via Stainless API ([#716](https://github.com/cloudflare/cloudflare-python/issues/716)) ([ddb10a2](https://github.com/cloudflare/cloudflare-python/commit/ddb10a2361a2adbfe8073607aec7d0190a3f7ecd)) +* **api:** OpenAPI spec update via Stainless API ([#717](https://github.com/cloudflare/cloudflare-python/issues/717)) ([dea253d](https://github.com/cloudflare/cloudflare-python/commit/dea253d90dd9f903dc01466398188eed54af94bf)) +* **api:** OpenAPI spec update via Stainless API ([#718](https://github.com/cloudflare/cloudflare-python/issues/718)) ([49c0c0f](https://github.com/cloudflare/cloudflare-python/commit/49c0c0f46fc15923d11e984994ef908ff80250c4)) +* **api:** OpenAPI spec update via Stainless API ([#719](https://github.com/cloudflare/cloudflare-python/issues/719)) ([457ac82](https://github.com/cloudflare/cloudflare-python/commit/457ac8295b5195508086a73cf8faf740a2a91591)) +* **api:** OpenAPI spec update via Stainless API ([#720](https://github.com/cloudflare/cloudflare-python/issues/720)) ([359cd8e](https://github.com/cloudflare/cloudflare-python/commit/359cd8e8121618f6c43ef4415a122613f2cf1baa)) +* **api:** OpenAPI spec update via Stainless API ([#721](https://github.com/cloudflare/cloudflare-python/issues/721)) ([0a5e98b](https://github.com/cloudflare/cloudflare-python/commit/0a5e98b7f27a7440d44b23ac82a97ec9cbf04d7c)) +* **api:** OpenAPI spec update via Stainless API ([#722](https://github.com/cloudflare/cloudflare-python/issues/722)) ([e5ba886](https://github.com/cloudflare/cloudflare-python/commit/e5ba886179519b93c9324c08487cc41b3cd052c7)) +* **api:** OpenAPI spec update via Stainless API ([#723](https://github.com/cloudflare/cloudflare-python/issues/723)) ([014819d](https://github.com/cloudflare/cloudflare-python/commit/014819d5d90311d89c2d74870b5d9be61896fb65)) +* **api:** OpenAPI spec update via Stainless API ([#724](https://github.com/cloudflare/cloudflare-python/issues/724)) ([6cceaf7](https://github.com/cloudflare/cloudflare-python/commit/6cceaf781a7e5c5df4d69c0ce308399d16ccb081)) +* **api:** OpenAPI spec update via Stainless API ([#725](https://github.com/cloudflare/cloudflare-python/issues/725)) ([4b98eab](https://github.com/cloudflare/cloudflare-python/commit/4b98eabcc7782cffd33bc3e90b102aabd28accfc)) +* **api:** OpenAPI spec update via Stainless API ([#727](https://github.com/cloudflare/cloudflare-python/issues/727)) ([5745d99](https://github.com/cloudflare/cloudflare-python/commit/5745d99e6178305eb9e32825bb1a4658a702e33a)) +* **api:** OpenAPI spec update via Stainless API ([#728](https://github.com/cloudflare/cloudflare-python/issues/728)) ([4ca97ec](https://github.com/cloudflare/cloudflare-python/commit/4ca97ec63dcd1baa99ab53a8a8f96435df2c16c2)) +* **api:** OpenAPI spec update via Stainless API ([#729](https://github.com/cloudflare/cloudflare-python/issues/729)) ([26fd504](https://github.com/cloudflare/cloudflare-python/commit/26fd50450a3c626df938dd12c976d71eac604728)) +* **api:** OpenAPI spec update via Stainless API ([#730](https://github.com/cloudflare/cloudflare-python/issues/730)) ([45acdc0](https://github.com/cloudflare/cloudflare-python/commit/45acdc076313cb27bdac600896333e9234a0c304)) +* **api:** OpenAPI spec update via Stainless API ([#731](https://github.com/cloudflare/cloudflare-python/issues/731)) ([799f40e](https://github.com/cloudflare/cloudflare-python/commit/799f40eb7b149090d87ff3bb522621dbe73c8a47)) +* **api:** OpenAPI spec update via Stainless API ([#732](https://github.com/cloudflare/cloudflare-python/issues/732)) ([1bdd586](https://github.com/cloudflare/cloudflare-python/commit/1bdd586a537837b08069faa92af8da6c2b956c88)) +* **api:** OpenAPI spec update via Stainless API ([#733](https://github.com/cloudflare/cloudflare-python/issues/733)) ([5c45e6e](https://github.com/cloudflare/cloudflare-python/commit/5c45e6e24fb544d21bcc07cb5175364ccae157e4)) +* **api:** OpenAPI spec update via Stainless API ([#734](https://github.com/cloudflare/cloudflare-python/issues/734)) ([5b3d98d](https://github.com/cloudflare/cloudflare-python/commit/5b3d98ddcda6958f888607b6e420d125be3ed32b)) +* **api:** OpenAPI spec update via Stainless API ([#735](https://github.com/cloudflare/cloudflare-python/issues/735)) ([45c5755](https://github.com/cloudflare/cloudflare-python/commit/45c575503a9b51403d2ea44b1e250d26dca9467d)) +* **api:** OpenAPI spec update via Stainless API ([#736](https://github.com/cloudflare/cloudflare-python/issues/736)) ([556227a](https://github.com/cloudflare/cloudflare-python/commit/556227a4dea855bf414fdeab4606cbc2d912ccd3)) +* **api:** OpenAPI spec update via Stainless API ([#737](https://github.com/cloudflare/cloudflare-python/issues/737)) ([5a27fe1](https://github.com/cloudflare/cloudflare-python/commit/5a27fe15de393019289ad28a7744f8fda547c9f9)) +* **api:** OpenAPI spec update via Stainless API ([#738](https://github.com/cloudflare/cloudflare-python/issues/738)) ([3258d85](https://github.com/cloudflare/cloudflare-python/commit/3258d858d78449cebec4d0c3f0480eeac15201ff)) +* **api:** OpenAPI spec update via Stainless API ([#739](https://github.com/cloudflare/cloudflare-python/issues/739)) ([760506b](https://github.com/cloudflare/cloudflare-python/commit/760506b6bd05fedcd12e310e7fe87dd9665e7a26)) +* **api:** OpenAPI spec update via Stainless API ([#740](https://github.com/cloudflare/cloudflare-python/issues/740)) ([947a9e9](https://github.com/cloudflare/cloudflare-python/commit/947a9e996d9cd68bb97a6e56ec6d2f9d0a931411)) +* **api:** OpenAPI spec update via Stainless API ([#741](https://github.com/cloudflare/cloudflare-python/issues/741)) ([07a5624](https://github.com/cloudflare/cloudflare-python/commit/07a5624809bb04e45bb08ec7b7dfcde700677fc9)) +* **api:** OpenAPI spec update via Stainless API ([#742](https://github.com/cloudflare/cloudflare-python/issues/742)) ([a730175](https://github.com/cloudflare/cloudflare-python/commit/a7301751431c4306bfc32212ea130a0d900304fa)) +* **api:** OpenAPI spec update via Stainless API ([#743](https://github.com/cloudflare/cloudflare-python/issues/743)) ([0a87d13](https://github.com/cloudflare/cloudflare-python/commit/0a87d13db8a1679a16019159d679f38ed3efb595)) +* **api:** OpenAPI spec update via Stainless API ([#744](https://github.com/cloudflare/cloudflare-python/issues/744)) ([8353bfe](https://github.com/cloudflare/cloudflare-python/commit/8353bfe5af9e60ce20130aa158d5301be016eba2)) +* **api:** OpenAPI spec update via Stainless API ([#745](https://github.com/cloudflare/cloudflare-python/issues/745)) ([dfa69f4](https://github.com/cloudflare/cloudflare-python/commit/dfa69f4694afe0202dbec8e449c38aa1fa09e382)) +* **api:** OpenAPI spec update via Stainless API ([#746](https://github.com/cloudflare/cloudflare-python/issues/746)) ([1dffe01](https://github.com/cloudflare/cloudflare-python/commit/1dffe018eaeb5c4a0424a6f52e3c6f983ab89cf3)) +* **api:** OpenAPI spec update via Stainless API ([#747](https://github.com/cloudflare/cloudflare-python/issues/747)) ([8b8fd23](https://github.com/cloudflare/cloudflare-python/commit/8b8fd23a03c7c20c1cdd260c195e14301a0e687e)) +* **api:** OpenAPI spec update via Stainless API ([#748](https://github.com/cloudflare/cloudflare-python/issues/748)) ([588623e](https://github.com/cloudflare/cloudflare-python/commit/588623e18406e1b3d6a162416a66f34015c31da9)) +* **api:** OpenAPI spec update via Stainless API ([#749](https://github.com/cloudflare/cloudflare-python/issues/749)) ([c642855](https://github.com/cloudflare/cloudflare-python/commit/c64285555159e5f374c06a31a41c88e4e2023b7c)) +* **api:** OpenAPI spec update via Stainless API ([#750](https://github.com/cloudflare/cloudflare-python/issues/750)) ([cb5aa05](https://github.com/cloudflare/cloudflare-python/commit/cb5aa0599c74bf7d6c0a7018ac95677d4d739c2b)) +* **api:** OpenAPI spec update via Stainless API ([#751](https://github.com/cloudflare/cloudflare-python/issues/751)) ([19b730b](https://github.com/cloudflare/cloudflare-python/commit/19b730bd51d04cf93868797e454563ddb62c3372)) +* **api:** OpenAPI spec update via Stainless API ([#752](https://github.com/cloudflare/cloudflare-python/issues/752)) ([9b0b40d](https://github.com/cloudflare/cloudflare-python/commit/9b0b40de707fb282debb67242c7bcf4db4ff9572)) +* **api:** OpenAPI spec update via Stainless API ([#753](https://github.com/cloudflare/cloudflare-python/issues/753)) ([cdb2935](https://github.com/cloudflare/cloudflare-python/commit/cdb293551d9ef2d06e0f3379d79331d66cea3429)) +* **api:** OpenAPI spec update via Stainless API ([#754](https://github.com/cloudflare/cloudflare-python/issues/754)) ([2e9a76c](https://github.com/cloudflare/cloudflare-python/commit/2e9a76c81512a90954d441c12f8feafd2039d099)) +* **api:** OpenAPI spec update via Stainless API ([#755](https://github.com/cloudflare/cloudflare-python/issues/755)) ([adfc559](https://github.com/cloudflare/cloudflare-python/commit/adfc559082bf2dbde589d71408de48de2eb788a9)) +* **api:** OpenAPI spec update via Stainless API ([#756](https://github.com/cloudflare/cloudflare-python/issues/756)) ([2824161](https://github.com/cloudflare/cloudflare-python/commit/2824161b0c8049803c8d94568aeb13b0902e6356)) +* **api:** OpenAPI spec update via Stainless API ([#757](https://github.com/cloudflare/cloudflare-python/issues/757)) ([04ed5f6](https://github.com/cloudflare/cloudflare-python/commit/04ed5f6617139752d3443b9d367a5134865cc358)) +* **api:** OpenAPI spec update via Stainless API ([#758](https://github.com/cloudflare/cloudflare-python/issues/758)) ([509db71](https://github.com/cloudflare/cloudflare-python/commit/509db710e5b72e08a77e67876e07892cfd3ed6f5)) +* **api:** OpenAPI spec update via Stainless API ([#759](https://github.com/cloudflare/cloudflare-python/issues/759)) ([926996c](https://github.com/cloudflare/cloudflare-python/commit/926996cd10c584ea6f0d8a5a52804159f310a9df)) +* **api:** OpenAPI spec update via Stainless API ([#760](https://github.com/cloudflare/cloudflare-python/issues/760)) ([8600f31](https://github.com/cloudflare/cloudflare-python/commit/8600f31343c576979ea0f5ae21ec92dc463bbb0c)) +* **api:** OpenAPI spec update via Stainless API ([#761](https://github.com/cloudflare/cloudflare-python/issues/761)) ([69ec751](https://github.com/cloudflare/cloudflare-python/commit/69ec7516745c71b2443fc365da060f3214e795ed)) +* **api:** OpenAPI spec update via Stainless API ([#762](https://github.com/cloudflare/cloudflare-python/issues/762)) ([9ba0f1b](https://github.com/cloudflare/cloudflare-python/commit/9ba0f1bb8345b87b71c1403ee6d24760603fd3fd)) +* **api:** OpenAPI spec update via Stainless API ([#763](https://github.com/cloudflare/cloudflare-python/issues/763)) ([9d24609](https://github.com/cloudflare/cloudflare-python/commit/9d24609073cad5ba379c97cb0eae4c75a814d997)) +* **api:** OpenAPI spec update via Stainless API ([#764](https://github.com/cloudflare/cloudflare-python/issues/764)) ([d722b7b](https://github.com/cloudflare/cloudflare-python/commit/d722b7b5b364041dfceec62e54f70cb7a79b1b20)) +* **api:** OpenAPI spec update via Stainless API ([#765](https://github.com/cloudflare/cloudflare-python/issues/765)) ([325e2cc](https://github.com/cloudflare/cloudflare-python/commit/325e2cc40a11554b2011d69a947edcfc55258253)) +* **api:** OpenAPI spec update via Stainless API ([#766](https://github.com/cloudflare/cloudflare-python/issues/766)) ([edb1fc5](https://github.com/cloudflare/cloudflare-python/commit/edb1fc53ce83225353d5ba27c8253b18b0b56aa8)) +* **api:** OpenAPI spec update via Stainless API ([#767](https://github.com/cloudflare/cloudflare-python/issues/767)) ([3238c36](https://github.com/cloudflare/cloudflare-python/commit/3238c36d41f544ebc562c560b5c17a5efb0a8b47)) +* **api:** OpenAPI spec update via Stainless API ([#768](https://github.com/cloudflare/cloudflare-python/issues/768)) ([fbc645e](https://github.com/cloudflare/cloudflare-python/commit/fbc645eb9fce79a16c0c0b3774f235698bf5bac2)) +* **api:** OpenAPI spec update via Stainless API ([#769](https://github.com/cloudflare/cloudflare-python/issues/769)) ([563d2cc](https://github.com/cloudflare/cloudflare-python/commit/563d2ccc1d5d45d7bca7b8944d258461ac742a35)) +* **api:** OpenAPI spec update via Stainless API ([#770](https://github.com/cloudflare/cloudflare-python/issues/770)) ([16f2024](https://github.com/cloudflare/cloudflare-python/commit/16f2024592b07624378ae6f584b7be64edb38762)) +* **api:** OpenAPI spec update via Stainless API ([#771](https://github.com/cloudflare/cloudflare-python/issues/771)) ([1aca606](https://github.com/cloudflare/cloudflare-python/commit/1aca60697f409eabe0813e6ff09a888dbecdc832)) +* **api:** OpenAPI spec update via Stainless API ([#772](https://github.com/cloudflare/cloudflare-python/issues/772)) ([3cfe2ab](https://github.com/cloudflare/cloudflare-python/commit/3cfe2ab9c306db44b0d14461adef8b855310b598)) +* **api:** OpenAPI spec update via Stainless API ([#773](https://github.com/cloudflare/cloudflare-python/issues/773)) ([129cd12](https://github.com/cloudflare/cloudflare-python/commit/129cd128f6c2bc7404bc413feb0f99917be5f140)) +* **api:** OpenAPI spec update via Stainless API ([#774](https://github.com/cloudflare/cloudflare-python/issues/774)) ([be4677a](https://github.com/cloudflare/cloudflare-python/commit/be4677a1dd37a8422eb8b7277e8b41451267c924)) +* **api:** OpenAPI spec update via Stainless API ([#776](https://github.com/cloudflare/cloudflare-python/issues/776)) ([af6dfae](https://github.com/cloudflare/cloudflare-python/commit/af6dfae184d6380d5702d575bbbf17f2b3360a65)) +* **api:** OpenAPI spec update via Stainless API ([#777](https://github.com/cloudflare/cloudflare-python/issues/777)) ([ae96268](https://github.com/cloudflare/cloudflare-python/commit/ae962684f6ce3fe43deac956713ff72c53aeab2b)) +* **api:** OpenAPI spec update via Stainless API ([#779](https://github.com/cloudflare/cloudflare-python/issues/779)) ([bd08f43](https://github.com/cloudflare/cloudflare-python/commit/bd08f43b49292706755e2772c876ae1a8cb39dc1)) +* **api:** OpenAPI spec update via Stainless API ([#780](https://github.com/cloudflare/cloudflare-python/issues/780)) ([2d617ad](https://github.com/cloudflare/cloudflare-python/commit/2d617ad49431032b211bb8c5aeb1ca76463866ef)) +* **api:** OpenAPI spec update via Stainless API ([#781](https://github.com/cloudflare/cloudflare-python/issues/781)) ([f5ecfb2](https://github.com/cloudflare/cloudflare-python/commit/f5ecfb2c0e890526d0166fbc300e670659aaaf26)) +* **api:** OpenAPI spec update via Stainless API ([#785](https://github.com/cloudflare/cloudflare-python/issues/785)) ([7f3baa6](https://github.com/cloudflare/cloudflare-python/commit/7f3baa694305a43de27dd61e9278319e309ab3f8)) +* **api:** OpenAPI spec update via Stainless API ([#786](https://github.com/cloudflare/cloudflare-python/issues/786)) ([ffbb106](https://github.com/cloudflare/cloudflare-python/commit/ffbb10669205683229a8ddb18c64cb8a9599fffe)) +* **api:** OpenAPI spec update via Stainless API ([#787](https://github.com/cloudflare/cloudflare-python/issues/787)) ([ecf6363](https://github.com/cloudflare/cloudflare-python/commit/ecf6363a5307ff255892ada1803074856c78ae44)) +* **api:** OpenAPI spec update via Stainless API ([#788](https://github.com/cloudflare/cloudflare-python/issues/788)) ([ee85bf1](https://github.com/cloudflare/cloudflare-python/commit/ee85bf180b6b32b28ef05de2642c53a837721d3f)) +* **api:** OpenAPI spec update via Stainless API ([#789](https://github.com/cloudflare/cloudflare-python/issues/789)) ([e8ed1f8](https://github.com/cloudflare/cloudflare-python/commit/e8ed1f8f7f7cf78b7f1869b1296e8d570d025771)) +* **api:** OpenAPI spec update via Stainless API ([#790](https://github.com/cloudflare/cloudflare-python/issues/790)) ([9091d7b](https://github.com/cloudflare/cloudflare-python/commit/9091d7b0efaf6ece2e99756a6bc91c2d420b6cc8)) +* **api:** OpenAPI spec update via Stainless API ([#791](https://github.com/cloudflare/cloudflare-python/issues/791)) ([45f7884](https://github.com/cloudflare/cloudflare-python/commit/45f7884a795276b12a0c8ab7516193a6500c7583)) +* **api:** OpenAPI spec update via Stainless API ([#792](https://github.com/cloudflare/cloudflare-python/issues/792)) ([cd93b55](https://github.com/cloudflare/cloudflare-python/commit/cd93b55fbaecee453b2682e8efbf5ed490c6c249)) +* **api:** OpenAPI spec update via Stainless API ([#793](https://github.com/cloudflare/cloudflare-python/issues/793)) ([9475e3c](https://github.com/cloudflare/cloudflare-python/commit/9475e3cbe7dc98fa889b44ae43a52346d949371e)) +* **api:** OpenAPI spec update via Stainless API ([#794](https://github.com/cloudflare/cloudflare-python/issues/794)) ([bb3889a](https://github.com/cloudflare/cloudflare-python/commit/bb3889a105c71b02b97ea63e52ae6f310ea878f7)) +* **api:** OpenAPI spec update via Stainless API ([#795](https://github.com/cloudflare/cloudflare-python/issues/795)) ([d84dbbb](https://github.com/cloudflare/cloudflare-python/commit/d84dbbb74d4fd13ab612fcc76f1c3dd95ddbcc71)) +* **api:** OpenAPI spec update via Stainless API ([#796](https://github.com/cloudflare/cloudflare-python/issues/796)) ([bfa8b22](https://github.com/cloudflare/cloudflare-python/commit/bfa8b2256a21a5b5c40eaa5b7904caedb301fce4)) +* **api:** OpenAPI spec update via Stainless API ([#797](https://github.com/cloudflare/cloudflare-python/issues/797)) ([ec2e1e3](https://github.com/cloudflare/cloudflare-python/commit/ec2e1e3670b003dff8a9f41d94e99055b03e9303)) +* **api:** OpenAPI spec update via Stainless API ([#798](https://github.com/cloudflare/cloudflare-python/issues/798)) ([4567f4d](https://github.com/cloudflare/cloudflare-python/commit/4567f4d99ea72da60b5bcf3390ca1fdffedd43e9)) +* **api:** OpenAPI spec update via Stainless API ([#799](https://github.com/cloudflare/cloudflare-python/issues/799)) ([9066b55](https://github.com/cloudflare/cloudflare-python/commit/9066b5546dd19ea3aa0b6bc073ebd20a196bf3a2)) +* **api:** OpenAPI spec update via Stainless API ([#800](https://github.com/cloudflare/cloudflare-python/issues/800)) ([098ce63](https://github.com/cloudflare/cloudflare-python/commit/098ce63b7560e7287b37b76cf9bee389e0551c95)) +* **api:** OpenAPI spec update via Stainless API ([#801](https://github.com/cloudflare/cloudflare-python/issues/801)) ([784447a](https://github.com/cloudflare/cloudflare-python/commit/784447a897b73f8bd2a416e247aaa5a432d43996)) +* **api:** OpenAPI spec update via Stainless API ([#802](https://github.com/cloudflare/cloudflare-python/issues/802)) ([4e8e439](https://github.com/cloudflare/cloudflare-python/commit/4e8e439098c4c1a76dc1f562c90bccf718d17c06)) +* **api:** OpenAPI spec update via Stainless API ([#803](https://github.com/cloudflare/cloudflare-python/issues/803)) ([0bfacd4](https://github.com/cloudflare/cloudflare-python/commit/0bfacd43972e5206b333ab1eed96a453f0c09a86)) +* **api:** OpenAPI spec update via Stainless API ([#804](https://github.com/cloudflare/cloudflare-python/issues/804)) ([442f36f](https://github.com/cloudflare/cloudflare-python/commit/442f36f79e7159a4c3787d6add16016b02f96941)) +* **api:** OpenAPI spec update via Stainless API ([#805](https://github.com/cloudflare/cloudflare-python/issues/805)) ([58169cc](https://github.com/cloudflare/cloudflare-python/commit/58169cc0744c229644294f6da4ad2782df9e3b6b)) +* **api:** OpenAPI spec update via Stainless API ([#806](https://github.com/cloudflare/cloudflare-python/issues/806)) ([565b4a2](https://github.com/cloudflare/cloudflare-python/commit/565b4a2c1a454cd4d47ccb222cc3d0503c66c571)) +* **api:** OpenAPI spec update via Stainless API ([#807](https://github.com/cloudflare/cloudflare-python/issues/807)) ([c974ba0](https://github.com/cloudflare/cloudflare-python/commit/c974ba0ad6e771ada9a9d5454e7c24101b725dc9)) +* **api:** OpenAPI spec update via Stainless API ([#808](https://github.com/cloudflare/cloudflare-python/issues/808)) ([69b665d](https://github.com/cloudflare/cloudflare-python/commit/69b665d94d7124e1f4e150d8b9d727e2ec3a5f5b)) +* **api:** OpenAPI spec update via Stainless API ([#810](https://github.com/cloudflare/cloudflare-python/issues/810)) ([d2a77f2](https://github.com/cloudflare/cloudflare-python/commit/d2a77f29c75f3bd4bf8287e3f1479588f478f338)) +* **api:** OpenAPI spec update via Stainless API ([#811](https://github.com/cloudflare/cloudflare-python/issues/811)) ([8f5a33d](https://github.com/cloudflare/cloudflare-python/commit/8f5a33d507d165445ad10c23c249076cfc30847a)) +* **api:** OpenAPI spec update via Stainless API ([#812](https://github.com/cloudflare/cloudflare-python/issues/812)) ([835829a](https://github.com/cloudflare/cloudflare-python/commit/835829aa939117e91cfd20839de9ef5029bab0c9)) +* **api:** OpenAPI spec update via Stainless API ([#813](https://github.com/cloudflare/cloudflare-python/issues/813)) ([dd703c4](https://github.com/cloudflare/cloudflare-python/commit/dd703c4841fa9a7094057543681fb4e9f97f5d6a)) +* **api:** OpenAPI spec update via Stainless API ([#814](https://github.com/cloudflare/cloudflare-python/issues/814)) ([2b107f5](https://github.com/cloudflare/cloudflare-python/commit/2b107f5ebc465c519b9df346af86134bf6306011)) +* **api:** OpenAPI spec update via Stainless API ([#815](https://github.com/cloudflare/cloudflare-python/issues/815)) ([063d1f3](https://github.com/cloudflare/cloudflare-python/commit/063d1f3067e2427b978e03f93de0a87b8747044d)) +* **api:** OpenAPI spec update via Stainless API ([#816](https://github.com/cloudflare/cloudflare-python/issues/816)) ([98426f4](https://github.com/cloudflare/cloudflare-python/commit/98426f4c32e3421b4e67273e3d85024bc4cfedb8)) +* **api:** OpenAPI spec update via Stainless API ([#817](https://github.com/cloudflare/cloudflare-python/issues/817)) ([f4f82f4](https://github.com/cloudflare/cloudflare-python/commit/f4f82f499061ae2a924b85f8c6328c7f6e13123b)) +* **api:** OpenAPI spec update via Stainless API ([#818](https://github.com/cloudflare/cloudflare-python/issues/818)) ([b3fc97d](https://github.com/cloudflare/cloudflare-python/commit/b3fc97d2227f3607a02f26499c15fd8c70f0489d)) +* **api:** OpenAPI spec update via Stainless API ([#819](https://github.com/cloudflare/cloudflare-python/issues/819)) ([0592df8](https://github.com/cloudflare/cloudflare-python/commit/0592df806648374da2f0a96c5d5ebc679e93b140)) +* **api:** OpenAPI spec update via Stainless API ([#820](https://github.com/cloudflare/cloudflare-python/issues/820)) ([d3c3d58](https://github.com/cloudflare/cloudflare-python/commit/d3c3d58c9b132f63415583fa0804f606688696ef)) +* **api:** OpenAPI spec update via Stainless API ([#821](https://github.com/cloudflare/cloudflare-python/issues/821)) ([f0c83e0](https://github.com/cloudflare/cloudflare-python/commit/f0c83e009e1938d57c261bda5af2e7ba4c3bdfd4)) +* **api:** OpenAPI spec update via Stainless API ([#822](https://github.com/cloudflare/cloudflare-python/issues/822)) ([f61c978](https://github.com/cloudflare/cloudflare-python/commit/f61c978ec97810f9d8e9e81c1ad593c95fd1d82c)) +* **api:** OpenAPI spec update via Stainless API ([#823](https://github.com/cloudflare/cloudflare-python/issues/823)) ([f3749fd](https://github.com/cloudflare/cloudflare-python/commit/f3749fd6d003e3c8fd5da4a5a0c136e469d4c2e9)) +* **api:** OpenAPI spec update via Stainless API ([#824](https://github.com/cloudflare/cloudflare-python/issues/824)) ([3830cda](https://github.com/cloudflare/cloudflare-python/commit/3830cdae38c5feff3a6e50a81ca766b9b31f9b14)) +* **api:** OpenAPI spec update via Stainless API ([#825](https://github.com/cloudflare/cloudflare-python/issues/825)) ([c3a0ecc](https://github.com/cloudflare/cloudflare-python/commit/c3a0ecc86f1df1d40c4da016b032aee4be65ac86)) +* **api:** OpenAPI spec update via Stainless API ([#826](https://github.com/cloudflare/cloudflare-python/issues/826)) ([f47e088](https://github.com/cloudflare/cloudflare-python/commit/f47e0885d02b32499cdb6e4428b6bf1ba775bf70)) +* **api:** OpenAPI spec update via Stainless API ([#827](https://github.com/cloudflare/cloudflare-python/issues/827)) ([82a67f8](https://github.com/cloudflare/cloudflare-python/commit/82a67f8fe5be49f2db639f4f9d22a5b531272a2d)) +* **api:** OpenAPI spec update via Stainless API ([#828](https://github.com/cloudflare/cloudflare-python/issues/828)) ([53c19b3](https://github.com/cloudflare/cloudflare-python/commit/53c19b3eaa76ce8cf8519f045abf6f7d3210a070)) +* **api:** OpenAPI spec update via Stainless API ([#829](https://github.com/cloudflare/cloudflare-python/issues/829)) ([218645a](https://github.com/cloudflare/cloudflare-python/commit/218645a9acae1c15994b3c2d31bf570bf31fd4f0)) +* **api:** OpenAPI spec update via Stainless API ([#830](https://github.com/cloudflare/cloudflare-python/issues/830)) ([8668e02](https://github.com/cloudflare/cloudflare-python/commit/8668e02b24f1e0363cf61f939264df634eeae1a4)) +* **api:** OpenAPI spec update via Stainless API ([#831](https://github.com/cloudflare/cloudflare-python/issues/831)) ([442584f](https://github.com/cloudflare/cloudflare-python/commit/442584f708be371e7717030f50de9ba147f1f879)) +* **api:** OpenAPI spec update via Stainless API ([#832](https://github.com/cloudflare/cloudflare-python/issues/832)) ([fff2454](https://github.com/cloudflare/cloudflare-python/commit/fff2454d959b7ee206f740e1134c268492d579c0)) +* **api:** OpenAPI spec update via Stainless API ([#833](https://github.com/cloudflare/cloudflare-python/issues/833)) ([7ee6553](https://github.com/cloudflare/cloudflare-python/commit/7ee6553a4ce1f41f7d005e30aa9cf42edb2aa1a8)) +* **api:** OpenAPI spec update via Stainless API ([#836](https://github.com/cloudflare/cloudflare-python/issues/836)) ([2d97be7](https://github.com/cloudflare/cloudflare-python/commit/2d97be7aa527f1bf80dd7ead3de6b717f342aa87)) +* **api:** OpenAPI spec update via Stainless API ([#837](https://github.com/cloudflare/cloudflare-python/issues/837)) ([ed6a712](https://github.com/cloudflare/cloudflare-python/commit/ed6a712c10eefc6bc5e4668359cb0082624e8b4e)) +* **api:** OpenAPI spec update via Stainless API ([#838](https://github.com/cloudflare/cloudflare-python/issues/838)) ([9bc4946](https://github.com/cloudflare/cloudflare-python/commit/9bc4946f7489b752a93654bc2ccdda85c2ae1816)) +* **api:** OpenAPI spec update via Stainless API ([#839](https://github.com/cloudflare/cloudflare-python/issues/839)) ([f520ca5](https://github.com/cloudflare/cloudflare-python/commit/f520ca581ccd653787cb58ff4178f77e3dc22826)) +* **api:** OpenAPI spec update via Stainless API ([#840](https://github.com/cloudflare/cloudflare-python/issues/840)) ([287bb9a](https://github.com/cloudflare/cloudflare-python/commit/287bb9a3b7f082a2a1203bf53d3d5aab5443332e)) +* **api:** OpenAPI spec update via Stainless API ([#841](https://github.com/cloudflare/cloudflare-python/issues/841)) ([7a0162e](https://github.com/cloudflare/cloudflare-python/commit/7a0162e173c26d91afae0514599bb30037d87f12)) +* **api:** OpenAPI spec update via Stainless API ([#842](https://github.com/cloudflare/cloudflare-python/issues/842)) ([943e7bf](https://github.com/cloudflare/cloudflare-python/commit/943e7bf32d74a101e690721cebbeb3e5cefca860)) +* **api:** OpenAPI spec update via Stainless API ([#843](https://github.com/cloudflare/cloudflare-python/issues/843)) ([671030a](https://github.com/cloudflare/cloudflare-python/commit/671030ae276bb000db3796ef04a626d0bd4338df)) +* **api:** OpenAPI spec update via Stainless API ([#844](https://github.com/cloudflare/cloudflare-python/issues/844)) ([79eab2f](https://github.com/cloudflare/cloudflare-python/commit/79eab2f86576f5b55e47620be9fbafb1e1fd0852)) +* **api:** OpenAPI spec update via Stainless API ([#845](https://github.com/cloudflare/cloudflare-python/issues/845)) ([2d7391b](https://github.com/cloudflare/cloudflare-python/commit/2d7391be05780a67a1f84a4cb3e2cf7187b46c82)) +* **api:** OpenAPI spec update via Stainless API ([#846](https://github.com/cloudflare/cloudflare-python/issues/846)) ([4d5d4bd](https://github.com/cloudflare/cloudflare-python/commit/4d5d4bd261eff4a436f6c4b2ac768a0fa38e04d1)) +* **api:** OpenAPI spec update via Stainless API ([#847](https://github.com/cloudflare/cloudflare-python/issues/847)) ([33ca608](https://github.com/cloudflare/cloudflare-python/commit/33ca608d5ddc5da50231321e7289308d162f27ec)) +* **api:** OpenAPI spec update via Stainless API ([#848](https://github.com/cloudflare/cloudflare-python/issues/848)) ([15c8441](https://github.com/cloudflare/cloudflare-python/commit/15c844182258ff2f0d010ee11ef6ebc05ce87f72)) +* **api:** OpenAPI spec update via Stainless API ([#849](https://github.com/cloudflare/cloudflare-python/issues/849)) ([9966bb7](https://github.com/cloudflare/cloudflare-python/commit/9966bb71bc61f4aad7565573f640de02e24943df)) +* **api:** OpenAPI spec update via Stainless API ([#850](https://github.com/cloudflare/cloudflare-python/issues/850)) ([3009046](https://github.com/cloudflare/cloudflare-python/commit/3009046a27c7966cb0ce01186c0d8acb7cfe3659)) +* **api:** OpenAPI spec update via Stainless API ([#851](https://github.com/cloudflare/cloudflare-python/issues/851)) ([ce39f6a](https://github.com/cloudflare/cloudflare-python/commit/ce39f6aed053e6e2c771022c56f5f087cbf59f42)) +* **api:** OpenAPI spec update via Stainless API ([#852](https://github.com/cloudflare/cloudflare-python/issues/852)) ([f48bf63](https://github.com/cloudflare/cloudflare-python/commit/f48bf6350d26ea58a9f0122112644ac031c22677)) +* **api:** OpenAPI spec update via Stainless API ([#853](https://github.com/cloudflare/cloudflare-python/issues/853)) ([1c71964](https://github.com/cloudflare/cloudflare-python/commit/1c71964ca439e7d9df66e241bcb0fba0e747b1d2)) +* **api:** OpenAPI spec update via Stainless API ([#854](https://github.com/cloudflare/cloudflare-python/issues/854)) ([8dca457](https://github.com/cloudflare/cloudflare-python/commit/8dca457d3413810a36aac11360f3a8ad1abc97b5)) +* **api:** OpenAPI spec update via Stainless API ([#855](https://github.com/cloudflare/cloudflare-python/issues/855)) ([6048cc2](https://github.com/cloudflare/cloudflare-python/commit/6048cc2ac18e1d180a66ac405e3fd48cf829539a)) +* **api:** OpenAPI spec update via Stainless API ([#856](https://github.com/cloudflare/cloudflare-python/issues/856)) ([0f546f5](https://github.com/cloudflare/cloudflare-python/commit/0f546f597ae97e5b584c526a967fd26dfe8c5e3b)) +* **api:** OpenAPI spec update via Stainless API ([#857](https://github.com/cloudflare/cloudflare-python/issues/857)) ([96236a2](https://github.com/cloudflare/cloudflare-python/commit/96236a2dc34933de8b2c33cb0d2e6c5c49561d08)) +* **api:** OpenAPI spec update via Stainless API ([#858](https://github.com/cloudflare/cloudflare-python/issues/858)) ([7896891](https://github.com/cloudflare/cloudflare-python/commit/789689195f9ca252ad900eead2afd79bcb49dae3)) +* **api:** OpenAPI spec update via Stainless API ([#859](https://github.com/cloudflare/cloudflare-python/issues/859)) ([131db3e](https://github.com/cloudflare/cloudflare-python/commit/131db3e1b0f52edd381ac67dac65c477b867a503)) +* **api:** OpenAPI spec update via Stainless API ([#860](https://github.com/cloudflare/cloudflare-python/issues/860)) ([baf75e2](https://github.com/cloudflare/cloudflare-python/commit/baf75e216f9f996d1ee4a004465cbdc36fa2d724)) +* **api:** OpenAPI spec update via Stainless API ([#861](https://github.com/cloudflare/cloudflare-python/issues/861)) ([b6421e4](https://github.com/cloudflare/cloudflare-python/commit/b6421e4f37ee9f6a3b3f9ad356c4c0a2ebfac0ef)) +* **api:** OpenAPI spec update via Stainless API ([#864](https://github.com/cloudflare/cloudflare-python/issues/864)) ([9c81cda](https://github.com/cloudflare/cloudflare-python/commit/9c81cdaaa7a8d3d2b3e9c0d237a5f777ebeb804a)) +* **api:** OpenAPI spec update via Stainless API ([#865](https://github.com/cloudflare/cloudflare-python/issues/865)) ([eafefcd](https://github.com/cloudflare/cloudflare-python/commit/eafefcd3485bc7c932fa4a30c8cb9d3bb09f5517)) +* **api:** OpenAPI spec update via Stainless API ([#866](https://github.com/cloudflare/cloudflare-python/issues/866)) ([4f83a03](https://github.com/cloudflare/cloudflare-python/commit/4f83a03df2bc9160476e97c98837a6d3cae01f1b)) +* **api:** OpenAPI spec update via Stainless API ([#867](https://github.com/cloudflare/cloudflare-python/issues/867)) ([09f9f1f](https://github.com/cloudflare/cloudflare-python/commit/09f9f1f6f4572b35eb043f85cd2d2edca8e2dd47)) +* **api:** OpenAPI spec update via Stainless API ([#868](https://github.com/cloudflare/cloudflare-python/issues/868)) ([50facab](https://github.com/cloudflare/cloudflare-python/commit/50facab4f812941e1242e652b6789fb02dea0bf6)) +* **api:** OpenAPI spec update via Stainless API ([#869](https://github.com/cloudflare/cloudflare-python/issues/869)) ([db82249](https://github.com/cloudflare/cloudflare-python/commit/db8224984433842bb3d267be303cb2e4f75731ae)) +* **api:** OpenAPI spec update via Stainless API ([#870](https://github.com/cloudflare/cloudflare-python/issues/870)) ([57e73e5](https://github.com/cloudflare/cloudflare-python/commit/57e73e5f475d547bc6c383759d84eef590570265)) +* **api:** OpenAPI spec update via Stainless API ([#871](https://github.com/cloudflare/cloudflare-python/issues/871)) ([0d5f2a9](https://github.com/cloudflare/cloudflare-python/commit/0d5f2a92b0355c0dbfc5e4998936c63034e26fa1)) +* **api:** OpenAPI spec update via Stainless API ([#872](https://github.com/cloudflare/cloudflare-python/issues/872)) ([7a883a3](https://github.com/cloudflare/cloudflare-python/commit/7a883a3af3ae930a5d54192d3659c984b87b0c45)) +* **api:** OpenAPI spec update via Stainless API ([#873](https://github.com/cloudflare/cloudflare-python/issues/873)) ([fd420da](https://github.com/cloudflare/cloudflare-python/commit/fd420dab47712333a017cb157d5d9b02fec4feba)) +* **api:** OpenAPI spec update via Stainless API ([#874](https://github.com/cloudflare/cloudflare-python/issues/874)) ([d05b083](https://github.com/cloudflare/cloudflare-python/commit/d05b083904538968e1d3f40e88b819ea16f1d259)) +* **api:** OpenAPI spec update via Stainless API ([#875](https://github.com/cloudflare/cloudflare-python/issues/875)) ([4944d40](https://github.com/cloudflare/cloudflare-python/commit/4944d404c55c05d059a7b8dbb4ccf90fe4d7c714)) +* **api:** OpenAPI spec update via Stainless API ([#876](https://github.com/cloudflare/cloudflare-python/issues/876)) ([8f28f6c](https://github.com/cloudflare/cloudflare-python/commit/8f28f6cafbaf9cea72e6f2345d4ec861b08b5700)) +* **api:** OpenAPI spec update via Stainless API ([#877](https://github.com/cloudflare/cloudflare-python/issues/877)) ([b0a46c0](https://github.com/cloudflare/cloudflare-python/commit/b0a46c09fe8c80c22b02434b01193a1536321c9f)) +* **api:** OpenAPI spec update via Stainless API ([#878](https://github.com/cloudflare/cloudflare-python/issues/878)) ([306f8a4](https://github.com/cloudflare/cloudflare-python/commit/306f8a4fa860428042d6e144e9f633325836c490)) +* **api:** OpenAPI spec update via Stainless API ([#879](https://github.com/cloudflare/cloudflare-python/issues/879)) ([017c740](https://github.com/cloudflare/cloudflare-python/commit/017c740e7c372cd79590edb64b5434fb2df8aa61)) +* **api:** OpenAPI spec update via Stainless API ([#880](https://github.com/cloudflare/cloudflare-python/issues/880)) ([fdbc41b](https://github.com/cloudflare/cloudflare-python/commit/fdbc41b6f8ed81836e45def67becb4dc17910fc6)) +* **api:** OpenAPI spec update via Stainless API ([#881](https://github.com/cloudflare/cloudflare-python/issues/881)) ([a54ba22](https://github.com/cloudflare/cloudflare-python/commit/a54ba22cbd417bc28ff96635c9a6e673de2f02b6)) +* **api:** OpenAPI spec update via Stainless API ([#882](https://github.com/cloudflare/cloudflare-python/issues/882)) ([be7f95b](https://github.com/cloudflare/cloudflare-python/commit/be7f95b936c4664abf46db13afc5ca13e94baa26)) +* **api:** OpenAPI spec update via Stainless API ([#883](https://github.com/cloudflare/cloudflare-python/issues/883)) ([2f8cee5](https://github.com/cloudflare/cloudflare-python/commit/2f8cee56e4505a5d9d4b258551fd14e559751062)) +* **api:** OpenAPI spec update via Stainless API ([#884](https://github.com/cloudflare/cloudflare-python/issues/884)) ([0a5bff5](https://github.com/cloudflare/cloudflare-python/commit/0a5bff5ef8bb33e91847dc06e27cd64c25a3d366)) +* **api:** OpenAPI spec update via Stainless API ([#885](https://github.com/cloudflare/cloudflare-python/issues/885)) ([142d257](https://github.com/cloudflare/cloudflare-python/commit/142d257f4487a91f424c34b9c06c45efe1dfbcd9)) +* **api:** OpenAPI spec update via Stainless API ([#886](https://github.com/cloudflare/cloudflare-python/issues/886)) ([78c7e25](https://github.com/cloudflare/cloudflare-python/commit/78c7e25e85316d7529d76bed2c75a47476337ebb)) +* **api:** OpenAPI spec update via Stainless API ([#887](https://github.com/cloudflare/cloudflare-python/issues/887)) ([561f2c0](https://github.com/cloudflare/cloudflare-python/commit/561f2c0b649394d493363915c97714e39fc2a011)) +* **api:** OpenAPI spec update via Stainless API ([#888](https://github.com/cloudflare/cloudflare-python/issues/888)) ([21b7830](https://github.com/cloudflare/cloudflare-python/commit/21b7830e1b36b653ba670f7584da0c57dd515704)) +* **api:** OpenAPI spec update via Stainless API ([#889](https://github.com/cloudflare/cloudflare-python/issues/889)) ([77175b0](https://github.com/cloudflare/cloudflare-python/commit/77175b0d230954b2f3cd31d12af45b5f022e3c3f)) +* **api:** OpenAPI spec update via Stainless API ([#890](https://github.com/cloudflare/cloudflare-python/issues/890)) ([1158194](https://github.com/cloudflare/cloudflare-python/commit/11581943445a1858adc8cb003764bdf52b1d8319)) +* **api:** OpenAPI spec update via Stainless API ([#891](https://github.com/cloudflare/cloudflare-python/issues/891)) ([6e2115a](https://github.com/cloudflare/cloudflare-python/commit/6e2115adddba8d6764013bc377e4264e74553c96)) +* **api:** OpenAPI spec update via Stainless API ([#892](https://github.com/cloudflare/cloudflare-python/issues/892)) ([0330dce](https://github.com/cloudflare/cloudflare-python/commit/0330dce9a9dc3ebf88c74e7b1f73dab4cd927550)) +* **api:** OpenAPI spec update via Stainless API ([#893](https://github.com/cloudflare/cloudflare-python/issues/893)) ([b22ba08](https://github.com/cloudflare/cloudflare-python/commit/b22ba085dffb57dc8540e88e250655e23a0e6c4e)) +* **api:** OpenAPI spec update via Stainless API ([#894](https://github.com/cloudflare/cloudflare-python/issues/894)) ([8140735](https://github.com/cloudflare/cloudflare-python/commit/814073556826dcf850c9066b40dbb6a186a55b29)) +* **api:** OpenAPI spec update via Stainless API ([#895](https://github.com/cloudflare/cloudflare-python/issues/895)) ([547a922](https://github.com/cloudflare/cloudflare-python/commit/547a922d645ba30f18fda20308cec11a00605295)) +* **api:** OpenAPI spec update via Stainless API ([#896](https://github.com/cloudflare/cloudflare-python/issues/896)) ([7067513](https://github.com/cloudflare/cloudflare-python/commit/706751326205e3272f1d3e5e2ae60c6555c18b72)) +* **api:** OpenAPI spec update via Stainless API ([#897](https://github.com/cloudflare/cloudflare-python/issues/897)) ([ec1cce1](https://github.com/cloudflare/cloudflare-python/commit/ec1cce1022b73726a50bcd19f518c47a2f7f90d1)) +* **api:** OpenAPI spec update via Stainless API ([#898](https://github.com/cloudflare/cloudflare-python/issues/898)) ([ee63e1e](https://github.com/cloudflare/cloudflare-python/commit/ee63e1eabd0ded4e2b0d66f7be3b4d3fdc73454a)) +* **api:** OpenAPI spec update via Stainless API ([#899](https://github.com/cloudflare/cloudflare-python/issues/899)) ([f7761eb](https://github.com/cloudflare/cloudflare-python/commit/f7761ebf84cf5a60e6c2b1443e34104e3c65b06b)) +* **api:** OpenAPI spec update via Stainless API ([#900](https://github.com/cloudflare/cloudflare-python/issues/900)) ([d61c9a1](https://github.com/cloudflare/cloudflare-python/commit/d61c9a1401a1d200fdaa850a1e4393dd60159bdc)) +* **api:** OpenAPI spec update via Stainless API ([#901](https://github.com/cloudflare/cloudflare-python/issues/901)) ([0c82790](https://github.com/cloudflare/cloudflare-python/commit/0c827900578fa4ca1f790b7dddd1e93090ceaa6a)) +* **api:** OpenAPI spec update via Stainless API ([#902](https://github.com/cloudflare/cloudflare-python/issues/902)) ([36f10ac](https://github.com/cloudflare/cloudflare-python/commit/36f10acb46a80d69906018baaad28c5c07299da0)) +* **api:** OpenAPI spec update via Stainless API ([#903](https://github.com/cloudflare/cloudflare-python/issues/903)) ([a1c451e](https://github.com/cloudflare/cloudflare-python/commit/a1c451e77848fc90c5bcb0cbb7e681d6df8611a6)) +* **api:** OpenAPI spec update via Stainless API ([#904](https://github.com/cloudflare/cloudflare-python/issues/904)) ([73c1c10](https://github.com/cloudflare/cloudflare-python/commit/73c1c103a90c77f85d548d93478a39412f0e7647)) +* **api:** OpenAPI spec update via Stainless API ([#905](https://github.com/cloudflare/cloudflare-python/issues/905)) ([fe3c0e9](https://github.com/cloudflare/cloudflare-python/commit/fe3c0e9aaf50b1376da4159da12f03134b1b1d4d)) +* **api:** OpenAPI spec update via Stainless API ([#906](https://github.com/cloudflare/cloudflare-python/issues/906)) ([637480d](https://github.com/cloudflare/cloudflare-python/commit/637480d143b5f2f77226b84d88a3b283733367bf)) +* **api:** OpenAPI spec update via Stainless API ([#907](https://github.com/cloudflare/cloudflare-python/issues/907)) ([1716baf](https://github.com/cloudflare/cloudflare-python/commit/1716bafadaba2a6fc8511f0cafb000ee33d661ba)) +* **api:** OpenAPI spec update via Stainless API ([#908](https://github.com/cloudflare/cloudflare-python/issues/908)) ([392e54f](https://github.com/cloudflare/cloudflare-python/commit/392e54fb43bf148da0f1686cb8e777135c96d106)) +* **api:** OpenAPI spec update via Stainless API ([#909](https://github.com/cloudflare/cloudflare-python/issues/909)) ([f9ea911](https://github.com/cloudflare/cloudflare-python/commit/f9ea911f67fe67ecdc9dd7cbb9611db3a777cd95)) +* **api:** OpenAPI spec update via Stainless API ([#910](https://github.com/cloudflare/cloudflare-python/issues/910)) ([cef0cea](https://github.com/cloudflare/cloudflare-python/commit/cef0cea6c48a6b3af2c3da8ece583cf5cef347c8)) +* **api:** OpenAPI spec update via Stainless API ([#911](https://github.com/cloudflare/cloudflare-python/issues/911)) ([92b2ce3](https://github.com/cloudflare/cloudflare-python/commit/92b2ce3b9b1800491f3e82e109d0daa3ef8624c1)) +* **api:** OpenAPI spec update via Stainless API ([#913](https://github.com/cloudflare/cloudflare-python/issues/913)) ([7600ef4](https://github.com/cloudflare/cloudflare-python/commit/7600ef4404439ad88e907cfbc906df3f295f92b4)) +* **api:** OpenAPI spec update via Stainless API ([#914](https://github.com/cloudflare/cloudflare-python/issues/914)) ([64e3e72](https://github.com/cloudflare/cloudflare-python/commit/64e3e727948bb198791c83e0eab875729a213ca8)) +* **api:** OpenAPI spec update via Stainless API ([#915](https://github.com/cloudflare/cloudflare-python/issues/915)) ([e94d9f7](https://github.com/cloudflare/cloudflare-python/commit/e94d9f7e8a238b5706f65db4bb7e83cc0db7aedb)) +* **api:** OpenAPI spec update via Stainless API ([#916](https://github.com/cloudflare/cloudflare-python/issues/916)) ([6dc52de](https://github.com/cloudflare/cloudflare-python/commit/6dc52de9b04efdf2f0a09731f7d9fd262a87cdd7)) +* **api:** OpenAPI spec update via Stainless API ([#917](https://github.com/cloudflare/cloudflare-python/issues/917)) ([5d522b4](https://github.com/cloudflare/cloudflare-python/commit/5d522b4a3b7a5b8c1dcc48b7e19bcc86570ad0c1)) +* **api:** OpenAPI spec update via Stainless API ([#918](https://github.com/cloudflare/cloudflare-python/issues/918)) ([598f17d](https://github.com/cloudflare/cloudflare-python/commit/598f17dc09f2bc1eba21732d658aff91092ad38f)) +* **api:** OpenAPI spec update via Stainless API ([#919](https://github.com/cloudflare/cloudflare-python/issues/919)) ([8c02be4](https://github.com/cloudflare/cloudflare-python/commit/8c02be4d02578daa36bb64a06f3ecc5e6d1e93a6)) +* **api:** OpenAPI spec update via Stainless API ([#920](https://github.com/cloudflare/cloudflare-python/issues/920)) ([3f3c410](https://github.com/cloudflare/cloudflare-python/commit/3f3c410cc465de67bf4a353cfe18b3d29fc8524a)) +* **api:** OpenAPI spec update via Stainless API ([#921](https://github.com/cloudflare/cloudflare-python/issues/921)) ([9c78797](https://github.com/cloudflare/cloudflare-python/commit/9c787974347ea014457389007bc6f9f6397306e3)) +* **api:** OpenAPI spec update via Stainless API ([#922](https://github.com/cloudflare/cloudflare-python/issues/922)) ([4f81e3a](https://github.com/cloudflare/cloudflare-python/commit/4f81e3a49b56512c4258c33a5aa9872b8362842b)) +* **api:** OpenAPI spec update via Stainless API ([#924](https://github.com/cloudflare/cloudflare-python/issues/924)) ([a19a006](https://github.com/cloudflare/cloudflare-python/commit/a19a00632f6f635bad9789a9021dc5f006c3d580)) +* **api:** OpenAPI spec update via Stainless API ([#925](https://github.com/cloudflare/cloudflare-python/issues/925)) ([ff97dd5](https://github.com/cloudflare/cloudflare-python/commit/ff97dd5b0cd64672a0a63102396a2fbfc04a3cb8)) +* **api:** OpenAPI spec update via Stainless API ([#926](https://github.com/cloudflare/cloudflare-python/issues/926)) ([02aeaab](https://github.com/cloudflare/cloudflare-python/commit/02aeaabae3c68c8f46570d9dbff8f5c72b271093)) +* **api:** OpenAPI spec update via Stainless API ([#927](https://github.com/cloudflare/cloudflare-python/issues/927)) ([74f9017](https://github.com/cloudflare/cloudflare-python/commit/74f90177e7343e27868c0b6cfef297254cdaa41f)) +* **api:** OpenAPI spec update via Stainless API ([#928](https://github.com/cloudflare/cloudflare-python/issues/928)) ([113cb5b](https://github.com/cloudflare/cloudflare-python/commit/113cb5b2690caf2ec4dc37986ebc1a5849e365d2)) +* **api:** OpenAPI spec update via Stainless API ([#929](https://github.com/cloudflare/cloudflare-python/issues/929)) ([4198b88](https://github.com/cloudflare/cloudflare-python/commit/4198b88ddc5f68bf8a433bc57f70bf4d55e6631e)) +* **api:** OpenAPI spec update via Stainless API ([#930](https://github.com/cloudflare/cloudflare-python/issues/930)) ([5384210](https://github.com/cloudflare/cloudflare-python/commit/53842105e14b0bbed52311da07a5c7396fe09e03)) +* **api:** OpenAPI spec update via Stainless API ([#931](https://github.com/cloudflare/cloudflare-python/issues/931)) ([912276c](https://github.com/cloudflare/cloudflare-python/commit/912276c1fd9a39bd0bba3e79f809af55122488ff)) +* **api:** OpenAPI spec update via Stainless API ([#932](https://github.com/cloudflare/cloudflare-python/issues/932)) ([a1758ad](https://github.com/cloudflare/cloudflare-python/commit/a1758adc9d2920cc77be660f8d2ae15be0a91b68)) +* **api:** OpenAPI spec update via Stainless API ([#933](https://github.com/cloudflare/cloudflare-python/issues/933)) ([02fe287](https://github.com/cloudflare/cloudflare-python/commit/02fe287f003629a048370f66b452b4875f1f593f)) +* **api:** OpenAPI spec update via Stainless API ([#934](https://github.com/cloudflare/cloudflare-python/issues/934)) ([a1af91e](https://github.com/cloudflare/cloudflare-python/commit/a1af91e7e01b6e610d12f64346c5c1335c6e76c5)) +* **api:** OpenAPI spec update via Stainless API ([#935](https://github.com/cloudflare/cloudflare-python/issues/935)) ([3a93f41](https://github.com/cloudflare/cloudflare-python/commit/3a93f412ba0bd69443b91c2e2c4609eb0c1ad82f)) +* **api:** OpenAPI spec update via Stainless API ([#936](https://github.com/cloudflare/cloudflare-python/issues/936)) ([b852f70](https://github.com/cloudflare/cloudflare-python/commit/b852f702de447c36d347fac54b08ee052b4803f5)) +* **api:** OpenAPI spec update via Stainless API ([#937](https://github.com/cloudflare/cloudflare-python/issues/937)) ([e1195ac](https://github.com/cloudflare/cloudflare-python/commit/e1195acc48a21dec20c5e59da1a3ea5263ca9f47)) +* **api:** OpenAPI spec update via Stainless API ([#938](https://github.com/cloudflare/cloudflare-python/issues/938)) ([bd703b4](https://github.com/cloudflare/cloudflare-python/commit/bd703b43af9642113eb06b19934055dc8c00a251)) +* **api:** OpenAPI spec update via Stainless API ([#939](https://github.com/cloudflare/cloudflare-python/issues/939)) ([ef6191f](https://github.com/cloudflare/cloudflare-python/commit/ef6191f69de92028baaa4229db1bc7f6b001f3e5)) +* **api:** OpenAPI spec update via Stainless API ([#940](https://github.com/cloudflare/cloudflare-python/issues/940)) ([14b0f66](https://github.com/cloudflare/cloudflare-python/commit/14b0f6621fde28becf1e808db62fbff4dd5b0d3c)) +* **api:** OpenAPI spec update via Stainless API ([#941](https://github.com/cloudflare/cloudflare-python/issues/941)) ([9da9ede](https://github.com/cloudflare/cloudflare-python/commit/9da9ede896cbed33dab7b6c94be84c8c9669508a)) +* **api:** OpenAPI spec update via Stainless API ([#942](https://github.com/cloudflare/cloudflare-python/issues/942)) ([cb14149](https://github.com/cloudflare/cloudflare-python/commit/cb1414919426a182bdd69c42bf739c2b8ae31295)) +* **api:** OpenAPI spec update via Stainless API ([#943](https://github.com/cloudflare/cloudflare-python/issues/943)) ([72884ce](https://github.com/cloudflare/cloudflare-python/commit/72884ce88dbb895fe462582ea9d949f079569e7e)) +* **api:** OpenAPI spec update via Stainless API ([#944](https://github.com/cloudflare/cloudflare-python/issues/944)) ([d621200](https://github.com/cloudflare/cloudflare-python/commit/d62120038551a25bb438529ea4106aa8b9c9e1ac)) +* **api:** OpenAPI spec update via Stainless API ([#945](https://github.com/cloudflare/cloudflare-python/issues/945)) ([5ba6aa2](https://github.com/cloudflare/cloudflare-python/commit/5ba6aa2fdcdafdef77a6bde34245383093d85e38)) +* **api:** OpenAPI spec update via Stainless API ([#946](https://github.com/cloudflare/cloudflare-python/issues/946)) ([ba3959a](https://github.com/cloudflare/cloudflare-python/commit/ba3959a51ffcb40e2e1a5d34ee96ec1875bea4cd)) +* **api:** OpenAPI spec update via Stainless API ([#947](https://github.com/cloudflare/cloudflare-python/issues/947)) ([efcc9eb](https://github.com/cloudflare/cloudflare-python/commit/efcc9ebccaf23f036ffa5e569aa74042c709fd64)) +* **api:** OpenAPI spec update via Stainless API ([#948](https://github.com/cloudflare/cloudflare-python/issues/948)) ([c90d052](https://github.com/cloudflare/cloudflare-python/commit/c90d052713e311b792f2e8d6c1081aef615e92e8)) +* **api:** OpenAPI spec update via Stainless API ([#949](https://github.com/cloudflare/cloudflare-python/issues/949)) ([7826536](https://github.com/cloudflare/cloudflare-python/commit/78265361b34ab207c70f5c9a6a43d9801a8b96c5)) +* **api:** OpenAPI spec update via Stainless API ([#950](https://github.com/cloudflare/cloudflare-python/issues/950)) ([00bf600](https://github.com/cloudflare/cloudflare-python/commit/00bf60078f7158b263e7be34f56c1dff60fe518c)) +* **api:** OpenAPI spec update via Stainless API ([#951](https://github.com/cloudflare/cloudflare-python/issues/951)) ([39e0aa0](https://github.com/cloudflare/cloudflare-python/commit/39e0aa0787ac55a1e7da6616724cbf4fde261bbe)) +* **api:** OpenAPI spec update via Stainless API ([#952](https://github.com/cloudflare/cloudflare-python/issues/952)) ([7db30f1](https://github.com/cloudflare/cloudflare-python/commit/7db30f1a64bf0564027e0577cf992bef4c752b75)) +* **api:** OpenAPI spec update via Stainless API ([#953](https://github.com/cloudflare/cloudflare-python/issues/953)) ([1b6e7fb](https://github.com/cloudflare/cloudflare-python/commit/1b6e7fb5063b1c13cc11c3f33d34baf62e77a782)) +* **api:** OpenAPI spec update via Stainless API ([#954](https://github.com/cloudflare/cloudflare-python/issues/954)) ([1a54c89](https://github.com/cloudflare/cloudflare-python/commit/1a54c89f03b210722717e09169d4ffd07f6ef461)) +* **api:** OpenAPI spec update via Stainless API ([#955](https://github.com/cloudflare/cloudflare-python/issues/955)) ([3062da9](https://github.com/cloudflare/cloudflare-python/commit/3062da94071e16c97847144b5cbec16b481a0b50)) +* **api:** OpenAPI spec update via Stainless API ([#956](https://github.com/cloudflare/cloudflare-python/issues/956)) ([1755024](https://github.com/cloudflare/cloudflare-python/commit/1755024b6ff5d16c49b801f6b82addecc140ec36)) +* **api:** OpenAPI spec update via Stainless API ([#957](https://github.com/cloudflare/cloudflare-python/issues/957)) ([da57903](https://github.com/cloudflare/cloudflare-python/commit/da5790328894a566ced0878f3b2e6d70ac27cfcd)) +* **api:** OpenAPI spec update via Stainless API ([#958](https://github.com/cloudflare/cloudflare-python/issues/958)) ([578652c](https://github.com/cloudflare/cloudflare-python/commit/578652c4ac86d756a965431bbfac7d9485983a65)) +* **api:** OpenAPI spec update via Stainless API ([#959](https://github.com/cloudflare/cloudflare-python/issues/959)) ([9911e8a](https://github.com/cloudflare/cloudflare-python/commit/9911e8a5ae9c075129174b9a87f057c39ca2dfca)) +* **api:** OpenAPI spec update via Stainless API ([#960](https://github.com/cloudflare/cloudflare-python/issues/960)) ([f3cd3a0](https://github.com/cloudflare/cloudflare-python/commit/f3cd3a0e495e843468505ccdb9716a9cc330b785)) +* **api:** OpenAPI spec update via Stainless API ([#961](https://github.com/cloudflare/cloudflare-python/issues/961)) ([3900806](https://github.com/cloudflare/cloudflare-python/commit/390080678ba70c628de15912eed8b4609436796e)) +* **api:** OpenAPI spec update via Stainless API ([#962](https://github.com/cloudflare/cloudflare-python/issues/962)) ([e272f2d](https://github.com/cloudflare/cloudflare-python/commit/e272f2d2f3f59d61619ccf848085503ccaebfb06)) +* **api:** OpenAPI spec update via Stainless API ([#964](https://github.com/cloudflare/cloudflare-python/issues/964)) ([66380bd](https://github.com/cloudflare/cloudflare-python/commit/66380bd32051b0f2a8ab1a5bcde8fa2973c546d7)) +* **api:** OpenAPI spec update via Stainless API ([#965](https://github.com/cloudflare/cloudflare-python/issues/965)) ([6adbe9a](https://github.com/cloudflare/cloudflare-python/commit/6adbe9ad9f873f7ed67a46b412d310995947810a)) +* **api:** OpenAPI spec update via Stainless API ([#966](https://github.com/cloudflare/cloudflare-python/issues/966)) ([e8189fd](https://github.com/cloudflare/cloudflare-python/commit/e8189fd35144f716a5b55dfe26194abda2f00e13)) +* **api:** OpenAPI spec update via Stainless API ([#967](https://github.com/cloudflare/cloudflare-python/issues/967)) ([a4c88df](https://github.com/cloudflare/cloudflare-python/commit/a4c88dfb7e357ff1a44da1e6d75bfe05911fb577)) +* **api:** OpenAPI spec update via Stainless API ([#968](https://github.com/cloudflare/cloudflare-python/issues/968)) ([cefb09f](https://github.com/cloudflare/cloudflare-python/commit/cefb09fd18869c7a25a6b02c92b489056d510f87)) +* **api:** OpenAPI spec update via Stainless API ([#969](https://github.com/cloudflare/cloudflare-python/issues/969)) ([71e97aa](https://github.com/cloudflare/cloudflare-python/commit/71e97aa998ff64ea105d88198f981fb9ffcfae71)) +* **api:** OpenAPI spec update via Stainless API ([#970](https://github.com/cloudflare/cloudflare-python/issues/970)) ([9ced3bb](https://github.com/cloudflare/cloudflare-python/commit/9ced3bb626f729053d508b37e233fac9df9ed909)) +* **api:** OpenAPI spec update via Stainless API ([#971](https://github.com/cloudflare/cloudflare-python/issues/971)) ([843c4ab](https://github.com/cloudflare/cloudflare-python/commit/843c4ab7b0fbd684d1a90b94a4af5060d308f439)) +* **api:** OpenAPI spec update via Stainless API ([#972](https://github.com/cloudflare/cloudflare-python/issues/972)) ([187d46d](https://github.com/cloudflare/cloudflare-python/commit/187d46db1fc70b7031f3d0c63569f3d49c1ea9de)) +* **api:** OpenAPI spec update via Stainless API ([#973](https://github.com/cloudflare/cloudflare-python/issues/973)) ([568efe9](https://github.com/cloudflare/cloudflare-python/commit/568efe921e631808baa64520df55692e351db1ce)) +* **api:** OpenAPI spec update via Stainless API ([#974](https://github.com/cloudflare/cloudflare-python/issues/974)) ([edccbd6](https://github.com/cloudflare/cloudflare-python/commit/edccbd62ef420f8a3d3fea10006e728fbaa90194)) +* **api:** OpenAPI spec update via Stainless API ([#975](https://github.com/cloudflare/cloudflare-python/issues/975)) ([46f1cc1](https://github.com/cloudflare/cloudflare-python/commit/46f1cc127ba7a692d3fbd9ecabfc469b7c551a41)) +* **api:** OpenAPI spec update via Stainless API ([#976](https://github.com/cloudflare/cloudflare-python/issues/976)) ([b4a7375](https://github.com/cloudflare/cloudflare-python/commit/b4a7375244c24f9635fec7a075567f0bdcd1ca2d)) +* **api:** OpenAPI spec update via Stainless API ([#977](https://github.com/cloudflare/cloudflare-python/issues/977)) ([816c7b3](https://github.com/cloudflare/cloudflare-python/commit/816c7b3eaf99b4bad259a1434a07d51784fa0db7)) +* **api:** OpenAPI spec update via Stainless API ([#978](https://github.com/cloudflare/cloudflare-python/issues/978)) ([2d44575](https://github.com/cloudflare/cloudflare-python/commit/2d44575915b107e5a829a869d1fc589b2d6b231b)) +* **api:** OpenAPI spec update via Stainless API ([#979](https://github.com/cloudflare/cloudflare-python/issues/979)) ([c57c906](https://github.com/cloudflare/cloudflare-python/commit/c57c9060afa88e36970657fc9721c743f9b013d8)) +* **api:** OpenAPI spec update via Stainless API ([#980](https://github.com/cloudflare/cloudflare-python/issues/980)) ([9742593](https://github.com/cloudflare/cloudflare-python/commit/974259348041aee050a3b00ba4f05309dd831280)) +* **api:** OpenAPI spec update via Stainless API ([#981](https://github.com/cloudflare/cloudflare-python/issues/981)) ([8543fae](https://github.com/cloudflare/cloudflare-python/commit/8543fae03e0d0e700c198cf571df5f0441875a42)) +* **api:** OpenAPI spec update via Stainless API ([#982](https://github.com/cloudflare/cloudflare-python/issues/982)) ([04cd78a](https://github.com/cloudflare/cloudflare-python/commit/04cd78a2fb2db9cea0fa2e7481cf88f7e8dacf43)) +* **api:** OpenAPI spec update via Stainless API ([#983](https://github.com/cloudflare/cloudflare-python/issues/983)) ([06307a8](https://github.com/cloudflare/cloudflare-python/commit/06307a82040a4d26f2da6de687f9f9fcef220505)) +* **api:** OpenAPI spec update via Stainless API ([#984](https://github.com/cloudflare/cloudflare-python/issues/984)) ([c702343](https://github.com/cloudflare/cloudflare-python/commit/c7023433bda54769e048b2e9f106d42e9296474e)) +* **api:** OpenAPI spec update via Stainless API ([#985](https://github.com/cloudflare/cloudflare-python/issues/985)) ([6ee5e16](https://github.com/cloudflare/cloudflare-python/commit/6ee5e162f922d90b1006641505edb8284c334bf4)) +* **api:** OpenAPI spec update via Stainless API ([#986](https://github.com/cloudflare/cloudflare-python/issues/986)) ([4f82091](https://github.com/cloudflare/cloudflare-python/commit/4f82091a8bcd193f25ce42b3e505d052425d9b3b)) +* **api:** OpenAPI spec update via Stainless API ([#987](https://github.com/cloudflare/cloudflare-python/issues/987)) ([b1e3549](https://github.com/cloudflare/cloudflare-python/commit/b1e35493ea6456711b912450eb05f2cc28bc2a2e)) +* **api:** OpenAPI spec update via Stainless API ([#988](https://github.com/cloudflare/cloudflare-python/issues/988)) ([1be11e8](https://github.com/cloudflare/cloudflare-python/commit/1be11e847dbb0966c7a2821a5faaea7bcf16f622)) +* **api:** OpenAPI spec update via Stainless API ([#989](https://github.com/cloudflare/cloudflare-python/issues/989)) ([d8131ea](https://github.com/cloudflare/cloudflare-python/commit/d8131eaecc741a1f4b6b8498965bd39b4e6f2abc)) +* **api:** OpenAPI spec update via Stainless API ([#990](https://github.com/cloudflare/cloudflare-python/issues/990)) ([cc76cff](https://github.com/cloudflare/cloudflare-python/commit/cc76cffbc92ab4a7c88108459723b19be60b6fd5)) +* **api:** OpenAPI spec update via Stainless API ([#991](https://github.com/cloudflare/cloudflare-python/issues/991)) ([0d3feac](https://github.com/cloudflare/cloudflare-python/commit/0d3feacc6e64117014242505b3b9d4222b5cc471)) +* **api:** OpenAPI spec update via Stainless API ([#992](https://github.com/cloudflare/cloudflare-python/issues/992)) ([05e0b92](https://github.com/cloudflare/cloudflare-python/commit/05e0b92bd3b15a1a89e6c390046c027cb87fa6fd)) +* **api:** OpenAPI spec update via Stainless API ([#993](https://github.com/cloudflare/cloudflare-python/issues/993)) ([9cb5cd7](https://github.com/cloudflare/cloudflare-python/commit/9cb5cd7d018e59fbc6d2c069932cb222aaa81377)) +* **api:** OpenAPI spec update via Stainless API ([#994](https://github.com/cloudflare/cloudflare-python/issues/994)) ([349941a](https://github.com/cloudflare/cloudflare-python/commit/349941a0f10e78688bec3cac9cab06fa22d13b68)) +* **api:** update via SDK Studio ([#1011](https://github.com/cloudflare/cloudflare-python/issues/1011)) ([6a74ae1](https://github.com/cloudflare/cloudflare-python/commit/6a74ae12a6920b8572d331367774bba1a11d9966)) +* **api:** update via SDK Studio ([#726](https://github.com/cloudflare/cloudflare-python/issues/726)) ([cb61101](https://github.com/cloudflare/cloudflare-python/commit/cb61101d98a02f77a21e538964b193dc33d2e9a3)) +* **api:** update via SDK Studio ([#775](https://github.com/cloudflare/cloudflare-python/issues/775)) ([c8f72ed](https://github.com/cloudflare/cloudflare-python/commit/c8f72ed706ea5af7bade55a7277ce7f7867ec43a)) +* **api:** update via SDK Studio ([#778](https://github.com/cloudflare/cloudflare-python/issues/778)) ([5ffaecc](https://github.com/cloudflare/cloudflare-python/commit/5ffaecc6e0a404a3df2a65d088ab500e46027256)) +* **api:** update via SDK Studio ([#782](https://github.com/cloudflare/cloudflare-python/issues/782)) ([c8dc5e3](https://github.com/cloudflare/cloudflare-python/commit/c8dc5e30a180643fbf269ce5cbb276d91db36373)) +* **api:** update via SDK Studio ([#783](https://github.com/cloudflare/cloudflare-python/issues/783)) ([f30af85](https://github.com/cloudflare/cloudflare-python/commit/f30af8597b0de54d7ca199a713e7e66f7fc16ec5)) +* **api:** update via SDK Studio ([#784](https://github.com/cloudflare/cloudflare-python/issues/784)) ([547f900](https://github.com/cloudflare/cloudflare-python/commit/547f900a651274f74fa778bb26b12b5492179775)) +* **api:** update via SDK Studio ([#809](https://github.com/cloudflare/cloudflare-python/issues/809)) ([9d23770](https://github.com/cloudflare/cloudflare-python/commit/9d23770ed3153efe957cb14a51c6bdf9545a2af7)) +* **api:** update via SDK Studio ([#834](https://github.com/cloudflare/cloudflare-python/issues/834)) ([11bb6dd](https://github.com/cloudflare/cloudflare-python/commit/11bb6dd69fb5b3e8f872056580da76f62b2a2852)) +* **api:** update via SDK Studio ([#835](https://github.com/cloudflare/cloudflare-python/issues/835)) ([df5ef97](https://github.com/cloudflare/cloudflare-python/commit/df5ef97507b50a14aefafd0d908ce703ae7ca075)) +* **api:** update via SDK Studio ([#862](https://github.com/cloudflare/cloudflare-python/issues/862)) ([8c548f7](https://github.com/cloudflare/cloudflare-python/commit/8c548f7bb0b4447f013db23642bfaff5357d5244)) +* **api:** update via SDK Studio ([#863](https://github.com/cloudflare/cloudflare-python/issues/863)) ([992e3d6](https://github.com/cloudflare/cloudflare-python/commit/992e3d68e7e40ae34819190a7deb9ef9b63d97ac)) +* **api:** update via SDK Studio ([#912](https://github.com/cloudflare/cloudflare-python/issues/912)) ([03507c5](https://github.com/cloudflare/cloudflare-python/commit/03507c5c9172bb669b25ba6ba81737b8c5f8da17)) +* **api:** update via SDK Studio ([#923](https://github.com/cloudflare/cloudflare-python/issues/923)) ([980ac6d](https://github.com/cloudflare/cloudflare-python/commit/980ac6dd9ed7bc345c36fd112f2be169870680ec)) +* **api:** update via SDK Studio ([#963](https://github.com/cloudflare/cloudflare-python/issues/963)) ([e51ae76](https://github.com/cloudflare/cloudflare-python/commit/e51ae76cb5230e3c28f24e47ab3fa7139dc6f23c)) +* **api:** update via SDK Studio ([#995](https://github.com/cloudflare/cloudflare-python/issues/995)) ([3de5454](https://github.com/cloudflare/cloudflare-python/commit/3de54540a0c98b9069eb2d61e7a2aafd76270223)) +* **api:** update via SDK Studio ([#996](https://github.com/cloudflare/cloudflare-python/issues/996)) ([04b79fa](https://github.com/cloudflare/cloudflare-python/commit/04b79faf413cf05f4e73d99250d19648b3238a45)) +* **api:** update via SDK Studio ([#997](https://github.com/cloudflare/cloudflare-python/issues/997)) ([f583ec8](https://github.com/cloudflare/cloudflare-python/commit/f583ec8acf38b39270a15d4eaa6ab5c24646e4ee)) +* **api:** update via SDK Studio ([#998](https://github.com/cloudflare/cloudflare-python/issues/998)) ([7e2cd67](https://github.com/cloudflare/cloudflare-python/commit/7e2cd67996f60b19b131fb6dcadc99ebc7900ef4)) +* **api:** update via SDK Studio ([#999](https://github.com/cloudflare/cloudflare-python/issues/999)) ([e0269bb](https://github.com/cloudflare/cloudflare-python/commit/e0269bba241cfdc1ff1ffad4f5c5ff01d79f3951)) + ## 3.0.0-beta.9 (2024-05-08) Full Changelog: [v3.0.0-beta.8...v3.0.0-beta.9](https://github.com/cloudflare/cloudflare-python/compare/v3.0.0-beta.8...v3.0.0-beta.9) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4fc00cc62e1..655bcd3b39d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ ### With Rye -We use [Rye](https://rye-up.com/) to manage dependencies so we highly recommend [installing it](https://rye-up.com/guide/installation/) as it will automatically provision a Python environment with the expected Python version. +We use [Rye](https://rye.astral.sh/) to manage dependencies so we highly recommend [installing it](https://rye.astral.sh/guide/installation/) as it will automatically provision a Python environment with the expected Python version. After installing Rye, you'll just have to run this command: diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000000..8cd70e5e93b --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +# Security Policy + +## Reporting Security Issues + +This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. + +To report a security issue, please contact the Stainless team at security@stainlessapi.com. + +## Responsible Disclosure + +We appreciate the efforts of security researchers and individuals who help us maintain the security of +SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible +disclosure practices by allowing us a reasonable amount of time to investigate and address the issue +before making any information public. + +## Reporting Non-SDK Related Security Issues + +If you encounter security issues that are not directly related to SDKs but pertain to the services +or products provided by Cloudflare please follow the respective company's security reporting guidelines. + +### Cloudflare Terms and Policies + +Please contact api@cloudflare.com for any questions or concerns regarding security of our services. + +--- + +Thank you for helping us keep the SDKs and systems they interact with secure. diff --git a/api.md b/api.md index 5fca9d1aeaa..85216eb6939 100644 --- a/api.md +++ b/api.md @@ -36,9 +36,9 @@ from cloudflare.types.accounts import ( Methods: -- client.accounts.update(\*, account_id, \*\*params) -> AccountUpdateResponse +- client.accounts.update(\*, account_id, \*\*params) -> object - client.accounts.list(\*\*params) -> SyncV4PagePaginationArray[object] -- client.accounts.get(\*, account_id) -> AccountGetResponse +- client.accounts.get(\*, account_id) -> object ## Members @@ -48,18 +48,21 @@ Types: from cloudflare.types.accounts import ( Status, UserWithInviteCode, + MemberCreateResponse, + MemberUpdateResponse, MemberListResponse, MemberDeleteResponse, + MemberGetResponse, ) ``` Methods: -- client.accounts.members.create(\*, account_id, \*\*params) -> UserWithInviteCode -- client.accounts.members.update(member_id, \*, account_id, \*\*params) -> Member +- client.accounts.members.create(\*, account_id, \*\*params) -> Optional +- client.accounts.members.update(member_id, \*, account_id, \*\*params) -> Optional - 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) -> Member +- client.accounts.members.get(member_id, \*, account_id) -> Optional ## Roles @@ -72,7 +75,7 @@ from cloudflare.types.accounts import RoleGetResponse Methods: - client.accounts.roles.list(\*, account_id) -> SyncSinglePage[Role] -- client.accounts.roles.get(role_id, \*, account_id) -> RoleGetResponse +- client.accounts.roles.get(role_id, \*, account_id) -> object # OriginCACertificates @@ -121,10 +124,10 @@ from cloudflare.types.memberships import ( Methods: -- client.memberships.update(membership_id, \*\*params) -> MembershipUpdateResponse +- client.memberships.update(membership_id, \*\*params) -> Optional - client.memberships.list(\*\*params) -> SyncV4PagePaginationArray[Membership] -- client.memberships.delete(membership_id) -> MembershipDeleteResponse -- client.memberships.get(membership_id) -> MembershipGetResponse +- client.memberships.delete(membership_id) -> Optional +- client.memberships.get(membership_id) -> Optional # User @@ -136,8 +139,8 @@ from cloudflare.types.user import UserEditResponse, UserGetResponse Methods: -- client.user.edit(\*\*params) -> UserEditResponse -- client.user.get() -> UserGetResponse +- client.user.edit(\*\*params) -> object +- client.user.get() -> object ## AuditLogs @@ -182,8 +185,8 @@ from cloudflare.types.user import Invite, InviteEditResponse, InviteGetResponse Methods: - client.user.invites.list() -> SyncSinglePage[Invite] -- client.user.invites.edit(invite_id, \*\*params) -> InviteEditResponse -- client.user.invites.get(invite_id) -> InviteGetResponse +- client.user.invites.edit(invite_id, \*\*params) -> object +- client.user.invites.get(invite_id) -> object ## Organizations @@ -197,7 +200,7 @@ Methods: - client.user.organizations.list(\*\*params) -> SyncV4PagePaginationArray[Organization] - client.user.organizations.delete(organization_id) -> OrganizationDeleteResponse -- client.user.organizations.get(organization_id) -> OrganizationGetResponse +- client.user.organizations.get(organization_id) -> object ## Subscriptions @@ -243,12 +246,12 @@ from cloudflare.types.user import ( Methods: -- client.user.tokens.create(\*\*params) -> TokenCreateResponse -- client.user.tokens.update(token_id, \*\*params) -> TokenUpdateResponse +- client.user.tokens.create(\*\*params) -> Optional +- client.user.tokens.update(token_id, \*\*params) -> object - client.user.tokens.list(\*\*params) -> SyncV4PagePaginationArray[object] - client.user.tokens.delete(token_id) -> Optional -- client.user.tokens.get(token_id) -> TokenGetResponse -- client.user.tokens.verify() -> TokenVerifyResponse +- client.user.tokens.get(token_id) -> object +- client.user.tokens.verify() -> Optional ### PermissionGroups @@ -302,19 +305,6 @@ Methods: - client.zones.activation_check.trigger(\*, zone_id) -> Optional -## DNSSettings - -Types: - -```python -from cloudflare.types.zones import DNSSetting, Nameserver -``` - -Methods: - -- client.zones.dns_settings.edit(\*, zone_id, \*\*params) -> Optional -- client.zones.dns_settings.get(\*, zone_id) -> Optional - ## Settings ### ZeroRTT @@ -1654,6 +1644,19 @@ Methods: - client.dns.records.import\_(\*, zone_id, \*\*params) -> Optional - client.dns.records.scan(\*, zone_id, \*\*params) -> Optional +## Settings + +Types: + +```python +from cloudflare.types.dns import DNSSetting, Nameserver, SettingEditResponse, SettingGetResponse +``` + +Methods: + +- client.dns.settings.edit(\*, account_id, zone_id, \*\*params) -> Optional +- client.dns.settings.get(\*, account_id, zone_id) -> Optional + ## Analytics ### Reports @@ -1859,7 +1862,7 @@ Types: ```python from cloudflare.types.firewall import ( FirewallRule, - Products, + Product, DeletedFilter, RuleCreateResponse, RuleEditResponse, @@ -2142,18 +2145,16 @@ Methods: ### Retention -#### Flag - Types: ```python -from cloudflare.types.logs.control.retention import FlagCreateResponse, FlagGetResponse +from cloudflare.types.logs.control import RetentionCreateResponse, RetentionGetResponse ``` Methods: -- client.logs.control.retention.flag.create(zone_identifier, \*\*params) -> FlagCreateResponse -- client.logs.control.retention.flag.get(zone_identifier) -> FlagGetResponse +- client.logs.control.retention.create(zone_identifier, \*\*params) -> RetentionCreateResponse +- client.logs.control.retention.get(zone_identifier) -> RetentionGetResponse ### Cmb @@ -2657,7 +2658,21 @@ from cloudflare.types.workers import AIRunResponse Methods: -- client.workers.ai.run(model_name, \*, account_id, \*\*params) -> Optional +- client.workers.ai.run(model_name, \*, account_id, \*\*params) -> Optional + +### Models + +#### Schema + +Types: + +```python +from cloudflare.types.workers.ai.models import SchemaGetResponse +``` + +Methods: + +- client.workers.ai.models.schema.get(\*, account_id, \*\*params) -> object ## Scripts @@ -2752,7 +2767,7 @@ from cloudflare.types.workers.scripts import ( Methods: - 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.list(script_name, \*, account_id, \*\*params) -> SyncV4PagePagination[VersionListResponse] - client.workers.scripts.versions.get(version_id, \*, account_id, script_name) -> Optional ## AccountSettings @@ -2808,10 +2823,11 @@ from cloudflare.types.kv import Namespace, NamespaceUpdateResponse, NamespaceDel Methods: -- client.kv.namespaces.create(\*, account_id, \*\*params) -> Namespace -- client.kv.namespaces.update(namespace_id, \*, account_id, \*\*params) -> NamespaceUpdateResponse +- client.kv.namespaces.create(\*, account_id, \*\*params) -> Optional +- client.kv.namespaces.update(namespace_id, \*, account_id, \*\*params) -> Optional - client.kv.namespaces.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Namespace] -- client.kv.namespaces.delete(namespace_id, \*, account_id) -> NamespaceDeleteResponse +- client.kv.namespaces.delete(namespace_id, \*, account_id) -> Optional +- client.kv.namespaces.get(namespace_id, \*, account_id) -> Optional ### Bulk @@ -2823,8 +2839,8 @@ from cloudflare.types.kv.namespaces import BulkUpdateResponse, BulkDeleteRespons Methods: -- client.kv.namespaces.bulk.update(namespace_id, \*, account_id, \*\*params) -> BulkUpdateResponse -- client.kv.namespaces.bulk.delete(namespace_id, \*, account_id) -> BulkDeleteResponse +- client.kv.namespaces.bulk.update(namespace_id, \*, account_id, \*\*params) -> Optional +- client.kv.namespaces.bulk.delete(namespace_id, \*, account_id) -> Optional ### Keys @@ -2848,25 +2864,21 @@ from cloudflare.types.kv.namespaces import MetadataGetResponse Methods: -- client.kv.namespaces.metadata.get(key_name, \*, account_id, namespace_id) -> object +- client.kv.namespaces.metadata.get(key_name, \*, account_id, namespace_id) -> Optional ### Values Types: ```python -from cloudflare.types.kv.namespaces import ( - ValueUpdateResponse, - ValueDeleteResponse, - ValueGetResponse, -) +from cloudflare.types.kv.namespaces import ValueUpdateResponse, ValueDeleteResponse ``` 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.get(key_name, \*, account_id, namespace_id) -> str +- client.kv.namespaces.values.update(key_name, \*, account_id, namespace_id, \*\*params) -> Optional +- client.kv.namespaces.values.delete(key_name, \*, account_id, namespace_id) -> Optional +- client.kv.namespaces.values.get(key_name, \*, account_id, namespace_id) -> BinaryAPIResponse # DurableObjects @@ -2944,6 +2956,145 @@ Methods: - client.queues.messages.ack(queue_id, \*, account_id, \*\*params) -> Optional - client.queues.messages.pull(queue_id, \*, account_id, \*\*params) -> Optional +# APIGateway + +## Configurations + +Types: + +```python +from cloudflare.types.api_gateway import Configuration, ConfigurationUpdateResponse +``` + +Methods: + +- client.api_gateway.configurations.update(\*, zone_id, \*\*params) -> ConfigurationUpdateResponse +- client.api_gateway.configurations.get(\*, zone_id, \*\*params) -> Configuration + +## Discovery + +Types: + +```python +from cloudflare.types.api_gateway import DiscoveryOperation, DiscoveryGetResponse +``` + +Methods: + +- client.api_gateway.discovery.get(\*, zone_id) -> DiscoveryGetResponse + +### Operations + +Types: + +```python +from cloudflare.types.api_gateway.discovery import OperationEditResponse +``` + +Methods: + +- client.api_gateway.discovery.operations.list(\*, zone_id, \*\*params) -> SyncSinglePage[DiscoveryOperation] +- client.api_gateway.discovery.operations.edit(operation_id, \*, zone_id, \*\*params) -> OperationEditResponse + +## Operations + +Types: + +```python +from cloudflare.types.api_gateway import APIShield, OperationCreateResponse, OperationDeleteResponse +``` + +Methods: + +- client.api_gateway.operations.create(\*, zone_id, \*\*params) -> Optional +- client.api_gateway.operations.list(\*, zone_id, \*\*params) -> SyncSinglePage[APIShield] +- client.api_gateway.operations.delete(operation_id, \*, zone_id) -> OperationDeleteResponse +- client.api_gateway.operations.get(operation_id, \*, zone_id, \*\*params) -> APIShield + +### SchemaValidation + +Types: + +```python +from cloudflare.types.api_gateway.operations import ( + SettingsMultipleRequest, + SchemaValidationUpdateResponse, + SchemaValidationGetResponse, +) +``` + +Methods: + +- client.api_gateway.operations.schema_validation.update(operation_id, \*, zone_id, \*\*params) -> SchemaValidationUpdateResponse +- client.api_gateway.operations.schema_validation.edit(\*, zone_id, \*\*params) -> SettingsMultipleRequest +- client.api_gateway.operations.schema_validation.get(operation_id, \*, zone_id) -> SchemaValidationGetResponse + +## Schemas + +Types: + +```python +from cloudflare.types.api_gateway import SchemaListResponse +``` + +Methods: + +- client.api_gateway.schemas.list(\*, zone_id, \*\*params) -> SchemaListResponse + +## Settings + +### SchemaValidation + +Types: + +```python +from cloudflare.types.api_gateway.settings import Settings +``` + +Methods: + +- client.api_gateway.settings.schema_validation.update(\*, zone_id, \*\*params) -> Settings +- client.api_gateway.settings.schema_validation.get(\*, zone_id) -> Settings + +## UserSchemas + +Types: + +```python +from cloudflare.types.api_gateway import ( + Message, + PublicSchema, + SchemaUpload, + UserSchemaDeleteResponse, +) +``` + +Methods: + +- client.api_gateway.user_schemas.create(\*, zone_id, \*\*params) -> SchemaUpload +- client.api_gateway.user_schemas.list(\*, zone_id, \*\*params) -> SyncSinglePage[PublicSchema] +- client.api_gateway.user_schemas.delete(schema_id, \*, zone_id) -> UserSchemaDeleteResponse +- client.api_gateway.user_schemas.edit(schema_id, \*, zone_id, \*\*params) -> PublicSchema +- client.api_gateway.user_schemas.get(schema_id, \*, zone_id, \*\*params) -> PublicSchema + +### Operations + +Types: + +```python +from cloudflare.types.api_gateway.user_schemas import OperationListResponse +``` + +Methods: + +- client.api_gateway.user_schemas.operations.list(schema_id, \*, zone_id, \*\*params) -> SyncSinglePage[OperationListResponse] + +## SchemaValidation + +Methods: + +- client.api_gateway.schema_validation.edit(\*, zone_id, \*\*params) -> Settings + # ManagedHeaders Types: @@ -2971,24 +3122,30 @@ from cloudflare.types.page_shield import Setting, PageShieldUpdateResponse Methods: -- client.page_shield.update(\*, zone_id, \*\*params) -> PageShieldUpdateResponse -- client.page_shield.get(\*, zone_id) -> Setting +- client.page_shield.update(\*, zone_id, \*\*params) -> Optional +- client.page_shield.get(\*, zone_id) -> Optional ## Policies Types: ```python -from cloudflare.types.page_shield import Policy +from cloudflare.types.page_shield import ( + Policy, + PolicyCreateResponse, + PolicyUpdateResponse, + PolicyListResponse, + PolicyGetResponse, +) ``` Methods: -- 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.create(\*, zone_id, \*\*params) -> Optional +- client.page_shield.policies.update(policy_id, \*, zone_id, \*\*params) -> Optional +- client.page_shield.policies.list(\*, zone_id) -> SyncSinglePage[PolicyListResponse] - client.page_shield.policies.delete(policy_id, \*, zone_id) -> None -- client.page_shield.policies.get(policy_id, \*, zone_id) -> Policy +- client.page_shield.policies.get(policy_id, \*, zone_id) -> Optional ## Connections @@ -3001,7 +3158,7 @@ from cloudflare.types.page_shield import Connection Methods: - client.page_shield.connections.list(\*, zone_id, \*\*params) -> SyncSinglePage[Connection] -- client.page_shield.connections.get(connection_id, \*, zone_id) -> Connection +- client.page_shield.connections.get(connection_id, \*, zone_id) -> Optional ## Scripts @@ -3014,7 +3171,20 @@ from cloudflare.types.page_shield import Script, ScriptGetResponse Methods: - client.page_shield.scripts.list(\*, zone_id, \*\*params) -> SyncSinglePage[Script] -- client.page_shield.scripts.get(script_id, \*, zone_id) -> ScriptGetResponse +- client.page_shield.scripts.get(script_id, \*, zone_id) -> Optional + +## Cookies + +Types: + +```python +from cloudflare.types.page_shield import CookieListResponse, CookieGetResponse +``` + +Methods: + +- client.page_shield.cookies.list(\*, zone_id, \*\*params) -> SyncSinglePage[CookieListResponse] +- client.page_shield.cookies.get(cookie_id, \*, zone_id) -> Optional # Rulesets @@ -3027,6 +3197,7 @@ from cloudflare.types.rulesets import ( Ruleset, RulesetCreateResponse, RulesetUpdateResponse, + RulesetListResponse, RulesetGetResponse, ) ``` @@ -3035,7 +3206,7 @@ Methods: - 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.list(\*, account_id, zone_id) -> SyncSinglePage[RulesetListResponse] - client.rulesets.delete(ruleset_id, \*, account_id, zone_id) -> None - client.rulesets.get(ruleset_id, \*, account_id, zone_id) -> RulesetGetResponse @@ -3057,12 +3228,12 @@ Methods: Types: ```python -from cloudflare.types.rulesets.phases import VersionGetResponse +from cloudflare.types.rulesets.phases import VersionListResponse, VersionGetResponse ``` Methods: -- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[Ruleset] +- 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) -> VersionGetResponse ## Rules @@ -3106,12 +3277,12 @@ Methods: Types: ```python -from cloudflare.types.rulesets import VersionGetResponse +from cloudflare.types.rulesets import VersionListResponse, VersionGetResponse ``` Methods: -- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[Ruleset] +- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] - 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) -> VersionGetResponse @@ -3223,6 +3394,40 @@ Methods: # Addressing +## RegionalHostnames + +Types: + +```python +from cloudflare.types.addressing import ( + RegionalHostnameCreateResponse, + RegionalHostnameListResponse, + RegionalHostnameDeleteResponse, + RegionalHostnameEditResponse, + RegionalHostnameGetResponse, +) +``` + +Methods: + +- client.addressing.regional_hostnames.create(\*, zone_id, \*\*params) -> Optional +- client.addressing.regional_hostnames.list(\*, zone_id) -> SyncSinglePage[RegionalHostnameListResponse] +- client.addressing.regional_hostnames.delete(hostname, \*, zone_id) -> RegionalHostnameDeleteResponse +- client.addressing.regional_hostnames.edit(hostname, \*, zone_id, \*\*params) -> Optional +- client.addressing.regional_hostnames.get(hostname, \*, zone_id) -> Optional + +### Regions + +Types: + +```python +from cloudflare.types.addressing.regional_hostnames import RegionListResponse +``` + +Methods: + +- client.addressing.regional_hostnames.regions.list(\*, account_id) -> SyncSinglePage[RegionListResponse] + ## Services Types: @@ -3310,15 +3515,9 @@ Methods: ### Downloads -Types: - -```python -from cloudflare.types.addressing.loa_documents import DownloadGetResponse -``` - Methods: -- client.addressing.loa_documents.downloads.get(loa_document_id, \*, account_id) -> object +- client.addressing.loa_documents.downloads.get(loa_document_id, \*, account_id) -> BinaryAPIResponse ## Prefixes @@ -3769,6 +3968,26 @@ Types: from cloudflare.types.magic_transit import HealthCheck, HealthCheckRate, HealthCheckType ``` +## Apps + +Types: + +```python +from cloudflare.types.magic_transit import ( + AppCreateResponse, + AppUpdateResponse, + AppListResponse, + AppDeleteResponse, +) +``` + +Methods: + +- client.magic_transit.apps.create(\*, account_id, \*\*params) -> Optional +- client.magic_transit.apps.update(account_app_id, \*, account_id, \*\*params) -> Optional +- client.magic_transit.apps.list(\*, account_id) -> SyncSinglePage[AppListResponse] +- client.magic_transit.apps.delete(account_app_id, \*, account_id) -> Optional + ## CfInterconnects Types: @@ -3873,6 +4092,7 @@ Methods: - 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) -> Site +- client.magic_transit.sites.edit(site_id, \*, account_id, \*\*params) -> Site - client.magic_transit.sites.get(site_id, \*, account_id) -> Site ### ACLs @@ -3889,6 +4109,7 @@ Methods: - 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) -> ACL +- client.magic_transit.sites.acls.edit(acl_identifier, \*, account_id, site_id, \*\*params) -> ACL - client.magic_transit.sites.acls.get(acl_identifier, \*, account_id, site_id) -> ACL ### LANs @@ -3913,6 +4134,7 @@ Methods: - 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) -> LAN +- client.magic_transit.sites.lans.edit(lan_id, \*, account_id, site_id, \*\*params) -> LAN - client.magic_transit.sites.lans.get(lan_id, \*, account_id, site_id) -> LAN ### WANs @@ -3929,8 +4151,29 @@ Methods: - 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) -> WAN +- client.magic_transit.sites.wans.edit(wan_id, \*, account_id, site_id, \*\*params) -> WAN - client.magic_transit.sites.wans.get(wan_id, \*, account_id, site_id) -> WAN +## Connectors + +Types: + +```python +from cloudflare.types.magic_transit import ( + ConnectorUpdateResponse, + ConnectorListResponse, + ConnectorEditResponse, + ConnectorGetResponse, +) +``` + +Methods: + +- client.magic_transit.connectors.update(connector_id, \*, account_id, \*\*params) -> ConnectorUpdateResponse +- client.magic_transit.connectors.list(\*, account_id) -> SyncSinglePage[ConnectorListResponse] +- client.magic_transit.connectors.edit(connector_id, \*, account_id, \*\*params) -> ConnectorEditResponse +- client.magic_transit.connectors.get(connector_id, \*, account_id) -> ConnectorGetResponse + # MagicNetworkMonitoring ## Configs @@ -4228,8 +4471,8 @@ from cloudflare.types.storage import Components, Schema Methods: -- client.storage.analytics.list(\*, account_id, \*\*params) -> Schema -- client.storage.analytics.stored(\*, account_id, \*\*params) -> Components +- client.storage.analytics.list(\*, account_id, \*\*params) -> Optional +- client.storage.analytics.stored(\*, account_id, \*\*params) -> Optional # Stream @@ -4459,12 +4702,6 @@ Methods: # Alerting -Types: - -```python -from cloudflare.types.alerting import Alert -``` - ## AvailableAlerts Types: @@ -4507,10 +4744,10 @@ from cloudflare.types.alerting.destinations import ( Methods: -- client.alerting.destinations.pagerduty.create(\*, account_id) -> PagerdutyCreateResponse -- client.alerting.destinations.pagerduty.delete(\*, account_id) -> Optional +- client.alerting.destinations.pagerduty.create(\*, account_id) -> Optional +- client.alerting.destinations.pagerduty.delete(\*, account_id) -> PagerdutyDeleteResponse - client.alerting.destinations.pagerduty.get(\*, account_id) -> Optional -- client.alerting.destinations.pagerduty.link(token_id, \*, account_id) -> PagerdutyLinkResponse +- client.alerting.destinations.pagerduty.link(token_id, \*, account_id) -> Optional ### Webhooks @@ -4527,11 +4764,11 @@ from cloudflare.types.alerting.destinations import ( 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.create(\*, account_id, \*\*params) -> Optional +- client.alerting.destinations.webhooks.update(webhook_id, \*, account_id, \*\*params) -> Optional - 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) -> Webhooks +- client.alerting.destinations.webhooks.delete(webhook_id, \*, account_id) -> WebhookDeleteResponse +- client.alerting.destinations.webhooks.get(webhook_id, \*, account_id) -> Optional ## History @@ -4562,11 +4799,11 @@ from cloudflare.types.alerting import ( Methods: -- client.alerting.policies.create(\*, account_id, \*\*params) -> PolicyCreateResponse -- client.alerting.policies.update(policy_id, \*, account_id, \*\*params) -> PolicyUpdateResponse +- client.alerting.policies.create(\*, account_id, \*\*params) -> Optional +- client.alerting.policies.update(policy_id, \*, account_id, \*\*params) -> Optional - 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) -> Policy +- client.alerting.policies.delete(policy_id, \*, account_id) -> PolicyDeleteResponse +- client.alerting.policies.get(policy_id, \*, account_id) -> Optional # D1 @@ -4587,6 +4824,7 @@ from cloudflare.types.d1 import ( DatabaseListResponse, DatabaseDeleteResponse, DatabaseQueryResponse, + DatabaseRawResponse, ) ``` @@ -4594,9 +4832,10 @@ Methods: - 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 +- client.d1.database.delete(database_id, \*, account_id) -> DatabaseDeleteResponse +- client.d1.database.get(database_id, \*, account_id) -> D1 +- client.d1.database.query(database_id, \*, account_id, \*\*params) -> DatabaseQueryResponse +- client.d1.database.raw(database_id, \*, account_id, \*\*params) -> DatabaseRawResponse # R2 @@ -4629,6 +4868,18 @@ Methods: - client.r2.sippy.delete(bucket_name, \*, account_id) -> SippyDeleteResponse - client.r2.sippy.get(bucket_name, \*, account_id) -> Sippy +## TemporaryCredentials + +Types: + +```python +from cloudflare.types.r2 import TemporaryCredential, TemporaryCredentialCreateResponse +``` + +Methods: + +- client.r2.temporary_credentials.create(\*, account_id, \*\*params) -> TemporaryCredentialCreateResponse + # WARPConnector Types: @@ -5006,7 +5257,7 @@ from cloudflare.types.zero_trust import ( GenericOAuthConfig, IdentityProvider, IdentityProviderType, - ScimConfig, + SCIMConfig, IdentityProviderListResponse, IdentityProviderDeleteResponse, ) @@ -5015,10 +5266,10 @@ from cloudflare.types.zero_trust import ( Methods: - 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.update(identity_provider_id, \*, 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) -> Optional -- client.zero_trust.identity_providers.get(uuid, \*, account_id, zone_id) -> Optional +- client.zero_trust.identity_providers.delete(identity_provider_id, \*, account_id, zone_id) -> Optional +- client.zero_trust.identity_providers.get(identity_provider_id, \*, account_id, zone_id) -> Optional ## Organizations @@ -5045,7 +5296,7 @@ from cloudflare.types.zero_trust import Seat, SeatEditResponse Methods: -- client.zero_trust.seats.edit(identifier, \*\*params) -> Optional +- client.zero_trust.seats.edit(\*, account_id, \*\*params) -> Optional ## Access @@ -5090,23 +5341,28 @@ from cloudflare.types.zero_trust.access import ( Application, ApplicationType, CORSHeaders, + Decision, SaaSAppNameFormat, SaaSAppNameIDFormat, SaaSAppSource, SAMLSaaSApp, SelfHostedDomains, + ApplicationCreateResponse, + ApplicationUpdateResponse, + ApplicationListResponse, ApplicationDeleteResponse, + ApplicationGetResponse, ApplicationRevokeTokensResponse, ) ``` Methods: -- 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.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[ApplicationListResponse] - 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.get(app_id, \*, account_id, zone_id) -> Optional - client.zero_trust.access.applications.revoke_tokens(app_id, \*, account_id, zone_id) -> object #### CAs @@ -5124,10 +5380,10 @@ from cloudflare.types.zero_trust.access.applications import ( Methods: -- client.zero_trust.access.applications.cas.create(uuid, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.applications.cas.create(app_id, \*, 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 +- client.zero_trust.access.applications.cas.delete(app_id, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.applications.cas.get(app_id, \*, account_id, zone_id) -> Optional #### UserPolicyChecks @@ -5152,17 +5408,21 @@ Types: from cloudflare.types.zero_trust.access.applications import ( ApprovalGroup, Policy, + PolicyCreateResponse, + PolicyUpdateResponse, + PolicyListResponse, PolicyDeleteResponse, + PolicyGetResponse, ) ``` Methods: -- 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 +- client.zero_trust.access.applications.policies.create(app_id, \*, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.applications.policies.update(policy_id, \*, app_id, account_id, zone_id, \*\*params) -> Optional +- client.zero_trust.access.applications.policies.list(app_id, \*, account_id, zone_id) -> SyncSinglePage[PolicyListResponse] +- client.zero_trust.access.applications.policies.delete(policy_id, \*, app_id, account_id, zone_id) -> Optional +- client.zero_trust.access.applications.policies.get(policy_id, \*, app_id, account_id, zone_id) -> Optional ### Certificates @@ -5179,10 +5439,10 @@ from cloudflare.types.zero_trust.access import ( Methods: - 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.update(certificate_id, \*, 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 +- client.zero_trust.access.certificates.delete(certificate_id, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.certificates.get(certificate_id, \*, account_id, zone_id) -> Optional #### Settings @@ -5212,10 +5472,10 @@ from cloudflare.types.zero_trust.access import ZeroTrustGroup, GroupDeleteRespon Methods: - 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.update(group_id, \*, 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 +- client.zero_trust.access.groups.delete(group_id, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.groups.get(group_id, \*, account_id, zone_id) -> Optional ### ServiceTokens @@ -5232,11 +5492,12 @@ from cloudflare.types.zero_trust.access import ( Methods: - 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.update(service_token_id, \*, 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 +- client.zero_trust.access.service_tokens.delete(service_token_id, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.service_tokens.get(service_token_id, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.service_tokens.refresh(service_token_id, \*, account_id) -> Optional +- client.zero_trust.access.service_tokens.rotate(service_token_id, \*, account_id) -> Optional ### Bookmarks @@ -5248,11 +5509,11 @@ from cloudflare.types.zero_trust.access import Bookmark, BookmarkDeleteResponse Methods: -- 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) -> Optional -- client.zero_trust.access.bookmarks.get(uuid, \*, identifier) -> Optional +- client.zero_trust.access.bookmarks.create(bookmark_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.access.bookmarks.update(bookmark_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.access.bookmarks.list(\*, account_id) -> SyncSinglePage[Bookmark] +- client.zero_trust.access.bookmarks.delete(bookmark_id, \*, account_id) -> Optional +- client.zero_trust.access.bookmarks.get(bookmark_id, \*, account_id) -> Optional ### Keys @@ -5264,9 +5525,9 @@ from cloudflare.types.zero_trust.access import KeyUpdateResponse, KeyGetResponse Methods: -- 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 +- client.zero_trust.access.keys.update(\*, account_id, \*\*params) -> Optional +- client.zero_trust.access.keys.get(\*, account_id) -> Optional +- client.zero_trust.access.keys.rotate(\*, account_id) -> Optional ### Logs @@ -5280,7 +5541,7 @@ from cloudflare.types.zero_trust.access.logs import AccessRequests, AccessReques Methods: -- client.zero_trust.access.logs.access_requests.list(identifier) -> Optional +- client.zero_trust.access.logs.access_requests.list(\*, account_id, \*\*params) -> Optional ### Users @@ -5292,7 +5553,7 @@ from cloudflare.types.zero_trust.access import AccessUser Methods: -- client.zero_trust.access.users.list(identifier) -> SyncSinglePage[AccessUser] +- client.zero_trust.access.users.list(\*, account_id) -> SyncSinglePage[AccessUser] #### ActiveSessions @@ -5307,8 +5568,8 @@ 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) -> Optional +- client.zero_trust.access.users.active_sessions.list(user_id, \*, account_id) -> SyncSinglePage[ActiveSessionListResponse] +- client.zero_trust.access.users.active_sessions.get(nonce, \*, account_id, user_id) -> Optional #### LastSeenIdentity @@ -5320,7 +5581,7 @@ from cloudflare.types.zero_trust.access.users import Identity Methods: -- client.zero_trust.access.users.last_seen_identity.get(id, \*, identifier) -> Optional +- client.zero_trust.access.users.last_seen_identity.get(user_id, \*, account_id) -> Optional #### FailedLogins @@ -5332,7 +5593,7 @@ from cloudflare.types.zero_trust.access.users import FailedLoginListResponse Methods: -- client.zero_trust.access.users.failed_logins.list(id, \*, identifier) -> SyncSinglePage[FailedLoginListResponse] +- client.zero_trust.access.users.failed_logins.list(user_id, \*, account_id) -> SyncSinglePage[FailedLoginListResponse] ### CustomPages @@ -5348,11 +5609,11 @@ from cloudflare.types.zero_trust.access import ( Methods: -- 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 +- client.zero_trust.access.custom_pages.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.access.custom_pages.update(custom_page_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.access.custom_pages.list(\*, account_id) -> SyncSinglePage[CustomPageWithoutHTML] +- client.zero_trust.access.custom_pages.delete(custom_page_id, \*, account_id) -> Optional +- client.zero_trust.access.custom_pages.get(custom_page_id, \*, account_id) -> Optional ### Tags @@ -5364,11 +5625,33 @@ from cloudflare.types.zero_trust.access import Tag, TagDeleteResponse Methods: -- 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 +- client.zero_trust.access.tags.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.access.tags.update(tag_name, \*, account_id, \*\*params) -> Optional +- client.zero_trust.access.tags.list(\*, account_id) -> SyncSinglePage[Tag] +- client.zero_trust.access.tags.delete(tag_name, \*, account_id) -> Optional +- client.zero_trust.access.tags.get(tag_name, \*, account_id) -> Optional + +### Policies + +Types: + +```python +from cloudflare.types.zero_trust.access import ( + PolicyCreateResponse, + PolicyUpdateResponse, + PolicyListResponse, + PolicyDeleteResponse, + PolicyGetResponse, +) +``` + +Methods: + +- client.zero_trust.access.policies.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.access.policies.update(policy_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.access.policies.list(\*, account_id) -> SyncSinglePage[PolicyListResponse] +- client.zero_trust.access.policies.delete(policy_id, \*, account_id) -> Optional +- client.zero_trust.access.policies.get(policy_id, \*, account_id) -> Optional ## DEX @@ -5851,16 +6134,17 @@ from cloudflare.types.zero_trust.gateway import ( GatewayIPs, ProxyEndpoint, ProxyEndpointDeleteResponse, + ProxyEndpointGetResponse, ) ``` Methods: - 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.list(\*, account_id) -> Optional - client.zero_trust.gateway.proxy_endpoints.delete(proxy_endpoint_id, \*, account_id) -> 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 +- client.zero_trust.gateway.proxy_endpoints.get(proxy_endpoint_id, \*, account_id) -> Optional ### Rules @@ -5975,6 +6259,40 @@ Methods: - client.zero_trust.risk_scoring.summary.get(account_identifier, \*\*params) -> SummaryGetResponse +### Integrations + +Types: + +```python +from cloudflare.types.zero_trust.risk_scoring import ( + IntegrationCreateResponse, + IntegrationUpdateResponse, + IntegrationListResponse, + IntegrationDeleteResponse, + IntegrationGetResponse, +) +``` + +Methods: + +- client.zero_trust.risk_scoring.integrations.create(\*, account_id, \*\*params) -> Optional +- client.zero_trust.risk_scoring.integrations.update(integration_id, \*, account_id, \*\*params) -> Optional +- client.zero_trust.risk_scoring.integrations.list(\*, account_id) -> SyncSinglePage[IntegrationListResponse] +- client.zero_trust.risk_scoring.integrations.delete(integration_id, \*, account_id) -> object +- client.zero_trust.risk_scoring.integrations.get(integration_id, \*, account_id) -> Optional + +#### References + +Types: + +```python +from cloudflare.types.zero_trust.risk_scoring.integrations import ReferenceGetResponse +``` + +Methods: + +- client.zero_trust.risk_scoring.integrations.references.get(reference_id, \*, account_id) -> Optional + # Challenges ## Widgets @@ -6205,19 +6523,31 @@ Types: ```python from cloudflare.types.radar.bgp import ( + RouteAsesResponse, RouteMoasResponse, RoutePfx2asResponse, RouteStatsResponse, - RouteTimeseriesResponse, ) ``` Methods: +- client.radar.bgp.routes.ases(\*\*params) -> RouteAsesResponse - client.radar.bgp.routes.moas(\*\*params) -> RouteMoasResponse - client.radar.bgp.routes.pfx2as(\*\*params) -> RoutePfx2asResponse - client.radar.bgp.routes.stats(\*\*params) -> RouteStatsResponse -- client.radar.bgp.routes.timeseries(\*\*params) -> RouteTimeseriesResponse + +### IPs + +Types: + +```python +from cloudflare.types.radar.bgp import IPTimeseriesResponse +``` + +Methods: + +- client.radar.bgp.ips.timeseries(\*\*params) -> IPTimeseriesResponse ## Datasets @@ -6817,6 +7147,16 @@ Methods: ## HTTP +Types: + +```python +from cloudflare.types.radar import HTTPTimeseriesResponse +``` + +Methods: + +- client.radar.http.timeseries(\*\*params) -> HTTPTimeseriesResponse + ### Top Types: @@ -6926,6 +7266,18 @@ Methods: - client.radar.http.locations.tls_version.get(tls_version, \*\*params) -> TLSVersionGetResponse +#### BrowserFamily + +Types: + +```python +from cloudflare.types.radar.http.locations import BrowserFamilyGetResponse +``` + +Methods: + +- client.radar.http.locations.browser_family.get(browser_family, \*\*params) -> BrowserFamilyGetResponse + ### Ases Types: @@ -7022,6 +7374,18 @@ Methods: - client.radar.http.ases.tls_version.get(tls_version, \*\*params) -> TLSVersionGetResponse +#### BrowserFamily + +Types: + +```python +from cloudflare.types.radar.http.ases import BrowserFamilyGetResponse +``` + +Methods: + +- client.radar.http.ases.browser_family.get(browser_family, \*\*params) -> BrowserFamilyGetResponse + ### Summary Types: @@ -7272,8 +7636,6 @@ Methods: # DCVDelegation -## UUID - Types: ```python @@ -7282,7 +7644,7 @@ from cloudflare.types.dcv_delegation import DCVDelegationUUID Methods: -- client.dcv_delegation.uuid.get(\*, zone_id) -> Optional +- client.dcv_delegation.get(\*, zone_id) -> Optional # Hostnames @@ -7346,16 +7708,40 @@ Methods: Types: ```python -from cloudflare.types.calls import CallsApp, CallsAppWithSecret +from cloudflare.types.calls import CallsApp, CallsAppWithSecret, CallListResponse ``` Methods: -- 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 +- client.calls.create(\*, account_id, \*\*params) -> Optional +- client.calls.update(app_id, \*, account_id, \*\*params) -> Optional +- client.calls.list(\*, account_id) -> SyncSinglePage[CallListResponse] +- client.calls.delete(app_id, \*, account_id) -> Optional +- client.calls.get(app_id, \*, account_id) -> Optional + +## TURN + +### Keys + +Types: + +```python +from cloudflare.types.calls.turn import ( + KeyCreateResponse, + KeyUpdateResponse, + KeyListResponse, + KeyDeleteResponse, + KeyGetResponse, +) +``` + +Methods: + +- client.calls.turn.keys.create(\*, account_id, \*\*params) -> KeyCreateResponse +- client.calls.turn.keys.update(key_id, \*, account_id, \*\*params) -> str +- client.calls.turn.keys.list(\*, account_id) -> SyncSinglePage[KeyListResponse] +- client.calls.turn.keys.delete(key_id, \*, account_id) -> str +- client.calls.turn.keys.get(key_id, \*, account_id) -> str # CloudforceOne @@ -7490,3 +7876,40 @@ from cloudflare.types.ai_gateway import LogGetResponse Methods: - client.ai_gateway.logs.get(id, \*, account_id, \*\*params) -> LogGetResponse + +# IAM + +## PermissionGroups + +Types: + +```python +from cloudflare.types.iam import PermissionGroupListResponse, PermissionGroupGetResponse +``` + +Methods: + +- client.iam.permission_groups.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[object] +- client.iam.permission_groups.get(permission_group_id, \*, account_id) -> PermissionGroupGetResponse + +## ResourceGroups + +Types: + +```python +from cloudflare.types.iam import ( + ResourceGroupCreateResponse, + ResourceGroupUpdateResponse, + ResourceGroupListResponse, + ResourceGroupDeleteResponse, + ResourceGroupGetResponse, +) +``` + +Methods: + +- client.iam.resource_groups.create(\*, account_id, \*\*params) -> ResourceGroupCreateResponse +- client.iam.resource_groups.update(resource_group_id, \*, account_id, \*\*params) -> ResourceGroupUpdateResponse +- client.iam.resource_groups.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[object] +- client.iam.resource_groups.delete(resource_group_id, \*, account_id) -> Optional +- client.iam.resource_groups.get(resource_group_id, \*, account_id) -> ResourceGroupGetResponse diff --git a/mypy.ini b/mypy.ini index 1df17ff1948..ec35df6ad25 100644 --- a/mypy.ini +++ b/mypy.ini @@ -5,7 +5,7 @@ show_error_codes = True # Exclude _files.py because mypy isn't smart enough to apply # the correct type narrowing and as this is an internal module # it's fine to just use Pyright. -exclude = ^(src/cloudflare/_files\.py|_dev/.*\.py|src/cloudflare/resources/zero_trust/identity_providers\.py|src/cloudflare/resources/zero_trust/access/applications/applications\.py|src/cloudflare/resources/workers/ai\.py)$ +exclude = ^(src/cloudflare/_files\.py|_dev/.*\.py|src/cloudflare/resources/zero_trust/identity_providers\.py|src/cloudflare/resources/zero_trust/access/applications/applications\.py|src/cloudflare/resources/workers/ai\.py|src/cloudflare/resources/magic_transit/apps\.py)$ strict_equality = True implicit_reexport = True diff --git a/pyproject.toml b/pyproject.toml index 3a86f27f65f..02bcdae2a23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cloudflare" -version = "3.0.0-beta.9" +version = "3.0.0-beta.10" description = "The official Python library for the cloudflare API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/requirements-dev.lock b/requirements-dev.lock index 736dff54fa6..3a5469efbd0 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -59,11 +59,11 @@ pluggy==1.3.0 # via pytest py==1.11.0 # via pytest -pydantic==2.4.2 +pydantic==2.7.1 # via cloudflare -pydantic-core==2.10.1 +pydantic-core==2.18.2 # via pydantic -pyright==1.1.359 +pyright==1.1.364 pytest==7.1.1 # via pytest-asyncio pytest-asyncio==0.21.1 diff --git a/requirements.lock b/requirements.lock index 69b72930885..ec0db0c5222 100644 --- a/requirements.lock +++ b/requirements.lock @@ -29,9 +29,9 @@ httpx==0.25.2 idna==3.4 # via anyio # via httpx -pydantic==2.4.2 +pydantic==2.7.1 # via cloudflare -pydantic-core==2.10.1 +pydantic-core==2.18.2 # via pydantic sniffio==1.3.0 # via anyio diff --git a/scripts/bootstrap b/scripts/bootstrap index 29df07e77be..8c5c60eba34 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -16,4 +16,4 @@ echo "==> Installing Python dependencies…" # experimental uv support makes installations significantly faster rye config --set-bool behavior.use-uv=true -rye sync +rye sync --all-features diff --git a/scripts/format b/scripts/format index 2a9ea4664bf..667ec2d7af0 100755 --- a/scripts/format +++ b/scripts/format @@ -4,5 +4,5 @@ set -e cd "$(dirname "$0")/.." +echo "==> Running formatters" rye run format - diff --git a/scripts/lint b/scripts/lint index 0cc68b51578..aa39f69ffbd 100755 --- a/scripts/lint +++ b/scripts/lint @@ -4,5 +4,9 @@ set -e cd "$(dirname "$0")/.." +echo "==> Running lints" rye run lint +echo "==> Making sure it imports" +rye run python -c 'import cloudflare' + diff --git a/scripts/test b/scripts/test index be01d044734..b3ace9013bd 100755 --- a/scripts/test +++ b/scripts/test @@ -52,6 +52,5 @@ else echo fi -# Run tests echo "==> Running tests" rye run pytest "$@" diff --git a/src/cloudflare/_base_client.py b/src/cloudflare/_base_client.py index edd993ce049..ca66d5b4018 100644 --- a/src/cloudflare/_base_client.py +++ b/src/cloudflare/_base_client.py @@ -456,7 +456,7 @@ def _build_request( raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`") headers = self._build_headers(options) - params = _merge_mappings(self._custom_query, options.params) + params = _merge_mappings(self.default_query, options.params) content_type = headers.get("Content-Type") # If the given Content-Type header is multipart/form-data then it @@ -592,6 +592,12 @@ def default_headers(self) -> dict[str, str | Omit]: **self._custom_headers, } + @property + def default_query(self) -> dict[str, object]: + return { + **self._custom_query, + } + def _validate_headers( self, headers: Headers, # noqa: ARG002 diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index 529638ece6d..cf1a1aadb2b 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -85,6 +85,7 @@ class Cloudflare(SyncAPIClient): kv: resources.KVResource durable_objects: resources.DurableObjectsResource queues: resources.QueuesResource + api_gateway: resources.APIGatewayResource managed_headers: resources.ManagedHeadersResource page_shield: resources.PageShieldResource rulesets: resources.RulesetsResource @@ -129,6 +130,7 @@ class Cloudflare(SyncAPIClient): cloudforce_one: resources.CloudforceOneResource event_notifications: resources.EventNotificationsResource ai_gateway: resources.AIGatewayResource + iam: resources.IAMResource with_raw_response: CloudflareWithRawResponse with_streaming_response: CloudflareWithStreamedResponse @@ -242,6 +244,7 @@ def __init__( self.kv = resources.KVResource(self) self.durable_objects = resources.DurableObjectsResource(self) self.queues = resources.QueuesResource(self) + self.api_gateway = resources.APIGatewayResource(self) self.managed_headers = resources.ManagedHeadersResource(self) self.page_shield = resources.PageShieldResource(self) self.rulesets = resources.RulesetsResource(self) @@ -286,6 +289,7 @@ def __init__( self.cloudforce_one = resources.CloudforceOneResource(self) self.event_notifications = resources.EventNotificationsResource(self) self.ai_gateway = resources.AIGatewayResource(self) + self.iam = resources.IAMResource(self) self.with_raw_response = CloudflareWithRawResponse(self) self.with_streaming_response = CloudflareWithStreamedResponse(self) @@ -502,6 +506,7 @@ class AsyncCloudflare(AsyncAPIClient): kv: resources.AsyncKVResource durable_objects: resources.AsyncDurableObjectsResource queues: resources.AsyncQueuesResource + api_gateway: resources.AsyncAPIGatewayResource managed_headers: resources.AsyncManagedHeadersResource page_shield: resources.AsyncPageShieldResource rulesets: resources.AsyncRulesetsResource @@ -546,6 +551,7 @@ class AsyncCloudflare(AsyncAPIClient): cloudforce_one: resources.AsyncCloudforceOneResource event_notifications: resources.AsyncEventNotificationsResource ai_gateway: resources.AsyncAIGatewayResource + iam: resources.AsyncIAMResource with_raw_response: AsyncCloudflareWithRawResponse with_streaming_response: AsyncCloudflareWithStreamedResponse @@ -659,6 +665,7 @@ def __init__( self.kv = resources.AsyncKVResource(self) self.durable_objects = resources.AsyncDurableObjectsResource(self) self.queues = resources.AsyncQueuesResource(self) + self.api_gateway = resources.AsyncAPIGatewayResource(self) self.managed_headers = resources.AsyncManagedHeadersResource(self) self.page_shield = resources.AsyncPageShieldResource(self) self.rulesets = resources.AsyncRulesetsResource(self) @@ -703,6 +710,7 @@ def __init__( self.cloudforce_one = resources.AsyncCloudforceOneResource(self) self.event_notifications = resources.AsyncEventNotificationsResource(self) self.ai_gateway = resources.AsyncAIGatewayResource(self) + self.iam = resources.AsyncIAMResource(self) self.with_raw_response = AsyncCloudflareWithRawResponse(self) self.with_streaming_response = AsyncCloudflareWithStreamedResponse(self) @@ -926,6 +934,7 @@ def __init__(self, client: Cloudflare) -> None: self.kv = resources.KVResourceWithRawResponse(client.kv) self.durable_objects = resources.DurableObjectsResourceWithRawResponse(client.durable_objects) self.queues = resources.QueuesResourceWithRawResponse(client.queues) + self.api_gateway = resources.APIGatewayResourceWithRawResponse(client.api_gateway) self.managed_headers = resources.ManagedHeadersResourceWithRawResponse(client.managed_headers) self.page_shield = resources.PageShieldResourceWithRawResponse(client.page_shield) self.rulesets = resources.RulesetsResourceWithRawResponse(client.rulesets) @@ -974,6 +983,7 @@ def __init__(self, client: Cloudflare) -> None: self.cloudforce_one = resources.CloudforceOneResourceWithRawResponse(client.cloudforce_one) self.event_notifications = resources.EventNotificationsResourceWithRawResponse(client.event_notifications) self.ai_gateway = resources.AIGatewayResourceWithRawResponse(client.ai_gateway) + self.iam = resources.IAMResourceWithRawResponse(client.iam) class AsyncCloudflareWithRawResponse: @@ -1024,6 +1034,7 @@ def __init__(self, client: AsyncCloudflare) -> None: self.kv = resources.AsyncKVResourceWithRawResponse(client.kv) self.durable_objects = resources.AsyncDurableObjectsResourceWithRawResponse(client.durable_objects) self.queues = resources.AsyncQueuesResourceWithRawResponse(client.queues) + self.api_gateway = resources.AsyncAPIGatewayResourceWithRawResponse(client.api_gateway) self.managed_headers = resources.AsyncManagedHeadersResourceWithRawResponse(client.managed_headers) self.page_shield = resources.AsyncPageShieldResourceWithRawResponse(client.page_shield) self.rulesets = resources.AsyncRulesetsResourceWithRawResponse(client.rulesets) @@ -1074,6 +1085,7 @@ def __init__(self, client: AsyncCloudflare) -> None: self.cloudforce_one = resources.AsyncCloudforceOneResourceWithRawResponse(client.cloudforce_one) self.event_notifications = resources.AsyncEventNotificationsResourceWithRawResponse(client.event_notifications) self.ai_gateway = resources.AsyncAIGatewayResourceWithRawResponse(client.ai_gateway) + self.iam = resources.AsyncIAMResourceWithRawResponse(client.iam) class CloudflareWithStreamedResponse: @@ -1124,6 +1136,7 @@ def __init__(self, client: Cloudflare) -> None: self.kv = resources.KVResourceWithStreamingResponse(client.kv) self.durable_objects = resources.DurableObjectsResourceWithStreamingResponse(client.durable_objects) self.queues = resources.QueuesResourceWithStreamingResponse(client.queues) + self.api_gateway = resources.APIGatewayResourceWithStreamingResponse(client.api_gateway) self.managed_headers = resources.ManagedHeadersResourceWithStreamingResponse(client.managed_headers) self.page_shield = resources.PageShieldResourceWithStreamingResponse(client.page_shield) self.rulesets = resources.RulesetsResourceWithStreamingResponse(client.rulesets) @@ -1174,6 +1187,7 @@ def __init__(self, client: Cloudflare) -> None: self.cloudforce_one = resources.CloudforceOneResourceWithStreamingResponse(client.cloudforce_one) self.event_notifications = resources.EventNotificationsResourceWithStreamingResponse(client.event_notifications) self.ai_gateway = resources.AIGatewayResourceWithStreamingResponse(client.ai_gateway) + self.iam = resources.IAMResourceWithStreamingResponse(client.iam) class AsyncCloudflareWithStreamedResponse: @@ -1230,6 +1244,7 @@ def __init__(self, client: AsyncCloudflare) -> None: self.kv = resources.AsyncKVResourceWithStreamingResponse(client.kv) self.durable_objects = resources.AsyncDurableObjectsResourceWithStreamingResponse(client.durable_objects) self.queues = resources.AsyncQueuesResourceWithStreamingResponse(client.queues) + self.api_gateway = resources.AsyncAPIGatewayResourceWithStreamingResponse(client.api_gateway) self.managed_headers = resources.AsyncManagedHeadersResourceWithStreamingResponse(client.managed_headers) self.page_shield = resources.AsyncPageShieldResourceWithStreamingResponse(client.page_shield) self.rulesets = resources.AsyncRulesetsResourceWithStreamingResponse(client.rulesets) @@ -1282,6 +1297,7 @@ def __init__(self, client: AsyncCloudflare) -> None: client.event_notifications ) self.ai_gateway = resources.AsyncAIGatewayResourceWithStreamingResponse(client.ai_gateway) + self.iam = resources.AsyncIAMResourceWithStreamingResponse(client.iam) Client = Cloudflare diff --git a/src/cloudflare/_models.py b/src/cloudflare/_models.py index ff3f54e2cdc..75c68cc7302 100644 --- a/src/cloudflare/_models.py +++ b/src/cloudflare/_models.py @@ -62,7 +62,7 @@ from ._constants import RAW_RESPONSE_HEADER if TYPE_CHECKING: - from pydantic_core.core_schema import ModelField, ModelFieldsSchema + from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema __all__ = ["BaseModel", "GenericModel"] @@ -251,7 +251,9 @@ def model_dump( exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, - warnings: bool = True, + warnings: bool | Literal["none", "warn", "error"] = True, + context: dict[str, Any] | None = None, + serialize_as_any: bool = False, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -279,6 +281,10 @@ def model_dump( raise ValueError("round_trip is only supported in Pydantic v2") if warnings != True: raise ValueError("warnings is only supported in Pydantic v2") + if context is not None: + raise ValueError("context is only supported in Pydantic v2") + if serialize_as_any != False: + raise ValueError("serialize_as_any is only supported in Pydantic v2") return super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, @@ -300,7 +306,9 @@ def model_dump_json( exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, - warnings: bool = True, + warnings: bool | Literal["none", "warn", "error"] = True, + context: dict[str, Any] | None = None, + serialize_as_any: bool = False, ) -> str: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json @@ -324,6 +332,10 @@ def model_dump_json( raise ValueError("round_trip is only supported in Pydantic v2") if warnings != True: raise ValueError("warnings is only supported in Pydantic v2") + if context is not None: + raise ValueError("context is only supported in Pydantic v2") + if serialize_as_any != False: + raise ValueError("serialize_as_any is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, @@ -550,7 +562,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, field_schema = field["schema"] if field_schema["type"] == "literal": - for entry in field_schema["expected"]: + for entry in cast("LiteralSchema", field_schema)["expected"]: if isinstance(entry, str): mapping[entry] = variant else: diff --git a/src/cloudflare/_utils/_utils.py b/src/cloudflare/_utils/_utils.py index 17904ce60d3..34797c29057 100644 --- a/src/cloudflare/_utils/_utils.py +++ b/src/cloudflare/_utils/_utils.py @@ -20,7 +20,7 @@ import sniffio -from .._types import Headers, NotGiven, FileTypes, NotGivenOr, HeadersLike +from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike from .._compat import parse_date as parse_date, parse_datetime as parse_datetime _T = TypeVar("_T") @@ -370,7 +370,6 @@ def file_from_path(path: str) -> FileTypes: def get_required_header(headers: HeadersLike, header: str) -> str: lower_header = header.lower() if isinstance(headers, Mapping): - headers = cast(Headers, headers) for k, v in headers.items(): if k.lower() == lower_header and isinstance(v, str): return v diff --git a/src/cloudflare/_version.py b/src/cloudflare/_version.py index 0e7c52ee3d0..92e51bde907 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.9" # x-release-please-version +__version__ = "3.0.0-beta.10" # x-release-please-version diff --git a/src/cloudflare/pagination.py b/src/cloudflare/pagination.py index 37e133da6f6..7d52fed691a 100644 --- a/src/cloudflare/pagination.py +++ b/src/cloudflare/pagination.py @@ -52,16 +52,9 @@ def _get_page_items(self) -> List[_T]: @override def next_page_info(self) -> Optional[PageInfo]: - current_page = cast("int | None", self._options.params.get("page")) - if current_page is None: - current_page = 1 + last_page = cast("int | None", self._options.params.get("page")) or 1 - last_page = cast("int | None", self._options.params.get("page")) - if last_page is not None and current_page <= last_page: - # The API didn't return a new page in the last request - return None - - return PageInfo(params={"page": current_page + 1}) + return PageInfo(params={"page": last_page + 1}) class AsyncV4PagePagination(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): @@ -79,16 +72,9 @@ def _get_page_items(self) -> List[_T]: @override def next_page_info(self) -> Optional[PageInfo]: - current_page = cast("int | None", self._options.params.get("page")) - if current_page is None: - current_page = 1 - - last_page = cast("int | None", self._options.params.get("page")) - if last_page is not None and current_page <= last_page: - # The API didn't return a new page in the last request - return None + last_page = cast("int | None", self._options.params.get("page")) or 1 - return PageInfo(params={"page": current_page + 1}) + return PageInfo(params={"page": last_page + 1}) class V4PagePaginationArrayResultInfo(BaseModel): @@ -110,16 +96,9 @@ def _get_page_items(self) -> List[_T]: @override def next_page_info(self) -> Optional[PageInfo]: - current_page = cast("int | None", self._options.params.get("page")) - if current_page is None: - current_page = 1 + last_page = cast("int | None", self._options.params.get("page")) or 1 - last_page = cast("int | None", self._options.params.get("page")) - if last_page is not None and current_page <= last_page: - # The API didn't return a new page in the last request - return None - - return PageInfo(params={"page": current_page + 1}) + return PageInfo(params={"page": last_page + 1}) class AsyncV4PagePaginationArray(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): @@ -135,16 +114,9 @@ def _get_page_items(self) -> List[_T]: @override def next_page_info(self) -> Optional[PageInfo]: - current_page = cast("int | None", self._options.params.get("page")) - if current_page is None: - current_page = 1 - - last_page = cast("int | None", self._options.params.get("page")) - if last_page is not None and current_page <= last_page: - # The API didn't return a new page in the last request - return None + last_page = cast("int | None", self._options.params.get("page")) or 1 - return PageInfo(params={"page": current_page + 1}) + return PageInfo(params={"page": last_page + 1}) class CursorPaginationResultInfo(BaseModel): diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py index 4d7acbc7a4c..05545390c25 100644 --- a/src/cloudflare/resources/__init__.py +++ b/src/cloudflare/resources/__init__.py @@ -40,6 +40,14 @@ DNSResourceWithStreamingResponse, AsyncDNSResourceWithStreamingResponse, ) +from .iam import ( + IAMResource, + AsyncIAMResource, + IAMResourceWithRawResponse, + AsyncIAMResourceWithRawResponse, + IAMResourceWithStreamingResponse, + AsyncIAMResourceWithStreamingResponse, +) from .ips import ( IPsResource, AsyncIPsResource, @@ -384,6 +392,14 @@ ZeroTrustResourceWithStreamingResponse, AsyncZeroTrustResourceWithStreamingResponse, ) +from .api_gateway import ( + APIGatewayResource, + AsyncAPIGatewayResource, + APIGatewayResourceWithRawResponse, + AsyncAPIGatewayResourceWithRawResponse, + APIGatewayResourceWithStreamingResponse, + AsyncAPIGatewayResourceWithStreamingResponse, +) from .diagnostics import ( DiagnosticsResource, AsyncDiagnosticsResource, @@ -886,6 +902,12 @@ "AsyncQueuesResourceWithRawResponse", "QueuesResourceWithStreamingResponse", "AsyncQueuesResourceWithStreamingResponse", + "APIGatewayResource", + "AsyncAPIGatewayResource", + "APIGatewayResourceWithRawResponse", + "AsyncAPIGatewayResourceWithRawResponse", + "APIGatewayResourceWithStreamingResponse", + "AsyncAPIGatewayResourceWithStreamingResponse", "ManagedHeadersResource", "AsyncManagedHeadersResource", "ManagedHeadersResourceWithRawResponse", @@ -1150,4 +1172,10 @@ "AsyncAIGatewayResourceWithRawResponse", "AIGatewayResourceWithStreamingResponse", "AsyncAIGatewayResourceWithStreamingResponse", + "IAMResource", + "AsyncIAMResource", + "IAMResourceWithRawResponse", + "AsyncIAMResourceWithRawResponse", + "IAMResourceWithStreamingResponse", + "AsyncIAMResourceWithStreamingResponse", ] diff --git a/src/cloudflare/resources/accounts/accounts.py b/src/cloudflare/resources/accounts/accounts.py index f2778f600c0..75b2a0e8fbe 100644 --- a/src/cloudflare/resources/accounts/accounts.py +++ b/src/cloudflare/resources/accounts/accounts.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -43,8 +43,6 @@ 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__ = ["AccountsResource", "AsyncAccountsResource"] @@ -78,7 +76,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountUpdateResponse: + ) -> object: """ Update an existing account. @@ -95,28 +93,23 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - return cast( - AccountUpdateResponse, - self._put( - f"/accounts/{account_id}", - body=maybe_transform( - { - "name": name, - "settings": settings, - }, - 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[AccountUpdateResponse]._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}", + body=maybe_transform( + { + "name": name, + "settings": settings, + }, + 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[object]]._unwrapper, + ), + cast_to=cast(Type[object], ResultWrapper[object]), ) def list( @@ -184,7 +177,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountGetResponse: + ) -> object: """ Get information about a specific account that you are a member of. @@ -197,21 +190,16 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - return cast( - AccountGetResponse, - self._get( - f"/accounts/{account_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[AccountGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AccountGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/accounts/{account_id}", + 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]), ) @@ -244,7 +232,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountUpdateResponse: + ) -> object: """ Update an existing account. @@ -261,28 +249,23 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - return cast( - AccountUpdateResponse, - await self._put( - f"/accounts/{account_id}", - body=await async_maybe_transform( - { - "name": name, - "settings": settings, - }, - 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[AccountUpdateResponse]._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}", + body=await async_maybe_transform( + { + "name": name, + "settings": settings, + }, + 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[object]]._unwrapper, + ), + cast_to=cast(Type[object], ResultWrapper[object]), ) def list( @@ -350,7 +333,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AccountGetResponse: + ) -> object: """ Get information about a specific account that you are a member of. @@ -363,21 +346,16 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - return cast( - AccountGetResponse, - await self._get( - f"/accounts/{account_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[AccountGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AccountGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/accounts/{account_id}", + 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]), ) diff --git a/src/cloudflare/resources/accounts/members.py b/src/cloudflare/resources/accounts/members.py index 602ab0f69d7..ab13b631e8f 100644 --- a/src/cloudflare/resources/accounts/members.py +++ b/src/cloudflare/resources/accounts/members.py @@ -2,13 +2,14 @@ from __future__ import annotations -from typing import List, Type, Iterable, Optional, cast +from typing import List, Type, Iterable, Optional, cast, overload from typing_extensions import Literal import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( + required_args, maybe_transform, async_maybe_transform, ) @@ -27,10 +28,11 @@ make_request_options, ) from ...types.accounts import member_list_params, member_create_params, member_update_params -from ...types.shared.member import Member +from ...types.accounts.member_get_response import MemberGetResponse from ...types.accounts.member_list_response import MemberListResponse -from ...types.accounts.user_with_invite_code import UserWithInviteCode +from ...types.accounts.member_create_response import MemberCreateResponse from ...types.accounts.member_delete_response import MemberDeleteResponse +from ...types.accounts.member_update_response import MemberUpdateResponse __all__ = ["MembersResource", "AsyncMembersResource"] @@ -44,6 +46,7 @@ def with_raw_response(self) -> MembersResourceWithRawResponse: def with_streaming_response(self) -> MembersResourceWithStreamingResponse: return MembersResourceWithStreamingResponse(self) + @overload def create( self, *, @@ -57,11 +60,13 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserWithInviteCode: + ) -> Optional[MemberCreateResponse]: """ Add a user to the list of members for this account. Args: + account_id: Account identifier tag. + email: The contact email address of the user. roles: Array of roles associated with this member. @@ -74,6 +79,59 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ + ... + + @overload + def create( + self, + *, + account_id: str, + email: str, + policies: Iterable[member_create_params.IAMCreateMemberWithPoliciesPolicy], + status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[MemberCreateResponse]: + """ + Add a user to the list of members for this account. + + Args: + account_id: Account identifier tag. + + email: The contact email address of the user. + + policies: Array of policies associated with this member. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["account_id", "email", "roles"], ["account_id", "email", "policies"]) + def create( + self, + *, + account_id: str, + email: str, + roles: List[str] | NotGiven = NOT_GIVEN, + status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN, + policies: Iterable[member_create_params.IAMCreateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[MemberCreateResponse]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( @@ -83,6 +141,7 @@ def create( "email": email, "roles": roles, "status": status, + "policies": policies, }, member_create_params.MemberCreateParams, ), @@ -91,28 +150,31 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[UserWithInviteCode]._unwrapper, + post_parser=ResultWrapper[Optional[MemberCreateResponse]]._unwrapper, ), - cast_to=cast(Type[UserWithInviteCode], ResultWrapper[UserWithInviteCode]), + cast_to=cast(Type[Optional[MemberCreateResponse]], ResultWrapper[MemberCreateResponse]), ) + @overload def update( self, member_id: str, *, account_id: str, - roles: Iterable[member_update_params.Role], + roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Member: + ) -> Optional[MemberUpdateResponse]: """ Modify an account member. Args: + account_id: Account identifier tag. + member_id: Membership identifier tag. roles: Roles assigned to this member. @@ -125,21 +187,78 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ + ... + + @overload + def update( + self, + member_id: str, + *, + account_id: str, + policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[MemberUpdateResponse]: + """ + Modify an account member. + + Args: + account_id: Account identifier tag. + + member_id: Membership identifier tag. + + policies: Array of policies associated with this member. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["account_id"], ["account_id", "policies"]) + def update( + self, + member_id: str, + *, + account_id: str, + roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN, + policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[MemberUpdateResponse]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return self._put( f"/accounts/{account_id}/members/{member_id}", - body=maybe_transform({"roles": roles}, member_update_params.MemberUpdateParams), + body=maybe_transform( + { + "roles": roles, + "policies": policies, + }, + member_update_params.MemberUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Member]._unwrapper, + post_parser=ResultWrapper[Optional[MemberUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[Member], ResultWrapper[Member]), + cast_to=cast(Type[Optional[MemberUpdateResponse]], ResultWrapper[MemberUpdateResponse]), ) def list( @@ -162,6 +281,8 @@ def list( List all members of an account. Args: + account_id: Account identifier tag. + direction: Direction to order results. order: Field to order results by. @@ -220,6 +341,8 @@ def delete( Remove a member from an account. Args: + account_id: Account identifier tag. + member_id: Membership identifier tag. extra_headers: Send extra headers @@ -257,11 +380,13 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Member: + ) -> Optional[MemberGetResponse]: """ Get information about a specific member of an account. Args: + account_id: Account identifier tag. + member_id: Membership identifier tag. extra_headers: Send extra headers @@ -283,9 +408,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Member]._unwrapper, + post_parser=ResultWrapper[Optional[MemberGetResponse]]._unwrapper, ), - cast_to=cast(Type[Member], ResultWrapper[Member]), + cast_to=cast(Type[Optional[MemberGetResponse]], ResultWrapper[MemberGetResponse]), ) @@ -298,6 +423,7 @@ def with_raw_response(self) -> AsyncMembersResourceWithRawResponse: def with_streaming_response(self) -> AsyncMembersResourceWithStreamingResponse: return AsyncMembersResourceWithStreamingResponse(self) + @overload async def create( self, *, @@ -311,11 +437,13 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserWithInviteCode: + ) -> Optional[MemberCreateResponse]: """ Add a user to the list of members for this account. Args: + account_id: Account identifier tag. + email: The contact email address of the user. roles: Array of roles associated with this member. @@ -328,6 +456,59 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ + ... + + @overload + async def create( + self, + *, + account_id: str, + email: str, + policies: Iterable[member_create_params.IAMCreateMemberWithPoliciesPolicy], + status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[MemberCreateResponse]: + """ + Add a user to the list of members for this account. + + Args: + account_id: Account identifier tag. + + email: The contact email address of the user. + + policies: Array of policies associated with this member. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["account_id", "email", "roles"], ["account_id", "email", "policies"]) + async def create( + self, + *, + account_id: str, + email: str, + roles: List[str] | NotGiven = NOT_GIVEN, + status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN, + policies: Iterable[member_create_params.IAMCreateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[MemberCreateResponse]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( @@ -337,6 +518,7 @@ async def create( "email": email, "roles": roles, "status": status, + "policies": policies, }, member_create_params.MemberCreateParams, ), @@ -345,28 +527,31 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[UserWithInviteCode]._unwrapper, + post_parser=ResultWrapper[Optional[MemberCreateResponse]]._unwrapper, ), - cast_to=cast(Type[UserWithInviteCode], ResultWrapper[UserWithInviteCode]), + cast_to=cast(Type[Optional[MemberCreateResponse]], ResultWrapper[MemberCreateResponse]), ) + @overload async def update( self, member_id: str, *, account_id: str, - roles: Iterable[member_update_params.Role], + roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Member: + ) -> Optional[MemberUpdateResponse]: """ Modify an account member. Args: + account_id: Account identifier tag. + member_id: Membership identifier tag. roles: Roles assigned to this member. @@ -379,21 +564,78 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ + ... + + @overload + async def update( + self, + member_id: str, + *, + account_id: str, + policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[MemberUpdateResponse]: + """ + Modify an account member. + + Args: + account_id: Account identifier tag. + + member_id: Membership identifier tag. + + policies: Array of policies associated with this member. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["account_id"], ["account_id", "policies"]) + async def update( + self, + member_id: str, + *, + account_id: str, + roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN, + policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[MemberUpdateResponse]: if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not member_id: raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}") return await self._put( f"/accounts/{account_id}/members/{member_id}", - body=await async_maybe_transform({"roles": roles}, member_update_params.MemberUpdateParams), + body=await async_maybe_transform( + { + "roles": roles, + "policies": policies, + }, + member_update_params.MemberUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Member]._unwrapper, + post_parser=ResultWrapper[Optional[MemberUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[Member], ResultWrapper[Member]), + cast_to=cast(Type[Optional[MemberUpdateResponse]], ResultWrapper[MemberUpdateResponse]), ) def list( @@ -416,6 +658,8 @@ def list( List all members of an account. Args: + account_id: Account identifier tag. + direction: Direction to order results. order: Field to order results by. @@ -474,6 +718,8 @@ async def delete( Remove a member from an account. Args: + account_id: Account identifier tag. + member_id: Membership identifier tag. extra_headers: Send extra headers @@ -511,11 +757,13 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Member: + ) -> Optional[MemberGetResponse]: """ Get information about a specific member of an account. Args: + account_id: Account identifier tag. + member_id: Membership identifier tag. extra_headers: Send extra headers @@ -537,9 +785,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Member]._unwrapper, + post_parser=ResultWrapper[Optional[MemberGetResponse]]._unwrapper, ), - cast_to=cast(Type[Member], ResultWrapper[Member]), + cast_to=cast(Type[Optional[MemberGetResponse]], ResultWrapper[MemberGetResponse]), ) diff --git a/src/cloudflare/resources/accounts/roles.py b/src/cloudflare/resources/accounts/roles.py index f316a2caa9a..16c89ca10dd 100644 --- a/src/cloudflare/resources/accounts/roles.py +++ b/src/cloudflare/resources/accounts/roles.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, Optional, cast import httpx @@ -22,7 +22,6 @@ make_request_options, ) from ...types.shared.role import Role -from ...types.accounts.role_get_response import RoleGetResponse __all__ = ["RolesResource", "AsyncRolesResource"] @@ -51,6 +50,8 @@ def list( Get all available roles for an account. Args: + account_id: Account identifier tag. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -81,11 +82,13 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoleGetResponse: + ) -> object: """ Get information about a specific role for an account. Args: + account_id: Account identifier tag. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -96,21 +99,16 @@ def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - RoleGetResponse, - self._get( - f"/accounts/{account_id}/roles/{role_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[RoleGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[RoleGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/accounts/{account_id}/roles/{role_id}", + 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]), ) @@ -138,6 +136,8 @@ def list( Get all available roles for an account. Args: + account_id: Account identifier tag. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -168,11 +168,13 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoleGetResponse: + ) -> object: """ Get information about a specific role for an account. Args: + account_id: Account identifier tag. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -183,21 +185,16 @@ 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( - RoleGetResponse, - await self._get( - f"/accounts/{account_id}/roles/{role_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[RoleGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[RoleGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/accounts/{account_id}/roles/{role_id}", + 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]), ) diff --git a/src/cloudflare/resources/addressing/__init__.py b/src/cloudflare/resources/addressing/__init__.py index 662ac0127d3..7abbb395744 100644 --- a/src/cloudflare/resources/addressing/__init__.py +++ b/src/cloudflare/resources/addressing/__init__.py @@ -40,8 +40,22 @@ LOADocumentsResourceWithStreamingResponse, AsyncLOADocumentsResourceWithStreamingResponse, ) +from .regional_hostnames import ( + RegionalHostnamesResource, + AsyncRegionalHostnamesResource, + RegionalHostnamesResourceWithRawResponse, + AsyncRegionalHostnamesResourceWithRawResponse, + RegionalHostnamesResourceWithStreamingResponse, + AsyncRegionalHostnamesResourceWithStreamingResponse, +) __all__ = [ + "RegionalHostnamesResource", + "AsyncRegionalHostnamesResource", + "RegionalHostnamesResourceWithRawResponse", + "AsyncRegionalHostnamesResourceWithRawResponse", + "RegionalHostnamesResourceWithStreamingResponse", + "AsyncRegionalHostnamesResourceWithStreamingResponse", "ServicesResource", "AsyncServicesResource", "ServicesResourceWithRawResponse", diff --git a/src/cloudflare/resources/addressing/address_maps/address_maps.py b/src/cloudflare/resources/addressing/address_maps/address_maps.py index bb2faee96ef..c92ddd937a3 100644 --- a/src/cloudflare/resources/addressing/address_maps/address_maps.py +++ b/src/cloudflare/resources/addressing/address_maps/address_maps.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import List, Type, Iterable, Optional, cast import httpx @@ -85,6 +85,8 @@ def create( account_id: str, description: Optional[str] | NotGiven = NOT_GIVEN, enabled: Optional[bool] | NotGiven = NOT_GIVEN, + ips: List[str] | NotGiven = NOT_GIVEN, + memberships: Iterable[address_map_create_params.Membership] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,6 +106,9 @@ def create( enabled: 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. + memberships: Zones and Accounts which will be assigned IPs on this Address Map. A zone + membership will take priority over an account membership. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -120,6 +125,8 @@ def create( { "description": description, "enabled": enabled, + "ips": ips, + "memberships": memberships, }, address_map_create_params.AddressMapCreateParams, ), @@ -354,6 +361,8 @@ async def create( account_id: str, description: Optional[str] | NotGiven = NOT_GIVEN, enabled: Optional[bool] | NotGiven = NOT_GIVEN, + ips: List[str] | NotGiven = NOT_GIVEN, + memberships: Iterable[address_map_create_params.Membership] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -373,6 +382,9 @@ async def create( enabled: 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. + memberships: Zones and Accounts which will be assigned IPs on this Address Map. A zone + membership will take priority over an account membership. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -389,6 +401,8 @@ async def create( { "description": description, "enabled": enabled, + "ips": ips, + "memberships": memberships, }, address_map_create_params.AddressMapCreateParams, ), diff --git a/src/cloudflare/resources/addressing/addressing.py b/src/cloudflare/resources/addressing/addressing.py index c0e0cd3b374..8157035d32f 100644 --- a/src/cloudflare/resources/addressing/addressing.py +++ b/src/cloudflare/resources/addressing/addressing.py @@ -37,13 +37,26 @@ AsyncLOADocumentsResourceWithStreamingResponse, ) from .prefixes.prefixes import PrefixesResource, AsyncPrefixesResource +from .regional_hostnames import ( + RegionalHostnamesResource, + AsyncRegionalHostnamesResource, + RegionalHostnamesResourceWithRawResponse, + AsyncRegionalHostnamesResourceWithRawResponse, + RegionalHostnamesResourceWithStreamingResponse, + AsyncRegionalHostnamesResourceWithStreamingResponse, +) from .address_maps.address_maps import AddressMapsResource, AsyncAddressMapsResource from .loa_documents.loa_documents import LOADocumentsResource, AsyncLOADocumentsResource +from .regional_hostnames.regional_hostnames import RegionalHostnamesResource, AsyncRegionalHostnamesResource __all__ = ["AddressingResource", "AsyncAddressingResource"] class AddressingResource(SyncAPIResource): + @cached_property + def regional_hostnames(self) -> RegionalHostnamesResource: + return RegionalHostnamesResource(self._client) + @cached_property def services(self) -> ServicesResource: return ServicesResource(self._client) @@ -70,6 +83,10 @@ def with_streaming_response(self) -> AddressingResourceWithStreamingResponse: class AsyncAddressingResource(AsyncAPIResource): + @cached_property + def regional_hostnames(self) -> AsyncRegionalHostnamesResource: + return AsyncRegionalHostnamesResource(self._client) + @cached_property def services(self) -> AsyncServicesResource: return AsyncServicesResource(self._client) @@ -99,6 +116,10 @@ class AddressingResourceWithRawResponse: def __init__(self, addressing: AddressingResource) -> None: self._addressing = addressing + @cached_property + def regional_hostnames(self) -> RegionalHostnamesResourceWithRawResponse: + return RegionalHostnamesResourceWithRawResponse(self._addressing.regional_hostnames) + @cached_property def services(self) -> ServicesResourceWithRawResponse: return ServicesResourceWithRawResponse(self._addressing.services) @@ -120,6 +141,10 @@ class AsyncAddressingResourceWithRawResponse: def __init__(self, addressing: AsyncAddressingResource) -> None: self._addressing = addressing + @cached_property + def regional_hostnames(self) -> AsyncRegionalHostnamesResourceWithRawResponse: + return AsyncRegionalHostnamesResourceWithRawResponse(self._addressing.regional_hostnames) + @cached_property def services(self) -> AsyncServicesResourceWithRawResponse: return AsyncServicesResourceWithRawResponse(self._addressing.services) @@ -141,6 +166,10 @@ class AddressingResourceWithStreamingResponse: def __init__(self, addressing: AddressingResource) -> None: self._addressing = addressing + @cached_property + def regional_hostnames(self) -> RegionalHostnamesResourceWithStreamingResponse: + return RegionalHostnamesResourceWithStreamingResponse(self._addressing.regional_hostnames) + @cached_property def services(self) -> ServicesResourceWithStreamingResponse: return ServicesResourceWithStreamingResponse(self._addressing.services) @@ -162,6 +191,10 @@ class AsyncAddressingResourceWithStreamingResponse: def __init__(self, addressing: AsyncAddressingResource) -> None: self._addressing = addressing + @cached_property + def regional_hostnames(self) -> AsyncRegionalHostnamesResourceWithStreamingResponse: + return AsyncRegionalHostnamesResourceWithStreamingResponse(self._addressing.regional_hostnames) + @cached_property def services(self) -> AsyncServicesResourceWithStreamingResponse: return AsyncServicesResourceWithStreamingResponse(self._addressing.services) diff --git a/src/cloudflare/resources/addressing/loa_documents/downloads.py b/src/cloudflare/resources/addressing/loa_documents/downloads.py index b29d0888acd..e333bc3e986 100644 --- a/src/cloudflare/resources/addressing/loa_documents/downloads.py +++ b/src/cloudflare/resources/addressing/loa_documents/downloads.py @@ -10,10 +10,14 @@ 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, + 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, @@ -42,7 +46,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> BinaryAPIResponse: """ Download specified LOA document under the account. @@ -63,12 +67,13 @@ def get( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not loa_document_id: raise ValueError(f"Expected a non-empty value for `loa_document_id` but received {loa_document_id!r}") + extra_headers = {"Accept": "application/pdf", **(extra_headers or {})} return self._get( f"/accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=BinaryAPIResponse, ) @@ -92,7 +97,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> AsyncBinaryAPIResponse: """ Download specified LOA document under the account. @@ -113,12 +118,13 @@ async def get( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not loa_document_id: raise ValueError(f"Expected a non-empty value for `loa_document_id` but received {loa_document_id!r}") + extra_headers = {"Accept": "application/pdf", **(extra_headers or {})} return await self._get( f"/accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=AsyncBinaryAPIResponse, ) @@ -126,8 +132,9 @@ class DownloadsResourceWithRawResponse: def __init__(self, downloads: DownloadsResource) -> None: self._downloads = downloads - self.get = to_raw_response_wrapper( + self.get = to_custom_raw_response_wrapper( downloads.get, + BinaryAPIResponse, ) @@ -135,8 +142,9 @@ class AsyncDownloadsResourceWithRawResponse: def __init__(self, downloads: AsyncDownloadsResource) -> None: self._downloads = downloads - self.get = async_to_raw_response_wrapper( + self.get = async_to_custom_raw_response_wrapper( downloads.get, + AsyncBinaryAPIResponse, ) @@ -144,8 +152,9 @@ class DownloadsResourceWithStreamingResponse: def __init__(self, downloads: DownloadsResource) -> None: self._downloads = downloads - self.get = to_streamed_response_wrapper( + self.get = to_custom_streamed_response_wrapper( downloads.get, + StreamedBinaryAPIResponse, ) @@ -153,6 +162,7 @@ class AsyncDownloadsResourceWithStreamingResponse: def __init__(self, downloads: AsyncDownloadsResource) -> None: self._downloads = downloads - self.get = async_to_streamed_response_wrapper( + self.get = async_to_custom_streamed_response_wrapper( downloads.get, + AsyncStreamedBinaryAPIResponse, ) diff --git a/src/cloudflare/resources/addressing/regional_hostnames/__init__.py b/src/cloudflare/resources/addressing/regional_hostnames/__init__.py new file mode 100644 index 00000000000..b81e8f7c300 --- /dev/null +++ b/src/cloudflare/resources/addressing/regional_hostnames/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .regions import ( + RegionsResource, + AsyncRegionsResource, + RegionsResourceWithRawResponse, + AsyncRegionsResourceWithRawResponse, + RegionsResourceWithStreamingResponse, + AsyncRegionsResourceWithStreamingResponse, +) +from .regional_hostnames import ( + RegionalHostnamesResource, + AsyncRegionalHostnamesResource, + RegionalHostnamesResourceWithRawResponse, + AsyncRegionalHostnamesResourceWithRawResponse, + RegionalHostnamesResourceWithStreamingResponse, + AsyncRegionalHostnamesResourceWithStreamingResponse, +) + +__all__ = [ + "RegionsResource", + "AsyncRegionsResource", + "RegionsResourceWithRawResponse", + "AsyncRegionsResourceWithRawResponse", + "RegionsResourceWithStreamingResponse", + "AsyncRegionsResourceWithStreamingResponse", + "RegionalHostnamesResource", + "AsyncRegionalHostnamesResource", + "RegionalHostnamesResourceWithRawResponse", + "AsyncRegionalHostnamesResourceWithRawResponse", + "RegionalHostnamesResourceWithStreamingResponse", + "AsyncRegionalHostnamesResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py b/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py new file mode 100644 index 00000000000..1524d3e06bc --- /dev/null +++ b/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py @@ -0,0 +1,633 @@ +# 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 .regions import ( + RegionsResource, + AsyncRegionsResource, + RegionsResourceWithRawResponse, + AsyncRegionsResourceWithRawResponse, + RegionsResourceWithStreamingResponse, + AsyncRegionsResourceWithStreamingResponse, +) +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.addressing import regional_hostname_edit_params, regional_hostname_create_params +from ....types.addressing.regional_hostname_get_response import RegionalHostnameGetResponse +from ....types.addressing.regional_hostname_edit_response import RegionalHostnameEditResponse +from ....types.addressing.regional_hostname_list_response import RegionalHostnameListResponse +from ....types.addressing.regional_hostname_create_response import RegionalHostnameCreateResponse +from ....types.addressing.regional_hostname_delete_response import RegionalHostnameDeleteResponse + +__all__ = ["RegionalHostnamesResource", "AsyncRegionalHostnamesResource"] + + +class RegionalHostnamesResource(SyncAPIResource): + @cached_property + def regions(self) -> RegionsResource: + return RegionsResource(self._client) + + @cached_property + def with_raw_response(self) -> RegionalHostnamesResourceWithRawResponse: + return RegionalHostnamesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RegionalHostnamesResourceWithStreamingResponse: + return RegionalHostnamesResourceWithStreamingResponse(self) + + def create( + self, + *, + zone_id: str, + hostname: str, + region_key: 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[RegionalHostnameCreateResponse]: + """Create a new Regional Hostname entry. + + Cloudflare will only use data centers that + are physically located within the chosen region to decrypt and service HTTPS + traffic. Learn more about + [Regional Services](https://developers.cloudflare.com/data-localization/regional-services/get-started/). + + Args: + zone_id: Identifier + + hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are + supported for one level, e.g `*.example.com` + + region_key: Identifying key for the region + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/addressing/regional_hostnames", + body=maybe_transform( + { + "hostname": hostname, + "region_key": region_key, + }, + regional_hostname_create_params.RegionalHostnameCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RegionalHostnameCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RegionalHostnameCreateResponse]], ResultWrapper[RegionalHostnameCreateResponse]), + ) + + 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[RegionalHostnameListResponse]: + """ + List all Regional Hostnames within 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}/addressing/regional_hostnames", + page=SyncSinglePage[RegionalHostnameListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RegionalHostnameListResponse, + ) + + def delete( + self, + hostname: 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, + ) -> RegionalHostnameDeleteResponse: + """ + Delete the region configuration for a specific Regional Hostname. + + Args: + zone_id: Identifier + + hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are + supported for one level, e.g `*.example.com` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 hostname: + raise ValueError(f"Expected a non-empty value for `hostname` but received {hostname!r}") + return self._delete( + f"/zones/{zone_id}/addressing/regional_hostnames/{hostname}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegionalHostnameDeleteResponse, + ) + + def edit( + self, + hostname: str, + *, + zone_id: str, + region_key: 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[RegionalHostnameEditResponse]: + """Update the configuration for a specific Regional Hostname. + + Only the region_key + of a hostname is mutable. + + Args: + zone_id: Identifier + + hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are + supported for one level, e.g `*.example.com` + + region_key: Identifying key for the region + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 hostname: + raise ValueError(f"Expected a non-empty value for `hostname` but received {hostname!r}") + return self._patch( + f"/zones/{zone_id}/addressing/regional_hostnames/{hostname}", + body=maybe_transform({"region_key": region_key}, regional_hostname_edit_params.RegionalHostnameEditParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RegionalHostnameEditResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RegionalHostnameEditResponse]], ResultWrapper[RegionalHostnameEditResponse]), + ) + + def get( + self, + hostname: 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[RegionalHostnameGetResponse]: + """ + Fetch the configuration for a specific Regional Hostname, within a zone. + + Args: + zone_id: Identifier + + hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are + supported for one level, e.g `*.example.com` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 hostname: + raise ValueError(f"Expected a non-empty value for `hostname` but received {hostname!r}") + return self._get( + f"/zones/{zone_id}/addressing/regional_hostnames/{hostname}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RegionalHostnameGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RegionalHostnameGetResponse]], ResultWrapper[RegionalHostnameGetResponse]), + ) + + +class AsyncRegionalHostnamesResource(AsyncAPIResource): + @cached_property + def regions(self) -> AsyncRegionsResource: + return AsyncRegionsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncRegionalHostnamesResourceWithRawResponse: + return AsyncRegionalHostnamesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRegionalHostnamesResourceWithStreamingResponse: + return AsyncRegionalHostnamesResourceWithStreamingResponse(self) + + async def create( + self, + *, + zone_id: str, + hostname: str, + region_key: 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[RegionalHostnameCreateResponse]: + """Create a new Regional Hostname entry. + + Cloudflare will only use data centers that + are physically located within the chosen region to decrypt and service HTTPS + traffic. Learn more about + [Regional Services](https://developers.cloudflare.com/data-localization/regional-services/get-started/). + + Args: + zone_id: Identifier + + hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are + supported for one level, e.g `*.example.com` + + region_key: Identifying key for the region + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/addressing/regional_hostnames", + body=await async_maybe_transform( + { + "hostname": hostname, + "region_key": region_key, + }, + regional_hostname_create_params.RegionalHostnameCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RegionalHostnameCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RegionalHostnameCreateResponse]], ResultWrapper[RegionalHostnameCreateResponse]), + ) + + 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[RegionalHostnameListResponse, AsyncSinglePage[RegionalHostnameListResponse]]: + """ + List all Regional Hostnames within 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}/addressing/regional_hostnames", + page=AsyncSinglePage[RegionalHostnameListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RegionalHostnameListResponse, + ) + + async def delete( + self, + hostname: 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, + ) -> RegionalHostnameDeleteResponse: + """ + Delete the region configuration for a specific Regional Hostname. + + Args: + zone_id: Identifier + + hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are + supported for one level, e.g `*.example.com` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 hostname: + raise ValueError(f"Expected a non-empty value for `hostname` but received {hostname!r}") + return await self._delete( + f"/zones/{zone_id}/addressing/regional_hostnames/{hostname}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RegionalHostnameDeleteResponse, + ) + + async def edit( + self, + hostname: str, + *, + zone_id: str, + region_key: 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[RegionalHostnameEditResponse]: + """Update the configuration for a specific Regional Hostname. + + Only the region_key + of a hostname is mutable. + + Args: + zone_id: Identifier + + hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are + supported for one level, e.g `*.example.com` + + region_key: Identifying key for the region + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 hostname: + raise ValueError(f"Expected a non-empty value for `hostname` but received {hostname!r}") + return await self._patch( + f"/zones/{zone_id}/addressing/regional_hostnames/{hostname}", + body=await async_maybe_transform( + {"region_key": region_key}, regional_hostname_edit_params.RegionalHostnameEditParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RegionalHostnameEditResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RegionalHostnameEditResponse]], ResultWrapper[RegionalHostnameEditResponse]), + ) + + async def get( + self, + hostname: 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[RegionalHostnameGetResponse]: + """ + Fetch the configuration for a specific Regional Hostname, within a zone. + + Args: + zone_id: Identifier + + hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are + supported for one level, e.g `*.example.com` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 hostname: + raise ValueError(f"Expected a non-empty value for `hostname` but received {hostname!r}") + return await self._get( + f"/zones/{zone_id}/addressing/regional_hostnames/{hostname}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[RegionalHostnameGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[RegionalHostnameGetResponse]], ResultWrapper[RegionalHostnameGetResponse]), + ) + + +class RegionalHostnamesResourceWithRawResponse: + def __init__(self, regional_hostnames: RegionalHostnamesResource) -> None: + self._regional_hostnames = regional_hostnames + + self.create = to_raw_response_wrapper( + regional_hostnames.create, + ) + self.list = to_raw_response_wrapper( + regional_hostnames.list, + ) + self.delete = to_raw_response_wrapper( + regional_hostnames.delete, + ) + self.edit = to_raw_response_wrapper( + regional_hostnames.edit, + ) + self.get = to_raw_response_wrapper( + regional_hostnames.get, + ) + + @cached_property + def regions(self) -> RegionsResourceWithRawResponse: + return RegionsResourceWithRawResponse(self._regional_hostnames.regions) + + +class AsyncRegionalHostnamesResourceWithRawResponse: + def __init__(self, regional_hostnames: AsyncRegionalHostnamesResource) -> None: + self._regional_hostnames = regional_hostnames + + self.create = async_to_raw_response_wrapper( + regional_hostnames.create, + ) + self.list = async_to_raw_response_wrapper( + regional_hostnames.list, + ) + self.delete = async_to_raw_response_wrapper( + regional_hostnames.delete, + ) + self.edit = async_to_raw_response_wrapper( + regional_hostnames.edit, + ) + self.get = async_to_raw_response_wrapper( + regional_hostnames.get, + ) + + @cached_property + def regions(self) -> AsyncRegionsResourceWithRawResponse: + return AsyncRegionsResourceWithRawResponse(self._regional_hostnames.regions) + + +class RegionalHostnamesResourceWithStreamingResponse: + def __init__(self, regional_hostnames: RegionalHostnamesResource) -> None: + self._regional_hostnames = regional_hostnames + + self.create = to_streamed_response_wrapper( + regional_hostnames.create, + ) + self.list = to_streamed_response_wrapper( + regional_hostnames.list, + ) + self.delete = to_streamed_response_wrapper( + regional_hostnames.delete, + ) + self.edit = to_streamed_response_wrapper( + regional_hostnames.edit, + ) + self.get = to_streamed_response_wrapper( + regional_hostnames.get, + ) + + @cached_property + def regions(self) -> RegionsResourceWithStreamingResponse: + return RegionsResourceWithStreamingResponse(self._regional_hostnames.regions) + + +class AsyncRegionalHostnamesResourceWithStreamingResponse: + def __init__(self, regional_hostnames: AsyncRegionalHostnamesResource) -> None: + self._regional_hostnames = regional_hostnames + + self.create = async_to_streamed_response_wrapper( + regional_hostnames.create, + ) + self.list = async_to_streamed_response_wrapper( + regional_hostnames.list, + ) + self.delete = async_to_streamed_response_wrapper( + regional_hostnames.delete, + ) + self.edit = async_to_streamed_response_wrapper( + regional_hostnames.edit, + ) + self.get = async_to_streamed_response_wrapper( + regional_hostnames.get, + ) + + @cached_property + def regions(self) -> AsyncRegionsResourceWithStreamingResponse: + return AsyncRegionsResourceWithStreamingResponse(self._regional_hostnames.regions) diff --git a/src/cloudflare/resources/addressing/regional_hostnames/regions.py b/src/cloudflare/resources/addressing/regional_hostnames/regions.py new file mode 100644 index 00000000000..7340ffab77f --- /dev/null +++ b/src/cloudflare/resources/addressing/regional_hostnames/regions.py @@ -0,0 +1,151 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....pagination import SyncSinglePage, AsyncSinglePage +from ...._base_client import ( + AsyncPaginator, + make_request_options, +) +from ....types.addressing.regional_hostnames.region_list_response import RegionListResponse + +__all__ = ["RegionsResource", "AsyncRegionsResource"] + + +class RegionsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RegionsResourceWithRawResponse: + return RegionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RegionsResourceWithStreamingResponse: + return RegionsResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[RegionListResponse]: + """ + List all Regional Services regions available for use by this account. + + Args: + account_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/addressing/regional_hostnames/regions", + page=SyncSinglePage[RegionListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RegionListResponse, + ) + + +class AsyncRegionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRegionsResourceWithRawResponse: + return AsyncRegionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRegionsResourceWithStreamingResponse: + return AsyncRegionsResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[RegionListResponse, AsyncSinglePage[RegionListResponse]]: + """ + List all Regional Services regions available for use by this account. + + Args: + account_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/addressing/regional_hostnames/regions", + page=AsyncSinglePage[RegionListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RegionListResponse, + ) + + +class RegionsResourceWithRawResponse: + def __init__(self, regions: RegionsResource) -> None: + self._regions = regions + + self.list = to_raw_response_wrapper( + regions.list, + ) + + +class AsyncRegionsResourceWithRawResponse: + def __init__(self, regions: AsyncRegionsResource) -> None: + self._regions = regions + + self.list = async_to_raw_response_wrapper( + regions.list, + ) + + +class RegionsResourceWithStreamingResponse: + def __init__(self, regions: RegionsResource) -> None: + self._regions = regions + + self.list = to_streamed_response_wrapper( + regions.list, + ) + + +class AsyncRegionsResourceWithStreamingResponse: + def __init__(self, regions: AsyncRegionsResource) -> None: + self._regions = regions + + self.list = async_to_streamed_response_wrapper( + regions.list, + ) diff --git a/src/cloudflare/resources/ai_gateway/ai_gateway.py b/src/cloudflare/resources/ai_gateway/ai_gateway.py index 44734436ea9..2fc5cfcef74 100644 --- a/src/cloudflare/resources/ai_gateway/ai_gateway.py +++ b/src/cloudflare/resources/ai_gateway/ai_gateway.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast +from typing_extensions import Literal import httpx @@ -60,14 +61,13 @@ def create( self, *, account_id: str, + id: str, cache_invalidate_on_update: bool, - cache_ttl: int, + cache_ttl: Optional[int], collect_logs: bool, - name: str, - slug: str, - rate_limiting_interval: int | NotGiven = NOT_GIVEN, - rate_limiting_limit: int | NotGiven = NOT_GIVEN, - rate_limiting_technique: str | NotGiven = NOT_GIVEN, + rate_limiting_interval: Optional[int], + rate_limiting_limit: Optional[int], + rate_limiting_technique: Literal["fixed", "sliding"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,6 +79,8 @@ def create( Create a new Gateway Args: + id: gateway id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -93,11 +95,10 @@ def create( f"/accounts/{account_id}/ai-gateway/gateways", body=maybe_transform( { + "id": id, "cache_invalidate_on_update": cache_invalidate_on_update, "cache_ttl": cache_ttl, "collect_logs": collect_logs, - "name": name, - "slug": slug, "rate_limiting_interval": rate_limiting_interval, "rate_limiting_limit": rate_limiting_limit, "rate_limiting_technique": rate_limiting_technique, @@ -120,13 +121,11 @@ def update( *, account_id: str, cache_invalidate_on_update: bool, - cache_ttl: int, + cache_ttl: Optional[int], collect_logs: bool, - name: str, - slug: str, - rate_limiting_interval: int | NotGiven = NOT_GIVEN, - rate_limiting_limit: int | NotGiven = NOT_GIVEN, - rate_limiting_technique: str | NotGiven = NOT_GIVEN, + rate_limiting_interval: Optional[int], + rate_limiting_limit: Optional[int], + rate_limiting_technique: Literal["fixed", "sliding"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -138,6 +137,8 @@ def update( Update a Gateway Args: + id: gateway id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -157,8 +158,6 @@ def update( "cache_invalidate_on_update": cache_invalidate_on_update, "cache_ttl": cache_ttl, "collect_logs": collect_logs, - "name": name, - "slug": slug, "rate_limiting_interval": rate_limiting_interval, "rate_limiting_limit": rate_limiting_limit, "rate_limiting_technique": rate_limiting_technique, @@ -194,6 +193,8 @@ def list( List Gateway's Args: + id: gateway id + order_by: Order By Column Name extra_headers: Send extra headers @@ -283,6 +284,8 @@ def get( Fetch a Gateway Args: + id: gateway id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -325,14 +328,13 @@ async def create( self, *, account_id: str, + id: str, cache_invalidate_on_update: bool, - cache_ttl: int, + cache_ttl: Optional[int], collect_logs: bool, - name: str, - slug: str, - rate_limiting_interval: int | NotGiven = NOT_GIVEN, - rate_limiting_limit: int | NotGiven = NOT_GIVEN, - rate_limiting_technique: str | NotGiven = NOT_GIVEN, + rate_limiting_interval: Optional[int], + rate_limiting_limit: Optional[int], + rate_limiting_technique: Literal["fixed", "sliding"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -344,6 +346,8 @@ async def create( Create a new Gateway Args: + id: gateway id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -358,11 +362,10 @@ async def create( f"/accounts/{account_id}/ai-gateway/gateways", body=await async_maybe_transform( { + "id": id, "cache_invalidate_on_update": cache_invalidate_on_update, "cache_ttl": cache_ttl, "collect_logs": collect_logs, - "name": name, - "slug": slug, "rate_limiting_interval": rate_limiting_interval, "rate_limiting_limit": rate_limiting_limit, "rate_limiting_technique": rate_limiting_technique, @@ -385,13 +388,11 @@ async def update( *, account_id: str, cache_invalidate_on_update: bool, - cache_ttl: int, + cache_ttl: Optional[int], collect_logs: bool, - name: str, - slug: str, - rate_limiting_interval: int | NotGiven = NOT_GIVEN, - rate_limiting_limit: int | NotGiven = NOT_GIVEN, - rate_limiting_technique: str | NotGiven = NOT_GIVEN, + rate_limiting_interval: Optional[int], + rate_limiting_limit: Optional[int], + rate_limiting_technique: Literal["fixed", "sliding"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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 +404,8 @@ async def update( Update a Gateway Args: + id: gateway id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -422,8 +425,6 @@ async def update( "cache_invalidate_on_update": cache_invalidate_on_update, "cache_ttl": cache_ttl, "collect_logs": collect_logs, - "name": name, - "slug": slug, "rate_limiting_interval": rate_limiting_interval, "rate_limiting_limit": rate_limiting_limit, "rate_limiting_technique": rate_limiting_technique, @@ -459,6 +460,8 @@ def list( List Gateway's Args: + id: gateway id + order_by: Order By Column Name extra_headers: Send extra headers @@ -548,6 +551,8 @@ async def get( Fetch a Gateway Args: + id: gateway id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/cloudflare/resources/ai_gateway/logs.py b/src/cloudflare/resources/ai_gateway/logs.py index 11b66892f08..01650e97aa3 100644 --- a/src/cloudflare/resources/ai_gateway/logs.py +++ b/src/cloudflare/resources/ai_gateway/logs.py @@ -65,6 +65,8 @@ def get( List Gateway Logs Args: + id: gateway id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -138,6 +140,8 @@ async def get( List Gateway Logs Args: + id: gateway id + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/cloudflare/resources/alerting/available_alerts.py b/src/cloudflare/resources/alerting/available_alerts.py index abcc97045c4..b6c6a2d8327 100644 --- a/src/cloudflare/resources/alerting/available_alerts.py +++ b/src/cloudflare/resources/alerting/available_alerts.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Optional, cast +from typing import Type, Optional, cast import httpx @@ -60,21 +60,16 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - Optional[AvailableAlertListResponse], - self._get( - f"/accounts/{account_id}/alerting/v3/available_alerts", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AvailableAlertListResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AvailableAlertListResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/accounts/{account_id}/alerting/v3/available_alerts", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AvailableAlertListResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AvailableAlertListResponse]], ResultWrapper[AvailableAlertListResponse]), ) @@ -114,21 +109,16 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - Optional[AvailableAlertListResponse], - await self._get( - f"/accounts/{account_id}/alerting/v3/available_alerts", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[AvailableAlertListResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[AvailableAlertListResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/accounts/{account_id}/alerting/v3/available_alerts", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AvailableAlertListResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[AvailableAlertListResponse]], ResultWrapper[AvailableAlertListResponse]), ) diff --git a/src/cloudflare/resources/alerting/destinations/eligible.py b/src/cloudflare/resources/alerting/destinations/eligible.py index 850586d484a..25d24519dce 100644 --- a/src/cloudflare/resources/alerting/destinations/eligible.py +++ b/src/cloudflare/resources/alerting/destinations/eligible.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Optional, cast +from typing import Type, Optional, cast import httpx @@ -60,21 +60,16 @@ def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return cast( - Optional[EligibleGetResponse], - self._get( - f"/accounts/{account_id}/alerting/v3/destinations/eligible", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[EligibleGetResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[EligibleGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/accounts/{account_id}/alerting/v3/destinations/eligible", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[EligibleGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[EligibleGetResponse]], ResultWrapper[EligibleGetResponse]), ) @@ -114,21 +109,16 @@ 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( - Optional[EligibleGetResponse], - await self._get( - f"/accounts/{account_id}/alerting/v3/destinations/eligible", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[EligibleGetResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[EligibleGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/accounts/{account_id}/alerting/v3/destinations/eligible", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[EligibleGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[EligibleGetResponse]], ResultWrapper[EligibleGetResponse]), ) diff --git a/src/cloudflare/resources/alerting/destinations/pagerduty.py b/src/cloudflare/resources/alerting/destinations/pagerduty.py index bf465aff2f2..093dbb88fbf 100644 --- a/src/cloudflare/resources/alerting/destinations/pagerduty.py +++ b/src/cloudflare/resources/alerting/destinations/pagerduty.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast import httpx @@ -46,7 +46,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PagerdutyCreateResponse: + ) -> Optional[PagerdutyCreateResponse]: """ Creates a new token for integrating with PagerDuty. @@ -70,9 +70,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[PagerdutyCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PagerdutyCreateResponse]]._unwrapper, ), - cast_to=cast(Type[PagerdutyCreateResponse], ResultWrapper[PagerdutyCreateResponse]), + cast_to=cast(Type[Optional[PagerdutyCreateResponse]], ResultWrapper[PagerdutyCreateResponse]), ) def delete( @@ -85,7 +85,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PagerdutyDeleteResponse]: + ) -> PagerdutyDeleteResponse: """ Deletes all the PagerDuty Services connected to the account. @@ -102,21 +102,12 @@ 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[PagerdutyDeleteResponse], - self._delete( - f"/accounts/{account_id}/alerting/v3/destinations/pagerduty", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PagerdutyDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PagerdutyDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/alerting/v3/destinations/pagerduty", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=PagerdutyDeleteResponse, ) def get( @@ -169,7 +160,7 @@ def link( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PagerdutyLinkResponse: + ) -> Optional[PagerdutyLinkResponse]: """ Links PagerDuty with the account using the integration token. @@ -197,9 +188,9 @@ def link( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[PagerdutyLinkResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PagerdutyLinkResponse]]._unwrapper, ), - cast_to=cast(Type[PagerdutyLinkResponse], ResultWrapper[PagerdutyLinkResponse]), + cast_to=cast(Type[Optional[PagerdutyLinkResponse]], ResultWrapper[PagerdutyLinkResponse]), ) @@ -222,7 +213,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PagerdutyCreateResponse: + ) -> Optional[PagerdutyCreateResponse]: """ Creates a new token for integrating with PagerDuty. @@ -246,9 +237,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[PagerdutyCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PagerdutyCreateResponse]]._unwrapper, ), - cast_to=cast(Type[PagerdutyCreateResponse], ResultWrapper[PagerdutyCreateResponse]), + cast_to=cast(Type[Optional[PagerdutyCreateResponse]], ResultWrapper[PagerdutyCreateResponse]), ) async def delete( @@ -261,7 +252,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PagerdutyDeleteResponse]: + ) -> PagerdutyDeleteResponse: """ Deletes all the PagerDuty Services connected to the account. @@ -278,21 +269,12 @@ 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[PagerdutyDeleteResponse], - await self._delete( - f"/accounts/{account_id}/alerting/v3/destinations/pagerduty", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PagerdutyDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PagerdutyDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/alerting/v3/destinations/pagerduty", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=PagerdutyDeleteResponse, ) async def get( @@ -345,7 +327,7 @@ async def link( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PagerdutyLinkResponse: + ) -> Optional[PagerdutyLinkResponse]: """ Links PagerDuty with the account using the integration token. @@ -373,9 +355,9 @@ async def link( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[PagerdutyLinkResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PagerdutyLinkResponse]]._unwrapper, ), - cast_to=cast(Type[PagerdutyLinkResponse], ResultWrapper[PagerdutyLinkResponse]), + cast_to=cast(Type[Optional[PagerdutyLinkResponse]], ResultWrapper[PagerdutyLinkResponse]), ) diff --git a/src/cloudflare/resources/alerting/destinations/webhooks.py b/src/cloudflare/resources/alerting/destinations/webhooks.py index f988d06b025..883d4890db8 100644 --- a/src/cloudflare/resources/alerting/destinations/webhooks.py +++ b/src/cloudflare/resources/alerting/destinations/webhooks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast import httpx @@ -56,7 +56,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookCreateResponse: + ) -> Optional[WebhookCreateResponse]: """ Creates a new webhook destination. @@ -97,9 +97,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[WebhookCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[WebhookCreateResponse]]._unwrapper, ), - cast_to=cast(Type[WebhookCreateResponse], ResultWrapper[WebhookCreateResponse]), + cast_to=cast(Type[Optional[WebhookCreateResponse]], ResultWrapper[WebhookCreateResponse]), ) def update( @@ -116,7 +116,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookUpdateResponse: + ) -> Optional[WebhookUpdateResponse]: """ Update a webhook destination. @@ -161,9 +161,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[WebhookUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[WebhookUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[WebhookUpdateResponse], ResultWrapper[WebhookUpdateResponse]), + cast_to=cast(Type[Optional[WebhookUpdateResponse]], ResultWrapper[WebhookUpdateResponse]), ) def list( @@ -213,7 +213,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WebhookDeleteResponse]: + ) -> WebhookDeleteResponse: """ Delete a configured webhook destination. @@ -234,21 +234,12 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not webhook_id: raise ValueError(f"Expected a non-empty value for `webhook_id` but received {webhook_id!r}") - return cast( - Optional[WebhookDeleteResponse], - self._delete( - f"/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[WebhookDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[WebhookDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=WebhookDeleteResponse, ) def get( @@ -262,7 +253,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Webhooks: + ) -> Optional[Webhooks]: """ Get details for a single webhooks destination. @@ -290,9 +281,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Webhooks]._unwrapper, + post_parser=ResultWrapper[Optional[Webhooks]]._unwrapper, ), - cast_to=cast(Type[Webhooks], ResultWrapper[Webhooks]), + cast_to=cast(Type[Optional[Webhooks]], ResultWrapper[Webhooks]), ) @@ -318,7 +309,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WebhookCreateResponse: + ) -> Optional[WebhookCreateResponse]: """ Creates a new webhook destination. @@ -359,9 +350,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[WebhookCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[WebhookCreateResponse]]._unwrapper, ), - cast_to=cast(Type[WebhookCreateResponse], ResultWrapper[WebhookCreateResponse]), + cast_to=cast(Type[Optional[WebhookCreateResponse]], ResultWrapper[WebhookCreateResponse]), ) async def update( @@ -378,7 +369,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]: """ Update a webhook destination. @@ -423,9 +414,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[WebhookUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[WebhookUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[WebhookUpdateResponse], ResultWrapper[WebhookUpdateResponse]), + cast_to=cast(Type[Optional[WebhookUpdateResponse]], ResultWrapper[WebhookUpdateResponse]), ) def list( @@ -475,7 +466,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WebhookDeleteResponse]: + ) -> WebhookDeleteResponse: """ Delete a configured webhook destination. @@ -496,21 +487,12 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not webhook_id: raise ValueError(f"Expected a non-empty value for `webhook_id` but received {webhook_id!r}") - return cast( - Optional[WebhookDeleteResponse], - await self._delete( - f"/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[WebhookDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[WebhookDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhook_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=WebhookDeleteResponse, ) async def get( @@ -524,7 +506,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Webhooks: + ) -> Optional[Webhooks]: """ Get details for a single webhooks destination. @@ -552,9 +534,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Webhooks]._unwrapper, + post_parser=ResultWrapper[Optional[Webhooks]]._unwrapper, ), - cast_to=cast(Type[Webhooks], ResultWrapper[Webhooks]), + cast_to=cast(Type[Optional[Webhooks]], ResultWrapper[Webhooks]), ) diff --git a/src/cloudflare/resources/alerting/policies.py b/src/cloudflare/resources/alerting/policies.py index b7c35076824..b4c0c91442f 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, Type, Optional, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -118,7 +118,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PolicyCreateResponse: + ) -> Optional[PolicyCreateResponse]: """ Creates a new Notification policy. @@ -170,9 +170,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[PolicyCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PolicyCreateResponse]]._unwrapper, ), - cast_to=cast(Type[PolicyCreateResponse], ResultWrapper[PolicyCreateResponse]), + cast_to=cast(Type[Optional[PolicyCreateResponse]], ResultWrapper[PolicyCreateResponse]), ) def update( @@ -249,7 +249,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PolicyUpdateResponse: + ) -> Optional[PolicyUpdateResponse]: """ Update a Notification policy. @@ -305,9 +305,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[PolicyUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PolicyUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[PolicyUpdateResponse], ResultWrapper[PolicyUpdateResponse]), + cast_to=cast(Type[Optional[PolicyUpdateResponse]], ResultWrapper[PolicyUpdateResponse]), ) def list( @@ -357,7 +357,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyDeleteResponse]: + ) -> PolicyDeleteResponse: """ Delete a Notification policy. @@ -378,21 +378,12 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") - return cast( - Optional[PolicyDeleteResponse], - self._delete( - f"/accounts/{account_id}/alerting/v3/policies/{policy_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PolicyDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/alerting/v3/policies/{policy_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=PolicyDeleteResponse, ) def get( @@ -406,7 +397,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Policy: + ) -> Optional[Policy]: """ Get details for a single policy. @@ -434,9 +425,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Policy]._unwrapper, + post_parser=ResultWrapper[Optional[Policy]]._unwrapper, ), - cast_to=cast(Type[Policy], ResultWrapper[Policy]), + cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), ) @@ -521,7 +512,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PolicyCreateResponse: + ) -> Optional[PolicyCreateResponse]: """ Creates a new Notification policy. @@ -573,9 +564,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[PolicyCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PolicyCreateResponse]]._unwrapper, ), - cast_to=cast(Type[PolicyCreateResponse], ResultWrapper[PolicyCreateResponse]), + cast_to=cast(Type[Optional[PolicyCreateResponse]], ResultWrapper[PolicyCreateResponse]), ) async def update( @@ -652,7 +643,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PolicyUpdateResponse: + ) -> Optional[PolicyUpdateResponse]: """ Update a Notification policy. @@ -708,9 +699,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[PolicyUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PolicyUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[PolicyUpdateResponse], ResultWrapper[PolicyUpdateResponse]), + cast_to=cast(Type[Optional[PolicyUpdateResponse]], ResultWrapper[PolicyUpdateResponse]), ) def list( @@ -760,7 +751,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyDeleteResponse]: + ) -> PolicyDeleteResponse: """ Delete a Notification policy. @@ -781,21 +772,12 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") - return cast( - Optional[PolicyDeleteResponse], - await self._delete( - f"/accounts/{account_id}/alerting/v3/policies/{policy_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[PolicyDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/alerting/v3/policies/{policy_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=PolicyDeleteResponse, ) async def get( @@ -809,7 +791,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Policy: + ) -> Optional[Policy]: """ Get details for a single policy. @@ -837,9 +819,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Policy]._unwrapper, + post_parser=ResultWrapper[Optional[Policy]]._unwrapper, ), - cast_to=cast(Type[Policy], ResultWrapper[Policy]), + cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), ) diff --git a/src/cloudflare/resources/api_gateway/__init__.py b/src/cloudflare/resources/api_gateway/__init__.py new file mode 100644 index 00000000000..4adb2b18211 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/__init__.py @@ -0,0 +1,117 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .schemas import ( + SchemasResource, + AsyncSchemasResource, + SchemasResourceWithRawResponse, + AsyncSchemasResourceWithRawResponse, + SchemasResourceWithStreamingResponse, + AsyncSchemasResourceWithStreamingResponse, +) +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +from .discovery import ( + DiscoveryResource, + AsyncDiscoveryResource, + DiscoveryResourceWithRawResponse, + AsyncDiscoveryResourceWithRawResponse, + DiscoveryResourceWithStreamingResponse, + AsyncDiscoveryResourceWithStreamingResponse, +) +from .operations import ( + OperationsResource, + AsyncOperationsResource, + OperationsResourceWithRawResponse, + AsyncOperationsResourceWithRawResponse, + OperationsResourceWithStreamingResponse, + AsyncOperationsResourceWithStreamingResponse, +) +from .api_gateway import ( + APIGatewayResource, + AsyncAPIGatewayResource, + APIGatewayResourceWithRawResponse, + AsyncAPIGatewayResourceWithRawResponse, + APIGatewayResourceWithStreamingResponse, + AsyncAPIGatewayResourceWithStreamingResponse, +) +from .user_schemas import ( + UserSchemasResource, + AsyncUserSchemasResource, + UserSchemasResourceWithRawResponse, + AsyncUserSchemasResourceWithRawResponse, + UserSchemasResourceWithStreamingResponse, + AsyncUserSchemasResourceWithStreamingResponse, +) +from .configurations import ( + ConfigurationsResource, + AsyncConfigurationsResource, + ConfigurationsResourceWithRawResponse, + AsyncConfigurationsResourceWithRawResponse, + ConfigurationsResourceWithStreamingResponse, + AsyncConfigurationsResourceWithStreamingResponse, +) +from .schema_validation import ( + SchemaValidationResource, + AsyncSchemaValidationResource, + SchemaValidationResourceWithRawResponse, + AsyncSchemaValidationResourceWithRawResponse, + SchemaValidationResourceWithStreamingResponse, + AsyncSchemaValidationResourceWithStreamingResponse, +) + +__all__ = [ + "ConfigurationsResource", + "AsyncConfigurationsResource", + "ConfigurationsResourceWithRawResponse", + "AsyncConfigurationsResourceWithRawResponse", + "ConfigurationsResourceWithStreamingResponse", + "AsyncConfigurationsResourceWithStreamingResponse", + "DiscoveryResource", + "AsyncDiscoveryResource", + "DiscoveryResourceWithRawResponse", + "AsyncDiscoveryResourceWithRawResponse", + "DiscoveryResourceWithStreamingResponse", + "AsyncDiscoveryResourceWithStreamingResponse", + "OperationsResource", + "AsyncOperationsResource", + "OperationsResourceWithRawResponse", + "AsyncOperationsResourceWithRawResponse", + "OperationsResourceWithStreamingResponse", + "AsyncOperationsResourceWithStreamingResponse", + "SchemasResource", + "AsyncSchemasResource", + "SchemasResourceWithRawResponse", + "AsyncSchemasResourceWithRawResponse", + "SchemasResourceWithStreamingResponse", + "AsyncSchemasResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", + "UserSchemasResource", + "AsyncUserSchemasResource", + "UserSchemasResourceWithRawResponse", + "AsyncUserSchemasResourceWithRawResponse", + "UserSchemasResourceWithStreamingResponse", + "AsyncUserSchemasResourceWithStreamingResponse", + "SchemaValidationResource", + "AsyncSchemaValidationResource", + "SchemaValidationResourceWithRawResponse", + "AsyncSchemaValidationResourceWithRawResponse", + "SchemaValidationResourceWithStreamingResponse", + "AsyncSchemaValidationResourceWithStreamingResponse", + "APIGatewayResource", + "AsyncAPIGatewayResource", + "APIGatewayResourceWithRawResponse", + "AsyncAPIGatewayResourceWithRawResponse", + "APIGatewayResourceWithStreamingResponse", + "AsyncAPIGatewayResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/api_gateway/api_gateway.py b/src/cloudflare/resources/api_gateway/api_gateway.py new file mode 100644 index 00000000000..baae4ee7e3b --- /dev/null +++ b/src/cloudflare/resources/api_gateway/api_gateway.py @@ -0,0 +1,276 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .schemas import ( + SchemasResource, + AsyncSchemasResource, + SchemasResourceWithRawResponse, + AsyncSchemasResourceWithRawResponse, + SchemasResourceWithStreamingResponse, + AsyncSchemasResourceWithStreamingResponse, +) +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +from ..._compat import cached_property +from .discovery import ( + DiscoveryResource, + AsyncDiscoveryResource, + DiscoveryResourceWithRawResponse, + AsyncDiscoveryResourceWithRawResponse, + DiscoveryResourceWithStreamingResponse, + AsyncDiscoveryResourceWithStreamingResponse, +) +from .operations import ( + OperationsResource, + AsyncOperationsResource, + OperationsResourceWithRawResponse, + AsyncOperationsResourceWithRawResponse, + OperationsResourceWithStreamingResponse, + AsyncOperationsResourceWithStreamingResponse, +) +from ..._resource import SyncAPIResource, AsyncAPIResource +from .user_schemas import ( + UserSchemasResource, + AsyncUserSchemasResource, + UserSchemasResourceWithRawResponse, + AsyncUserSchemasResourceWithRawResponse, + UserSchemasResourceWithStreamingResponse, + AsyncUserSchemasResourceWithStreamingResponse, +) +from .configurations import ( + ConfigurationsResource, + AsyncConfigurationsResource, + ConfigurationsResourceWithRawResponse, + AsyncConfigurationsResourceWithRawResponse, + ConfigurationsResourceWithStreamingResponse, + AsyncConfigurationsResourceWithStreamingResponse, +) +from .schema_validation import ( + SchemaValidationResource, + AsyncSchemaValidationResource, + SchemaValidationResourceWithRawResponse, + AsyncSchemaValidationResourceWithRawResponse, + SchemaValidationResourceWithStreamingResponse, + AsyncSchemaValidationResourceWithStreamingResponse, +) +from .settings.settings import SettingsResource, AsyncSettingsResource +from .discovery.discovery import DiscoveryResource, AsyncDiscoveryResource +from .operations.operations import OperationsResource, AsyncOperationsResource +from .user_schemas.user_schemas import UserSchemasResource, AsyncUserSchemasResource + +__all__ = ["APIGatewayResource", "AsyncAPIGatewayResource"] + + +class APIGatewayResource(SyncAPIResource): + @cached_property + def configurations(self) -> ConfigurationsResource: + return ConfigurationsResource(self._client) + + @cached_property + def discovery(self) -> DiscoveryResource: + return DiscoveryResource(self._client) + + @cached_property + def operations(self) -> OperationsResource: + return OperationsResource(self._client) + + @cached_property + def schemas(self) -> SchemasResource: + return SchemasResource(self._client) + + @cached_property + def settings(self) -> SettingsResource: + return SettingsResource(self._client) + + @cached_property + def user_schemas(self) -> UserSchemasResource: + return UserSchemasResource(self._client) + + @cached_property + def schema_validation(self) -> SchemaValidationResource: + return SchemaValidationResource(self._client) + + @cached_property + def with_raw_response(self) -> APIGatewayResourceWithRawResponse: + return APIGatewayResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> APIGatewayResourceWithStreamingResponse: + return APIGatewayResourceWithStreamingResponse(self) + + +class AsyncAPIGatewayResource(AsyncAPIResource): + @cached_property + def configurations(self) -> AsyncConfigurationsResource: + return AsyncConfigurationsResource(self._client) + + @cached_property + def discovery(self) -> AsyncDiscoveryResource: + return AsyncDiscoveryResource(self._client) + + @cached_property + def operations(self) -> AsyncOperationsResource: + return AsyncOperationsResource(self._client) + + @cached_property + def schemas(self) -> AsyncSchemasResource: + return AsyncSchemasResource(self._client) + + @cached_property + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) + + @cached_property + def user_schemas(self) -> AsyncUserSchemasResource: + return AsyncUserSchemasResource(self._client) + + @cached_property + def schema_validation(self) -> AsyncSchemaValidationResource: + return AsyncSchemaValidationResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncAPIGatewayResourceWithRawResponse: + return AsyncAPIGatewayResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAPIGatewayResourceWithStreamingResponse: + return AsyncAPIGatewayResourceWithStreamingResponse(self) + + +class APIGatewayResourceWithRawResponse: + def __init__(self, api_gateway: APIGatewayResource) -> None: + self._api_gateway = api_gateway + + @cached_property + def configurations(self) -> ConfigurationsResourceWithRawResponse: + return ConfigurationsResourceWithRawResponse(self._api_gateway.configurations) + + @cached_property + def discovery(self) -> DiscoveryResourceWithRawResponse: + return DiscoveryResourceWithRawResponse(self._api_gateway.discovery) + + @cached_property + def operations(self) -> OperationsResourceWithRawResponse: + return OperationsResourceWithRawResponse(self._api_gateway.operations) + + @cached_property + def schemas(self) -> SchemasResourceWithRawResponse: + return SchemasResourceWithRawResponse(self._api_gateway.schemas) + + @cached_property + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._api_gateway.settings) + + @cached_property + def user_schemas(self) -> UserSchemasResourceWithRawResponse: + return UserSchemasResourceWithRawResponse(self._api_gateway.user_schemas) + + @cached_property + def schema_validation(self) -> SchemaValidationResourceWithRawResponse: + return SchemaValidationResourceWithRawResponse(self._api_gateway.schema_validation) + + +class AsyncAPIGatewayResourceWithRawResponse: + def __init__(self, api_gateway: AsyncAPIGatewayResource) -> None: + self._api_gateway = api_gateway + + @cached_property + def configurations(self) -> AsyncConfigurationsResourceWithRawResponse: + return AsyncConfigurationsResourceWithRawResponse(self._api_gateway.configurations) + + @cached_property + def discovery(self) -> AsyncDiscoveryResourceWithRawResponse: + return AsyncDiscoveryResourceWithRawResponse(self._api_gateway.discovery) + + @cached_property + def operations(self) -> AsyncOperationsResourceWithRawResponse: + return AsyncOperationsResourceWithRawResponse(self._api_gateway.operations) + + @cached_property + def schemas(self) -> AsyncSchemasResourceWithRawResponse: + return AsyncSchemasResourceWithRawResponse(self._api_gateway.schemas) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._api_gateway.settings) + + @cached_property + def user_schemas(self) -> AsyncUserSchemasResourceWithRawResponse: + return AsyncUserSchemasResourceWithRawResponse(self._api_gateway.user_schemas) + + @cached_property + def schema_validation(self) -> AsyncSchemaValidationResourceWithRawResponse: + return AsyncSchemaValidationResourceWithRawResponse(self._api_gateway.schema_validation) + + +class APIGatewayResourceWithStreamingResponse: + def __init__(self, api_gateway: APIGatewayResource) -> None: + self._api_gateway = api_gateway + + @cached_property + def configurations(self) -> ConfigurationsResourceWithStreamingResponse: + return ConfigurationsResourceWithStreamingResponse(self._api_gateway.configurations) + + @cached_property + def discovery(self) -> DiscoveryResourceWithStreamingResponse: + return DiscoveryResourceWithStreamingResponse(self._api_gateway.discovery) + + @cached_property + def operations(self) -> OperationsResourceWithStreamingResponse: + return OperationsResourceWithStreamingResponse(self._api_gateway.operations) + + @cached_property + def schemas(self) -> SchemasResourceWithStreamingResponse: + return SchemasResourceWithStreamingResponse(self._api_gateway.schemas) + + @cached_property + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._api_gateway.settings) + + @cached_property + def user_schemas(self) -> UserSchemasResourceWithStreamingResponse: + return UserSchemasResourceWithStreamingResponse(self._api_gateway.user_schemas) + + @cached_property + def schema_validation(self) -> SchemaValidationResourceWithStreamingResponse: + return SchemaValidationResourceWithStreamingResponse(self._api_gateway.schema_validation) + + +class AsyncAPIGatewayResourceWithStreamingResponse: + def __init__(self, api_gateway: AsyncAPIGatewayResource) -> None: + self._api_gateway = api_gateway + + @cached_property + def configurations(self) -> AsyncConfigurationsResourceWithStreamingResponse: + return AsyncConfigurationsResourceWithStreamingResponse(self._api_gateway.configurations) + + @cached_property + def discovery(self) -> AsyncDiscoveryResourceWithStreamingResponse: + return AsyncDiscoveryResourceWithStreamingResponse(self._api_gateway.discovery) + + @cached_property + def operations(self) -> AsyncOperationsResourceWithStreamingResponse: + return AsyncOperationsResourceWithStreamingResponse(self._api_gateway.operations) + + @cached_property + def schemas(self) -> AsyncSchemasResourceWithStreamingResponse: + return AsyncSchemasResourceWithStreamingResponse(self._api_gateway.schemas) + + @cached_property + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._api_gateway.settings) + + @cached_property + def user_schemas(self) -> AsyncUserSchemasResourceWithStreamingResponse: + return AsyncUserSchemasResourceWithStreamingResponse(self._api_gateway.user_schemas) + + @cached_property + def schema_validation(self) -> AsyncSchemaValidationResourceWithStreamingResponse: + return AsyncSchemaValidationResourceWithStreamingResponse(self._api_gateway.schema_validation) diff --git a/src/cloudflare/resources/api_gateway/configurations.py b/src/cloudflare/resources/api_gateway/configurations.py new file mode 100644 index 00000000000..4e02d4359d6 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/configurations.py @@ -0,0 +1,285 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, List, 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.api_gateway import configuration_get_params, configuration_update_params +from ...types.api_gateway.configuration import Configuration +from ...types.api_gateway.configuration_update_response import ConfigurationUpdateResponse + +__all__ = ["ConfigurationsResource", "AsyncConfigurationsResource"] + + +class ConfigurationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ConfigurationsResourceWithRawResponse: + return ConfigurationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ConfigurationsResourceWithStreamingResponse: + return ConfigurationsResourceWithStreamingResponse(self) + + def update( + self, + *, + zone_id: str, + auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Set configuration properties + + 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( + ConfigurationUpdateResponse, + self._put( + f"/zones/{zone_id}/api_gateway/configuration", + body=maybe_transform( + {"auth_id_characteristics": auth_id_characteristics}, + configuration_update_params.ConfigurationUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ConfigurationUpdateResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[ConfigurationUpdateResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + def get( + self, + *, + zone_id: str, + properties: List[Literal["auth_id_characteristics"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Configuration: + """ + Retrieve information about specific configuration properties + + Args: + zone_id: Identifier + + properties: Requests information about certain properties. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/api_gateway/configuration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"properties": properties}, configuration_get_params.ConfigurationGetParams), + post_parser=ResultWrapper[Configuration]._unwrapper, + ), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), + ) + + +class AsyncConfigurationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncConfigurationsResourceWithRawResponse: + return AsyncConfigurationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncConfigurationsResourceWithStreamingResponse: + return AsyncConfigurationsResourceWithStreamingResponse(self) + + async def update( + self, + *, + zone_id: str, + auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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: + """ + Set configuration properties + + 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( + ConfigurationUpdateResponse, + await self._put( + f"/zones/{zone_id}/api_gateway/configuration", + body=await async_maybe_transform( + {"auth_id_characteristics": auth_id_characteristics}, + configuration_update_params.ConfigurationUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ConfigurationUpdateResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[ConfigurationUpdateResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def get( + self, + *, + zone_id: str, + properties: List[Literal["auth_id_characteristics"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Configuration: + """ + Retrieve information about specific configuration properties + + Args: + zone_id: Identifier + + properties: Requests information about certain properties. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/api_gateway/configuration", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"properties": properties}, configuration_get_params.ConfigurationGetParams + ), + post_parser=ResultWrapper[Configuration]._unwrapper, + ), + cast_to=cast(Type[Configuration], ResultWrapper[Configuration]), + ) + + +class ConfigurationsResourceWithRawResponse: + def __init__(self, configurations: ConfigurationsResource) -> None: + self._configurations = configurations + + self.update = to_raw_response_wrapper( + configurations.update, + ) + self.get = to_raw_response_wrapper( + configurations.get, + ) + + +class AsyncConfigurationsResourceWithRawResponse: + def __init__(self, configurations: AsyncConfigurationsResource) -> None: + self._configurations = configurations + + self.update = async_to_raw_response_wrapper( + configurations.update, + ) + self.get = async_to_raw_response_wrapper( + configurations.get, + ) + + +class ConfigurationsResourceWithStreamingResponse: + def __init__(self, configurations: ConfigurationsResource) -> None: + self._configurations = configurations + + self.update = to_streamed_response_wrapper( + configurations.update, + ) + self.get = to_streamed_response_wrapper( + configurations.get, + ) + + +class AsyncConfigurationsResourceWithStreamingResponse: + def __init__(self, configurations: AsyncConfigurationsResource) -> None: + self._configurations = configurations + + self.update = async_to_streamed_response_wrapper( + configurations.update, + ) + self.get = async_to_streamed_response_wrapper( + configurations.get, + ) diff --git a/src/cloudflare/resources/api_gateway/discovery/__init__.py b/src/cloudflare/resources/api_gateway/discovery/__init__.py new file mode 100644 index 00000000000..b126c44ef71 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/discovery/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .discovery import ( + DiscoveryResource, + AsyncDiscoveryResource, + DiscoveryResourceWithRawResponse, + AsyncDiscoveryResourceWithRawResponse, + DiscoveryResourceWithStreamingResponse, + AsyncDiscoveryResourceWithStreamingResponse, +) +from .operations import ( + OperationsResource, + AsyncOperationsResource, + OperationsResourceWithRawResponse, + AsyncOperationsResourceWithRawResponse, + OperationsResourceWithStreamingResponse, + AsyncOperationsResourceWithStreamingResponse, +) + +__all__ = [ + "OperationsResource", + "AsyncOperationsResource", + "OperationsResourceWithRawResponse", + "AsyncOperationsResourceWithRawResponse", + "OperationsResourceWithStreamingResponse", + "AsyncOperationsResourceWithStreamingResponse", + "DiscoveryResource", + "AsyncDiscoveryResource", + "DiscoveryResourceWithRawResponse", + "AsyncDiscoveryResourceWithRawResponse", + "DiscoveryResourceWithStreamingResponse", + "AsyncDiscoveryResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/api_gateway/discovery/discovery.py b/src/cloudflare/resources/api_gateway/discovery/discovery.py new file mode 100644 index 00000000000..f4aed13c07e --- /dev/null +++ b/src/cloudflare/resources/api_gateway/discovery/discovery.py @@ -0,0 +1,192 @@ +# 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 .operations import ( + OperationsResource, + AsyncOperationsResource, + OperationsResourceWithRawResponse, + AsyncOperationsResourceWithRawResponse, + OperationsResourceWithStreamingResponse, + AsyncOperationsResourceWithStreamingResponse, +) +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.api_gateway.discovery_get_response import DiscoveryGetResponse + +__all__ = ["DiscoveryResource", "AsyncDiscoveryResource"] + + +class DiscoveryResource(SyncAPIResource): + @cached_property + def operations(self) -> OperationsResource: + return OperationsResource(self._client) + + @cached_property + def with_raw_response(self) -> DiscoveryResourceWithRawResponse: + return DiscoveryResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> DiscoveryResourceWithStreamingResponse: + return DiscoveryResourceWithStreamingResponse(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, + ) -> DiscoveryGetResponse: + """ + Retrieve the most up to date view of discovered operations, rendered as OpenAPI + schemas + + 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}/api_gateway/discovery", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[DiscoveryGetResponse]._unwrapper, + ), + cast_to=cast(Type[DiscoveryGetResponse], ResultWrapper[DiscoveryGetResponse]), + ) + + +class AsyncDiscoveryResource(AsyncAPIResource): + @cached_property + def operations(self) -> AsyncOperationsResource: + return AsyncOperationsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncDiscoveryResourceWithRawResponse: + return AsyncDiscoveryResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncDiscoveryResourceWithStreamingResponse: + return AsyncDiscoveryResourceWithStreamingResponse(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, + ) -> DiscoveryGetResponse: + """ + Retrieve the most up to date view of discovered operations, rendered as OpenAPI + schemas + + 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}/api_gateway/discovery", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[DiscoveryGetResponse]._unwrapper, + ), + cast_to=cast(Type[DiscoveryGetResponse], ResultWrapper[DiscoveryGetResponse]), + ) + + +class DiscoveryResourceWithRawResponse: + def __init__(self, discovery: DiscoveryResource) -> None: + self._discovery = discovery + + self.get = to_raw_response_wrapper( + discovery.get, + ) + + @cached_property + def operations(self) -> OperationsResourceWithRawResponse: + return OperationsResourceWithRawResponse(self._discovery.operations) + + +class AsyncDiscoveryResourceWithRawResponse: + def __init__(self, discovery: AsyncDiscoveryResource) -> None: + self._discovery = discovery + + self.get = async_to_raw_response_wrapper( + discovery.get, + ) + + @cached_property + def operations(self) -> AsyncOperationsResourceWithRawResponse: + return AsyncOperationsResourceWithRawResponse(self._discovery.operations) + + +class DiscoveryResourceWithStreamingResponse: + def __init__(self, discovery: DiscoveryResource) -> None: + self._discovery = discovery + + self.get = to_streamed_response_wrapper( + discovery.get, + ) + + @cached_property + def operations(self) -> OperationsResourceWithStreamingResponse: + return OperationsResourceWithStreamingResponse(self._discovery.operations) + + +class AsyncDiscoveryResourceWithStreamingResponse: + def __init__(self, discovery: AsyncDiscoveryResource) -> None: + self._discovery = discovery + + self.get = async_to_streamed_response_wrapper( + discovery.get, + ) + + @cached_property + def operations(self) -> AsyncOperationsResourceWithStreamingResponse: + return AsyncOperationsResourceWithStreamingResponse(self._discovery.operations) diff --git a/src/cloudflare/resources/api_gateway/discovery/operations.py b/src/cloudflare/resources/api_gateway/discovery/operations.py new file mode 100644 index 00000000000..d893457fcdb --- /dev/null +++ b/src/cloudflare/resources/api_gateway/discovery/operations.py @@ -0,0 +1,399 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Type, cast +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage +from ...._base_client import ( + AsyncPaginator, + make_request_options, +) +from ....types.api_gateway.discovery import operation_edit_params, operation_list_params +from ....types.api_gateway.discovery_operation import DiscoveryOperation +from ....types.api_gateway.discovery.operation_edit_response import OperationEditResponse + +__all__ = ["OperationsResource", "AsyncOperationsResource"] + + +class OperationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> OperationsResourceWithRawResponse: + return OperationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OperationsResourceWithStreamingResponse: + return OperationsResourceWithStreamingResponse(self) + + def list( + self, + *, + zone_id: str, + diff: bool | NotGiven = NOT_GIVEN, + direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + endpoint: str | NotGiven = NOT_GIVEN, + host: List[str] | NotGiven = NOT_GIVEN, + method: List[str] | NotGiven = NOT_GIVEN, + order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"] + | NotGiven = NOT_GIVEN, + origin: Literal["ML", "SessionIdentifier"] | NotGiven = NOT_GIVEN, + page: object | NotGiven = NOT_GIVEN, + per_page: object | NotGiven = NOT_GIVEN, + state: Literal["review", "saved", "ignored"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[DiscoveryOperation]: + """ + Retrieve the most up to date view of discovered operations + + Args: + zone_id: Identifier + + diff: When `true`, only return API Discovery results that are not saved into API + Shield Endpoint Management + + direction: Direction to order results. + + endpoint: Filter results to only include endpoints containing this pattern. + + host: Filter results to only include the specified hosts. + + method: Filter results to only include the specified HTTP methods. + + order: Field to order by + + origin: Filter results to only include discovery results sourced from a particular + discovery engine + + - `ML` - Discovered operations that were sourced using ML API Discovery + - `SessionIdentifier` - Discovered operations that were sourced using Session + Identifier API Discovery + + page: Page number of paginated results. + + per_page: Maximum number of results per page. + + state: Filter results to only include discovery results in a particular state. States + are as follows + + - `review` - Discovered operations that are not saved into API Shield Endpoint + Management + - `saved` - Discovered operations that are already saved into API Shield + Endpoint Management + - `ignored` - Discovered operations that have been marked as ignored + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/api_gateway/discovery/operations", + page=SyncSinglePage[DiscoveryOperation], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "diff": diff, + "direction": direction, + "endpoint": endpoint, + "host": host, + "method": method, + "order": order, + "origin": origin, + "page": page, + "per_page": per_page, + "state": state, + }, + operation_list_params.OperationListParams, + ), + ), + model=DiscoveryOperation, + ) + + def edit( + self, + operation_id: str, + *, + zone_id: str, + state: Literal["review", "ignored"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OperationEditResponse: + """ + Update the `state` on a discovered operation + + Args: + zone_id: Identifier + + operation_id: UUID identifier + + state: Mark state of operation in API Discovery + + - `review` - Mark operation as for review + - `ignored` - Mark operation as ignored + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 operation_id: + raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") + return self._patch( + f"/zones/{zone_id}/api_gateway/discovery/operations/{operation_id}", + body=maybe_transform({"state": state}, operation_edit_params.OperationEditParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[OperationEditResponse]._unwrapper, + ), + cast_to=cast(Type[OperationEditResponse], ResultWrapper[OperationEditResponse]), + ) + + +class AsyncOperationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncOperationsResourceWithRawResponse: + return AsyncOperationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOperationsResourceWithStreamingResponse: + return AsyncOperationsResourceWithStreamingResponse(self) + + def list( + self, + *, + zone_id: str, + diff: bool | NotGiven = NOT_GIVEN, + direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + endpoint: str | NotGiven = NOT_GIVEN, + host: List[str] | NotGiven = NOT_GIVEN, + method: List[str] | NotGiven = NOT_GIVEN, + order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"] + | NotGiven = NOT_GIVEN, + origin: Literal["ML", "SessionIdentifier"] | NotGiven = NOT_GIVEN, + page: object | NotGiven = NOT_GIVEN, + per_page: object | NotGiven = NOT_GIVEN, + state: Literal["review", "saved", "ignored"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[DiscoveryOperation, AsyncSinglePage[DiscoveryOperation]]: + """ + Retrieve the most up to date view of discovered operations + + Args: + zone_id: Identifier + + diff: When `true`, only return API Discovery results that are not saved into API + Shield Endpoint Management + + direction: Direction to order results. + + endpoint: Filter results to only include endpoints containing this pattern. + + host: Filter results to only include the specified hosts. + + method: Filter results to only include the specified HTTP methods. + + order: Field to order by + + origin: Filter results to only include discovery results sourced from a particular + discovery engine + + - `ML` - Discovered operations that were sourced using ML API Discovery + - `SessionIdentifier` - Discovered operations that were sourced using Session + Identifier API Discovery + + page: Page number of paginated results. + + per_page: Maximum number of results per page. + + state: Filter results to only include discovery results in a particular state. States + are as follows + + - `review` - Discovered operations that are not saved into API Shield Endpoint + Management + - `saved` - Discovered operations that are already saved into API Shield + Endpoint Management + - `ignored` - Discovered operations that have been marked as ignored + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/api_gateway/discovery/operations", + page=AsyncSinglePage[DiscoveryOperation], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "diff": diff, + "direction": direction, + "endpoint": endpoint, + "host": host, + "method": method, + "order": order, + "origin": origin, + "page": page, + "per_page": per_page, + "state": state, + }, + operation_list_params.OperationListParams, + ), + ), + model=DiscoveryOperation, + ) + + async def edit( + self, + operation_id: str, + *, + zone_id: str, + state: Literal["review", "ignored"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OperationEditResponse: + """ + Update the `state` on a discovered operation + + Args: + zone_id: Identifier + + operation_id: UUID identifier + + state: Mark state of operation in API Discovery + + - `review` - Mark operation as for review + - `ignored` - Mark operation as ignored + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 operation_id: + raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") + return await self._patch( + f"/zones/{zone_id}/api_gateway/discovery/operations/{operation_id}", + body=await async_maybe_transform({"state": state}, operation_edit_params.OperationEditParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[OperationEditResponse]._unwrapper, + ), + cast_to=cast(Type[OperationEditResponse], ResultWrapper[OperationEditResponse]), + ) + + +class OperationsResourceWithRawResponse: + def __init__(self, operations: OperationsResource) -> None: + self._operations = operations + + self.list = to_raw_response_wrapper( + operations.list, + ) + self.edit = to_raw_response_wrapper( + operations.edit, + ) + + +class AsyncOperationsResourceWithRawResponse: + def __init__(self, operations: AsyncOperationsResource) -> None: + self._operations = operations + + self.list = async_to_raw_response_wrapper( + operations.list, + ) + self.edit = async_to_raw_response_wrapper( + operations.edit, + ) + + +class OperationsResourceWithStreamingResponse: + def __init__(self, operations: OperationsResource) -> None: + self._operations = operations + + self.list = to_streamed_response_wrapper( + operations.list, + ) + self.edit = to_streamed_response_wrapper( + operations.edit, + ) + + +class AsyncOperationsResourceWithStreamingResponse: + def __init__(self, operations: AsyncOperationsResource) -> None: + self._operations = operations + + self.list = async_to_streamed_response_wrapper( + operations.list, + ) + self.edit = async_to_streamed_response_wrapper( + operations.edit, + ) diff --git a/src/cloudflare/resources/api_gateway/operations/__init__.py b/src/cloudflare/resources/api_gateway/operations/__init__.py new file mode 100644 index 00000000000..d50a9df3f11 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/operations/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .operations import ( + OperationsResource, + AsyncOperationsResource, + OperationsResourceWithRawResponse, + AsyncOperationsResourceWithRawResponse, + OperationsResourceWithStreamingResponse, + AsyncOperationsResourceWithStreamingResponse, +) +from .schema_validation import ( + SchemaValidationResource, + AsyncSchemaValidationResource, + SchemaValidationResourceWithRawResponse, + AsyncSchemaValidationResourceWithRawResponse, + SchemaValidationResourceWithStreamingResponse, + AsyncSchemaValidationResourceWithStreamingResponse, +) + +__all__ = [ + "SchemaValidationResource", + "AsyncSchemaValidationResource", + "SchemaValidationResourceWithRawResponse", + "AsyncSchemaValidationResourceWithRawResponse", + "SchemaValidationResourceWithStreamingResponse", + "AsyncSchemaValidationResourceWithStreamingResponse", + "OperationsResource", + "AsyncOperationsResource", + "OperationsResourceWithRawResponse", + "AsyncOperationsResourceWithRawResponse", + "OperationsResourceWithStreamingResponse", + "AsyncOperationsResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/api_gateway/operations/operations.py b/src/cloudflare/resources/api_gateway/operations/operations.py new file mode 100644 index 00000000000..90c7b6dd975 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/operations/operations.py @@ -0,0 +1,598 @@ +# 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 .schema_validation import ( + SchemaValidationResource, + AsyncSchemaValidationResource, + SchemaValidationResourceWithRawResponse, + AsyncSchemaValidationResourceWithRawResponse, + SchemaValidationResourceWithStreamingResponse, + AsyncSchemaValidationResourceWithStreamingResponse, +) +from ....types.api_gateway import operation_get_params, operation_list_params, operation_create_params +from ....types.api_gateway.api_shield import APIShield +from ....types.api_gateway.operation_create_response import OperationCreateResponse +from ....types.api_gateway.operation_delete_response import OperationDeleteResponse + +__all__ = ["OperationsResource", "AsyncOperationsResource"] + + +class OperationsResource(SyncAPIResource): + @cached_property + def schema_validation(self) -> SchemaValidationResource: + return SchemaValidationResource(self._client) + + @cached_property + def with_raw_response(self) -> OperationsResourceWithRawResponse: + return OperationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OperationsResourceWithStreamingResponse: + return OperationsResourceWithStreamingResponse(self) + + def create( + self, + *, + zone_id: str, + body: Iterable[operation_create_params.Body], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[OperationCreateResponse]: + """Add one or more operations to a zone. + + Endpoints can contain path variables. + Host, method, endpoint will be normalized to a canoncial form when creating an + operation and must be unique on the zone. Inserting an operation that matches an + existing one will return the record of the already existing operation and update + its last_updated date. + + Args: + zone_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._post( + f"/zones/{zone_id}/api_gateway/operations", + body=maybe_transform(body, operation_create_params.OperationCreateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[OperationCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[OperationCreateResponse]], ResultWrapper[OperationCreateResponse]), + ) + + def list( + self, + *, + zone_id: str, + direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + endpoint: str | NotGiven = NOT_GIVEN, + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN, + host: List[str] | NotGiven = NOT_GIVEN, + method: List[str] | NotGiven = NOT_GIVEN, + order: Literal["method", "host", "endpoint", "thresholds.$key"] | NotGiven = NOT_GIVEN, + page: object | 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, + ) -> SyncSinglePage[APIShield]: + """ + Retrieve information about all operations on a zone + + Args: + zone_id: Identifier + + direction: Direction to order results. + + endpoint: Filter results to only include endpoints containing this pattern. + + feature: Add feature(s) to the results. The feature name that is given here corresponds + to the resulting feature object. Have a look at the top-level object description + for more details on the specific meaning. + + host: Filter results to only include the specified hosts. + + method: Filter results to only include the specified HTTP methods. + + order: Field to order by. When requesting a feature, the feature keys are available for + ordering as well, e.g., `thresholds.suggested_threshold`. + + page: Page number of paginated results. + + per_page: Number of results to return per page + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/api_gateway/operations", + page=SyncSinglePage[APIShield], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "direction": direction, + "endpoint": endpoint, + "feature": feature, + "host": host, + "method": method, + "order": order, + "page": page, + "per_page": per_page, + }, + operation_list_params.OperationListParams, + ), + ), + model=APIShield, + ) + + def delete( + self, + operation_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, + ) -> OperationDeleteResponse: + """ + Delete an operation + + 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}") + if not operation_id: + raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") + return cast( + OperationDeleteResponse, + self._delete( + f"/zones/{zone_id}/api_gateway/operations/{operation_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[OperationDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[OperationDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + def get( + self, + operation_id: str, + *, + zone_id: str, + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> APIShield: + """ + Retrieve information about an operation + + Args: + zone_id: Identifier + + feature: Add feature(s) to the results. The feature name that is given here corresponds + to the resulting feature object. Have a look at the top-level object description + for more details on the specific meaning. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 operation_id: + raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") + return self._get( + f"/zones/{zone_id}/api_gateway/operations/{operation_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"feature": feature}, operation_get_params.OperationGetParams), + post_parser=ResultWrapper[APIShield]._unwrapper, + ), + cast_to=cast(Type[APIShield], ResultWrapper[APIShield]), + ) + + +class AsyncOperationsResource(AsyncAPIResource): + @cached_property + def schema_validation(self) -> AsyncSchemaValidationResource: + return AsyncSchemaValidationResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncOperationsResourceWithRawResponse: + return AsyncOperationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOperationsResourceWithStreamingResponse: + return AsyncOperationsResourceWithStreamingResponse(self) + + async def create( + self, + *, + zone_id: str, + body: Iterable[operation_create_params.Body], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[OperationCreateResponse]: + """Add one or more operations to a zone. + + Endpoints can contain path variables. + Host, method, endpoint will be normalized to a canoncial form when creating an + operation and must be unique on the zone. Inserting an operation that matches an + existing one will return the record of the already existing operation and update + its last_updated date. + + Args: + zone_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return await self._post( + f"/zones/{zone_id}/api_gateway/operations", + body=await async_maybe_transform(body, operation_create_params.OperationCreateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[OperationCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[OperationCreateResponse]], ResultWrapper[OperationCreateResponse]), + ) + + def list( + self, + *, + zone_id: str, + direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + endpoint: str | NotGiven = NOT_GIVEN, + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN, + host: List[str] | NotGiven = NOT_GIVEN, + method: List[str] | NotGiven = NOT_GIVEN, + order: Literal["method", "host", "endpoint", "thresholds.$key"] | NotGiven = NOT_GIVEN, + page: object | 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[APIShield, AsyncSinglePage[APIShield]]: + """ + Retrieve information about all operations on a zone + + Args: + zone_id: Identifier + + direction: Direction to order results. + + endpoint: Filter results to only include endpoints containing this pattern. + + feature: Add feature(s) to the results. The feature name that is given here corresponds + to the resulting feature object. Have a look at the top-level object description + for more details on the specific meaning. + + host: Filter results to only include the specified hosts. + + method: Filter results to only include the specified HTTP methods. + + order: Field to order by. When requesting a feature, the feature keys are available for + ordering as well, e.g., `thresholds.suggested_threshold`. + + page: Page number of paginated results. + + per_page: Number of results to return per page + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/api_gateway/operations", + page=AsyncSinglePage[APIShield], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "direction": direction, + "endpoint": endpoint, + "feature": feature, + "host": host, + "method": method, + "order": order, + "page": page, + "per_page": per_page, + }, + operation_list_params.OperationListParams, + ), + ), + model=APIShield, + ) + + async def delete( + self, + operation_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, + ) -> OperationDeleteResponse: + """ + Delete an operation + + 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}") + if not operation_id: + raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") + return cast( + OperationDeleteResponse, + await self._delete( + f"/zones/{zone_id}/api_gateway/operations/{operation_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[OperationDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[OperationDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def get( + self, + operation_id: str, + *, + zone_id: str, + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> APIShield: + """ + Retrieve information about an operation + + Args: + zone_id: Identifier + + feature: Add feature(s) to the results. The feature name that is given here corresponds + to the resulting feature object. Have a look at the top-level object description + for more details on the specific meaning. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 operation_id: + raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") + return await self._get( + f"/zones/{zone_id}/api_gateway/operations/{operation_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"feature": feature}, operation_get_params.OperationGetParams), + post_parser=ResultWrapper[APIShield]._unwrapper, + ), + cast_to=cast(Type[APIShield], ResultWrapper[APIShield]), + ) + + +class OperationsResourceWithRawResponse: + def __init__(self, operations: OperationsResource) -> None: + self._operations = operations + + self.create = to_raw_response_wrapper( + operations.create, + ) + self.list = to_raw_response_wrapper( + operations.list, + ) + self.delete = to_raw_response_wrapper( + operations.delete, + ) + self.get = to_raw_response_wrapper( + operations.get, + ) + + @cached_property + def schema_validation(self) -> SchemaValidationResourceWithRawResponse: + return SchemaValidationResourceWithRawResponse(self._operations.schema_validation) + + +class AsyncOperationsResourceWithRawResponse: + def __init__(self, operations: AsyncOperationsResource) -> None: + self._operations = operations + + self.create = async_to_raw_response_wrapper( + operations.create, + ) + self.list = async_to_raw_response_wrapper( + operations.list, + ) + self.delete = async_to_raw_response_wrapper( + operations.delete, + ) + self.get = async_to_raw_response_wrapper( + operations.get, + ) + + @cached_property + def schema_validation(self) -> AsyncSchemaValidationResourceWithRawResponse: + return AsyncSchemaValidationResourceWithRawResponse(self._operations.schema_validation) + + +class OperationsResourceWithStreamingResponse: + def __init__(self, operations: OperationsResource) -> None: + self._operations = operations + + self.create = to_streamed_response_wrapper( + operations.create, + ) + self.list = to_streamed_response_wrapper( + operations.list, + ) + self.delete = to_streamed_response_wrapper( + operations.delete, + ) + self.get = to_streamed_response_wrapper( + operations.get, + ) + + @cached_property + def schema_validation(self) -> SchemaValidationResourceWithStreamingResponse: + return SchemaValidationResourceWithStreamingResponse(self._operations.schema_validation) + + +class AsyncOperationsResourceWithStreamingResponse: + def __init__(self, operations: AsyncOperationsResource) -> None: + self._operations = operations + + self.create = async_to_streamed_response_wrapper( + operations.create, + ) + self.list = async_to_streamed_response_wrapper( + operations.list, + ) + self.delete = async_to_streamed_response_wrapper( + operations.delete, + ) + self.get = async_to_streamed_response_wrapper( + operations.get, + ) + + @cached_property + def schema_validation(self) -> AsyncSchemaValidationResourceWithStreamingResponse: + return AsyncSchemaValidationResourceWithStreamingResponse(self._operations.schema_validation) diff --git a/src/cloudflare/resources/api_gateway/operations/schema_validation.py b/src/cloudflare/resources/api_gateway/operations/schema_validation.py new file mode 100644 index 00000000000..b8bd7a0cdcb --- /dev/null +++ b/src/cloudflare/resources/api_gateway/operations/schema_validation.py @@ -0,0 +1,379 @@ +# 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 ...._base_client import ( + make_request_options, +) +from ....types.api_gateway.operations import ( + SettingsMultipleRequest, + schema_validation_edit_params, + schema_validation_update_params, +) +from ....types.api_gateway.operations.settings_multiple_request import SettingsMultipleRequest +from ....types.api_gateway.operations.schema_validation_get_response import SchemaValidationGetResponse +from ....types.api_gateway.operations.settings_multiple_request_param import SettingsMultipleRequestParam +from ....types.api_gateway.operations.schema_validation_update_response import SchemaValidationUpdateResponse + +__all__ = ["SchemaValidationResource", "AsyncSchemaValidationResource"] + + +class SchemaValidationResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SchemaValidationResourceWithRawResponse: + return SchemaValidationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SchemaValidationResourceWithStreamingResponse: + return SchemaValidationResourceWithStreamingResponse(self) + + def update( + self, + operation_id: str, + *, + zone_id: str, + mitigation_action: Optional[Literal["log", "block", "none"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SchemaValidationUpdateResponse: + """ + Updates operation-level schema validation settings on the zone + + Args: + zone_id: Identifier + + mitigation_action: When set, this applies a mitigation action to this operation + + - `log` log request when request does not conform to schema for this operation + - `block` deny access to the site when request does not conform to schema for + this operation + - `none` will skip mitigation for this operation + - `null` indicates that no operation level mitigation is in place, see Zone + Level Schema Validation Settings for mitigation action that will be applied + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 operation_id: + raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") + return self._put( + f"/zones/{zone_id}/api_gateway/operations/{operation_id}/schema_validation", + body=maybe_transform( + {"mitigation_action": mitigation_action}, schema_validation_update_params.SchemaValidationUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SchemaValidationUpdateResponse, + ) + + def edit( + self, + *, + zone_id: str, + settings_multiple_request: SettingsMultipleRequestParam, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SettingsMultipleRequest: + """ + Updates multiple operation-level schema validation settings on the 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._patch( + f"/zones/{zone_id}/api_gateway/operations/schema_validation", + body=maybe_transform(settings_multiple_request, schema_validation_edit_params.SchemaValidationEditParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[SettingsMultipleRequest]._unwrapper, + ), + cast_to=cast(Type[SettingsMultipleRequest], ResultWrapper[SettingsMultipleRequest]), + ) + + def get( + self, + operation_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, + ) -> SchemaValidationGetResponse: + """ + Retrieves operation-level schema validation settings on the 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}") + if not operation_id: + raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") + return self._get( + f"/zones/{zone_id}/api_gateway/operations/{operation_id}/schema_validation", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SchemaValidationGetResponse, + ) + + +class AsyncSchemaValidationResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSchemaValidationResourceWithRawResponse: + return AsyncSchemaValidationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSchemaValidationResourceWithStreamingResponse: + return AsyncSchemaValidationResourceWithStreamingResponse(self) + + async def update( + self, + operation_id: str, + *, + zone_id: str, + mitigation_action: Optional[Literal["log", "block", "none"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SchemaValidationUpdateResponse: + """ + Updates operation-level schema validation settings on the zone + + Args: + zone_id: Identifier + + mitigation_action: When set, this applies a mitigation action to this operation + + - `log` log request when request does not conform to schema for this operation + - `block` deny access to the site when request does not conform to schema for + this operation + - `none` will skip mitigation for this operation + - `null` indicates that no operation level mitigation is in place, see Zone + Level Schema Validation Settings for mitigation action that will be applied + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 operation_id: + raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") + return await self._put( + f"/zones/{zone_id}/api_gateway/operations/{operation_id}/schema_validation", + body=await async_maybe_transform( + {"mitigation_action": mitigation_action}, schema_validation_update_params.SchemaValidationUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SchemaValidationUpdateResponse, + ) + + async def edit( + self, + *, + zone_id: str, + settings_multiple_request: SettingsMultipleRequestParam, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SettingsMultipleRequest: + """ + Updates multiple operation-level schema validation settings on the 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._patch( + f"/zones/{zone_id}/api_gateway/operations/schema_validation", + body=await async_maybe_transform( + settings_multiple_request, schema_validation_edit_params.SchemaValidationEditParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[SettingsMultipleRequest]._unwrapper, + ), + cast_to=cast(Type[SettingsMultipleRequest], ResultWrapper[SettingsMultipleRequest]), + ) + + async def get( + self, + operation_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, + ) -> SchemaValidationGetResponse: + """ + Retrieves operation-level schema validation settings on the 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}") + if not operation_id: + raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") + return await self._get( + f"/zones/{zone_id}/api_gateway/operations/{operation_id}/schema_validation", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SchemaValidationGetResponse, + ) + + +class SchemaValidationResourceWithRawResponse: + def __init__(self, schema_validation: SchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.update = to_raw_response_wrapper( + schema_validation.update, + ) + self.edit = to_raw_response_wrapper( + schema_validation.edit, + ) + self.get = to_raw_response_wrapper( + schema_validation.get, + ) + + +class AsyncSchemaValidationResourceWithRawResponse: + def __init__(self, schema_validation: AsyncSchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.update = async_to_raw_response_wrapper( + schema_validation.update, + ) + self.edit = async_to_raw_response_wrapper( + schema_validation.edit, + ) + self.get = async_to_raw_response_wrapper( + schema_validation.get, + ) + + +class SchemaValidationResourceWithStreamingResponse: + def __init__(self, schema_validation: SchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.update = to_streamed_response_wrapper( + schema_validation.update, + ) + self.edit = to_streamed_response_wrapper( + schema_validation.edit, + ) + self.get = to_streamed_response_wrapper( + schema_validation.get, + ) + + +class AsyncSchemaValidationResourceWithStreamingResponse: + def __init__(self, schema_validation: AsyncSchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.update = async_to_streamed_response_wrapper( + schema_validation.update, + ) + self.edit = async_to_streamed_response_wrapper( + schema_validation.edit, + ) + self.get = async_to_streamed_response_wrapper( + schema_validation.get, + ) diff --git a/src/cloudflare/resources/api_gateway/schema_validation.py b/src/cloudflare/resources/api_gateway/schema_validation.py new file mode 100644 index 00000000000..e1d210edd73 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/schema_validation.py @@ -0,0 +1,211 @@ +# 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 + +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 ..._base_client import ( + make_request_options, +) +from ...types.api_gateway import schema_validation_edit_params +from ...types.api_gateway.settings.settings import Settings + +__all__ = ["SchemaValidationResource", "AsyncSchemaValidationResource"] + + +class SchemaValidationResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SchemaValidationResourceWithRawResponse: + return SchemaValidationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SchemaValidationResourceWithStreamingResponse: + return SchemaValidationResourceWithStreamingResponse(self) + + def edit( + self, + *, + zone_id: str, + validation_default_mitigation_action: Optional[Literal["none", "log", "block"]] | NotGiven = NOT_GIVEN, + validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Settings: + """ + Updates zone level schema validation settings on the zone + + Args: + zone_id: Identifier + + validation_default_mitigation_action: The default mitigation action used when there is no mitigation action defined on + the operation Mitigation actions are as follows: + + - `log` - log request when request does not conform to schema + - `block` - deny access to the site when request does not conform to schema + + A special value of of `none` will skip running schema validation entirely for + the request when there is no mitigation action defined on the operation + + `null` will have no effect. + + validation_override_mitigation_action: When set, this overrides both zone level and operation level mitigation actions. + + - `none` will skip running schema validation entirely for the request + + To clear any override, use the special value `disable_override` + + `null` will have no effect. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return self._patch( + f"/zones/{zone_id}/api_gateway/settings/schema_validation", + body=maybe_transform( + { + "validation_default_mitigation_action": validation_default_mitigation_action, + "validation_override_mitigation_action": validation_override_mitigation_action, + }, + schema_validation_edit_params.SchemaValidationEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Settings, + ) + + +class AsyncSchemaValidationResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSchemaValidationResourceWithRawResponse: + return AsyncSchemaValidationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSchemaValidationResourceWithStreamingResponse: + return AsyncSchemaValidationResourceWithStreamingResponse(self) + + async def edit( + self, + *, + zone_id: str, + validation_default_mitigation_action: Optional[Literal["none", "log", "block"]] | NotGiven = NOT_GIVEN, + validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Settings: + """ + Updates zone level schema validation settings on the zone + + Args: + zone_id: Identifier + + validation_default_mitigation_action: The default mitigation action used when there is no mitigation action defined on + the operation Mitigation actions are as follows: + + - `log` - log request when request does not conform to schema + - `block` - deny access to the site when request does not conform to schema + + A special value of of `none` will skip running schema validation entirely for + the request when there is no mitigation action defined on the operation + + `null` will have no effect. + + validation_override_mitigation_action: When set, this overrides both zone level and operation level mitigation actions. + + - `none` will skip running schema validation entirely for the request + + To clear any override, use the special value `disable_override` + + `null` will have no effect. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not zone_id: + raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") + return await self._patch( + f"/zones/{zone_id}/api_gateway/settings/schema_validation", + body=await async_maybe_transform( + { + "validation_default_mitigation_action": validation_default_mitigation_action, + "validation_override_mitigation_action": validation_override_mitigation_action, + }, + schema_validation_edit_params.SchemaValidationEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Settings, + ) + + +class SchemaValidationResourceWithRawResponse: + def __init__(self, schema_validation: SchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.edit = to_raw_response_wrapper( + schema_validation.edit, + ) + + +class AsyncSchemaValidationResourceWithRawResponse: + def __init__(self, schema_validation: AsyncSchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.edit = async_to_raw_response_wrapper( + schema_validation.edit, + ) + + +class SchemaValidationResourceWithStreamingResponse: + def __init__(self, schema_validation: SchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.edit = to_streamed_response_wrapper( + schema_validation.edit, + ) + + +class AsyncSchemaValidationResourceWithStreamingResponse: + def __init__(self, schema_validation: AsyncSchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.edit = async_to_streamed_response_wrapper( + schema_validation.edit, + ) diff --git a/src/cloudflare/resources/api_gateway/schemas.py b/src/cloudflare/resources/api_gateway/schemas.py new file mode 100644 index 00000000000..d2d1976f847 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/schemas.py @@ -0,0 +1,194 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Type, cast +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._wrappers import ResultWrapper +from ..._base_client import ( + make_request_options, +) +from ...types.api_gateway import schema_list_params +from ...types.api_gateway.schema_list_response import SchemaListResponse + +__all__ = ["SchemasResource", "AsyncSchemasResource"] + + +class SchemasResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SchemasResourceWithRawResponse: + return SchemasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SchemasResourceWithStreamingResponse: + return SchemasResourceWithStreamingResponse(self) + + def list( + self, + *, + zone_id: str, + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN, + host: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SchemaListResponse: + """ + Retrieve operations and features as OpenAPI schemas + + Args: + zone_id: Identifier + + feature: Add feature(s) to the results. The feature name that is given here corresponds + to the resulting feature object. Have a look at the top-level object description + for more details on the specific meaning. + + host: Receive schema only for the given host(s). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/api_gateway/schemas", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "feature": feature, + "host": host, + }, + schema_list_params.SchemaListParams, + ), + post_parser=ResultWrapper[SchemaListResponse]._unwrapper, + ), + cast_to=cast(Type[SchemaListResponse], ResultWrapper[SchemaListResponse]), + ) + + +class AsyncSchemasResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSchemasResourceWithRawResponse: + return AsyncSchemasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSchemasResourceWithStreamingResponse: + return AsyncSchemasResourceWithStreamingResponse(self) + + async def list( + self, + *, + zone_id: str, + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN, + host: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SchemaListResponse: + """ + Retrieve operations and features as OpenAPI schemas + + Args: + zone_id: Identifier + + feature: Add feature(s) to the results. The feature name that is given here corresponds + to the resulting feature object. Have a look at the top-level object description + for more details on the specific meaning. + + host: Receive schema only for the given host(s). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/api_gateway/schemas", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "feature": feature, + "host": host, + }, + schema_list_params.SchemaListParams, + ), + post_parser=ResultWrapper[SchemaListResponse]._unwrapper, + ), + cast_to=cast(Type[SchemaListResponse], ResultWrapper[SchemaListResponse]), + ) + + +class SchemasResourceWithRawResponse: + def __init__(self, schemas: SchemasResource) -> None: + self._schemas = schemas + + self.list = to_raw_response_wrapper( + schemas.list, + ) + + +class AsyncSchemasResourceWithRawResponse: + def __init__(self, schemas: AsyncSchemasResource) -> None: + self._schemas = schemas + + self.list = async_to_raw_response_wrapper( + schemas.list, + ) + + +class SchemasResourceWithStreamingResponse: + def __init__(self, schemas: SchemasResource) -> None: + self._schemas = schemas + + self.list = to_streamed_response_wrapper( + schemas.list, + ) + + +class AsyncSchemasResourceWithStreamingResponse: + def __init__(self, schemas: AsyncSchemasResource) -> None: + self._schemas = schemas + + self.list = async_to_streamed_response_wrapper( + schemas.list, + ) diff --git a/src/cloudflare/resources/api_gateway/settings/__init__.py b/src/cloudflare/resources/api_gateway/settings/__init__.py new file mode 100644 index 00000000000..747e388f807 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/settings/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) +from .schema_validation import ( + SchemaValidationResource, + AsyncSchemaValidationResource, + SchemaValidationResourceWithRawResponse, + AsyncSchemaValidationResourceWithRawResponse, + SchemaValidationResourceWithStreamingResponse, + AsyncSchemaValidationResourceWithStreamingResponse, +) + +__all__ = [ + "SchemaValidationResource", + "AsyncSchemaValidationResource", + "SchemaValidationResourceWithRawResponse", + "AsyncSchemaValidationResourceWithRawResponse", + "SchemaValidationResourceWithStreamingResponse", + "AsyncSchemaValidationResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/api_gateway/settings/schema_validation.py b/src/cloudflare/resources/api_gateway/settings/schema_validation.py new file mode 100644 index 00000000000..f750f0775b3 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/settings/schema_validation.py @@ -0,0 +1,291 @@ +# 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 + +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 ...._base_client import ( + make_request_options, +) +from ....types.api_gateway.settings import schema_validation_update_params +from ....types.api_gateway.settings.settings import Settings + +__all__ = ["SchemaValidationResource", "AsyncSchemaValidationResource"] + + +class SchemaValidationResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SchemaValidationResourceWithRawResponse: + return SchemaValidationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SchemaValidationResourceWithStreamingResponse: + return SchemaValidationResourceWithStreamingResponse(self) + + def update( + self, + *, + zone_id: str, + validation_default_mitigation_action: Literal["none", "log", "block"], + validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Settings: + """ + Updates zone level schema validation settings on the zone + + Args: + zone_id: Identifier + + validation_default_mitigation_action: The default mitigation action used when there is no mitigation action defined on + the operation + + Mitigation actions are as follows: + + - `log` - log request when request does not conform to schema + - `block` - deny access to the site when request does not conform to schema + + A special value of of `none` will skip running schema validation entirely for + the request when there is no mitigation action defined on the operation + + validation_override_mitigation_action: When set, this overrides both zone level and operation level mitigation actions. + + - `none` will skip running schema validation entirely for the request + - `null` indicates that no override is in place + + To clear any override, use the special value `disable_override` or `null` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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._put( + f"/zones/{zone_id}/api_gateway/settings/schema_validation", + body=maybe_transform( + { + "validation_default_mitigation_action": validation_default_mitigation_action, + "validation_override_mitigation_action": validation_override_mitigation_action, + }, + schema_validation_update_params.SchemaValidationUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Settings, + ) + + 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, + ) -> Settings: + """ + Retrieves zone level schema validation settings currently set on the 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}/api_gateway/settings/schema_validation", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Settings, + ) + + +class AsyncSchemaValidationResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSchemaValidationResourceWithRawResponse: + return AsyncSchemaValidationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSchemaValidationResourceWithStreamingResponse: + return AsyncSchemaValidationResourceWithStreamingResponse(self) + + async def update( + self, + *, + zone_id: str, + validation_default_mitigation_action: Literal["none", "log", "block"], + validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Settings: + """ + Updates zone level schema validation settings on the zone + + Args: + zone_id: Identifier + + validation_default_mitigation_action: The default mitigation action used when there is no mitigation action defined on + the operation + + Mitigation actions are as follows: + + - `log` - log request when request does not conform to schema + - `block` - deny access to the site when request does not conform to schema + + A special value of of `none` will skip running schema validation entirely for + the request when there is no mitigation action defined on the operation + + validation_override_mitigation_action: When set, this overrides both zone level and operation level mitigation actions. + + - `none` will skip running schema validation entirely for the request + - `null` indicates that no override is in place + + To clear any override, use the special value `disable_override` or `null` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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._put( + f"/zones/{zone_id}/api_gateway/settings/schema_validation", + body=await async_maybe_transform( + { + "validation_default_mitigation_action": validation_default_mitigation_action, + "validation_override_mitigation_action": validation_override_mitigation_action, + }, + schema_validation_update_params.SchemaValidationUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Settings, + ) + + 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, + ) -> Settings: + """ + Retrieves zone level schema validation settings currently set on the 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}/api_gateway/settings/schema_validation", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Settings, + ) + + +class SchemaValidationResourceWithRawResponse: + def __init__(self, schema_validation: SchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.update = to_raw_response_wrapper( + schema_validation.update, + ) + self.get = to_raw_response_wrapper( + schema_validation.get, + ) + + +class AsyncSchemaValidationResourceWithRawResponse: + def __init__(self, schema_validation: AsyncSchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.update = async_to_raw_response_wrapper( + schema_validation.update, + ) + self.get = async_to_raw_response_wrapper( + schema_validation.get, + ) + + +class SchemaValidationResourceWithStreamingResponse: + def __init__(self, schema_validation: SchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.update = to_streamed_response_wrapper( + schema_validation.update, + ) + self.get = to_streamed_response_wrapper( + schema_validation.get, + ) + + +class AsyncSchemaValidationResourceWithStreamingResponse: + def __init__(self, schema_validation: AsyncSchemaValidationResource) -> None: + self._schema_validation = schema_validation + + self.update = async_to_streamed_response_wrapper( + schema_validation.update, + ) + self.get = async_to_streamed_response_wrapper( + schema_validation.get, + ) diff --git a/src/cloudflare/resources/api_gateway/settings/settings.py b/src/cloudflare/resources/api_gateway/settings/settings.py new file mode 100644 index 00000000000..867736caef9 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/settings/settings.py @@ -0,0 +1,80 @@ +# 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 .schema_validation import ( + SchemaValidationResource, + AsyncSchemaValidationResource, + SchemaValidationResourceWithRawResponse, + AsyncSchemaValidationResourceWithRawResponse, + SchemaValidationResourceWithStreamingResponse, + AsyncSchemaValidationResourceWithStreamingResponse, +) + +__all__ = ["SettingsResource", "AsyncSettingsResource"] + + +class SettingsResource(SyncAPIResource): + @cached_property + def schema_validation(self) -> SchemaValidationResource: + return SchemaValidationResource(self._client) + + @cached_property + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) + + +class AsyncSettingsResource(AsyncAPIResource): + @cached_property + def schema_validation(self) -> AsyncSchemaValidationResource: + return AsyncSchemaValidationResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) + + +class SettingsResourceWithRawResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + @cached_property + def schema_validation(self) -> SchemaValidationResourceWithRawResponse: + return SchemaValidationResourceWithRawResponse(self._settings.schema_validation) + + +class AsyncSettingsResourceWithRawResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + @cached_property + def schema_validation(self) -> AsyncSchemaValidationResourceWithRawResponse: + return AsyncSchemaValidationResourceWithRawResponse(self._settings.schema_validation) + + +class SettingsResourceWithStreamingResponse: + def __init__(self, settings: SettingsResource) -> None: + self._settings = settings + + @cached_property + def schema_validation(self) -> SchemaValidationResourceWithStreamingResponse: + return SchemaValidationResourceWithStreamingResponse(self._settings.schema_validation) + + +class AsyncSettingsResourceWithStreamingResponse: + def __init__(self, settings: AsyncSettingsResource) -> None: + self._settings = settings + + @cached_property + def schema_validation(self) -> AsyncSchemaValidationResourceWithStreamingResponse: + return AsyncSchemaValidationResourceWithStreamingResponse(self._settings.schema_validation) diff --git a/src/cloudflare/resources/api_gateway/user_schemas/__init__.py b/src/cloudflare/resources/api_gateway/user_schemas/__init__.py new file mode 100644 index 00000000000..40bf4737372 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/user_schemas/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .operations import ( + OperationsResource, + AsyncOperationsResource, + OperationsResourceWithRawResponse, + AsyncOperationsResourceWithRawResponse, + OperationsResourceWithStreamingResponse, + AsyncOperationsResourceWithStreamingResponse, +) +from .user_schemas import ( + UserSchemasResource, + AsyncUserSchemasResource, + UserSchemasResourceWithRawResponse, + AsyncUserSchemasResourceWithRawResponse, + UserSchemasResourceWithStreamingResponse, + AsyncUserSchemasResourceWithStreamingResponse, +) + +__all__ = [ + "OperationsResource", + "AsyncOperationsResource", + "OperationsResourceWithRawResponse", + "AsyncOperationsResourceWithRawResponse", + "OperationsResourceWithStreamingResponse", + "AsyncOperationsResourceWithStreamingResponse", + "UserSchemasResource", + "AsyncUserSchemasResource", + "UserSchemasResourceWithRawResponse", + "AsyncUserSchemasResourceWithRawResponse", + "UserSchemasResourceWithStreamingResponse", + "AsyncUserSchemasResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/api_gateway/user_schemas/operations.py b/src/cloudflare/resources/api_gateway/user_schemas/operations.py new file mode 100644 index 00000000000..171f80b2aef --- /dev/null +++ b/src/cloudflare/resources/api_gateway/user_schemas/operations.py @@ -0,0 +1,248 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, List, cast +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 SyncSinglePage, AsyncSinglePage +from ...._base_client import ( + AsyncPaginator, + make_request_options, +) +from ....types.api_gateway.user_schemas import operation_list_params +from ....types.api_gateway.user_schemas.operation_list_response import OperationListResponse + +__all__ = ["OperationsResource", "AsyncOperationsResource"] + + +class OperationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> OperationsResourceWithRawResponse: + return OperationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OperationsResourceWithStreamingResponse: + return OperationsResourceWithStreamingResponse(self) + + def list( + self, + schema_id: str, + *, + zone_id: str, + endpoint: str | NotGiven = NOT_GIVEN, + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN, + host: List[str] | NotGiven = NOT_GIVEN, + method: List[str] | NotGiven = NOT_GIVEN, + operation_status: Literal["new", "existing"] | NotGiven = NOT_GIVEN, + 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[OperationListResponse]: + """Retrieves all operations from the schema. + + Operations that already exist in API + Shield Endpoint Management will be returned as full operations. + + Args: + zone_id: Identifier + + endpoint: Filter results to only include endpoints containing this pattern. + + feature: Add feature(s) to the results. The feature name that is given here corresponds + to the resulting feature object. Have a look at the top-level object description + for more details on the specific meaning. + + host: Filter results to only include the specified hosts. + + method: Filter results to only include the specified HTTP methods. + + operation_status: Filter results by whether operations exist in API Shield Endpoint Management or + not. `new` will just return operations from the schema that do not exist in API + Shield Endpoint Management. `existing` will just return operations from the + schema that already exist in API Shield Endpoint Management. + + page: Page number of paginated results. + + per_page: Maximum number of results per page. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 schema_id: + raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") + return self._get_api_list( + f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}/operations", + page=SyncSinglePage[OperationListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "endpoint": endpoint, + "feature": feature, + "host": host, + "method": method, + "operation_status": operation_status, + "page": page, + "per_page": per_page, + }, + operation_list_params.OperationListParams, + ), + ), + model=cast(Any, OperationListResponse), # Union types cannot be passed in as arguments in the type system + ) + + +class AsyncOperationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncOperationsResourceWithRawResponse: + return AsyncOperationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOperationsResourceWithStreamingResponse: + return AsyncOperationsResourceWithStreamingResponse(self) + + def list( + self, + schema_id: str, + *, + zone_id: str, + endpoint: str | NotGiven = NOT_GIVEN, + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN, + host: List[str] | NotGiven = NOT_GIVEN, + method: List[str] | NotGiven = NOT_GIVEN, + operation_status: Literal["new", "existing"] | NotGiven = NOT_GIVEN, + 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[OperationListResponse, AsyncSinglePage[OperationListResponse]]: + """Retrieves all operations from the schema. + + Operations that already exist in API + Shield Endpoint Management will be returned as full operations. + + Args: + zone_id: Identifier + + endpoint: Filter results to only include endpoints containing this pattern. + + feature: Add feature(s) to the results. The feature name that is given here corresponds + to the resulting feature object. Have a look at the top-level object description + for more details on the specific meaning. + + host: Filter results to only include the specified hosts. + + method: Filter results to only include the specified HTTP methods. + + operation_status: Filter results by whether operations exist in API Shield Endpoint Management or + not. `new` will just return operations from the schema that do not exist in API + Shield Endpoint Management. `existing` will just return operations from the + schema that already exist in API Shield Endpoint Management. + + page: Page number of paginated results. + + per_page: Maximum number of results per page. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 schema_id: + raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") + return self._get_api_list( + f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}/operations", + page=AsyncSinglePage[OperationListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "endpoint": endpoint, + "feature": feature, + "host": host, + "method": method, + "operation_status": operation_status, + "page": page, + "per_page": per_page, + }, + operation_list_params.OperationListParams, + ), + ), + model=cast(Any, OperationListResponse), # Union types cannot be passed in as arguments in the type system + ) + + +class OperationsResourceWithRawResponse: + def __init__(self, operations: OperationsResource) -> None: + self._operations = operations + + self.list = to_raw_response_wrapper( + operations.list, + ) + + +class AsyncOperationsResourceWithRawResponse: + def __init__(self, operations: AsyncOperationsResource) -> None: + self._operations = operations + + self.list = async_to_raw_response_wrapper( + operations.list, + ) + + +class OperationsResourceWithStreamingResponse: + def __init__(self, operations: OperationsResource) -> None: + self._operations = operations + + self.list = to_streamed_response_wrapper( + operations.list, + ) + + +class AsyncOperationsResourceWithStreamingResponse: + def __init__(self, operations: AsyncOperationsResource) -> None: + self._operations = operations + + self.list = async_to_streamed_response_wrapper( + operations.list, + ) diff --git a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py new file mode 100644 index 00000000000..25fc670bd03 --- /dev/null +++ b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py @@ -0,0 +1,715 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, Type, Mapping, cast +from typing_extensions import Literal + +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 .operations import ( + OperationsResource, + AsyncOperationsResource, + OperationsResourceWithRawResponse, + AsyncOperationsResourceWithRawResponse, + OperationsResourceWithStreamingResponse, + AsyncOperationsResourceWithStreamingResponse, +) +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.api_gateway import ( + user_schema_get_params, + user_schema_edit_params, + user_schema_list_params, + user_schema_create_params, +) +from ....types.api_gateway.public_schema import PublicSchema +from ....types.api_gateway.schema_upload import SchemaUpload +from ....types.api_gateway.user_schema_delete_response import UserSchemaDeleteResponse + +__all__ = ["UserSchemasResource", "AsyncUserSchemasResource"] + + +class UserSchemasResource(SyncAPIResource): + @cached_property + def operations(self) -> OperationsResource: + return OperationsResource(self._client) + + @cached_property + def with_raw_response(self) -> UserSchemasResourceWithRawResponse: + return UserSchemasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UserSchemasResourceWithStreamingResponse: + return UserSchemasResourceWithStreamingResponse(self) + + def create( + self, + *, + zone_id: str, + file: FileTypes, + kind: Literal["openapi_v3"], + name: str | NotGiven = NOT_GIVEN, + validation_enabled: Literal["true", "false"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SchemaUpload: + """ + Upload a schema to a zone + + Args: + zone_id: Identifier + + file: Schema file bytes + + kind: Kind of schema + + name: Name of the schema + + validation_enabled: Flag whether schema is enabled for validation. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}") + body = deepcopy_minimal( + { + "file": file, + "kind": kind, + "name": name, + "validation_enabled": validation_enabled, + } + ) + files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) + 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"/zones/{zone_id}/api_gateway/user_schemas", + body=maybe_transform(body, user_schema_create_params.UserSchemaCreateParams), + files=files, + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[SchemaUpload]._unwrapper, + ), + cast_to=cast(Type[SchemaUpload], ResultWrapper[SchemaUpload]), + ) + + def list( + self, + *, + zone_id: str, + omit_source: bool | NotGiven = NOT_GIVEN, + page: object | NotGiven = NOT_GIVEN, + per_page: object | NotGiven = NOT_GIVEN, + validation_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. + # The extra values given here take precedence over values defined on the client or passed to this 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[PublicSchema]: + """ + Retrieve information about all schemas on a zone + + Args: + zone_id: Identifier + + omit_source: Omit the source-files of schemas and only retrieve their meta-data. + + page: Page number of paginated results. + + per_page: Maximum number of results per page. + + validation_enabled: Flag whether schema is enabled for validation. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/api_gateway/user_schemas", + page=SyncSinglePage[PublicSchema], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "omit_source": omit_source, + "page": page, + "per_page": per_page, + "validation_enabled": validation_enabled, + }, + user_schema_list_params.UserSchemaListParams, + ), + ), + model=PublicSchema, + ) + + def delete( + self, + schema_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, + ) -> UserSchemaDeleteResponse: + """ + Delete a schema + + 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}") + if not schema_id: + raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") + return cast( + UserSchemaDeleteResponse, + self._delete( + f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[UserSchemaDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[UserSchemaDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + def edit( + self, + schema_id: str, + *, + zone_id: str, + validation_enabled: Literal[True] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PublicSchema: + """ + Enable validation for a schema + + Args: + zone_id: Identifier + + validation_enabled: Flag whether schema is enabled for validation. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 schema_id: + raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") + return self._patch( + f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}", + body=maybe_transform( + {"validation_enabled": validation_enabled}, user_schema_edit_params.UserSchemaEditParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[PublicSchema]._unwrapper, + ), + cast_to=cast(Type[PublicSchema], ResultWrapper[PublicSchema]), + ) + + def get( + self, + schema_id: str, + *, + zone_id: str, + omit_source: 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, + ) -> PublicSchema: + """ + Retrieve information about a specific schema on a zone + + Args: + zone_id: Identifier + + omit_source: Omit the source-files of schemas and only retrieve their meta-data. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 schema_id: + raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") + return self._get( + f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"omit_source": omit_source}, user_schema_get_params.UserSchemaGetParams), + post_parser=ResultWrapper[PublicSchema]._unwrapper, + ), + cast_to=cast(Type[PublicSchema], ResultWrapper[PublicSchema]), + ) + + +class AsyncUserSchemasResource(AsyncAPIResource): + @cached_property + def operations(self) -> AsyncOperationsResource: + return AsyncOperationsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncUserSchemasResourceWithRawResponse: + return AsyncUserSchemasResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUserSchemasResourceWithStreamingResponse: + return AsyncUserSchemasResourceWithStreamingResponse(self) + + async def create( + self, + *, + zone_id: str, + file: FileTypes, + kind: Literal["openapi_v3"], + name: str | NotGiven = NOT_GIVEN, + validation_enabled: Literal["true", "false"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SchemaUpload: + """ + Upload a schema to a zone + + Args: + zone_id: Identifier + + file: Schema file bytes + + kind: Kind of schema + + name: Name of the schema + + validation_enabled: Flag whether schema is enabled for validation. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}") + body = deepcopy_minimal( + { + "file": file, + "kind": kind, + "name": name, + "validation_enabled": validation_enabled, + } + ) + files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) + 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"/zones/{zone_id}/api_gateway/user_schemas", + body=await async_maybe_transform(body, user_schema_create_params.UserSchemaCreateParams), + files=files, + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[SchemaUpload]._unwrapper, + ), + cast_to=cast(Type[SchemaUpload], ResultWrapper[SchemaUpload]), + ) + + def list( + self, + *, + zone_id: str, + omit_source: bool | NotGiven = NOT_GIVEN, + page: object | NotGiven = NOT_GIVEN, + per_page: object | NotGiven = NOT_GIVEN, + validation_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. + # The extra values given here take precedence over values defined on the client or passed to this 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[PublicSchema, AsyncSinglePage[PublicSchema]]: + """ + Retrieve information about all schemas on a zone + + Args: + zone_id: Identifier + + omit_source: Omit the source-files of schemas and only retrieve their meta-data. + + page: Page number of paginated results. + + per_page: Maximum number of results per page. + + validation_enabled: Flag whether schema is enabled for validation. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/api_gateway/user_schemas", + page=AsyncSinglePage[PublicSchema], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "omit_source": omit_source, + "page": page, + "per_page": per_page, + "validation_enabled": validation_enabled, + }, + user_schema_list_params.UserSchemaListParams, + ), + ), + model=PublicSchema, + ) + + async def delete( + self, + schema_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, + ) -> UserSchemaDeleteResponse: + """ + Delete a schema + + 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}") + if not schema_id: + raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") + return cast( + UserSchemaDeleteResponse, + await self._delete( + f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[UserSchemaDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[UserSchemaDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def edit( + self, + schema_id: str, + *, + zone_id: str, + validation_enabled: Literal[True] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> PublicSchema: + """ + Enable validation for a schema + + Args: + zone_id: Identifier + + validation_enabled: Flag whether schema is enabled for validation. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 schema_id: + raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") + return await self._patch( + f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}", + body=await async_maybe_transform( + {"validation_enabled": validation_enabled}, user_schema_edit_params.UserSchemaEditParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[PublicSchema]._unwrapper, + ), + cast_to=cast(Type[PublicSchema], ResultWrapper[PublicSchema]), + ) + + async def get( + self, + schema_id: str, + *, + zone_id: str, + omit_source: 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, + ) -> PublicSchema: + """ + Retrieve information about a specific schema on a zone + + Args: + zone_id: Identifier + + omit_source: Omit the source-files of schemas and only retrieve their meta-data. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 schema_id: + raise ValueError(f"Expected a non-empty value for `schema_id` but received {schema_id!r}") + return await self._get( + f"/zones/{zone_id}/api_gateway/user_schemas/{schema_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"omit_source": omit_source}, user_schema_get_params.UserSchemaGetParams + ), + post_parser=ResultWrapper[PublicSchema]._unwrapper, + ), + cast_to=cast(Type[PublicSchema], ResultWrapper[PublicSchema]), + ) + + +class UserSchemasResourceWithRawResponse: + def __init__(self, user_schemas: UserSchemasResource) -> None: + self._user_schemas = user_schemas + + self.create = to_raw_response_wrapper( + user_schemas.create, + ) + self.list = to_raw_response_wrapper( + user_schemas.list, + ) + self.delete = to_raw_response_wrapper( + user_schemas.delete, + ) + self.edit = to_raw_response_wrapper( + user_schemas.edit, + ) + self.get = to_raw_response_wrapper( + user_schemas.get, + ) + + @cached_property + def operations(self) -> OperationsResourceWithRawResponse: + return OperationsResourceWithRawResponse(self._user_schemas.operations) + + +class AsyncUserSchemasResourceWithRawResponse: + def __init__(self, user_schemas: AsyncUserSchemasResource) -> None: + self._user_schemas = user_schemas + + self.create = async_to_raw_response_wrapper( + user_schemas.create, + ) + self.list = async_to_raw_response_wrapper( + user_schemas.list, + ) + self.delete = async_to_raw_response_wrapper( + user_schemas.delete, + ) + self.edit = async_to_raw_response_wrapper( + user_schemas.edit, + ) + self.get = async_to_raw_response_wrapper( + user_schemas.get, + ) + + @cached_property + def operations(self) -> AsyncOperationsResourceWithRawResponse: + return AsyncOperationsResourceWithRawResponse(self._user_schemas.operations) + + +class UserSchemasResourceWithStreamingResponse: + def __init__(self, user_schemas: UserSchemasResource) -> None: + self._user_schemas = user_schemas + + self.create = to_streamed_response_wrapper( + user_schemas.create, + ) + self.list = to_streamed_response_wrapper( + user_schemas.list, + ) + self.delete = to_streamed_response_wrapper( + user_schemas.delete, + ) + self.edit = to_streamed_response_wrapper( + user_schemas.edit, + ) + self.get = to_streamed_response_wrapper( + user_schemas.get, + ) + + @cached_property + def operations(self) -> OperationsResourceWithStreamingResponse: + return OperationsResourceWithStreamingResponse(self._user_schemas.operations) + + +class AsyncUserSchemasResourceWithStreamingResponse: + def __init__(self, user_schemas: AsyncUserSchemasResource) -> None: + self._user_schemas = user_schemas + + self.create = async_to_streamed_response_wrapper( + user_schemas.create, + ) + self.list = async_to_streamed_response_wrapper( + user_schemas.list, + ) + self.delete = async_to_streamed_response_wrapper( + user_schemas.delete, + ) + self.edit = async_to_streamed_response_wrapper( + user_schemas.edit, + ) + self.get = async_to_streamed_response_wrapper( + user_schemas.get, + ) + + @cached_property + def operations(self) -> AsyncOperationsResourceWithStreamingResponse: + return AsyncOperationsResourceWithStreamingResponse(self._user_schemas.operations) diff --git a/src/cloudflare/resources/argo/tiered_caching.py b/src/cloudflare/resources/argo/tiered_caching.py index 89faa76ba4a..978bfc9d2c0 100644 --- a/src/cloudflare/resources/argo/tiered_caching.py +++ b/src/cloudflare/resources/argo/tiered_caching.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, cast from typing_extensions import Literal import httpx @@ -70,22 +70,17 @@ def edit( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - TieredCachingEditResponse, - self._patch( - f"/zones/{zone_id}/argo/tiered_caching", - body=maybe_transform({"value": value}, tiered_caching_edit_params.TieredCachingEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TieredCachingEditResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[TieredCachingEditResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._patch( + f"/zones/{zone_id}/argo/tiered_caching", + body=maybe_transform({"value": value}, tiered_caching_edit_params.TieredCachingEditParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[TieredCachingEditResponse]._unwrapper, ), + cast_to=cast(Type[TieredCachingEditResponse], ResultWrapper[TieredCachingEditResponse]), ) def get( @@ -115,21 +110,16 @@ def get( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - TieredCachingGetResponse, - self._get( - f"/zones/{zone_id}/argo/tiered_caching", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TieredCachingGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[TieredCachingGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/zones/{zone_id}/argo/tiered_caching", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[TieredCachingGetResponse]._unwrapper, ), + cast_to=cast(Type[TieredCachingGetResponse], ResultWrapper[TieredCachingGetResponse]), ) @@ -172,22 +162,17 @@ async def edit( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - TieredCachingEditResponse, - await self._patch( - f"/zones/{zone_id}/argo/tiered_caching", - body=await async_maybe_transform({"value": value}, tiered_caching_edit_params.TieredCachingEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TieredCachingEditResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[TieredCachingEditResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._patch( + f"/zones/{zone_id}/argo/tiered_caching", + body=await async_maybe_transform({"value": value}, tiered_caching_edit_params.TieredCachingEditParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[TieredCachingEditResponse]._unwrapper, ), + cast_to=cast(Type[TieredCachingEditResponse], ResultWrapper[TieredCachingEditResponse]), ) async def get( @@ -217,21 +202,16 @@ async def get( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - TieredCachingGetResponse, - await self._get( - f"/zones/{zone_id}/argo/tiered_caching", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TieredCachingGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[TieredCachingGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/zones/{zone_id}/argo/tiered_caching", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[TieredCachingGetResponse]._unwrapper, ), + cast_to=cast(Type[TieredCachingGetResponse], ResultWrapper[TieredCachingGetResponse]), ) diff --git a/src/cloudflare/resources/bot_management.py b/src/cloudflare/resources/bot_management.py index e53c10a35f6..d1ee986475a 100644 --- a/src/cloudflare/resources/bot_management.py +++ b/src/cloudflare/resources/bot_management.py @@ -248,7 +248,7 @@ def update( """ ... - @required_args(["zone_id"], ["zone_id"], ["zone_id"], ["zone_id"]) + @required_args(["zone_id"]) def update( self, *, @@ -563,7 +563,7 @@ async def update( """ ... - @required_args(["zone_id"], ["zone_id"], ["zone_id"], ["zone_id"]) + @required_args(["zone_id"]) async def update( self, *, diff --git a/src/cloudflare/resources/cache/cache.py b/src/cloudflare/resources/cache/cache.py index c46d707bd24..0b6fc0dd540 100644 --- a/src/cloudflare/resources/cache/cache.py +++ b/src/cloudflare/resources/cache/cache.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Optional, cast, overload +from typing import List, Type, Iterable, Optional, cast, overload import httpx @@ -106,6 +106,10 @@ def purge( All tiers can purge everything. + ``` + {"purge_everything": true} + ``` + ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -118,9 +122,34 @@ 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. **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. + 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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` ### Purge Cached Content by Tag, Host or Prefix @@ -133,7 +162,28 @@ def purge( prefixes in one API call. This rate limit can be raised for customers who need to purge at higher volume. + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + Args: + tags: For more information on cache tags and purging by tags, please refer to + [purge by cache-tags documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-tags/#purge-cache-by-cache-tags-enterprise-only). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -163,6 +213,10 @@ def purge( All tiers can purge everything. + ``` + {"purge_everything": true} + ``` + ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -175,9 +229,34 @@ 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. **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. + 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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` ### Purge Cached Content by Tag, Host or Prefix @@ -190,7 +269,28 @@ def purge( prefixes in one API call. This rate limit can be raised for customers who need to purge at higher volume. + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + Args: + hosts: For more information purging by hostnames, please refer to + [purge by hostname documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-hostname/). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -220,6 +320,10 @@ def purge( All tiers can purge everything. + ``` + {"purge_everything": true} + ``` + ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -232,9 +336,34 @@ 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. **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. + 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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` ### Purge Cached Content by Tag, Host or Prefix @@ -247,7 +376,28 @@ def purge( prefixes in one API call. This rate limit can be raised for customers who need to purge at higher volume. + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + Args: + prefixes: For more information on purging by prefixes, please refer to + [purge by prefix documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge_by_prefix/). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -277,6 +427,10 @@ def purge( All tiers can purge everything. + ``` + {"purge_everything": true} + ``` + ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -289,9 +443,34 @@ 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. **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. + 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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` ### Purge Cached Content by Tag, Host or Prefix @@ -304,7 +483,28 @@ def purge( prefixes in one API call. This rate limit can be raised for customers who need to purge at higher volume. + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + Args: + purge_everything: For more information, please refer to + [purge everything documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-everything/). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -320,7 +520,7 @@ def purge( self, *, zone_id: str, - files: List[cache_purge_params.CachePurgeFilesFile] | NotGiven = NOT_GIVEN, + files: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -334,6 +534,10 @@ def purge( All tiers can purge everything. + ``` + {"purge_everything": true} + ``` + ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -346,9 +550,34 @@ 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. **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. + 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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` ### Purge Cached Content by Tag, Host or Prefix @@ -361,7 +590,135 @@ def purge( prefixes in one API call. This rate limit can be raised for customers who need to purge at higher volume. + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + Args: + files: For more information on purging files, please refer to + [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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 purge( + self, + *, + zone_id: str, + files: Iterable[cache_purge_params.CachePurgeSingleFileWithURLAndHeadersFile] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[CachePurgeResponse]: + """### Purge All Cached Content + + Removes ALL files from Cloudflare's cache. + + All tiers can purge everything. + + ``` + {"purge_everything": true} + ``` + + ### Purge Cached Content by URL + + Granularly removes one or more files from Cloudflare's cache by specifying URLs. + All tiers can purge by URL. + + To purge files with custom cache keys, include the headers used to compute the + cache key as in the example. If you have a device type or geo in your cache key, + you will need to include the CF-Device-Type or CF-IPCountry headers. If you have + lang in your cache key, you will need to include the Accept-Language header. + + **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. + + **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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` + + ### Purge Cached Content by Tag, Host or Prefix + + Granularly removes one or more files from Cloudflare's cache either by + specifying the host, the associated Cache-Tag, or a Prefix. Only Enterprise + customers are permitted to purge by Tag, Host or Prefix. + + **NB:** Cache-Tag, host, and prefix purging each have a rate limit of 30,000 + purge API calls in every 24 hour period. You may purge up to 30 tags, hosts, or + prefixes in one API call. This rate limit can be raised for customers who need + to purge at higher volume. + + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + + Args: + files: For more information on purging files with URL and headers, please refer to + [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -372,7 +729,7 @@ def purge( """ ... - @required_args(["zone_id"], ["zone_id"], ["zone_id"], ["zone_id"], ["zone_id"]) + @required_args(["zone_id"]) def purge( self, *, @@ -381,7 +738,9 @@ def purge( hosts: List[str] | NotGiven = NOT_GIVEN, prefixes: List[str] | NotGiven = NOT_GIVEN, purge_everything: bool | NotGiven = NOT_GIVEN, - files: List[cache_purge_params.CachePurgeFilesFile] | NotGiven = NOT_GIVEN, + files: List[str] + | Iterable[cache_purge_params.CachePurgeSingleFileWithURLAndHeadersFile] + | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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,6 +817,10 @@ async def purge( All tiers can purge everything. + ``` + {"purge_everything": true} + ``` + ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -470,9 +833,34 @@ 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. **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. + 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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` ### Purge Cached Content by Tag, Host or Prefix @@ -485,7 +873,28 @@ async def purge( prefixes in one API call. This rate limit can be raised for customers who need to purge at higher volume. + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + Args: + tags: For more information on cache tags and purging by tags, please refer to + [purge by cache-tags documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-tags/#purge-cache-by-cache-tags-enterprise-only). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -515,6 +924,10 @@ async def purge( All tiers can purge everything. + ``` + {"purge_everything": true} + ``` + ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -527,9 +940,34 @@ 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. **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. + 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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` ### Purge Cached Content by Tag, Host or Prefix @@ -542,7 +980,28 @@ async def purge( prefixes in one API call. This rate limit can be raised for customers who need to purge at higher volume. + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + Args: + hosts: For more information purging by hostnames, please refer to + [purge by hostname documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-hostname/). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -572,6 +1031,10 @@ async def purge( All tiers can purge everything. + ``` + {"purge_everything": true} + ``` + ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -584,9 +1047,34 @@ 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. **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. + 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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` ### Purge Cached Content by Tag, Host or Prefix @@ -599,7 +1087,28 @@ async def purge( prefixes in one API call. This rate limit can be raised for customers who need to purge at higher volume. + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + Args: + prefixes: For more information on purging by prefixes, please refer to + [purge by prefix documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge_by_prefix/). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -629,6 +1138,10 @@ async def purge( All tiers can purge everything. + ``` + {"purge_everything": true} + ``` + ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -641,9 +1154,34 @@ 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. **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. + 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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` ### Purge Cached Content by Tag, Host or Prefix @@ -656,7 +1194,28 @@ async def purge( prefixes in one API call. This rate limit can be raised for customers who need to purge at higher volume. + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + Args: + purge_everything: For more information, please refer to + [purge everything documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-everything/). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -672,7 +1231,7 @@ async def purge( self, *, zone_id: str, - files: List[cache_purge_params.CachePurgeFilesFile] | NotGiven = NOT_GIVEN, + files: List[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -686,6 +1245,10 @@ async def purge( All tiers can purge everything. + ``` + {"purge_everything": true} + ``` + ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -698,9 +1261,34 @@ 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. **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. + 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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` ### Purge Cached Content by Tag, Host or Prefix @@ -713,7 +1301,135 @@ async def purge( prefixes in one API call. This rate limit can be raised for customers who need to purge at higher volume. + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + Args: + files: For more information on purging files, please refer to + [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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 purge( + self, + *, + zone_id: str, + files: Iterable[cache_purge_params.CachePurgeSingleFileWithURLAndHeadersFile] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[CachePurgeResponse]: + """### Purge All Cached Content + + Removes ALL files from Cloudflare's cache. + + All tiers can purge everything. + + ``` + {"purge_everything": true} + ``` + + ### Purge Cached Content by URL + + Granularly removes one or more files from Cloudflare's cache by specifying URLs. + All tiers can purge by URL. + + To purge files with custom cache keys, include the headers used to compute the + cache key as in the example. If you have a device type or geo in your cache key, + you will need to include the CF-Device-Type or CF-IPCountry headers. If you have + lang in your cache key, you will need to include the Accept-Language header. + + **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. + + **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. + + Single file purge example with files: + + ``` + {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + ``` + + Single file purge example with url and header pairs: + + ``` + { + "files": [ + { + url: "http://www.example.com/cat_picture.jpg", + headers: {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}, + }, + { + url: "http://www.example.com/dog_picture.jpg", + headers: {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}, + }, + ] + } + ``` + + ### Purge Cached Content by Tag, Host or Prefix + + Granularly removes one or more files from Cloudflare's cache either by + specifying the host, the associated Cache-Tag, or a Prefix. Only Enterprise + customers are permitted to purge by Tag, Host or Prefix. + + **NB:** Cache-Tag, host, and prefix purging each have a rate limit of 30,000 + purge API calls in every 24 hour period. You may purge up to 30 tags, hosts, or + prefixes in one API call. This rate limit can be raised for customers who need + to purge at higher volume. + + Flex purge with tags: + + ``` + {"tags": ["a-cache-tag", "another-cache-tag"]} + ``` + + Flex purge with hosts: + + ``` + {"hosts": ["www.example.com", "images.example.com"]} + ``` + + Flex purge with prefixes: + + ``` + {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + ``` + + Args: + files: For more information on purging files with URL and headers, please refer to + [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -724,7 +1440,7 @@ async def purge( """ ... - @required_args(["zone_id"], ["zone_id"], ["zone_id"], ["zone_id"], ["zone_id"]) + @required_args(["zone_id"]) async def purge( self, *, @@ -733,7 +1449,9 @@ async def purge( hosts: List[str] | NotGiven = NOT_GIVEN, prefixes: List[str] | NotGiven = NOT_GIVEN, purge_everything: bool | NotGiven = NOT_GIVEN, - files: List[cache_purge_params.CachePurgeFilesFile] | NotGiven = NOT_GIVEN, + files: List[str] + | Iterable[cache_purge_params.CachePurgeSingleFileWithURLAndHeadersFile] + | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/cloudflare/resources/cache/smart_tiered_cache.py b/src/cloudflare/resources/cache/smart_tiered_cache.py index 05eaf141475..28189fb0fe5 100644 --- a/src/cloudflare/resources/cache/smart_tiered_cache.py +++ b/src/cloudflare/resources/cache/smart_tiered_cache.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, cast from typing_extensions import Literal import httpx @@ -68,21 +68,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( - SmartTieredCacheDeleteResponse, - self._delete( - f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[SmartTieredCacheDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[SmartTieredCacheDeleteResponse]._unwrapper, ), + cast_to=cast(Type[SmartTieredCacheDeleteResponse], ResultWrapper[SmartTieredCacheDeleteResponse]), ) def edit( @@ -103,7 +98,7 @@ def edit( Args: zone_id: Identifier - value: Enables Tiered Cache. + value: Enable or disable the Smart Tiered Cache extra_headers: Send extra headers @@ -115,22 +110,17 @@ def edit( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - SmartTieredCacheEditResponse, - self._patch( - f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", - body=maybe_transform({"value": value}, smart_tiered_cache_edit_params.SmartTieredCacheEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheEditResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[SmartTieredCacheEditResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._patch( + f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", + body=maybe_transform({"value": value}, smart_tiered_cache_edit_params.SmartTieredCacheEditParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[SmartTieredCacheEditResponse]._unwrapper, ), + cast_to=cast(Type[SmartTieredCacheEditResponse], ResultWrapper[SmartTieredCacheEditResponse]), ) def get( @@ -160,21 +150,16 @@ def get( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - SmartTieredCacheGetResponse, - self._get( - f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[SmartTieredCacheGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[SmartTieredCacheGetResponse]._unwrapper, ), + cast_to=cast(Type[SmartTieredCacheGetResponse], ResultWrapper[SmartTieredCacheGetResponse]), ) @@ -214,21 +199,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( - SmartTieredCacheDeleteResponse, - await self._delete( - f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[SmartTieredCacheDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[SmartTieredCacheDeleteResponse]._unwrapper, ), + cast_to=cast(Type[SmartTieredCacheDeleteResponse], ResultWrapper[SmartTieredCacheDeleteResponse]), ) async def edit( @@ -249,7 +229,7 @@ async def edit( Args: zone_id: Identifier - value: Enables Tiered Cache. + value: Enable or disable the Smart Tiered Cache extra_headers: Send extra headers @@ -261,24 +241,19 @@ async def edit( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - SmartTieredCacheEditResponse, - await self._patch( - f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", - body=await async_maybe_transform( - {"value": value}, smart_tiered_cache_edit_params.SmartTieredCacheEditParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheEditResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[SmartTieredCacheEditResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._patch( + f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", + body=await async_maybe_transform( + {"value": value}, smart_tiered_cache_edit_params.SmartTieredCacheEditParams ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[SmartTieredCacheEditResponse]._unwrapper, + ), + cast_to=cast(Type[SmartTieredCacheEditResponse], ResultWrapper[SmartTieredCacheEditResponse]), ) async def get( @@ -308,21 +283,16 @@ async def get( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return cast( - SmartTieredCacheGetResponse, - await self._get( - f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[SmartTieredCacheGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[SmartTieredCacheGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/zones/{zone_id}/cache/tiered_cache_smart_topology_enable", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[SmartTieredCacheGetResponse]._unwrapper, ), + cast_to=cast(Type[SmartTieredCacheGetResponse], ResultWrapper[SmartTieredCacheGetResponse]), ) diff --git a/src/cloudflare/resources/calls/__init__.py b/src/cloudflare/resources/calls/__init__.py new file mode 100644 index 00000000000..2d00a1bdd9e --- /dev/null +++ b/src/cloudflare/resources/calls/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .turn import ( + TURNResource, + AsyncTURNResource, + TURNResourceWithRawResponse, + AsyncTURNResourceWithRawResponse, + TURNResourceWithStreamingResponse, + AsyncTURNResourceWithStreamingResponse, +) +from .calls import ( + CallsResource, + AsyncCallsResource, + CallsResourceWithRawResponse, + AsyncCallsResourceWithRawResponse, + CallsResourceWithStreamingResponse, + AsyncCallsResourceWithStreamingResponse, +) + +__all__ = [ + "TURNResource", + "AsyncTURNResource", + "TURNResourceWithRawResponse", + "AsyncTURNResourceWithRawResponse", + "TURNResourceWithStreamingResponse", + "AsyncTURNResourceWithStreamingResponse", + "CallsResource", + "AsyncCallsResource", + "CallsResourceWithRawResponse", + "AsyncCallsResourceWithRawResponse", + "CallsResourceWithStreamingResponse", + "AsyncCallsResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/calls.py b/src/cloudflare/resources/calls/calls.py similarity index 91% rename from src/cloudflare/resources/calls.py rename to src/cloudflare/resources/calls/calls.py index 71d97f590e8..17455714979 100644 --- a/src/cloudflare/resources/calls.py +++ b/src/cloudflare/resources/calls/calls.py @@ -6,33 +6,47 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( +from .turn import ( + TURNResource, + AsyncTURNResource, + TURNResourceWithRawResponse, + AsyncTURNResourceWithRawResponse, + TURNResourceWithStreamingResponse, + AsyncTURNResourceWithStreamingResponse, +) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( maybe_transform, async_maybe_transform, ) -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( +from ..._compat import cached_property +from .turn.turn import TURNResource, AsyncTURNResource +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 ..types.calls import call_create_params, call_update_params -from .._base_client import ( +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 +from ...types.calls.calls_app import CallsApp +from ...types.calls.call_list_response import CallListResponse +from ...types.calls.calls_app_with_secret import CallsAppWithSecret __all__ = ["CallsResource", "AsyncCallsResource"] class CallsResource(SyncAPIResource): + @cached_property + def turn(self) -> TURNResource: + return TURNResource(self._client) + @cached_property def with_raw_response(self) -> CallsResourceWithRawResponse: return CallsResourceWithRawResponse(self) @@ -144,7 +158,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[CallsApp]: + ) -> SyncSinglePage[CallListResponse]: """ Lists all apps in the Cloudflare account @@ -163,11 +177,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}/calls/apps", - page=SyncSinglePage[CallsApp], + page=SyncSinglePage[CallListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=CallsApp, + model=str, ) def delete( @@ -260,6 +274,10 @@ def get( class AsyncCallsResource(AsyncAPIResource): + @cached_property + def turn(self) -> AsyncTURNResource: + return AsyncTURNResource(self._client) + @cached_property def with_raw_response(self) -> AsyncCallsResourceWithRawResponse: return AsyncCallsResourceWithRawResponse(self) @@ -371,7 +389,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[CallsApp, AsyncSinglePage[CallsApp]]: + ) -> AsyncPaginator[CallListResponse, AsyncSinglePage[CallListResponse]]: """ Lists all apps in the Cloudflare account @@ -390,11 +408,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}/calls/apps", - page=AsyncSinglePage[CallsApp], + page=AsyncSinglePage[CallListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=CallsApp, + model=str, ) async def delete( @@ -506,6 +524,10 @@ def __init__(self, calls: CallsResource) -> None: calls.get, ) + @cached_property + def turn(self) -> TURNResourceWithRawResponse: + return TURNResourceWithRawResponse(self._calls.turn) + class AsyncCallsResourceWithRawResponse: def __init__(self, calls: AsyncCallsResource) -> None: @@ -527,6 +549,10 @@ def __init__(self, calls: AsyncCallsResource) -> None: calls.get, ) + @cached_property + def turn(self) -> AsyncTURNResourceWithRawResponse: + return AsyncTURNResourceWithRawResponse(self._calls.turn) + class CallsResourceWithStreamingResponse: def __init__(self, calls: CallsResource) -> None: @@ -548,6 +574,10 @@ def __init__(self, calls: CallsResource) -> None: calls.get, ) + @cached_property + def turn(self) -> TURNResourceWithStreamingResponse: + return TURNResourceWithStreamingResponse(self._calls.turn) + class AsyncCallsResourceWithStreamingResponse: def __init__(self, calls: AsyncCallsResource) -> None: @@ -568,3 +598,7 @@ def __init__(self, calls: AsyncCallsResource) -> None: self.get = async_to_streamed_response_wrapper( calls.get, ) + + @cached_property + def turn(self) -> AsyncTURNResourceWithStreamingResponse: + return AsyncTURNResourceWithStreamingResponse(self._calls.turn) diff --git a/src/cloudflare/resources/calls/turn/__init__.py b/src/cloudflare/resources/calls/turn/__init__.py new file mode 100644 index 00000000000..4ad11d459cd --- /dev/null +++ b/src/cloudflare/resources/calls/turn/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .keys import ( + KeysResource, + AsyncKeysResource, + KeysResourceWithRawResponse, + AsyncKeysResourceWithRawResponse, + KeysResourceWithStreamingResponse, + AsyncKeysResourceWithStreamingResponse, +) +from .turn import ( + TURNResource, + AsyncTURNResource, + TURNResourceWithRawResponse, + AsyncTURNResourceWithRawResponse, + TURNResourceWithStreamingResponse, + AsyncTURNResourceWithStreamingResponse, +) + +__all__ = [ + "KeysResource", + "AsyncKeysResource", + "KeysResourceWithRawResponse", + "AsyncKeysResourceWithRawResponse", + "KeysResourceWithStreamingResponse", + "AsyncKeysResourceWithStreamingResponse", + "TURNResource", + "AsyncTURNResource", + "TURNResourceWithRawResponse", + "AsyncTURNResourceWithRawResponse", + "TURNResourceWithStreamingResponse", + "AsyncTURNResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/calls/turn/keys.py b/src/cloudflare/resources/calls/turn/keys.py new file mode 100644 index 00000000000..f87b1c8c6f4 --- /dev/null +++ b/src/cloudflare/resources/calls/turn/keys.py @@ -0,0 +1,561 @@ +# 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.calls.turn import key_create_params, key_update_params +from ....types.calls.turn.key_get_response import KeyGetResponse +from ....types.calls.turn.key_list_response import KeyListResponse +from ....types.calls.turn.key_create_response import KeyCreateResponse +from ....types.calls.turn.key_delete_response import KeyDeleteResponse +from ....types.calls.turn.key_update_response import KeyUpdateResponse + +__all__ = ["KeysResource", "AsyncKeysResource"] + + +class KeysResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> KeysResourceWithRawResponse: + return KeysResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> KeysResourceWithStreamingResponse: + return KeysResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> KeyCreateResponse: + """ + Creates a new Cloudflare Calls TURN key. + + Args: + account_id: The account identifier tag. + + name: A short description of a TURN key, not shown to end users. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._post( + f"/accounts/{account_id}/calls/turn_keys", + body=maybe_transform({"name": name}, key_create_params.KeyCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=KeyCreateResponse, + ) + + def update( + self, + key_id: str, + *, + account_id: str, + name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> str: + """ + Edit details for a single TURN key. + + Args: + account_id: The account identifier tag. + + key_id: A Cloudflare-generated unique identifier for a item. + + name: A short description of a TURN key, not shown to end users. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 key_id: + raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") + return self._put( + f"/accounts/{account_id}/calls/turn_keys/{key_id}", + body=maybe_transform({"name": name}, key_update_params.KeyUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[KeyUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[str], ResultWrapper[str]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[KeyListResponse]: + """ + Lists all TURN keys in the Cloudflare account + + Args: + account_id: The account identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/calls/turn_keys", + page=SyncSinglePage[KeyListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=str, + ) + + def delete( + self, + key_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, + ) -> str: + """ + Deletes a TURN key from Cloudflare Calls + + Args: + account_id: The account identifier tag. + + key_id: A Cloudflare-generated unique identifier for a 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 key_id: + raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") + return self._delete( + f"/accounts/{account_id}/calls/turn_keys/{key_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[KeyDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[str], ResultWrapper[str]), + ) + + def get( + self, + key_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, + ) -> str: + """ + Fetches details for a single TURN key. + + Args: + account_id: The account identifier tag. + + key_id: A Cloudflare-generated unique identifier for a 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 key_id: + raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") + return self._get( + f"/accounts/{account_id}/calls/turn_keys/{key_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[KeyGetResponse]]._unwrapper, + ), + cast_to=cast(Type[str], ResultWrapper[str]), + ) + + +class AsyncKeysResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncKeysResourceWithRawResponse: + return AsyncKeysResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncKeysResourceWithStreamingResponse: + return AsyncKeysResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> KeyCreateResponse: + """ + Creates a new Cloudflare Calls TURN key. + + Args: + account_id: The account identifier tag. + + name: A short description of a TURN key, not shown to end users. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._post( + f"/accounts/{account_id}/calls/turn_keys", + body=await async_maybe_transform({"name": name}, key_create_params.KeyCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=KeyCreateResponse, + ) + + async def update( + self, + key_id: str, + *, + account_id: str, + name: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> str: + """ + Edit details for a single TURN key. + + Args: + account_id: The account identifier tag. + + key_id: A Cloudflare-generated unique identifier for a item. + + name: A short description of a TURN key, not shown to end users. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 key_id: + raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") + return await self._put( + f"/accounts/{account_id}/calls/turn_keys/{key_id}", + body=await async_maybe_transform({"name": name}, key_update_params.KeyUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[KeyUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[str], ResultWrapper[str]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[KeyListResponse, AsyncSinglePage[KeyListResponse]]: + """ + Lists all TURN keys in the Cloudflare account + + Args: + account_id: The account identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/calls/turn_keys", + page=AsyncSinglePage[KeyListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=str, + ) + + async def delete( + self, + key_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, + ) -> str: + """ + Deletes a TURN key from Cloudflare Calls + + Args: + account_id: The account identifier tag. + + key_id: A Cloudflare-generated unique identifier for a 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 key_id: + raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") + return await self._delete( + f"/accounts/{account_id}/calls/turn_keys/{key_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[KeyDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[str], ResultWrapper[str]), + ) + + async def get( + self, + key_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, + ) -> str: + """ + Fetches details for a single TURN key. + + Args: + account_id: The account identifier tag. + + key_id: A Cloudflare-generated unique identifier for a 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 key_id: + raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") + return await self._get( + f"/accounts/{account_id}/calls/turn_keys/{key_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[KeyGetResponse]]._unwrapper, + ), + cast_to=cast(Type[str], ResultWrapper[str]), + ) + + +class KeysResourceWithRawResponse: + def __init__(self, keys: KeysResource) -> None: + self._keys = keys + + self.create = to_raw_response_wrapper( + keys.create, + ) + self.update = to_raw_response_wrapper( + keys.update, + ) + self.list = to_raw_response_wrapper( + keys.list, + ) + self.delete = to_raw_response_wrapper( + keys.delete, + ) + self.get = to_raw_response_wrapper( + keys.get, + ) + + +class AsyncKeysResourceWithRawResponse: + def __init__(self, keys: AsyncKeysResource) -> None: + self._keys = keys + + self.create = async_to_raw_response_wrapper( + keys.create, + ) + self.update = async_to_raw_response_wrapper( + keys.update, + ) + self.list = async_to_raw_response_wrapper( + keys.list, + ) + self.delete = async_to_raw_response_wrapper( + keys.delete, + ) + self.get = async_to_raw_response_wrapper( + keys.get, + ) + + +class KeysResourceWithStreamingResponse: + def __init__(self, keys: KeysResource) -> None: + self._keys = keys + + self.create = to_streamed_response_wrapper( + keys.create, + ) + self.update = to_streamed_response_wrapper( + keys.update, + ) + self.list = to_streamed_response_wrapper( + keys.list, + ) + self.delete = to_streamed_response_wrapper( + keys.delete, + ) + self.get = to_streamed_response_wrapper( + keys.get, + ) + + +class AsyncKeysResourceWithStreamingResponse: + def __init__(self, keys: AsyncKeysResource) -> None: + self._keys = keys + + self.create = async_to_streamed_response_wrapper( + keys.create, + ) + self.update = async_to_streamed_response_wrapper( + keys.update, + ) + self.list = async_to_streamed_response_wrapper( + keys.list, + ) + self.delete = async_to_streamed_response_wrapper( + keys.delete, + ) + self.get = async_to_streamed_response_wrapper( + keys.get, + ) diff --git a/src/cloudflare/resources/calls/turn/turn.py b/src/cloudflare/resources/calls/turn/turn.py new file mode 100644 index 00000000000..830fa7f663b --- /dev/null +++ b/src/cloudflare/resources/calls/turn/turn.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .keys import ( + KeysResource, + AsyncKeysResource, + KeysResourceWithRawResponse, + AsyncKeysResourceWithRawResponse, + KeysResourceWithStreamingResponse, + AsyncKeysResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["TURNResource", "AsyncTURNResource"] + + +class TURNResource(SyncAPIResource): + @cached_property + def keys(self) -> KeysResource: + return KeysResource(self._client) + + @cached_property + def with_raw_response(self) -> TURNResourceWithRawResponse: + return TURNResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TURNResourceWithStreamingResponse: + return TURNResourceWithStreamingResponse(self) + + +class AsyncTURNResource(AsyncAPIResource): + @cached_property + def keys(self) -> AsyncKeysResource: + return AsyncKeysResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncTURNResourceWithRawResponse: + return AsyncTURNResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTURNResourceWithStreamingResponse: + return AsyncTURNResourceWithStreamingResponse(self) + + +class TURNResourceWithRawResponse: + def __init__(self, turn: TURNResource) -> None: + self._turn = turn + + @cached_property + def keys(self) -> KeysResourceWithRawResponse: + return KeysResourceWithRawResponse(self._turn.keys) + + +class AsyncTURNResourceWithRawResponse: + def __init__(self, turn: AsyncTURNResource) -> None: + self._turn = turn + + @cached_property + def keys(self) -> AsyncKeysResourceWithRawResponse: + return AsyncKeysResourceWithRawResponse(self._turn.keys) + + +class TURNResourceWithStreamingResponse: + def __init__(self, turn: TURNResource) -> None: + self._turn = turn + + @cached_property + def keys(self) -> KeysResourceWithStreamingResponse: + return KeysResourceWithStreamingResponse(self._turn.keys) + + +class AsyncTURNResourceWithStreamingResponse: + def __init__(self, turn: AsyncTURNResource) -> None: + self._turn = turn + + @cached_property + def keys(self) -> AsyncKeysResourceWithStreamingResponse: + return AsyncKeysResourceWithStreamingResponse(self._turn.keys) diff --git a/src/cloudflare/resources/d1/database.py b/src/cloudflare/resources/d1/database.py index fbdcdffd1f5..d4b4ca58763 100644 --- a/src/cloudflare/resources/d1/database.py +++ b/src/cloudflare/resources/d1/database.py @@ -12,7 +12,7 @@ async_maybe_transform, ) from ..._compat import cached_property -from ...types.d1 import database_list_params, database_query_params, database_create_params +from ...types.d1 import database_raw_params, database_list_params, database_query_params, database_create_params from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( to_raw_response_wrapper, @@ -27,6 +27,7 @@ AsyncPaginator, make_request_options, ) +from ...types.d1.database_raw_response import DatabaseRawResponse from ...types.d1.database_list_response import DatabaseListResponse from ...types.d1.database_query_response import DatabaseQueryResponse from ...types.d1.database_create_response import DatabaseCreateResponse @@ -143,9 +144,9 @@ def list( def delete( self, - database_identifier: str, + database_id: 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, @@ -157,7 +158,7 @@ def delete( Deletes the specified D1 database. Args: - account_identifier: Account identifier tag. + account_id: Account identifier tag. extra_headers: Send extra headers @@ -167,16 +168,14 @@ 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 database_identifier: - raise ValueError( - f"Expected a non-empty value for `database_identifier` but received {database_identifier!r}" - ) + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not database_id: + raise ValueError(f"Expected a non-empty value for `database_id` but received {database_id!r}") return cast( DatabaseDeleteResponse, self._delete( - f"/accounts/{account_identifier}/d1/database/{database_identifier}", + f"/accounts/{account_id}/d1/database/{database_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -192,9 +191,9 @@ def delete( def get( self, - database_identifier: str, + database_id: 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, @@ -206,7 +205,7 @@ def get( Returns the specified D1 database. Args: - account_identifier: Account identifier tag. + account_id: Account identifier tag. extra_headers: Send extra headers @@ -216,14 +215,12 @@ 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 database_identifier: - raise ValueError( - f"Expected a non-empty value for `database_identifier` but received {database_identifier!r}" - ) + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not database_id: + raise ValueError(f"Expected a non-empty value for `database_id` but received {database_id!r}") return self._get( - f"/accounts/{account_identifier}/d1/database/{database_identifier}", + f"/accounts/{account_id}/d1/database/{database_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -236,9 +233,9 @@ def get( def query( self, - database_identifier: str, + database_id: str, *, - account_identifier: str, + account_id: str, sql: str, params: 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. @@ -249,10 +246,10 @@ def query( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> DatabaseQueryResponse: """ - Returns the query result. + Returns the query result as an object. Args: - account_identifier: Account identifier tag. + account_id: Account identifier tag. extra_headers: Send extra headers @@ -262,14 +259,12 @@ 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 database_identifier: - raise ValueError( - f"Expected a non-empty value for `database_identifier` but received {database_identifier!r}" - ) + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not database_id: + raise ValueError(f"Expected a non-empty value for `database_id` but received {database_id!r}") return self._post( - f"/accounts/{account_identifier}/d1/database/{database_identifier}/query", + f"/accounts/{account_id}/d1/database/{database_id}/query", body=maybe_transform( { "sql": sql, @@ -287,6 +282,59 @@ def query( cast_to=cast(Type[DatabaseQueryResponse], ResultWrapper[DatabaseQueryResponse]), ) + def raw( + self, + database_id: str, + *, + account_id: str, + sql: str, + params: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DatabaseRawResponse: + """Returns the query result rows as arrays rather than objects. + + This is a + performance-optimized version of the /query endpoint. + + Args: + account_id: Account identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not database_id: + raise ValueError(f"Expected a non-empty value for `database_id` but received {database_id!r}") + return self._post( + f"/accounts/{account_id}/d1/database/{database_id}/raw", + body=maybe_transform( + { + "sql": sql, + "params": params, + }, + database_raw_params.DatabaseRawParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[DatabaseRawResponse]._unwrapper, + ), + cast_to=cast(Type[DatabaseRawResponse], ResultWrapper[DatabaseRawResponse]), + ) + class AsyncDatabaseResource(AsyncAPIResource): @cached_property @@ -396,9 +444,9 @@ def list( async def delete( self, - database_identifier: str, + database_id: 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, @@ -410,7 +458,7 @@ async def delete( Deletes the specified D1 database. Args: - account_identifier: Account identifier tag. + account_id: Account identifier tag. extra_headers: Send extra headers @@ -420,16 +468,14 @@ 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 database_identifier: - raise ValueError( - f"Expected a non-empty value for `database_identifier` but received {database_identifier!r}" - ) + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not database_id: + raise ValueError(f"Expected a non-empty value for `database_id` but received {database_id!r}") return cast( DatabaseDeleteResponse, await self._delete( - f"/accounts/{account_identifier}/d1/database/{database_identifier}", + f"/accounts/{account_id}/d1/database/{database_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -445,9 +491,9 @@ async def delete( async def get( self, - database_identifier: str, + database_id: 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, @@ -459,7 +505,7 @@ async def get( Returns the specified D1 database. Args: - account_identifier: Account identifier tag. + account_id: Account identifier tag. extra_headers: Send extra headers @@ -469,14 +515,12 @@ 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 database_identifier: - raise ValueError( - f"Expected a non-empty value for `database_identifier` but received {database_identifier!r}" - ) + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not database_id: + raise ValueError(f"Expected a non-empty value for `database_id` but received {database_id!r}") return await self._get( - f"/accounts/{account_identifier}/d1/database/{database_identifier}", + f"/accounts/{account_id}/d1/database/{database_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -489,9 +533,9 @@ async def get( async def query( self, - database_identifier: str, + database_id: str, *, - account_identifier: str, + account_id: str, sql: str, params: 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. @@ -502,10 +546,10 @@ async def query( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> DatabaseQueryResponse: """ - Returns the query result. + Returns the query result as an object. Args: - account_identifier: Account identifier tag. + account_id: Account identifier tag. extra_headers: Send extra headers @@ -515,14 +559,12 @@ 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 database_identifier: - raise ValueError( - f"Expected a non-empty value for `database_identifier` but received {database_identifier!r}" - ) + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not database_id: + raise ValueError(f"Expected a non-empty value for `database_id` but received {database_id!r}") return await self._post( - f"/accounts/{account_identifier}/d1/database/{database_identifier}/query", + f"/accounts/{account_id}/d1/database/{database_id}/query", body=await async_maybe_transform( { "sql": sql, @@ -540,6 +582,59 @@ async def query( cast_to=cast(Type[DatabaseQueryResponse], ResultWrapper[DatabaseQueryResponse]), ) + async def raw( + self, + database_id: str, + *, + account_id: str, + sql: str, + params: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> DatabaseRawResponse: + """Returns the query result rows as arrays rather than objects. + + This is a + performance-optimized version of the /query endpoint. + + Args: + account_id: Account identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not database_id: + raise ValueError(f"Expected a non-empty value for `database_id` but received {database_id!r}") + return await self._post( + f"/accounts/{account_id}/d1/database/{database_id}/raw", + body=await async_maybe_transform( + { + "sql": sql, + "params": params, + }, + database_raw_params.DatabaseRawParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[DatabaseRawResponse]._unwrapper, + ), + cast_to=cast(Type[DatabaseRawResponse], ResultWrapper[DatabaseRawResponse]), + ) + class DatabaseResourceWithRawResponse: def __init__(self, database: DatabaseResource) -> None: @@ -560,6 +655,9 @@ def __init__(self, database: DatabaseResource) -> None: self.query = to_raw_response_wrapper( database.query, ) + self.raw = to_raw_response_wrapper( + database.raw, + ) class AsyncDatabaseResourceWithRawResponse: @@ -581,6 +679,9 @@ def __init__(self, database: AsyncDatabaseResource) -> None: self.query = async_to_raw_response_wrapper( database.query, ) + self.raw = async_to_raw_response_wrapper( + database.raw, + ) class DatabaseResourceWithStreamingResponse: @@ -602,6 +703,9 @@ def __init__(self, database: DatabaseResource) -> None: self.query = to_streamed_response_wrapper( database.query, ) + self.raw = to_streamed_response_wrapper( + database.raw, + ) class AsyncDatabaseResourceWithStreamingResponse: @@ -623,3 +727,6 @@ def __init__(self, database: AsyncDatabaseResource) -> None: self.query = async_to_streamed_response_wrapper( database.query, ) + self.raw = async_to_streamed_response_wrapper( + database.raw, + ) diff --git a/src/cloudflare/resources/dcv_delegation/uuid.py b/src/cloudflare/resources/dcv_delegation.py similarity index 67% rename from src/cloudflare/resources/dcv_delegation/uuid.py rename to src/cloudflare/resources/dcv_delegation.py index c0c57c0ea2c..18aa2d28f43 100644 --- a/src/cloudflare/resources/dcv_delegation/uuid.py +++ b/src/cloudflare/resources/dcv_delegation.py @@ -6,32 +6,32 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( +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 ( +from .._wrappers import ResultWrapper +from .._base_client import ( make_request_options, ) -from ...types.dcv_delegation.dcv_delegation_uuid import DCVDelegationUUID +from ..types.dcv_delegation.dcv_delegation_uuid import DCVDelegationUUID -__all__ = ["UUIDResource", "AsyncUUIDResource"] +__all__ = ["DCVDelegationResource", "AsyncDCVDelegationResource"] -class UUIDResource(SyncAPIResource): +class DCVDelegationResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> UUIDResourceWithRawResponse: - return UUIDResourceWithRawResponse(self) + def with_raw_response(self) -> DCVDelegationResourceWithRawResponse: + return DCVDelegationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> UUIDResourceWithStreamingResponse: - return UUIDResourceWithStreamingResponse(self) + def with_streaming_response(self) -> DCVDelegationResourceWithStreamingResponse: + return DCVDelegationResourceWithStreamingResponse(self) def get( self, @@ -74,14 +74,14 @@ def get( ) -class AsyncUUIDResource(AsyncAPIResource): +class AsyncDCVDelegationResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncUUIDResourceWithRawResponse: - return AsyncUUIDResourceWithRawResponse(self) + def with_raw_response(self) -> AsyncDCVDelegationResourceWithRawResponse: + return AsyncDCVDelegationResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncUUIDResourceWithStreamingResponse: - return AsyncUUIDResourceWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDCVDelegationResourceWithStreamingResponse: + return AsyncDCVDelegationResourceWithStreamingResponse(self) async def get( self, @@ -124,37 +124,37 @@ async def get( ) -class UUIDResourceWithRawResponse: - def __init__(self, uuid: UUIDResource) -> None: - self._uuid = uuid +class DCVDelegationResourceWithRawResponse: + def __init__(self, dcv_delegation: DCVDelegationResource) -> None: + self._dcv_delegation = dcv_delegation self.get = to_raw_response_wrapper( - uuid.get, + dcv_delegation.get, ) -class AsyncUUIDResourceWithRawResponse: - def __init__(self, uuid: AsyncUUIDResource) -> None: - self._uuid = uuid +class AsyncDCVDelegationResourceWithRawResponse: + def __init__(self, dcv_delegation: AsyncDCVDelegationResource) -> None: + self._dcv_delegation = dcv_delegation self.get = async_to_raw_response_wrapper( - uuid.get, + dcv_delegation.get, ) -class UUIDResourceWithStreamingResponse: - def __init__(self, uuid: UUIDResource) -> None: - self._uuid = uuid +class DCVDelegationResourceWithStreamingResponse: + def __init__(self, dcv_delegation: DCVDelegationResource) -> None: + self._dcv_delegation = dcv_delegation self.get = to_streamed_response_wrapper( - uuid.get, + dcv_delegation.get, ) -class AsyncUUIDResourceWithStreamingResponse: - def __init__(self, uuid: AsyncUUIDResource) -> None: - self._uuid = uuid +class AsyncDCVDelegationResourceWithStreamingResponse: + def __init__(self, dcv_delegation: AsyncDCVDelegationResource) -> None: + self._dcv_delegation = dcv_delegation self.get = async_to_streamed_response_wrapper( - uuid.get, + dcv_delegation.get, ) diff --git a/src/cloudflare/resources/dcv_delegation/__init__.py b/src/cloudflare/resources/dcv_delegation/__init__.py deleted file mode 100644 index 774c44e1985..00000000000 --- a/src/cloudflare/resources/dcv_delegation/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .uuid import ( - UUIDResource, - AsyncUUIDResource, - UUIDResourceWithRawResponse, - AsyncUUIDResourceWithRawResponse, - UUIDResourceWithStreamingResponse, - AsyncUUIDResourceWithStreamingResponse, -) -from .dcv_delegation import ( - DCVDelegationResource, - AsyncDCVDelegationResource, - DCVDelegationResourceWithRawResponse, - AsyncDCVDelegationResourceWithRawResponse, - DCVDelegationResourceWithStreamingResponse, - AsyncDCVDelegationResourceWithStreamingResponse, -) - -__all__ = [ - "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 deleted file mode 100644 index d09a30ea18c..00000000000 --- a/src/cloudflare/resources/dcv_delegation/dcv_delegation.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 .uuid import ( - UUIDResource, - AsyncUUIDResource, - UUIDResourceWithRawResponse, - AsyncUUIDResourceWithRawResponse, - UUIDResourceWithStreamingResponse, - AsyncUUIDResourceWithStreamingResponse, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["DCVDelegationResource", "AsyncDCVDelegationResource"] - - -class DCVDelegationResource(SyncAPIResource): - @cached_property - def uuid(self) -> UUIDResource: - return UUIDResource(self._client) - - @cached_property - def with_raw_response(self) -> DCVDelegationResourceWithRawResponse: - return DCVDelegationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DCVDelegationResourceWithStreamingResponse: - return DCVDelegationResourceWithStreamingResponse(self) - - -class AsyncDCVDelegationResource(AsyncAPIResource): - @cached_property - def uuid(self) -> AsyncUUIDResource: - return AsyncUUIDResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncDCVDelegationResourceWithRawResponse: - return AsyncDCVDelegationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDCVDelegationResourceWithStreamingResponse: - return AsyncDCVDelegationResourceWithStreamingResponse(self) - - -class DCVDelegationResourceWithRawResponse: - def __init__(self, dcv_delegation: DCVDelegationResource) -> None: - self._dcv_delegation = dcv_delegation - - @cached_property - def uuid(self) -> UUIDResourceWithRawResponse: - return UUIDResourceWithRawResponse(self._dcv_delegation.uuid) - - -class AsyncDCVDelegationResourceWithRawResponse: - def __init__(self, dcv_delegation: AsyncDCVDelegationResource) -> None: - self._dcv_delegation = dcv_delegation - - @cached_property - def uuid(self) -> AsyncUUIDResourceWithRawResponse: - return AsyncUUIDResourceWithRawResponse(self._dcv_delegation.uuid) - - -class DCVDelegationResourceWithStreamingResponse: - def __init__(self, dcv_delegation: DCVDelegationResource) -> None: - self._dcv_delegation = dcv_delegation - - @cached_property - def uuid(self) -> UUIDResourceWithStreamingResponse: - return UUIDResourceWithStreamingResponse(self._dcv_delegation.uuid) - - -class AsyncDCVDelegationResourceWithStreamingResponse: - def __init__(self, dcv_delegation: AsyncDCVDelegationResource) -> None: - self._dcv_delegation = dcv_delegation - - @cached_property - def uuid(self) -> AsyncUUIDResourceWithStreamingResponse: - return AsyncUUIDResourceWithStreamingResponse(self._dcv_delegation.uuid) diff --git a/src/cloudflare/resources/dns/__init__.py b/src/cloudflare/resources/dns/__init__.py index 6f835256c8d..7e394f00159 100644 --- a/src/cloudflare/resources/dns/__init__.py +++ b/src/cloudflare/resources/dns/__init__.py @@ -24,6 +24,14 @@ FirewallResourceWithStreamingResponse, AsyncFirewallResourceWithStreamingResponse, ) +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) from .analytics import ( AnalyticsResource, AsyncAnalyticsResource, @@ -40,6 +48,12 @@ "AsyncRecordsResourceWithRawResponse", "RecordsResourceWithStreamingResponse", "AsyncRecordsResourceWithStreamingResponse", + "SettingsResource", + "AsyncSettingsResource", + "SettingsResourceWithRawResponse", + "AsyncSettingsResourceWithRawResponse", + "SettingsResourceWithStreamingResponse", + "AsyncSettingsResourceWithStreamingResponse", "AnalyticsResource", "AsyncAnalyticsResource", "AnalyticsResourceWithRawResponse", diff --git a/src/cloudflare/resources/dns/dns.py b/src/cloudflare/resources/dns/dns.py index 2f71f123a84..7f758f9e906 100644 --- a/src/cloudflare/resources/dns/dns.py +++ b/src/cloudflare/resources/dns/dns.py @@ -18,6 +18,14 @@ FirewallResourceWithStreamingResponse, AsyncFirewallResourceWithStreamingResponse, ) +from .settings import ( + SettingsResource, + AsyncSettingsResource, + SettingsResourceWithRawResponse, + AsyncSettingsResourceWithRawResponse, + SettingsResourceWithStreamingResponse, + AsyncSettingsResourceWithStreamingResponse, +) from ..._compat import cached_property from .analytics import ( AnalyticsResource, @@ -39,6 +47,10 @@ class DNSResource(SyncAPIResource): def records(self) -> RecordsResource: return RecordsResource(self._client) + @cached_property + def settings(self) -> SettingsResource: + return SettingsResource(self._client) + @cached_property def analytics(self) -> AnalyticsResource: return AnalyticsResource(self._client) @@ -61,6 +73,10 @@ class AsyncDNSResource(AsyncAPIResource): def records(self) -> AsyncRecordsResource: return AsyncRecordsResource(self._client) + @cached_property + def settings(self) -> AsyncSettingsResource: + return AsyncSettingsResource(self._client) + @cached_property def analytics(self) -> AsyncAnalyticsResource: return AsyncAnalyticsResource(self._client) @@ -86,6 +102,10 @@ def __init__(self, dns: DNSResource) -> None: def records(self) -> RecordsResourceWithRawResponse: return RecordsResourceWithRawResponse(self._dns.records) + @cached_property + def settings(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self._dns.settings) + @cached_property def analytics(self) -> AnalyticsResourceWithRawResponse: return AnalyticsResourceWithRawResponse(self._dns.analytics) @@ -103,6 +123,10 @@ def __init__(self, dns: AsyncDNSResource) -> None: def records(self) -> AsyncRecordsResourceWithRawResponse: return AsyncRecordsResourceWithRawResponse(self._dns.records) + @cached_property + def settings(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self._dns.settings) + @cached_property def analytics(self) -> AsyncAnalyticsResourceWithRawResponse: return AsyncAnalyticsResourceWithRawResponse(self._dns.analytics) @@ -120,6 +144,10 @@ def __init__(self, dns: DNSResource) -> None: def records(self) -> RecordsResourceWithStreamingResponse: return RecordsResourceWithStreamingResponse(self._dns.records) + @cached_property + def settings(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self._dns.settings) + @cached_property def analytics(self) -> AnalyticsResourceWithStreamingResponse: return AnalyticsResourceWithStreamingResponse(self._dns.analytics) @@ -137,6 +165,10 @@ def __init__(self, dns: AsyncDNSResource) -> None: def records(self) -> AsyncRecordsResourceWithStreamingResponse: return AsyncRecordsResourceWithStreamingResponse(self._dns.records) + @cached_property + def settings(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self._dns.settings) + @cached_property def analytics(self) -> AsyncAnalyticsResourceWithStreamingResponse: return AsyncAnalyticsResourceWithStreamingResponse(self._dns.analytics) diff --git a/src/cloudflare/resources/dns/records.py b/src/cloudflare/resources/dns/records.py index a3fc72a9354..b5142133fe4 100644 --- a/src/cloudflare/resources/dns/records.py +++ b/src/cloudflare/resources/dns/records.py @@ -1199,24 +1199,8 @@ def create( @required_args( ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], ["zone_id", "data", "name", "type"], ["zone_id", "content", "name", "priority", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], ["zone_id", "data", "name", "priority", "type"], ) def create( @@ -2486,24 +2470,8 @@ def update( @required_args( ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], ["zone_id", "data", "name", "type"], ["zone_id", "content", "name", "priority", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], ["zone_id", "data", "name", "priority", "type"], ) def update( @@ -3944,25 +3912,9 @@ def edit( ... @required_args( - ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], ["zone_id", "content", "name", "type"], ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], ["zone_id", "content", "name", "priority", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], ["zone_id", "data", "name", "priority", "type"], ) def edit( @@ -5403,24 +5355,8 @@ async def create( @required_args( ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], ["zone_id", "data", "name", "type"], ["zone_id", "content", "name", "priority", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], ["zone_id", "data", "name", "priority", "type"], ) async def create( @@ -6690,24 +6626,8 @@ async def update( @required_args( ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], ["zone_id", "data", "name", "type"], ["zone_id", "content", "name", "priority", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], ["zone_id", "data", "name", "priority", "type"], ) async def update( @@ -8148,25 +8068,9 @@ async def edit( ... @required_args( - ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], ["zone_id", "content", "name", "type"], ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], ["zone_id", "content", "name", "priority", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "content", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "data", "name", "type"], - ["zone_id", "content", "name", "type"], ["zone_id", "data", "name", "priority", "type"], ) async def edit( diff --git a/src/cloudflare/resources/dns/settings.py b/src/cloudflare/resources/dns/settings.py new file mode 100644 index 00000000000..635b4b77250 --- /dev/null +++ b/src/cloudflare/resources/dns/settings.py @@ -0,0 +1,311 @@ +# 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 ...types.dns import setting_edit_params +from ..._base_client import ( + make_request_options, +) +from ...types.dns.dns_setting_param import DNSSettingParam +from ...types.dns.setting_get_response import SettingGetResponse +from ...types.dns.setting_edit_response import SettingEditResponse + +__all__ = ["SettingsResource", "AsyncSettingsResource"] + + +class SettingsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SettingsResourceWithRawResponse: + return SettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: + return SettingsResourceWithStreamingResponse(self) + + def edit( + self, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + zone_defaults: DNSSettingParam | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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]: + """ + Update DNS settings for an account or zone + + Args: + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if account_id and zone_id: + raise ValueError("You cannot provide both account_id and zone_id") + + if account_id: + account_or_zone = "accounts" + account_or_zone_id = account_id + else: + if not zone_id: + raise ValueError("You must provide either account_id or zone_id") + + account_or_zone = "zones" + account_or_zone_id = zone_id + return self._patch( + f"/{account_or_zone}/{account_or_zone_id}/dns_settings", + body=maybe_transform({"zone_defaults": zone_defaults}, 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[Optional[SettingEditResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]), + ) + + def get( + self, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[SettingGetResponse]: + """ + Show DNS settings for an account or zone + + Args: + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if account_id and zone_id: + raise ValueError("You cannot provide both account_id and zone_id") + + if account_id: + account_or_zone = "accounts" + account_or_zone_id = account_id + else: + if not zone_id: + raise ValueError("You must provide either account_id or zone_id") + + account_or_zone = "zones" + account_or_zone_id = zone_id + return self._get( + f"/{account_or_zone}/{account_or_zone_id}/dns_settings", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[SettingGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]), + ) + + +class AsyncSettingsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: + return AsyncSettingsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: + return AsyncSettingsResourceWithStreamingResponse(self) + + async def edit( + self, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + zone_defaults: DNSSettingParam | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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]: + """ + Update DNS settings for an account or zone + + Args: + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if account_id and zone_id: + raise ValueError("You cannot provide both account_id and zone_id") + + if account_id: + account_or_zone = "accounts" + account_or_zone_id = account_id + else: + if not zone_id: + raise ValueError("You must provide either account_id or zone_id") + + account_or_zone = "zones" + account_or_zone_id = zone_id + return await self._patch( + f"/{account_or_zone}/{account_or_zone_id}/dns_settings", + body=await async_maybe_transform({"zone_defaults": zone_defaults}, 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[Optional[SettingEditResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]), + ) + + async def get( + self, + *, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[SettingGetResponse]: + """ + Show DNS settings for an account or zone + + Args: + account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + + zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if account_id and zone_id: + raise ValueError("You cannot provide both account_id and zone_id") + + if account_id: + account_or_zone = "accounts" + account_or_zone_id = account_id + else: + if not zone_id: + raise ValueError("You must provide either account_id or zone_id") + + account_or_zone = "zones" + account_or_zone_id = zone_id + return await self._get( + f"/{account_or_zone}/{account_or_zone_id}/dns_settings", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[SettingGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]), + ) + + +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, + ) + + +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, + ) + + +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, + ) + + +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, + ) diff --git a/src/cloudflare/resources/filters.py b/src/cloudflare/resources/filters.py index 6e9f3b01354..7c71132b273 100644 --- a/src/cloudflare/resources/filters.py +++ b/src/cloudflare/resources/filters.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Type, Optional, cast import httpx @@ -41,6 +42,9 @@ def with_raw_response(self) -> FiltersResourceWithRawResponse: def with_streaming_response(self) -> FiltersResourceWithStreamingResponse: return FiltersResourceWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def create( self, zone_identifier: str, @@ -82,6 +86,9 @@ def create( cast_to=cast(Type[Optional[FilterCreateResponse]], ResultWrapper[FilterCreateResponse]), ) + @typing_extensions.deprecated( + "The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def update( self, id: str, @@ -128,6 +135,9 @@ def update( cast_to=cast(Type[FirewallFilter], ResultWrapper[FirewallFilter]), ) + @typing_extensions.deprecated( + "The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def list( self, zone_identifier: str, @@ -202,6 +212,9 @@ def list( model=FirewallFilter, ) + @typing_extensions.deprecated( + "The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def delete( self, id: str, @@ -246,6 +259,9 @@ def delete( cast_to=cast(Type[FirewallFilter], ResultWrapper[FirewallFilter]), ) + @typing_extensions.deprecated( + "The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def get( self, id: str, @@ -300,6 +316,9 @@ def with_raw_response(self) -> AsyncFiltersResourceWithRawResponse: def with_streaming_response(self) -> AsyncFiltersResourceWithStreamingResponse: return AsyncFiltersResourceWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) async def create( self, zone_identifier: str, @@ -341,6 +360,9 @@ async def create( cast_to=cast(Type[Optional[FilterCreateResponse]], ResultWrapper[FilterCreateResponse]), ) + @typing_extensions.deprecated( + "The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) async def update( self, id: str, @@ -387,6 +409,9 @@ async def update( cast_to=cast(Type[FirewallFilter], ResultWrapper[FirewallFilter]), ) + @typing_extensions.deprecated( + "The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def list( self, zone_identifier: str, @@ -461,6 +486,9 @@ def list( model=FirewallFilter, ) + @typing_extensions.deprecated( + "The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) async def delete( self, id: str, @@ -505,6 +533,9 @@ async def delete( cast_to=cast(Type[FirewallFilter], ResultWrapper[FirewallFilter]), ) + @typing_extensions.deprecated( + "The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) async def get( self, id: str, @@ -554,20 +585,30 @@ class FiltersResourceWithRawResponse: def __init__(self, filters: FiltersResource) -> None: self._filters = filters - self.create = to_raw_response_wrapper( - filters.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + filters.create # pyright: ignore[reportDeprecated], + ) ) - self.update = to_raw_response_wrapper( - filters.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + filters.update # pyright: ignore[reportDeprecated], + ) ) - self.list = to_raw_response_wrapper( - filters.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + filters.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_raw_response_wrapper( - filters.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + filters.delete # pyright: ignore[reportDeprecated], + ) ) - self.get = to_raw_response_wrapper( - filters.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + filters.get # pyright: ignore[reportDeprecated], + ) ) @@ -575,20 +616,30 @@ class AsyncFiltersResourceWithRawResponse: def __init__(self, filters: AsyncFiltersResource) -> None: self._filters = filters - self.create = async_to_raw_response_wrapper( - filters.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + filters.create # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_raw_response_wrapper( - filters.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + filters.update # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_raw_response_wrapper( - filters.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + filters.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_raw_response_wrapper( - filters.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + filters.delete # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_raw_response_wrapper( - filters.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + filters.get # pyright: ignore[reportDeprecated], + ) ) @@ -596,20 +647,30 @@ class FiltersResourceWithStreamingResponse: def __init__(self, filters: FiltersResource) -> None: self._filters = filters - self.create = to_streamed_response_wrapper( - filters.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + filters.create # pyright: ignore[reportDeprecated], + ) ) - self.update = to_streamed_response_wrapper( - filters.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + filters.update # pyright: ignore[reportDeprecated], + ) ) - self.list = to_streamed_response_wrapper( - filters.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + filters.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_streamed_response_wrapper( - filters.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + filters.delete # pyright: ignore[reportDeprecated], + ) ) - self.get = to_streamed_response_wrapper( - filters.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + filters.get # pyright: ignore[reportDeprecated], + ) ) @@ -617,18 +678,28 @@ class AsyncFiltersResourceWithStreamingResponse: def __init__(self, filters: AsyncFiltersResource) -> None: self._filters = filters - self.create = async_to_streamed_response_wrapper( - filters.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + filters.create # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_streamed_response_wrapper( - filters.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + filters.update # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_streamed_response_wrapper( - filters.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + filters.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_streamed_response_wrapper( - filters.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + filters.delete # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_streamed_response_wrapper( - filters.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + filters.get # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/cloudflare/resources/firewall/rules.py b/src/cloudflare/resources/firewall/rules.py index 9a3a377e651..8e58114ac84 100644 --- a/src/cloudflare/resources/firewall/rules.py +++ b/src/cloudflare/resources/firewall/rules.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Type, Optional, cast import httpx @@ -48,6 +49,9 @@ def with_raw_response(self) -> RulesResourceWithRawResponse: def with_streaming_response(self) -> RulesResourceWithStreamingResponse: return RulesResourceWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def create( self, zone_identifier: str, @@ -89,6 +93,9 @@ def create( cast_to=cast(Type[Optional[RuleCreateResponse]], ResultWrapper[RuleCreateResponse]), ) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def update( self, id: str, @@ -135,6 +142,9 @@ def update( cast_to=cast(Type[FirewallRule], ResultWrapper[FirewallRule]), ) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def list( self, zone_identifier: str, @@ -205,6 +215,9 @@ def list( model=FirewallRule, ) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def delete( self, id: str, @@ -249,6 +262,9 @@ def delete( cast_to=cast(Type[FirewallRule], ResultWrapper[FirewallRule]), ) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def edit( self, id: str, @@ -295,6 +311,9 @@ def edit( cast_to=cast(Type[Optional[RuleEditResponse]], ResultWrapper[RuleEditResponse]), ) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def get( self, zone_identifier: str, @@ -353,6 +372,9 @@ def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: return AsyncRulesResourceWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) async def create( self, zone_identifier: str, @@ -394,6 +416,9 @@ async def create( cast_to=cast(Type[Optional[RuleCreateResponse]], ResultWrapper[RuleCreateResponse]), ) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) async def update( self, id: str, @@ -440,6 +465,9 @@ async def update( cast_to=cast(Type[FirewallRule], ResultWrapper[FirewallRule]), ) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) def list( self, zone_identifier: str, @@ -510,6 +538,9 @@ def list( model=FirewallRule, ) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) async def delete( self, id: str, @@ -554,6 +585,9 @@ async def delete( cast_to=cast(Type[FirewallRule], ResultWrapper[FirewallRule]), ) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) async def edit( self, id: str, @@ -600,6 +634,9 @@ async def edit( cast_to=cast(Type[Optional[RuleEditResponse]], ResultWrapper[RuleEditResponse]), ) + @typing_extensions.deprecated( + "The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details." + ) async def get( self, zone_identifier: str, @@ -653,23 +690,35 @@ class RulesResourceWithRawResponse: def __init__(self, rules: RulesResource) -> None: self._rules = rules - self.create = to_raw_response_wrapper( - rules.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = to_raw_response_wrapper( - rules.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = to_raw_response_wrapper( - rules.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_raw_response_wrapper( - rules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = to_raw_response_wrapper( - rules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = to_raw_response_wrapper( - rules.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rules.get # pyright: ignore[reportDeprecated], + ) ) @@ -677,23 +726,35 @@ class AsyncRulesResourceWithRawResponse: def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules - self.create = async_to_raw_response_wrapper( - rules.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_raw_response_wrapper( - rules.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_raw_response_wrapper( - rules.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_raw_response_wrapper( - rules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = async_to_raw_response_wrapper( - rules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_raw_response_wrapper( - rules.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rules.get # pyright: ignore[reportDeprecated], + ) ) @@ -701,23 +762,35 @@ class RulesResourceWithStreamingResponse: def __init__(self, rules: RulesResource) -> None: self._rules = rules - self.create = to_streamed_response_wrapper( - rules.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = to_streamed_response_wrapper( - rules.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = to_streamed_response_wrapper( - rules.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_streamed_response_wrapper( - rules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = to_streamed_response_wrapper( - rules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = to_streamed_response_wrapper( - rules.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rules.get # pyright: ignore[reportDeprecated], + ) ) @@ -725,21 +798,33 @@ class AsyncRulesResourceWithStreamingResponse: def __init__(self, rules: AsyncRulesResource) -> None: self._rules = rules - self.create = async_to_streamed_response_wrapper( - rules.create, - ) - self.update = async_to_streamed_response_wrapper( - rules.update, - ) - self.list = async_to_streamed_response_wrapper( - rules.list, - ) - self.delete = async_to_streamed_response_wrapper( - rules.delete, - ) - self.edit = async_to_streamed_response_wrapper( - rules.edit, - ) - self.get = async_to_streamed_response_wrapper( - rules.get, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rules.create # pyright: ignore[reportDeprecated], + ) + ) + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rules.update # pyright: ignore[reportDeprecated], + ) + ) + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rules.list # pyright: ignore[reportDeprecated], + ) + ) + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rules.delete # pyright: ignore[reportDeprecated], + ) + ) + self.edit = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rules.edit # pyright: ignore[reportDeprecated], + ) + ) + self.get = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rules.get # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/cloudflare/resources/iam/__init__.py b/src/cloudflare/resources/iam/__init__.py new file mode 100644 index 00000000000..a233360f769 --- /dev/null +++ b/src/cloudflare/resources/iam/__init__.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .iam import ( + IAMResource, + AsyncIAMResource, + IAMResourceWithRawResponse, + AsyncIAMResourceWithRawResponse, + IAMResourceWithStreamingResponse, + AsyncIAMResourceWithStreamingResponse, +) +from .resource_groups import ( + ResourceGroupsResource, + AsyncResourceGroupsResource, + ResourceGroupsResourceWithRawResponse, + AsyncResourceGroupsResourceWithRawResponse, + ResourceGroupsResourceWithStreamingResponse, + AsyncResourceGroupsResourceWithStreamingResponse, +) +from .permission_groups import ( + PermissionGroupsResource, + AsyncPermissionGroupsResource, + PermissionGroupsResourceWithRawResponse, + AsyncPermissionGroupsResourceWithRawResponse, + PermissionGroupsResourceWithStreamingResponse, + AsyncPermissionGroupsResourceWithStreamingResponse, +) + +__all__ = [ + "PermissionGroupsResource", + "AsyncPermissionGroupsResource", + "PermissionGroupsResourceWithRawResponse", + "AsyncPermissionGroupsResourceWithRawResponse", + "PermissionGroupsResourceWithStreamingResponse", + "AsyncPermissionGroupsResourceWithStreamingResponse", + "ResourceGroupsResource", + "AsyncResourceGroupsResource", + "ResourceGroupsResourceWithRawResponse", + "AsyncResourceGroupsResourceWithRawResponse", + "ResourceGroupsResourceWithStreamingResponse", + "AsyncResourceGroupsResourceWithStreamingResponse", + "IAMResource", + "AsyncIAMResource", + "IAMResourceWithRawResponse", + "AsyncIAMResourceWithRawResponse", + "IAMResourceWithStreamingResponse", + "AsyncIAMResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/iam/iam.py b/src/cloudflare/resources/iam/iam.py new file mode 100644 index 00000000000..c8dd72b1cdb --- /dev/null +++ b/src/cloudflare/resources/iam/iam.py @@ -0,0 +1,112 @@ +# 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 .resource_groups import ( + ResourceGroupsResource, + AsyncResourceGroupsResource, + ResourceGroupsResourceWithRawResponse, + AsyncResourceGroupsResourceWithRawResponse, + ResourceGroupsResourceWithStreamingResponse, + AsyncResourceGroupsResourceWithStreamingResponse, +) +from .permission_groups import ( + PermissionGroupsResource, + AsyncPermissionGroupsResource, + PermissionGroupsResourceWithRawResponse, + AsyncPermissionGroupsResourceWithRawResponse, + PermissionGroupsResourceWithStreamingResponse, + AsyncPermissionGroupsResourceWithStreamingResponse, +) + +__all__ = ["IAMResource", "AsyncIAMResource"] + + +class IAMResource(SyncAPIResource): + @cached_property + def permission_groups(self) -> PermissionGroupsResource: + return PermissionGroupsResource(self._client) + + @cached_property + def resource_groups(self) -> ResourceGroupsResource: + return ResourceGroupsResource(self._client) + + @cached_property + def with_raw_response(self) -> IAMResourceWithRawResponse: + return IAMResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IAMResourceWithStreamingResponse: + return IAMResourceWithStreamingResponse(self) + + +class AsyncIAMResource(AsyncAPIResource): + @cached_property + def permission_groups(self) -> AsyncPermissionGroupsResource: + return AsyncPermissionGroupsResource(self._client) + + @cached_property + def resource_groups(self) -> AsyncResourceGroupsResource: + return AsyncResourceGroupsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncIAMResourceWithRawResponse: + return AsyncIAMResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIAMResourceWithStreamingResponse: + return AsyncIAMResourceWithStreamingResponse(self) + + +class IAMResourceWithRawResponse: + def __init__(self, iam: IAMResource) -> None: + self._iam = iam + + @cached_property + def permission_groups(self) -> PermissionGroupsResourceWithRawResponse: + return PermissionGroupsResourceWithRawResponse(self._iam.permission_groups) + + @cached_property + def resource_groups(self) -> ResourceGroupsResourceWithRawResponse: + return ResourceGroupsResourceWithRawResponse(self._iam.resource_groups) + + +class AsyncIAMResourceWithRawResponse: + def __init__(self, iam: AsyncIAMResource) -> None: + self._iam = iam + + @cached_property + def permission_groups(self) -> AsyncPermissionGroupsResourceWithRawResponse: + return AsyncPermissionGroupsResourceWithRawResponse(self._iam.permission_groups) + + @cached_property + def resource_groups(self) -> AsyncResourceGroupsResourceWithRawResponse: + return AsyncResourceGroupsResourceWithRawResponse(self._iam.resource_groups) + + +class IAMResourceWithStreamingResponse: + def __init__(self, iam: IAMResource) -> None: + self._iam = iam + + @cached_property + def permission_groups(self) -> PermissionGroupsResourceWithStreamingResponse: + return PermissionGroupsResourceWithStreamingResponse(self._iam.permission_groups) + + @cached_property + def resource_groups(self) -> ResourceGroupsResourceWithStreamingResponse: + return ResourceGroupsResourceWithStreamingResponse(self._iam.resource_groups) + + +class AsyncIAMResourceWithStreamingResponse: + def __init__(self, iam: AsyncIAMResource) -> None: + self._iam = iam + + @cached_property + def permission_groups(self) -> AsyncPermissionGroupsResourceWithStreamingResponse: + return AsyncPermissionGroupsResourceWithStreamingResponse(self._iam.permission_groups) + + @cached_property + def resource_groups(self) -> AsyncResourceGroupsResourceWithStreamingResponse: + return AsyncResourceGroupsResourceWithStreamingResponse(self._iam.resource_groups) diff --git a/src/cloudflare/resources/iam/permission_groups.py b/src/cloudflare/resources/iam/permission_groups.py new file mode 100644 index 00000000000..1bb7effc98d --- /dev/null +++ b/src/cloudflare/resources/iam/permission_groups.py @@ -0,0 +1,305 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.iam import permission_group_list_params +from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from ..._base_client import ( + AsyncPaginator, + make_request_options, +) +from ...types.iam.permission_group_get_response import PermissionGroupGetResponse + +__all__ = ["PermissionGroupsResource", "AsyncPermissionGroupsResource"] + + +class PermissionGroupsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PermissionGroupsResourceWithRawResponse: + return PermissionGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PermissionGroupsResourceWithStreamingResponse: + return PermissionGroupsResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + id: str | NotGiven = NOT_GIVEN, + label: str | 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. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncV4PagePaginationArray[object]: + """ + List all the permissions groups for an account. + + Args: + account_id: Account identifier tag. + + id: ID of the permission group to be fetched. + + label: Label of the permission group to be fetched. + + name: Name of the permission group to be fetched. + + page: Page number of paginated results. + + per_page: Maximum number of results per page. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/iam/permission_groups", + page=SyncV4PagePaginationArray[object], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "label": label, + "name": name, + "page": page, + "per_page": per_page, + }, + permission_group_list_params.PermissionGroupListParams, + ), + ), + model=object, + ) + + def get( + self, + permission_group_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, + ) -> PermissionGroupGetResponse: + """ + Get information about a specific permission group in an account. + + Args: + account_id: Account identifier tag. + + permission_group_id: Permission Group identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not permission_group_id: + raise ValueError( + f"Expected a non-empty value for `permission_group_id` but received {permission_group_id!r}" + ) + return self._get( + f"/accounts/{account_id}/iam/permission_groups/{permission_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PermissionGroupGetResponse, + ) + + +class AsyncPermissionGroupsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPermissionGroupsResourceWithRawResponse: + return AsyncPermissionGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPermissionGroupsResourceWithStreamingResponse: + return AsyncPermissionGroupsResourceWithStreamingResponse(self) + + def list( + self, + *, + account_id: str, + id: str | NotGiven = NOT_GIVEN, + label: str | 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. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[object, AsyncV4PagePaginationArray[object]]: + """ + List all the permissions groups for an account. + + Args: + account_id: Account identifier tag. + + id: ID of the permission group to be fetched. + + label: Label of the permission group to be fetched. + + name: Name of the permission group to be fetched. + + page: Page number of paginated results. + + per_page: Maximum number of results per page. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/iam/permission_groups", + page=AsyncV4PagePaginationArray[object], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "label": label, + "name": name, + "page": page, + "per_page": per_page, + }, + permission_group_list_params.PermissionGroupListParams, + ), + ), + model=object, + ) + + async def get( + self, + permission_group_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, + ) -> PermissionGroupGetResponse: + """ + Get information about a specific permission group in an account. + + Args: + account_id: Account identifier tag. + + permission_group_id: Permission Group identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not permission_group_id: + raise ValueError( + f"Expected a non-empty value for `permission_group_id` but received {permission_group_id!r}" + ) + return await self._get( + f"/accounts/{account_id}/iam/permission_groups/{permission_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PermissionGroupGetResponse, + ) + + +class PermissionGroupsResourceWithRawResponse: + def __init__(self, permission_groups: PermissionGroupsResource) -> None: + self._permission_groups = permission_groups + + self.list = to_raw_response_wrapper( + permission_groups.list, + ) + self.get = to_raw_response_wrapper( + permission_groups.get, + ) + + +class AsyncPermissionGroupsResourceWithRawResponse: + def __init__(self, permission_groups: AsyncPermissionGroupsResource) -> None: + self._permission_groups = permission_groups + + self.list = async_to_raw_response_wrapper( + permission_groups.list, + ) + self.get = async_to_raw_response_wrapper( + permission_groups.get, + ) + + +class PermissionGroupsResourceWithStreamingResponse: + def __init__(self, permission_groups: PermissionGroupsResource) -> None: + self._permission_groups = permission_groups + + self.list = to_streamed_response_wrapper( + permission_groups.list, + ) + self.get = to_streamed_response_wrapper( + permission_groups.get, + ) + + +class AsyncPermissionGroupsResourceWithStreamingResponse: + def __init__(self, permission_groups: AsyncPermissionGroupsResource) -> None: + self._permission_groups = permission_groups + + self.list = async_to_streamed_response_wrapper( + permission_groups.list, + ) + self.get = async_to_streamed_response_wrapper( + permission_groups.get, + ) diff --git a/src/cloudflare/resources/iam/resource_groups.py b/src/cloudflare/resources/iam/resource_groups.py new file mode 100644 index 00000000000..9d524bcea8e --- /dev/null +++ b/src/cloudflare/resources/iam/resource_groups.py @@ -0,0 +1,628 @@ +# 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 ...types.iam import resource_group_list_params, resource_group_create_params, resource_group_update_params +from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from ..._base_client import ( + AsyncPaginator, + make_request_options, +) +from ...types.iam.resource_group_get_response import ResourceGroupGetResponse +from ...types.iam.resource_group_create_response import ResourceGroupCreateResponse +from ...types.iam.resource_group_delete_response import ResourceGroupDeleteResponse +from ...types.iam.resource_group_update_response import ResourceGroupUpdateResponse + +__all__ = ["ResourceGroupsResource", "AsyncResourceGroupsResource"] + + +class ResourceGroupsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ResourceGroupsResourceWithRawResponse: + return ResourceGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ResourceGroupsResourceWithStreamingResponse: + return ResourceGroupsResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + scope: resource_group_create_params.Scope, + meta: 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, + ) -> ResourceGroupCreateResponse: + """ + Create a new Resource Group under the specified account. + + Args: + account_id: Account identifier tag. + + scope: A scope is a combination of scope objects which provides additional context. + + meta: Attributes associated to the resource group. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._post( + f"/accounts/{account_id}/iam/resource_groups", + body=maybe_transform( + { + "scope": scope, + "meta": meta, + }, + resource_group_create_params.ResourceGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResourceGroupCreateResponse, + ) + + def update( + self, + resource_group_id: str, + *, + account_id: str, + scope: resource_group_update_params.Scope, + meta: 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, + ) -> ResourceGroupUpdateResponse: + """ + Modify an existing resource group. + + Args: + account_id: Account identifier tag. + + resource_group_id: Resource Group identifier tag. + + scope: A scope is a combination of scope objects which provides additional context. + + meta: Attributes associated to the resource group. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 resource_group_id: + raise ValueError(f"Expected a non-empty value for `resource_group_id` but received {resource_group_id!r}") + return self._put( + f"/accounts/{account_id}/iam/resource_groups/{resource_group_id}", + body=maybe_transform( + { + "scope": scope, + "meta": meta, + }, + resource_group_update_params.ResourceGroupUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResourceGroupUpdateResponse, + ) + + def list( + self, + *, + account_id: str, + id: str | 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. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncV4PagePaginationArray[object]: + """ + List all the resource groups for an account. + + Args: + account_id: Account identifier tag. + + id: ID of the resource group to be fetched. + + name: Name of the resource group to be fetched. + + page: Page number of paginated results. + + per_page: Maximum number of results per page. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/iam/resource_groups", + page=SyncV4PagePaginationArray[object], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "name": name, + "page": page, + "per_page": per_page, + }, + resource_group_list_params.ResourceGroupListParams, + ), + ), + model=object, + ) + + def delete( + self, + resource_group_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[ResourceGroupDeleteResponse]: + """ + Remove a resource group from an account. + + Args: + account_id: Account identifier tag. + + resource_group_id: Resource Group identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not resource_group_id: + raise ValueError(f"Expected a non-empty value for `resource_group_id` but received {resource_group_id!r}") + return self._delete( + f"/accounts/{account_id}/iam/resource_groups/{resource_group_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ResourceGroupDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[ResourceGroupDeleteResponse]], ResultWrapper[ResourceGroupDeleteResponse]), + ) + + def get( + self, + resource_group_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, + ) -> ResourceGroupGetResponse: + """ + Get information about a specific resource group in an account. + + Args: + account_id: Account identifier tag. + + resource_group_id: Resource Group identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not resource_group_id: + raise ValueError(f"Expected a non-empty value for `resource_group_id` but received {resource_group_id!r}") + return self._get( + f"/accounts/{account_id}/iam/resource_groups/{resource_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResourceGroupGetResponse, + ) + + +class AsyncResourceGroupsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncResourceGroupsResourceWithRawResponse: + return AsyncResourceGroupsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncResourceGroupsResourceWithStreamingResponse: + return AsyncResourceGroupsResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + scope: resource_group_create_params.Scope, + meta: 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, + ) -> ResourceGroupCreateResponse: + """ + Create a new Resource Group under the specified account. + + Args: + account_id: Account identifier tag. + + scope: A scope is a combination of scope objects which provides additional context. + + meta: Attributes associated to the resource group. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._post( + f"/accounts/{account_id}/iam/resource_groups", + body=await async_maybe_transform( + { + "scope": scope, + "meta": meta, + }, + resource_group_create_params.ResourceGroupCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResourceGroupCreateResponse, + ) + + async def update( + self, + resource_group_id: str, + *, + account_id: str, + scope: resource_group_update_params.Scope, + meta: 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, + ) -> ResourceGroupUpdateResponse: + """ + Modify an existing resource group. + + Args: + account_id: Account identifier tag. + + resource_group_id: Resource Group identifier tag. + + scope: A scope is a combination of scope objects which provides additional context. + + meta: Attributes associated to the resource group. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 resource_group_id: + raise ValueError(f"Expected a non-empty value for `resource_group_id` but received {resource_group_id!r}") + return await self._put( + f"/accounts/{account_id}/iam/resource_groups/{resource_group_id}", + body=await async_maybe_transform( + { + "scope": scope, + "meta": meta, + }, + resource_group_update_params.ResourceGroupUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResourceGroupUpdateResponse, + ) + + def list( + self, + *, + account_id: str, + id: str | 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. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[object, AsyncV4PagePaginationArray[object]]: + """ + List all the resource groups for an account. + + Args: + account_id: Account identifier tag. + + id: ID of the resource group to be fetched. + + name: Name of the resource group to be fetched. + + page: Page number of paginated results. + + per_page: Maximum number of results per page. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/iam/resource_groups", + page=AsyncV4PagePaginationArray[object], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "id": id, + "name": name, + "page": page, + "per_page": per_page, + }, + resource_group_list_params.ResourceGroupListParams, + ), + ), + model=object, + ) + + async def delete( + self, + resource_group_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[ResourceGroupDeleteResponse]: + """ + Remove a resource group from an account. + + Args: + account_id: Account identifier tag. + + resource_group_id: Resource Group identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not resource_group_id: + raise ValueError(f"Expected a non-empty value for `resource_group_id` but received {resource_group_id!r}") + return await self._delete( + f"/accounts/{account_id}/iam/resource_groups/{resource_group_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ResourceGroupDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[ResourceGroupDeleteResponse]], ResultWrapper[ResourceGroupDeleteResponse]), + ) + + async def get( + self, + resource_group_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, + ) -> ResourceGroupGetResponse: + """ + Get information about a specific resource group in an account. + + Args: + account_id: Account identifier tag. + + resource_group_id: Resource Group identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not resource_group_id: + raise ValueError(f"Expected a non-empty value for `resource_group_id` but received {resource_group_id!r}") + return await self._get( + f"/accounts/{account_id}/iam/resource_groups/{resource_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ResourceGroupGetResponse, + ) + + +class ResourceGroupsResourceWithRawResponse: + def __init__(self, resource_groups: ResourceGroupsResource) -> None: + self._resource_groups = resource_groups + + self.create = to_raw_response_wrapper( + resource_groups.create, + ) + self.update = to_raw_response_wrapper( + resource_groups.update, + ) + self.list = to_raw_response_wrapper( + resource_groups.list, + ) + self.delete = to_raw_response_wrapper( + resource_groups.delete, + ) + self.get = to_raw_response_wrapper( + resource_groups.get, + ) + + +class AsyncResourceGroupsResourceWithRawResponse: + def __init__(self, resource_groups: AsyncResourceGroupsResource) -> None: + self._resource_groups = resource_groups + + self.create = async_to_raw_response_wrapper( + resource_groups.create, + ) + self.update = async_to_raw_response_wrapper( + resource_groups.update, + ) + self.list = async_to_raw_response_wrapper( + resource_groups.list, + ) + self.delete = async_to_raw_response_wrapper( + resource_groups.delete, + ) + self.get = async_to_raw_response_wrapper( + resource_groups.get, + ) + + +class ResourceGroupsResourceWithStreamingResponse: + def __init__(self, resource_groups: ResourceGroupsResource) -> None: + self._resource_groups = resource_groups + + self.create = to_streamed_response_wrapper( + resource_groups.create, + ) + self.update = to_streamed_response_wrapper( + resource_groups.update, + ) + self.list = to_streamed_response_wrapper( + resource_groups.list, + ) + self.delete = to_streamed_response_wrapper( + resource_groups.delete, + ) + self.get = to_streamed_response_wrapper( + resource_groups.get, + ) + + +class AsyncResourceGroupsResourceWithStreamingResponse: + def __init__(self, resource_groups: AsyncResourceGroupsResource) -> None: + self._resource_groups = resource_groups + + self.create = async_to_streamed_response_wrapper( + resource_groups.create, + ) + self.update = async_to_streamed_response_wrapper( + resource_groups.update, + ) + self.list = async_to_streamed_response_wrapper( + resource_groups.list, + ) + self.delete = async_to_streamed_response_wrapper( + resource_groups.delete, + ) + self.get = async_to_streamed_response_wrapper( + resource_groups.get, + ) diff --git a/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py b/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py index 721bab7afab..59883527aab 100644 --- a/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py +++ b/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py @@ -124,9 +124,10 @@ def update( feed_id: int, *, account_id: str, - feed_description: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, is_attributable: bool | NotGiven = NOT_GIVEN, is_public: bool | 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. extra_headers: Headers | None = None, @@ -142,12 +143,14 @@ def update( feed_id: Indicator feed ID - feed_description: The new description of the feed + description: The new description of the feed is_attributable: The new is_attributable value of the feed is_public: The new is_public value of the feed + name: The new name of the feed + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -162,9 +165,10 @@ def update( f"/accounts/{account_id}/intel/indicator-feeds/{feed_id}", body=maybe_transform( { - "feed_description": feed_description, + "description": description, "is_attributable": is_attributable, "is_public": is_public, + "name": name, }, indicator_feed_update_params.IndicatorFeedUpdateParams, ), @@ -370,9 +374,10 @@ async def update( feed_id: int, *, account_id: str, - feed_description: str | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, is_attributable: bool | NotGiven = NOT_GIVEN, is_public: bool | 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. extra_headers: Headers | None = None, @@ -388,12 +393,14 @@ async def update( feed_id: Indicator feed ID - feed_description: The new description of the feed + description: The new description of the feed is_attributable: The new is_attributable value of the feed is_public: The new is_public value of the feed + name: The new name of the feed + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -408,9 +415,10 @@ async def update( f"/accounts/{account_id}/intel/indicator-feeds/{feed_id}", body=await async_maybe_transform( { - "feed_description": feed_description, + "description": description, "is_attributable": is_attributable, "is_public": is_public, + "name": name, }, indicator_feed_update_params.IndicatorFeedUpdateParams, ), diff --git a/src/cloudflare/resources/kv/namespaces/bulk.py b/src/cloudflare/resources/kv/namespaces/bulk.py index 9c9ee270e5c..7bc398ecfd9 100644 --- a/src/cloudflare/resources/kv/namespaces/bulk.py +++ b/src/cloudflare/resources/kv/namespaces/bulk.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Iterable, cast +from typing import Type, Iterable, Optional, cast import httpx @@ -51,7 +51,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BulkUpdateResponse: + ) -> Optional[BulkUpdateResponse]: """Write multiple keys and values at once. Body should be an array of up to 10,000 @@ -78,22 +78,17 @@ def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not namespace_id: raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") - return cast( - BulkUpdateResponse, - self._put( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk", - body=maybe_transform(body, bulk_update_params.BulkUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[BulkUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[BulkUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk", + body=maybe_transform(body, bulk_update_params.BulkUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[BulkUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[BulkUpdateResponse]], ResultWrapper[BulkUpdateResponse]), ) def delete( @@ -107,7 +102,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BulkDeleteResponse: + ) -> Optional[BulkDeleteResponse]: """Remove multiple KV pairs from the namespace. Body should be an array of up to @@ -130,21 +125,16 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not namespace_id: raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") - return cast( - BulkDeleteResponse, - self._delete( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[BulkDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[BulkDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[BulkDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[BulkDeleteResponse]], ResultWrapper[BulkDeleteResponse]), ) @@ -169,7 +159,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BulkUpdateResponse: + ) -> Optional[BulkUpdateResponse]: """Write multiple keys and values at once. Body should be an array of up to 10,000 @@ -196,22 +186,17 @@ async def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not namespace_id: raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") - return cast( - BulkUpdateResponse, - await self._put( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk", - body=await async_maybe_transform(body, bulk_update_params.BulkUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[BulkUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[BulkUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk", + body=await async_maybe_transform(body, bulk_update_params.BulkUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[BulkUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[BulkUpdateResponse]], ResultWrapper[BulkUpdateResponse]), ) async def delete( @@ -225,7 +210,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BulkDeleteResponse: + ) -> Optional[BulkDeleteResponse]: """Remove multiple KV pairs from the namespace. Body should be an array of up to @@ -248,21 +233,16 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not namespace_id: raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") - return cast( - BulkDeleteResponse, - await self._delete( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[BulkDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[BulkDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[BulkDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[BulkDeleteResponse]], ResultWrapper[BulkDeleteResponse]), ) diff --git a/src/cloudflare/resources/kv/namespaces/metadata.py b/src/cloudflare/resources/kv/namespaces/metadata.py index b9a442c88b0..9112053105f 100644 --- a/src/cloudflare/resources/kv/namespaces/metadata.py +++ b/src/cloudflare/resources/kv/namespaces/metadata.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -19,6 +19,7 @@ from ...._base_client import ( make_request_options, ) +from ....types.kv.namespaces.metadata_get_response import MetadataGetResponse __all__ = ["MetadataResource", "AsyncMetadataResource"] @@ -44,7 +45,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> Optional[MetadataGetResponse]: """Returns the metadata associated with the given key in the given namespace. Use @@ -80,9 +81,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[object]._unwrapper, + post_parser=ResultWrapper[Optional[MetadataGetResponse]]._unwrapper, ), - cast_to=cast(Type[object], ResultWrapper[object]), + cast_to=cast(Type[Optional[MetadataGetResponse]], ResultWrapper[MetadataGetResponse]), ) @@ -107,7 +108,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> Optional[MetadataGetResponse]: """Returns the metadata associated with the given key in the given namespace. Use @@ -143,9 +144,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[object]._unwrapper, + post_parser=ResultWrapper[Optional[MetadataGetResponse]]._unwrapper, ), - cast_to=cast(Type[object], ResultWrapper[object]), + cast_to=cast(Type[Optional[MetadataGetResponse]], ResultWrapper[MetadataGetResponse]), ) diff --git a/src/cloudflare/resources/kv/namespaces/namespaces.py b/src/cloudflare/resources/kv/namespaces/namespaces.py index ae2f40cc23f..be73605e215 100644 --- a/src/cloudflare/resources/kv/namespaces/namespaces.py +++ b/src/cloudflare/resources/kv/namespaces/namespaces.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -102,7 +102,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Namespace: + ) -> Optional[Namespace]: """Creates a namespace under the given title. A `400` is returned if the account @@ -132,9 +132,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Namespace]._unwrapper, + post_parser=ResultWrapper[Optional[Namespace]]._unwrapper, ), - cast_to=cast(Type[Namespace], ResultWrapper[Namespace]), + cast_to=cast(Type[Optional[Namespace]], ResultWrapper[Namespace]), ) def update( @@ -149,7 +149,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceUpdateResponse: + ) -> Optional[NamespaceUpdateResponse]: """ Modifies a namespace's title. @@ -172,22 +172,17 @@ def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not namespace_id: raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") - return cast( - NamespaceUpdateResponse, - self._put( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", - body=maybe_transform({"title": title}, namespace_update_params.NamespaceUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[NamespaceUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[NamespaceUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", + body=maybe_transform({"title": title}, namespace_update_params.NamespaceUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[NamespaceUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[NamespaceUpdateResponse]], ResultWrapper[NamespaceUpdateResponse]), ) def list( @@ -261,7 +256,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceDeleteResponse: + ) -> Optional[NamespaceDeleteResponse]: """ Deletes the namespace corresponding to the given ID. @@ -282,21 +277,60 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not namespace_id: raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") - return cast( - NamespaceDeleteResponse, - self._delete( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[NamespaceDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[NamespaceDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[NamespaceDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[NamespaceDeleteResponse]], ResultWrapper[NamespaceDeleteResponse]), + ) + + def get( + self, + namespace_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[Namespace]: + """ + Get the namespace corresponding to the given ID. + + Args: + account_id: Identifier + + namespace_id: Namespace identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not namespace_id: + raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") + return self._get( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Namespace]]._unwrapper, + ), + cast_to=cast(Type[Optional[Namespace]], ResultWrapper[Namespace]), ) @@ -336,7 +370,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Namespace: + ) -> Optional[Namespace]: """Creates a namespace under the given title. A `400` is returned if the account @@ -366,9 +400,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Namespace]._unwrapper, + post_parser=ResultWrapper[Optional[Namespace]]._unwrapper, ), - cast_to=cast(Type[Namespace], ResultWrapper[Namespace]), + cast_to=cast(Type[Optional[Namespace]], ResultWrapper[Namespace]), ) async def update( @@ -383,7 +417,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceUpdateResponse: + ) -> Optional[NamespaceUpdateResponse]: """ Modifies a namespace's title. @@ -406,22 +440,17 @@ async def update( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not namespace_id: raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") - return cast( - NamespaceUpdateResponse, - await self._put( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", - body=await async_maybe_transform({"title": title}, namespace_update_params.NamespaceUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[NamespaceUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[NamespaceUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", + body=await async_maybe_transform({"title": title}, namespace_update_params.NamespaceUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[NamespaceUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[NamespaceUpdateResponse]], ResultWrapper[NamespaceUpdateResponse]), ) def list( @@ -495,7 +524,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceDeleteResponse: + ) -> Optional[NamespaceDeleteResponse]: """ Deletes the namespace corresponding to the given ID. @@ -516,21 +545,60 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not namespace_id: raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") - return cast( - NamespaceDeleteResponse, - await self._delete( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[NamespaceDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[NamespaceDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[NamespaceDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[NamespaceDeleteResponse]], ResultWrapper[NamespaceDeleteResponse]), + ) + + async def get( + self, + namespace_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[Namespace]: + """ + Get the namespace corresponding to the given ID. + + Args: + account_id: Identifier + + namespace_id: Namespace identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not namespace_id: + raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") + return await self._get( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Namespace]]._unwrapper, + ), + cast_to=cast(Type[Optional[Namespace]], ResultWrapper[Namespace]), ) @@ -550,6 +618,9 @@ def __init__(self, namespaces: NamespacesResource) -> None: self.delete = to_raw_response_wrapper( namespaces.delete, ) + self.get = to_raw_response_wrapper( + namespaces.get, + ) @cached_property def bulk(self) -> BulkResourceWithRawResponse: @@ -584,6 +655,9 @@ def __init__(self, namespaces: AsyncNamespacesResource) -> None: self.delete = async_to_raw_response_wrapper( namespaces.delete, ) + self.get = async_to_raw_response_wrapper( + namespaces.get, + ) @cached_property def bulk(self) -> AsyncBulkResourceWithRawResponse: @@ -618,6 +692,9 @@ def __init__(self, namespaces: NamespacesResource) -> None: self.delete = to_streamed_response_wrapper( namespaces.delete, ) + self.get = to_streamed_response_wrapper( + namespaces.get, + ) @cached_property def bulk(self) -> BulkResourceWithStreamingResponse: @@ -652,6 +729,9 @@ def __init__(self, namespaces: AsyncNamespacesResource) -> None: self.delete = async_to_streamed_response_wrapper( namespaces.delete, ) + self.get = async_to_streamed_response_wrapper( + namespaces.get, + ) @cached_property def bulk(self) -> AsyncBulkResourceWithStreamingResponse: diff --git a/src/cloudflare/resources/kv/namespaces/values.py b/src/cloudflare/resources/kv/namespaces/values.py index 011fb16adde..b80c2b635bb 100644 --- a/src/cloudflare/resources/kv/namespaces/values.py +++ b/src/cloudflare/resources/kv/namespaces/values.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, Optional, cast import httpx @@ -14,10 +14,18 @@ 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 ( @@ -53,7 +61,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ValueUpdateResponse: + ) -> Optional[ValueUpdateResponse]: """Write a value identified by a key. Use URL-encoding to use special characters @@ -89,28 +97,23 @@ def update( raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") if not key_name: raise ValueError(f"Expected a non-empty value for `key_name` but received {key_name!r}") - return cast( - ValueUpdateResponse, - self._put( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", - body=maybe_transform( - { - "metadata": metadata, - "value": value, - }, - value_update_params.ValueUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ValueUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ValueUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", + body=maybe_transform( + { + "metadata": metadata, + "value": value, + }, + value_update_params.ValueUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ValueUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ValueUpdateResponse]], ResultWrapper[ValueUpdateResponse]), ) def delete( @@ -125,7 +128,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ValueDeleteResponse: + ) -> Optional[ValueDeleteResponse]: """Remove a KV pair from the namespace. Use URL-encoding to use special characters @@ -153,21 +156,16 @@ def delete( raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") if not key_name: raise ValueError(f"Expected a non-empty value for `key_name` but received {key_name!r}") - return cast( - ValueDeleteResponse, - self._delete( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ValueDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ValueDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ValueDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ValueDeleteResponse]], ResultWrapper[ValueDeleteResponse]), ) def get( @@ -182,7 +180,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> str: + ) -> BinaryAPIResponse: """Returns the value associated with the given key in the given namespace. Use @@ -213,12 +211,13 @@ def get( raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") if not key_name: raise ValueError(f"Expected a non-empty value for `key_name` but received {key_name!r}") + extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})} return self._get( f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=str, + cast_to=BinaryAPIResponse, ) @@ -245,7 +244,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ValueUpdateResponse: + ) -> Optional[ValueUpdateResponse]: """Write a value identified by a key. Use URL-encoding to use special characters @@ -281,28 +280,23 @@ async def update( raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") if not key_name: raise ValueError(f"Expected a non-empty value for `key_name` but received {key_name!r}") - return cast( - ValueUpdateResponse, - await self._put( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", - body=await async_maybe_transform( - { - "metadata": metadata, - "value": value, - }, - value_update_params.ValueUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ValueUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ValueUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", + body=await async_maybe_transform( + { + "metadata": metadata, + "value": value, + }, + value_update_params.ValueUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ValueUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ValueUpdateResponse]], ResultWrapper[ValueUpdateResponse]), ) async def delete( @@ -317,7 +311,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ValueDeleteResponse: + ) -> Optional[ValueDeleteResponse]: """Remove a KV pair from the namespace. Use URL-encoding to use special characters @@ -345,21 +339,16 @@ async def delete( raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") if not key_name: raise ValueError(f"Expected a non-empty value for `key_name` but received {key_name!r}") - return cast( - ValueDeleteResponse, - await self._delete( - f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ValueDeleteResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[ValueDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ValueDeleteResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[ValueDeleteResponse]], ResultWrapper[ValueDeleteResponse]), ) async def get( @@ -374,7 +363,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> str: + ) -> AsyncBinaryAPIResponse: """Returns the value associated with the given key in the given namespace. Use @@ -405,12 +394,13 @@ async def get( raise ValueError(f"Expected a non-empty value for `namespace_id` but received {namespace_id!r}") if not key_name: raise ValueError(f"Expected a non-empty value for `key_name` but received {key_name!r}") + extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})} return await self._get( f"/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=str, + cast_to=AsyncBinaryAPIResponse, ) @@ -424,8 +414,9 @@ def __init__(self, values: ValuesResource) -> None: self.delete = to_raw_response_wrapper( values.delete, ) - self.get = to_raw_response_wrapper( + self.get = to_custom_raw_response_wrapper( values.get, + BinaryAPIResponse, ) @@ -439,8 +430,9 @@ def __init__(self, values: AsyncValuesResource) -> None: self.delete = async_to_raw_response_wrapper( values.delete, ) - self.get = async_to_raw_response_wrapper( + self.get = async_to_custom_raw_response_wrapper( values.get, + AsyncBinaryAPIResponse, ) @@ -454,8 +446,9 @@ def __init__(self, values: ValuesResource) -> None: self.delete = to_streamed_response_wrapper( values.delete, ) - self.get = to_streamed_response_wrapper( + self.get = to_custom_streamed_response_wrapper( values.get, + StreamedBinaryAPIResponse, ) @@ -469,6 +462,7 @@ def __init__(self, values: AsyncValuesResource) -> None: self.delete = async_to_streamed_response_wrapper( values.delete, ) - self.get = async_to_streamed_response_wrapper( + self.get = async_to_custom_streamed_response_wrapper( values.get, + AsyncStreamedBinaryAPIResponse, ) diff --git a/src/cloudflare/resources/logs/control/control.py b/src/cloudflare/resources/logs/control/control.py index ce92ba94219..b642e31a573 100644 --- a/src/cloudflare/resources/logs/control/control.py +++ b/src/cloudflare/resources/logs/control/control.py @@ -21,7 +21,6 @@ ) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource -from .retention.retention import RetentionResource, AsyncRetentionResource __all__ = ["ControlResource", "AsyncControlResource"] diff --git a/src/cloudflare/resources/logs/control/retention/flag.py b/src/cloudflare/resources/logs/control/retention.py similarity index 68% rename from src/cloudflare/resources/logs/control/retention/flag.py rename to src/cloudflare/resources/logs/control/retention.py index 3b430f1e9c6..2d468f2a73f 100644 --- a/src/cloudflare/resources/logs/control/retention/flag.py +++ b/src/cloudflare/resources/logs/control/retention.py @@ -6,38 +6,38 @@ import httpx -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import ( +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( maybe_transform, async_maybe_transform, ) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....._wrappers import ResultWrapper -from ....._base_client import ( +from ...._wrappers import ResultWrapper +from ...._base_client import ( make_request_options, ) -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 +from ....types.logs.control import retention_create_params +from ....types.logs.control.retention_get_response import RetentionGetResponse +from ....types.logs.control.retention_create_response import RetentionCreateResponse -__all__ = ["FlagResource", "AsyncFlagResource"] +__all__ = ["RetentionResource", "AsyncRetentionResource"] -class FlagResource(SyncAPIResource): +class RetentionResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FlagResourceWithRawResponse: - return FlagResourceWithRawResponse(self) + def with_raw_response(self) -> RetentionResourceWithRawResponse: + return RetentionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FlagResourceWithStreamingResponse: - return FlagResourceWithStreamingResponse(self) + def with_streaming_response(self) -> RetentionResourceWithStreamingResponse: + return RetentionResourceWithStreamingResponse(self) def create( self, @@ -50,7 +50,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FlagCreateResponse: + ) -> RetentionCreateResponse: """ Updates log retention flag for Logpull API. @@ -71,15 +71,15 @@ def create( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return self._post( f"/zones/{zone_identifier}/logs/control/retention/flag", - body=maybe_transform({"flag": flag}, flag_create_params.FlagCreateParams), + body=maybe_transform({"flag": flag}, retention_create_params.RetentionCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[FlagCreateResponse]._unwrapper, + post_parser=ResultWrapper[RetentionCreateResponse]._unwrapper, ), - cast_to=cast(Type[FlagCreateResponse], ResultWrapper[FlagCreateResponse]), + cast_to=cast(Type[RetentionCreateResponse], ResultWrapper[RetentionCreateResponse]), ) def get( @@ -92,7 +92,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FlagGetResponse: + ) -> RetentionGetResponse: """ Gets log retention flag for Logpull API. @@ -116,20 +116,20 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[FlagGetResponse]._unwrapper, + post_parser=ResultWrapper[RetentionGetResponse]._unwrapper, ), - cast_to=cast(Type[FlagGetResponse], ResultWrapper[FlagGetResponse]), + cast_to=cast(Type[RetentionGetResponse], ResultWrapper[RetentionGetResponse]), ) -class AsyncFlagResource(AsyncAPIResource): +class AsyncRetentionResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFlagResourceWithRawResponse: - return AsyncFlagResourceWithRawResponse(self) + def with_raw_response(self) -> AsyncRetentionResourceWithRawResponse: + return AsyncRetentionResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFlagResourceWithStreamingResponse: - return AsyncFlagResourceWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRetentionResourceWithStreamingResponse: + return AsyncRetentionResourceWithStreamingResponse(self) async def create( self, @@ -142,7 +142,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FlagCreateResponse: + ) -> RetentionCreateResponse: """ Updates log retention flag for Logpull API. @@ -163,15 +163,15 @@ async def create( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") return await self._post( f"/zones/{zone_identifier}/logs/control/retention/flag", - body=await async_maybe_transform({"flag": flag}, flag_create_params.FlagCreateParams), + body=await async_maybe_transform({"flag": flag}, retention_create_params.RetentionCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[FlagCreateResponse]._unwrapper, + post_parser=ResultWrapper[RetentionCreateResponse]._unwrapper, ), - cast_to=cast(Type[FlagCreateResponse], ResultWrapper[FlagCreateResponse]), + cast_to=cast(Type[RetentionCreateResponse], ResultWrapper[RetentionCreateResponse]), ) async def get( @@ -184,7 +184,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FlagGetResponse: + ) -> RetentionGetResponse: """ Gets log retention flag for Logpull API. @@ -208,55 +208,55 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[FlagGetResponse]._unwrapper, + post_parser=ResultWrapper[RetentionGetResponse]._unwrapper, ), - cast_to=cast(Type[FlagGetResponse], ResultWrapper[FlagGetResponse]), + cast_to=cast(Type[RetentionGetResponse], ResultWrapper[RetentionGetResponse]), ) -class FlagResourceWithRawResponse: - def __init__(self, flag: FlagResource) -> None: - self._flag = flag +class RetentionResourceWithRawResponse: + def __init__(self, retention: RetentionResource) -> None: + self._retention = retention self.create = to_raw_response_wrapper( - flag.create, + retention.create, ) self.get = to_raw_response_wrapper( - flag.get, + retention.get, ) -class AsyncFlagResourceWithRawResponse: - def __init__(self, flag: AsyncFlagResource) -> None: - self._flag = flag +class AsyncRetentionResourceWithRawResponse: + def __init__(self, retention: AsyncRetentionResource) -> None: + self._retention = retention self.create = async_to_raw_response_wrapper( - flag.create, + retention.create, ) self.get = async_to_raw_response_wrapper( - flag.get, + retention.get, ) -class FlagResourceWithStreamingResponse: - def __init__(self, flag: FlagResource) -> None: - self._flag = flag +class RetentionResourceWithStreamingResponse: + def __init__(self, retention: RetentionResource) -> None: + self._retention = retention self.create = to_streamed_response_wrapper( - flag.create, + retention.create, ) self.get = to_streamed_response_wrapper( - flag.get, + retention.get, ) -class AsyncFlagResourceWithStreamingResponse: - def __init__(self, flag: AsyncFlagResource) -> None: - self._flag = flag +class AsyncRetentionResourceWithStreamingResponse: + def __init__(self, retention: AsyncRetentionResource) -> None: + self._retention = retention self.create = async_to_streamed_response_wrapper( - flag.create, + retention.create, ) self.get = async_to_streamed_response_wrapper( - flag.get, + retention.get, ) diff --git a/src/cloudflare/resources/logs/control/retention/__init__.py b/src/cloudflare/resources/logs/control/retention/__init__.py deleted file mode 100644 index f86ef33b8fd..00000000000 --- a/src/cloudflare/resources/logs/control/retention/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .flag import ( - FlagResource, - AsyncFlagResource, - FlagResourceWithRawResponse, - AsyncFlagResourceWithRawResponse, - FlagResourceWithStreamingResponse, - AsyncFlagResourceWithStreamingResponse, -) -from .retention import ( - RetentionResource, - AsyncRetentionResource, - RetentionResourceWithRawResponse, - AsyncRetentionResourceWithRawResponse, - RetentionResourceWithStreamingResponse, - AsyncRetentionResourceWithStreamingResponse, -) - -__all__ = [ - "FlagResource", - "AsyncFlagResource", - "FlagResourceWithRawResponse", - "AsyncFlagResourceWithRawResponse", - "FlagResourceWithStreamingResponse", - "AsyncFlagResourceWithStreamingResponse", - "RetentionResource", - "AsyncRetentionResource", - "RetentionResourceWithRawResponse", - "AsyncRetentionResourceWithRawResponse", - "RetentionResourceWithStreamingResponse", - "AsyncRetentionResourceWithStreamingResponse", -] diff --git a/src/cloudflare/resources/logs/control/retention/retention.py b/src/cloudflare/resources/logs/control/retention/retention.py deleted file mode 100644 index 01597a0c091..00000000000 --- a/src/cloudflare/resources/logs/control/retention/retention.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 .flag import ( - FlagResource, - AsyncFlagResource, - FlagResourceWithRawResponse, - AsyncFlagResourceWithRawResponse, - FlagResourceWithStreamingResponse, - AsyncFlagResourceWithStreamingResponse, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["RetentionResource", "AsyncRetentionResource"] - - -class RetentionResource(SyncAPIResource): - @cached_property - def flag(self) -> FlagResource: - return FlagResource(self._client) - - @cached_property - def with_raw_response(self) -> RetentionResourceWithRawResponse: - return RetentionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RetentionResourceWithStreamingResponse: - return RetentionResourceWithStreamingResponse(self) - - -class AsyncRetentionResource(AsyncAPIResource): - @cached_property - def flag(self) -> AsyncFlagResource: - return AsyncFlagResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncRetentionResourceWithRawResponse: - return AsyncRetentionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRetentionResourceWithStreamingResponse: - return AsyncRetentionResourceWithStreamingResponse(self) - - -class RetentionResourceWithRawResponse: - def __init__(self, retention: RetentionResource) -> None: - self._retention = retention - - @cached_property - def flag(self) -> FlagResourceWithRawResponse: - return FlagResourceWithRawResponse(self._retention.flag) - - -class AsyncRetentionResourceWithRawResponse: - def __init__(self, retention: AsyncRetentionResource) -> None: - self._retention = retention - - @cached_property - def flag(self) -> AsyncFlagResourceWithRawResponse: - return AsyncFlagResourceWithRawResponse(self._retention.flag) - - -class RetentionResourceWithStreamingResponse: - def __init__(self, retention: RetentionResource) -> None: - self._retention = retention - - @cached_property - def flag(self) -> FlagResourceWithStreamingResponse: - return FlagResourceWithStreamingResponse(self._retention.flag) - - -class AsyncRetentionResourceWithStreamingResponse: - def __init__(self, retention: AsyncRetentionResource) -> None: - self._retention = retention - - @cached_property - def flag(self) -> AsyncFlagResourceWithStreamingResponse: - return AsyncFlagResourceWithStreamingResponse(self._retention.flag) diff --git a/src/cloudflare/resources/magic_transit/__init__.py b/src/cloudflare/resources/magic_transit/__init__.py index c954e23e46a..db6f2e65c99 100644 --- a/src/cloudflare/resources/magic_transit/__init__.py +++ b/src/cloudflare/resources/magic_transit/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .apps import ( + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, +) from .sites import ( SitesResource, AsyncSitesResource, @@ -16,6 +24,14 @@ RoutesResourceWithStreamingResponse, AsyncRoutesResourceWithStreamingResponse, ) +from .connectors import ( + ConnectorsResource, + AsyncConnectorsResource, + ConnectorsResourceWithRawResponse, + AsyncConnectorsResourceWithRawResponse, + ConnectorsResourceWithStreamingResponse, + AsyncConnectorsResourceWithStreamingResponse, +) from .gre_tunnels import ( GRETunnelsResource, AsyncGRETunnelsResource, @@ -50,6 +66,12 @@ ) __all__ = [ + "AppsResource", + "AsyncAppsResource", + "AppsResourceWithRawResponse", + "AsyncAppsResourceWithRawResponse", + "AppsResourceWithStreamingResponse", + "AsyncAppsResourceWithStreamingResponse", "CfInterconnectsResource", "AsyncCfInterconnectsResource", "CfInterconnectsResourceWithRawResponse", @@ -80,6 +102,12 @@ "AsyncSitesResourceWithRawResponse", "SitesResourceWithStreamingResponse", "AsyncSitesResourceWithStreamingResponse", + "ConnectorsResource", + "AsyncConnectorsResource", + "ConnectorsResourceWithRawResponse", + "AsyncConnectorsResourceWithRawResponse", + "ConnectorsResourceWithStreamingResponse", + "AsyncConnectorsResourceWithStreamingResponse", "MagicTransitResource", "AsyncMagicTransitResource", "MagicTransitResourceWithRawResponse", diff --git a/src/cloudflare/resources/magic_transit/apps.py b/src/cloudflare/resources/magic_transit/apps.py new file mode 100644 index 00000000000..c0e9b974eec --- /dev/null +++ b/src/cloudflare/resources/magic_transit/apps.py @@ -0,0 +1,777 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, Type, Optional, cast, overload + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( + required_args, + maybe_transform, + async_maybe_transform, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + 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.magic_transit import app_create_params, app_update_params +from ...types.magic_transit.app_list_response import AppListResponse +from ...types.magic_transit.app_create_response import AppCreateResponse +from ...types.magic_transit.app_delete_response import AppDeleteResponse +from ...types.magic_transit.app_update_response import AppUpdateResponse + +__all__ = ["AppsResource", "AsyncAppsResource"] + + +class AppsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AppsResourceWithRawResponse: + return AppsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AppsResourceWithStreamingResponse: + return AppsResourceWithStreamingResponse(self) + + @overload + 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, + ) -> Optional[AppCreateResponse]: + """ + Creates a new App for an account + + 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 + """ + ... + + @overload + 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, + ) -> Optional[AppCreateResponse]: + """ + Creates a new App for an account + + 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 + """ + ... + + @required_args(["account_id", "body"]) + 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, + ) -> Optional[AppCreateResponse]: + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._post( + f"/accounts/{account_id}/magic/apps", + body=maybe_transform(body, app_create_params.AppCreateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AppCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[AppCreateResponse]], ResultWrapper[AppCreateResponse]), + ) + + @overload + def update( + self, + account_app_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[AppUpdateResponse]: + """ + Updates an Account App + + Args: + account_id: Identifier + + account_app_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 + """ + ... + + @overload + def update( + self, + account_app_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[AppUpdateResponse]: + """ + Updates an Account App + + Args: + account_id: Identifier + + account_app_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 + """ + ... + + @overload + def update( + self, + account_app_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[AppUpdateResponse]: + """ + Updates an Account App + + Args: + account_id: Identifier + + account_app_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 + """ + ... + + @overload + def update( + self, + account_app_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[AppUpdateResponse]: + """ + Updates an Account App + + Args: + account_id: Identifier + + account_app_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 + """ + ... + + @required_args(["account_id", "body"]) + def update( + self, + account_app_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[AppUpdateResponse]: + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not account_app_id: + raise ValueError(f"Expected a non-empty value for `account_app_id` but received {account_app_id!r}") + return self._put( + f"/accounts/{account_id}/magic/apps/{account_app_id}", + body=maybe_transform(body, app_update_params.AppUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AppUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[AppUpdateResponse]], ResultWrapper[AppUpdateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[AppListResponse]: + """ + Lists Apps associated with an account. + + Args: + account_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/magic/apps", + page=SyncSinglePage[AppListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=cast(Any, AppListResponse), # Union types cannot be passed in as arguments in the type system + ) + + def delete( + self, + account_app_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AppDeleteResponse]: + """ + Deletes specific Account App. + + Args: + account_id: Identifier + + account_app_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 account_app_id: + raise ValueError(f"Expected a non-empty value for `account_app_id` but received {account_app_id!r}") + return self._delete( + f"/accounts/{account_id}/magic/apps/{account_app_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AppDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[AppDeleteResponse]], ResultWrapper[AppDeleteResponse]), + ) + + +class AsyncAppsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAppsResourceWithRawResponse: + return AsyncAppsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAppsResourceWithStreamingResponse: + return AsyncAppsResourceWithStreamingResponse(self) + + @overload + 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, + ) -> Optional[AppCreateResponse]: + """ + Creates a new App for an account + + 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 + """ + ... + + @overload + 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, + ) -> Optional[AppCreateResponse]: + """ + Creates a new App for an account + + 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 + """ + ... + + @required_args(["account_id", "body"]) + 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, + ) -> Optional[AppCreateResponse]: + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._post( + f"/accounts/{account_id}/magic/apps", + body=await async_maybe_transform(body, app_create_params.AppCreateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AppCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[AppCreateResponse]], ResultWrapper[AppCreateResponse]), + ) + + @overload + async def update( + self, + account_app_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[AppUpdateResponse]: + """ + Updates an Account App + + Args: + account_id: Identifier + + account_app_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 + """ + ... + + @overload + async def update( + self, + account_app_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[AppUpdateResponse]: + """ + Updates an Account App + + Args: + account_id: Identifier + + account_app_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 + """ + ... + + @overload + async def update( + self, + account_app_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[AppUpdateResponse]: + """ + Updates an Account App + + Args: + account_id: Identifier + + account_app_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 + """ + ... + + @overload + async def update( + self, + account_app_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[AppUpdateResponse]: + """ + Updates an Account App + + Args: + account_id: Identifier + + account_app_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 + """ + ... + + @required_args(["account_id", "body"]) + async def update( + self, + account_app_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[AppUpdateResponse]: + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not account_app_id: + raise ValueError(f"Expected a non-empty value for `account_app_id` but received {account_app_id!r}") + return await self._put( + f"/accounts/{account_id}/magic/apps/{account_app_id}", + body=await async_maybe_transform(body, app_update_params.AppUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AppUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[AppUpdateResponse]], ResultWrapper[AppUpdateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[AppListResponse, AsyncSinglePage[AppListResponse]]: + """ + Lists Apps associated with an account. + + Args: + account_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/magic/apps", + page=AsyncSinglePage[AppListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=cast(Any, AppListResponse), # Union types cannot be passed in as arguments in the type system + ) + + async def delete( + self, + account_app_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AppDeleteResponse]: + """ + Deletes specific Account App. + + Args: + account_id: Identifier + + account_app_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 account_app_id: + raise ValueError(f"Expected a non-empty value for `account_app_id` but received {account_app_id!r}") + return await self._delete( + f"/accounts/{account_id}/magic/apps/{account_app_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[AppDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[AppDeleteResponse]], ResultWrapper[AppDeleteResponse]), + ) + + +class AppsResourceWithRawResponse: + def __init__(self, apps: AppsResource) -> None: + self._apps = apps + + self.create = to_raw_response_wrapper( + apps.create, + ) + self.update = to_raw_response_wrapper( + apps.update, + ) + self.list = to_raw_response_wrapper( + apps.list, + ) + self.delete = to_raw_response_wrapper( + apps.delete, + ) + + +class AsyncAppsResourceWithRawResponse: + def __init__(self, apps: AsyncAppsResource) -> None: + self._apps = apps + + self.create = async_to_raw_response_wrapper( + apps.create, + ) + self.update = async_to_raw_response_wrapper( + apps.update, + ) + self.list = async_to_raw_response_wrapper( + apps.list, + ) + self.delete = async_to_raw_response_wrapper( + apps.delete, + ) + + +class AppsResourceWithStreamingResponse: + def __init__(self, apps: AppsResource) -> None: + self._apps = apps + + self.create = to_streamed_response_wrapper( + apps.create, + ) + self.update = to_streamed_response_wrapper( + apps.update, + ) + self.list = to_streamed_response_wrapper( + apps.list, + ) + self.delete = to_streamed_response_wrapper( + apps.delete, + ) + + +class AsyncAppsResourceWithStreamingResponse: + def __init__(self, apps: AsyncAppsResource) -> None: + self._apps = apps + + self.create = async_to_streamed_response_wrapper( + apps.create, + ) + self.update = async_to_streamed_response_wrapper( + apps.update, + ) + self.list = async_to_streamed_response_wrapper( + apps.list, + ) + self.delete = async_to_streamed_response_wrapper( + apps.delete, + ) diff --git a/src/cloudflare/resources/magic_transit/connectors.py b/src/cloudflare/resources/magic_transit/connectors.py new file mode 100644 index 00000000000..c9c670927e4 --- /dev/null +++ b/src/cloudflare/resources/magic_transit/connectors.py @@ -0,0 +1,510 @@ +# 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 ...pagination import SyncSinglePage, AsyncSinglePage +from ..._base_client import ( + AsyncPaginator, + make_request_options, +) +from ...types.magic_transit import connector_edit_params, connector_update_params +from ...types.magic_transit.connector_get_response import ConnectorGetResponse +from ...types.magic_transit.connector_edit_response import ConnectorEditResponse +from ...types.magic_transit.connector_list_response import ConnectorListResponse +from ...types.magic_transit.connector_update_response import ConnectorUpdateResponse + +__all__ = ["ConnectorsResource", "AsyncConnectorsResource"] + + +class ConnectorsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ConnectorsResourceWithRawResponse: + return ConnectorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ConnectorsResourceWithStreamingResponse: + return ConnectorsResourceWithStreamingResponse(self) + + def update( + self, + connector_id: str, + *, + account_id: str, + activated: bool | NotGiven = NOT_GIVEN, + interrupt_window_duration_hours: float | NotGiven = NOT_GIVEN, + interrupt_window_hour_of_day: float | NotGiven = NOT_GIVEN, + notes: str | NotGiven = NOT_GIVEN, + timezone: 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, + ) -> ConnectorUpdateResponse: + """ + Replace Connector + + Args: + account_id: Account identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not connector_id: + raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}") + return self._put( + f"/accounts/{account_id}/magic/connectors/{connector_id}", + body=maybe_transform( + { + "activated": activated, + "interrupt_window_duration_hours": interrupt_window_duration_hours, + "interrupt_window_hour_of_day": interrupt_window_hour_of_day, + "notes": notes, + "timezone": timezone, + }, + connector_update_params.ConnectorUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ConnectorUpdateResponse]._unwrapper, + ), + cast_to=cast(Type[ConnectorUpdateResponse], ResultWrapper[ConnectorUpdateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[ConnectorListResponse]: + """ + List Connectors + + Args: + account_id: Account identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/magic/connectors", + page=SyncSinglePage[ConnectorListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=ConnectorListResponse, + ) + + def edit( + self, + connector_id: str, + *, + account_id: str, + activated: bool | NotGiven = NOT_GIVEN, + interrupt_window_duration_hours: float | NotGiven = NOT_GIVEN, + interrupt_window_hour_of_day: float | NotGiven = NOT_GIVEN, + notes: str | NotGiven = NOT_GIVEN, + timezone: 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, + ) -> ConnectorEditResponse: + """ + Update Connector + + Args: + account_id: Account identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not connector_id: + raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}") + return self._patch( + f"/accounts/{account_id}/magic/connectors/{connector_id}", + body=maybe_transform( + { + "activated": activated, + "interrupt_window_duration_hours": interrupt_window_duration_hours, + "interrupt_window_hour_of_day": interrupt_window_hour_of_day, + "notes": notes, + "timezone": timezone, + }, + connector_edit_params.ConnectorEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ConnectorEditResponse]._unwrapper, + ), + cast_to=cast(Type[ConnectorEditResponse], ResultWrapper[ConnectorEditResponse]), + ) + + def get( + self, + connector_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, + ) -> ConnectorGetResponse: + """ + Fetch Connector + + Args: + account_id: Account identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not connector_id: + raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}") + return self._get( + f"/accounts/{account_id}/magic/connectors/{connector_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ConnectorGetResponse]._unwrapper, + ), + cast_to=cast(Type[ConnectorGetResponse], ResultWrapper[ConnectorGetResponse]), + ) + + +class AsyncConnectorsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncConnectorsResourceWithRawResponse: + return AsyncConnectorsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncConnectorsResourceWithStreamingResponse: + return AsyncConnectorsResourceWithStreamingResponse(self) + + async def update( + self, + connector_id: str, + *, + account_id: str, + activated: bool | NotGiven = NOT_GIVEN, + interrupt_window_duration_hours: float | NotGiven = NOT_GIVEN, + interrupt_window_hour_of_day: float | NotGiven = NOT_GIVEN, + notes: str | NotGiven = NOT_GIVEN, + timezone: 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, + ) -> ConnectorUpdateResponse: + """ + Replace Connector + + Args: + account_id: Account identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not connector_id: + raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}") + return await self._put( + f"/accounts/{account_id}/magic/connectors/{connector_id}", + body=await async_maybe_transform( + { + "activated": activated, + "interrupt_window_duration_hours": interrupt_window_duration_hours, + "interrupt_window_hour_of_day": interrupt_window_hour_of_day, + "notes": notes, + "timezone": timezone, + }, + connector_update_params.ConnectorUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ConnectorUpdateResponse]._unwrapper, + ), + cast_to=cast(Type[ConnectorUpdateResponse], ResultWrapper[ConnectorUpdateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[ConnectorListResponse, AsyncSinglePage[ConnectorListResponse]]: + """ + List Connectors + + Args: + account_id: Account identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/magic/connectors", + page=AsyncSinglePage[ConnectorListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=ConnectorListResponse, + ) + + async def edit( + self, + connector_id: str, + *, + account_id: str, + activated: bool | NotGiven = NOT_GIVEN, + interrupt_window_duration_hours: float | NotGiven = NOT_GIVEN, + interrupt_window_hour_of_day: float | NotGiven = NOT_GIVEN, + notes: str | NotGiven = NOT_GIVEN, + timezone: 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, + ) -> ConnectorEditResponse: + """ + Update Connector + + Args: + account_id: Account identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not connector_id: + raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}") + return await self._patch( + f"/accounts/{account_id}/magic/connectors/{connector_id}", + body=await async_maybe_transform( + { + "activated": activated, + "interrupt_window_duration_hours": interrupt_window_duration_hours, + "interrupt_window_hour_of_day": interrupt_window_hour_of_day, + "notes": notes, + "timezone": timezone, + }, + connector_edit_params.ConnectorEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ConnectorEditResponse]._unwrapper, + ), + cast_to=cast(Type[ConnectorEditResponse], ResultWrapper[ConnectorEditResponse]), + ) + + async def get( + self, + connector_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, + ) -> ConnectorGetResponse: + """ + Fetch Connector + + Args: + account_id: Account identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not connector_id: + raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}") + return await self._get( + f"/accounts/{account_id}/magic/connectors/{connector_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ConnectorGetResponse]._unwrapper, + ), + cast_to=cast(Type[ConnectorGetResponse], ResultWrapper[ConnectorGetResponse]), + ) + + +class ConnectorsResourceWithRawResponse: + def __init__(self, connectors: ConnectorsResource) -> None: + self._connectors = connectors + + self.update = to_raw_response_wrapper( + connectors.update, + ) + self.list = to_raw_response_wrapper( + connectors.list, + ) + self.edit = to_raw_response_wrapper( + connectors.edit, + ) + self.get = to_raw_response_wrapper( + connectors.get, + ) + + +class AsyncConnectorsResourceWithRawResponse: + def __init__(self, connectors: AsyncConnectorsResource) -> None: + self._connectors = connectors + + self.update = async_to_raw_response_wrapper( + connectors.update, + ) + self.list = async_to_raw_response_wrapper( + connectors.list, + ) + self.edit = async_to_raw_response_wrapper( + connectors.edit, + ) + self.get = async_to_raw_response_wrapper( + connectors.get, + ) + + +class ConnectorsResourceWithStreamingResponse: + def __init__(self, connectors: ConnectorsResource) -> None: + self._connectors = connectors + + self.update = to_streamed_response_wrapper( + connectors.update, + ) + self.list = to_streamed_response_wrapper( + connectors.list, + ) + self.edit = to_streamed_response_wrapper( + connectors.edit, + ) + self.get = to_streamed_response_wrapper( + connectors.get, + ) + + +class AsyncConnectorsResourceWithStreamingResponse: + def __init__(self, connectors: AsyncConnectorsResource) -> None: + self._connectors = connectors + + self.update = async_to_streamed_response_wrapper( + connectors.update, + ) + self.list = async_to_streamed_response_wrapper( + connectors.list, + ) + self.edit = async_to_streamed_response_wrapper( + connectors.edit, + ) + self.get = async_to_streamed_response_wrapper( + connectors.get, + ) diff --git a/src/cloudflare/resources/magic_transit/magic_transit.py b/src/cloudflare/resources/magic_transit/magic_transit.py index 1cce72b3cfa..7eeb84551cf 100644 --- a/src/cloudflare/resources/magic_transit/magic_transit.py +++ b/src/cloudflare/resources/magic_transit/magic_transit.py @@ -2,6 +2,14 @@ from __future__ import annotations +from .apps import ( + AppsResource, + AsyncAppsResource, + AppsResourceWithRawResponse, + AsyncAppsResourceWithRawResponse, + AppsResourceWithStreamingResponse, + AsyncAppsResourceWithStreamingResponse, +) from .sites import ( SitesResource, AsyncSitesResource, @@ -19,6 +27,14 @@ AsyncRoutesResourceWithStreamingResponse, ) from ..._compat import cached_property +from .connectors import ( + ConnectorsResource, + AsyncConnectorsResource, + ConnectorsResourceWithRawResponse, + AsyncConnectorsResourceWithRawResponse, + ConnectorsResourceWithStreamingResponse, + AsyncConnectorsResourceWithStreamingResponse, +) from ..._resource import SyncAPIResource, AsyncAPIResource from .gre_tunnels import ( GRETunnelsResource, @@ -50,6 +66,10 @@ class MagicTransitResource(SyncAPIResource): + @cached_property + def apps(self) -> AppsResource: + return AppsResource(self._client) + @cached_property def cf_interconnects(self) -> CfInterconnectsResource: return CfInterconnectsResource(self._client) @@ -70,6 +90,10 @@ def routes(self) -> RoutesResource: def sites(self) -> SitesResource: return SitesResource(self._client) + @cached_property + def connectors(self) -> ConnectorsResource: + return ConnectorsResource(self._client) + @cached_property def with_raw_response(self) -> MagicTransitResourceWithRawResponse: return MagicTransitResourceWithRawResponse(self) @@ -80,6 +104,10 @@ def with_streaming_response(self) -> MagicTransitResourceWithStreamingResponse: class AsyncMagicTransitResource(AsyncAPIResource): + @cached_property + def apps(self) -> AsyncAppsResource: + return AsyncAppsResource(self._client) + @cached_property def cf_interconnects(self) -> AsyncCfInterconnectsResource: return AsyncCfInterconnectsResource(self._client) @@ -100,6 +128,10 @@ def routes(self) -> AsyncRoutesResource: def sites(self) -> AsyncSitesResource: return AsyncSitesResource(self._client) + @cached_property + def connectors(self) -> AsyncConnectorsResource: + return AsyncConnectorsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncMagicTransitResourceWithRawResponse: return AsyncMagicTransitResourceWithRawResponse(self) @@ -113,6 +145,10 @@ class MagicTransitResourceWithRawResponse: def __init__(self, magic_transit: MagicTransitResource) -> None: self._magic_transit = magic_transit + @cached_property + def apps(self) -> AppsResourceWithRawResponse: + return AppsResourceWithRawResponse(self._magic_transit.apps) + @cached_property def cf_interconnects(self) -> CfInterconnectsResourceWithRawResponse: return CfInterconnectsResourceWithRawResponse(self._magic_transit.cf_interconnects) @@ -133,11 +169,19 @@ def routes(self) -> RoutesResourceWithRawResponse: def sites(self) -> SitesResourceWithRawResponse: return SitesResourceWithRawResponse(self._magic_transit.sites) + @cached_property + def connectors(self) -> ConnectorsResourceWithRawResponse: + return ConnectorsResourceWithRawResponse(self._magic_transit.connectors) + class AsyncMagicTransitResourceWithRawResponse: def __init__(self, magic_transit: AsyncMagicTransitResource) -> None: self._magic_transit = magic_transit + @cached_property + def apps(self) -> AsyncAppsResourceWithRawResponse: + return AsyncAppsResourceWithRawResponse(self._magic_transit.apps) + @cached_property def cf_interconnects(self) -> AsyncCfInterconnectsResourceWithRawResponse: return AsyncCfInterconnectsResourceWithRawResponse(self._magic_transit.cf_interconnects) @@ -158,11 +202,19 @@ def routes(self) -> AsyncRoutesResourceWithRawResponse: def sites(self) -> AsyncSitesResourceWithRawResponse: return AsyncSitesResourceWithRawResponse(self._magic_transit.sites) + @cached_property + def connectors(self) -> AsyncConnectorsResourceWithRawResponse: + return AsyncConnectorsResourceWithRawResponse(self._magic_transit.connectors) + class MagicTransitResourceWithStreamingResponse: def __init__(self, magic_transit: MagicTransitResource) -> None: self._magic_transit = magic_transit + @cached_property + def apps(self) -> AppsResourceWithStreamingResponse: + return AppsResourceWithStreamingResponse(self._magic_transit.apps) + @cached_property def cf_interconnects(self) -> CfInterconnectsResourceWithStreamingResponse: return CfInterconnectsResourceWithStreamingResponse(self._magic_transit.cf_interconnects) @@ -183,11 +235,19 @@ def routes(self) -> RoutesResourceWithStreamingResponse: def sites(self) -> SitesResourceWithStreamingResponse: return SitesResourceWithStreamingResponse(self._magic_transit.sites) + @cached_property + def connectors(self) -> ConnectorsResourceWithStreamingResponse: + return ConnectorsResourceWithStreamingResponse(self._magic_transit.connectors) + class AsyncMagicTransitResourceWithStreamingResponse: def __init__(self, magic_transit: AsyncMagicTransitResource) -> None: self._magic_transit = magic_transit + @cached_property + def apps(self) -> AsyncAppsResourceWithStreamingResponse: + return AsyncAppsResourceWithStreamingResponse(self._magic_transit.apps) + @cached_property def cf_interconnects(self) -> AsyncCfInterconnectsResourceWithStreamingResponse: return AsyncCfInterconnectsResourceWithStreamingResponse(self._magic_transit.cf_interconnects) @@ -207,3 +267,7 @@ def routes(self) -> AsyncRoutesResourceWithStreamingResponse: @cached_property def sites(self) -> AsyncSitesResourceWithStreamingResponse: return AsyncSitesResourceWithStreamingResponse(self._magic_transit.sites) + + @cached_property + def connectors(self) -> AsyncConnectorsResourceWithStreamingResponse: + return AsyncConnectorsResourceWithStreamingResponse(self._magic_transit.connectors) diff --git a/src/cloudflare/resources/magic_transit/sites/acls.py b/src/cloudflare/resources/magic_transit/sites/acls.py index 4d850273bdf..8c6e537f60b 100644 --- a/src/cloudflare/resources/magic_transit/sites/acls.py +++ b/src/cloudflare/resources/magic_transit/sites/acls.py @@ -25,7 +25,7 @@ AsyncPaginator, make_request_options, ) -from ....types.magic_transit.sites import acl_create_params, acl_update_params +from ....types.magic_transit.sites import acl_edit_params, acl_create_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 @@ -74,8 +74,8 @@ def create( 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. + traffic locally on the Magic Connector. If not included in request, will default + to false. extra_headers: Send extra headers @@ -145,8 +145,8 @@ def update( 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. + traffic locally on the Magic Connector. If not included in request, will default + to false. name: The name of the ACL. @@ -277,6 +277,81 @@ def delete( cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) + def edit( + self, + acl_identifier: str, + *, + account_id: str, + site_id: str, + 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, + ) -> ACL: + """ + Patch a specific Site ACL. + + Args: + account_id: Identifier + + site_id: Identifier + + 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 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 + + 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 site_id: + raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") + if not acl_identifier: + raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}") + return self._patch( + f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}", + body=maybe_transform( + { + "description": description, + "forward_locally": forward_locally, + "lan_1": lan_1, + "lan_2": lan_2, + "name": name, + "protocols": protocols, + }, + acl_edit_params.ACLEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ACL]._unwrapper, + ), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), + ) + def get( self, acl_identifier: str, @@ -368,8 +443,8 @@ async def create( 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. + traffic locally on the Magic Connector. If not included in request, will default + to false. extra_headers: Send extra headers @@ -439,8 +514,8 @@ async def update( 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. + traffic locally on the Magic Connector. If not included in request, will default + to false. name: The name of the ACL. @@ -571,6 +646,81 @@ async def delete( cast_to=cast(Type[ACL], ResultWrapper[ACL]), ) + async def edit( + self, + acl_identifier: str, + *, + account_id: str, + site_id: str, + 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, + ) -> ACL: + """ + Patch a specific Site ACL. + + Args: + account_id: Identifier + + site_id: Identifier + + 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 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 + + 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 site_id: + raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") + if not acl_identifier: + raise ValueError(f"Expected a non-empty value for `acl_identifier` but received {acl_identifier!r}") + return await self._patch( + f"/accounts/{account_id}/magic/sites/{site_id}/acls/{acl_identifier}", + body=await async_maybe_transform( + { + "description": description, + "forward_locally": forward_locally, + "lan_1": lan_1, + "lan_2": lan_2, + "name": name, + "protocols": protocols, + }, + acl_edit_params.ACLEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[ACL]._unwrapper, + ), + cast_to=cast(Type[ACL], ResultWrapper[ACL]), + ) + async def get( self, acl_identifier: str, @@ -637,6 +787,9 @@ def __init__(self, acls: ACLsResource) -> None: self.delete = to_raw_response_wrapper( acls.delete, ) + self.edit = to_raw_response_wrapper( + acls.edit, + ) self.get = to_raw_response_wrapper( acls.get, ) @@ -658,6 +811,9 @@ def __init__(self, acls: AsyncACLsResource) -> None: self.delete = async_to_raw_response_wrapper( acls.delete, ) + self.edit = async_to_raw_response_wrapper( + acls.edit, + ) self.get = async_to_raw_response_wrapper( acls.get, ) @@ -679,6 +835,9 @@ def __init__(self, acls: ACLsResource) -> None: self.delete = to_streamed_response_wrapper( acls.delete, ) + self.edit = to_streamed_response_wrapper( + acls.edit, + ) self.get = to_streamed_response_wrapper( acls.get, ) @@ -700,6 +859,9 @@ def __init__(self, acls: AsyncACLsResource) -> None: self.delete = async_to_streamed_response_wrapper( acls.delete, ) + self.edit = async_to_streamed_response_wrapper( + acls.edit, + ) self.get = async_to_streamed_response_wrapper( acls.get, ) diff --git a/src/cloudflare/resources/magic_transit/sites/lans.py b/src/cloudflare/resources/magic_transit/sites/lans.py index cdb2d94456a..307bdcffc9b 100644 --- a/src/cloudflare/resources/magic_transit/sites/lans.py +++ b/src/cloudflare/resources/magic_transit/sites/lans.py @@ -25,7 +25,11 @@ AsyncPaginator, make_request_options, ) -from ....types.magic_transit.sites import lan_create_params, lan_update_params +from ....types.magic_transit.sites import ( + lan_edit_params, + lan_create_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 @@ -63,10 +67,10 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LANCreateResponse: - """Creates a new LAN. + """Creates a new Site LAN. - If the site is in high availability mode, static_addressing - is required along with secondary and virtual address. + If the site is in high availability mode, + static_addressing is required along with secondary and virtual address. Args: account_id: Identifier @@ -138,7 +142,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LAN: """ - Update a specific LAN. + Update a specific Site LAN. Args: account_id: Identifier @@ -203,7 +207,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncSinglePage[LAN]: """ - Lists LANs associated with an account and site. + Lists Site LANs associated with an account. Args: account_id: Identifier @@ -245,7 +249,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LAN: """ - Remove a specific LAN. + Remove a specific Site LAN. Args: account_id: Identifier @@ -280,6 +284,78 @@ def delete( cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) + def edit( + self, + lan_id: str, + *, + account_id: str, + site_id: str, + 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, + ) -> LAN: + """ + Patch a specific Site LAN. + + Args: + account_id: Identifier + + site_id: Identifier + + 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 + + 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 site_id: + raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") + if not lan_id: + raise ValueError(f"Expected a non-empty value for `lan_id` but received {lan_id!r}") + return self._patch( + f"/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}", + body=maybe_transform( + { + "name": name, + "nat": nat, + "physport": physport, + "routed_subnets": routed_subnets, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + lan_edit_params.LANEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[LAN]._unwrapper, + ), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), + ) + def get( self, lan_id: str, @@ -294,7 +370,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LAN: """ - Get a specific LAN. + Get a specific Site LAN. Args: account_id: Identifier @@ -358,10 +434,10 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LANCreateResponse: - """Creates a new LAN. + """Creates a new Site LAN. - If the site is in high availability mode, static_addressing - is required along with secondary and virtual address. + If the site is in high availability mode, + static_addressing is required along with secondary and virtual address. Args: account_id: Identifier @@ -433,7 +509,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LAN: """ - Update a specific LAN. + Update a specific Site LAN. Args: account_id: Identifier @@ -498,7 +574,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[LAN, AsyncSinglePage[LAN]]: """ - Lists LANs associated with an account and site. + Lists Site LANs associated with an account. Args: account_id: Identifier @@ -540,7 +616,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LAN: """ - Remove a specific LAN. + Remove a specific Site LAN. Args: account_id: Identifier @@ -575,6 +651,78 @@ async def delete( cast_to=cast(Type[LAN], ResultWrapper[LAN]), ) + async def edit( + self, + lan_id: str, + *, + account_id: str, + site_id: str, + 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, + ) -> LAN: + """ + Patch a specific Site LAN. + + Args: + account_id: Identifier + + site_id: Identifier + + 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 + + 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 site_id: + raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") + if not lan_id: + raise ValueError(f"Expected a non-empty value for `lan_id` but received {lan_id!r}") + return await self._patch( + f"/accounts/{account_id}/magic/sites/{site_id}/lans/{lan_id}", + body=await async_maybe_transform( + { + "name": name, + "nat": nat, + "physport": physport, + "routed_subnets": routed_subnets, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + lan_edit_params.LANEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[LAN]._unwrapper, + ), + cast_to=cast(Type[LAN], ResultWrapper[LAN]), + ) + async def get( self, lan_id: str, @@ -589,7 +737,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> LAN: """ - Get a specific LAN. + Get a specific Site LAN. Args: account_id: Identifier @@ -641,6 +789,9 @@ def __init__(self, lans: LANsResource) -> None: self.delete = to_raw_response_wrapper( lans.delete, ) + self.edit = to_raw_response_wrapper( + lans.edit, + ) self.get = to_raw_response_wrapper( lans.get, ) @@ -662,6 +813,9 @@ def __init__(self, lans: AsyncLANsResource) -> None: self.delete = async_to_raw_response_wrapper( lans.delete, ) + self.edit = async_to_raw_response_wrapper( + lans.edit, + ) self.get = async_to_raw_response_wrapper( lans.get, ) @@ -683,6 +837,9 @@ def __init__(self, lans: LANsResource) -> None: self.delete = to_streamed_response_wrapper( lans.delete, ) + self.edit = to_streamed_response_wrapper( + lans.edit, + ) self.get = to_streamed_response_wrapper( lans.get, ) @@ -704,6 +861,9 @@ def __init__(self, lans: AsyncLANsResource) -> None: self.delete = async_to_streamed_response_wrapper( lans.delete, ) + self.edit = async_to_streamed_response_wrapper( + lans.edit, + ) self.get = async_to_streamed_response_wrapper( lans.get, ) diff --git a/src/cloudflare/resources/magic_transit/sites/sites.py b/src/cloudflare/resources/magic_transit/sites/sites.py index b36d0ef691e..67c24a85c6f 100644 --- a/src/cloudflare/resources/magic_transit/sites/sites.py +++ b/src/cloudflare/resources/magic_transit/sites/sites.py @@ -49,7 +49,12 @@ AsyncPaginator, make_request_options, ) -from ....types.magic_transit import site_list_params, site_create_params, site_update_params +from ....types.magic_transit import ( + site_edit_params, + site_list_params, + site_create_params, + site_update_params, +) from ....types.magic_transit.site import Site from ....types.magic_transit.site_location_param import SiteLocationParam @@ -102,14 +107,14 @@ def create( name: The name of the site. - connector_id: Magic WAN Connector identifier tag. + connector_id: Magic 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. + secondary_connector_id: Magic Connector identifier tag. Used when high availability mode is on. extra_headers: Send extra headers @@ -169,13 +174,13 @@ def update( site_id: Identifier - connector_id: Magic WAN Connector identifier tag. + connector_id: Magic 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. + secondary_connector_id: Magic Connector identifier tag. Used when high availability mode is on. extra_headers: Send extra headers @@ -301,6 +306,73 @@ def delete( cast_to=cast(Type[Site], ResultWrapper[Site]), ) + def edit( + self, + site_id: str, + *, + account_id: str, + 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, + ) -> Site: + """ + Patch a specific Site. + + Args: + account_id: Identifier + + site_id: Identifier + + connector_id: Magic Connector identifier tag. + + location: Location of site in latitude and longitude. + + name: The name of the site. + + secondary_connector_id: Magic Connector identifier tag. Used when high availability mode is on. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 site_id: + raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") + return self._patch( + f"/accounts/{account_id}/magic/sites/{site_id}", + body=maybe_transform( + { + "connector_id": connector_id, + "description": description, + "location": location, + "name": name, + "secondary_connector_id": secondary_connector_id, + }, + site_edit_params.SiteEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Site]._unwrapper, + ), + cast_to=cast(Type[Site], ResultWrapper[Site]), + ) + def get( self, site_id: str, @@ -392,14 +464,14 @@ async def create( name: The name of the site. - connector_id: Magic WAN Connector identifier tag. + connector_id: Magic 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. + secondary_connector_id: Magic Connector identifier tag. Used when high availability mode is on. extra_headers: Send extra headers @@ -459,13 +531,13 @@ async def update( site_id: Identifier - connector_id: Magic WAN Connector identifier tag. + connector_id: Magic 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. + secondary_connector_id: Magic Connector identifier tag. Used when high availability mode is on. extra_headers: Send extra headers @@ -591,6 +663,73 @@ async def delete( cast_to=cast(Type[Site], ResultWrapper[Site]), ) + async def edit( + self, + site_id: str, + *, + account_id: str, + 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, + ) -> Site: + """ + Patch a specific Site. + + Args: + account_id: Identifier + + site_id: Identifier + + connector_id: Magic Connector identifier tag. + + location: Location of site in latitude and longitude. + + name: The name of the site. + + secondary_connector_id: Magic Connector identifier tag. Used when high availability mode is on. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 site_id: + raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") + return await self._patch( + f"/accounts/{account_id}/magic/sites/{site_id}", + body=await async_maybe_transform( + { + "connector_id": connector_id, + "description": description, + "location": location, + "name": name, + "secondary_connector_id": secondary_connector_id, + }, + site_edit_params.SiteEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Site]._unwrapper, + ), + cast_to=cast(Type[Site], ResultWrapper[Site]), + ) + async def get( self, site_id: str, @@ -652,6 +791,9 @@ def __init__(self, sites: SitesResource) -> None: self.delete = to_raw_response_wrapper( sites.delete, ) + self.edit = to_raw_response_wrapper( + sites.edit, + ) self.get = to_raw_response_wrapper( sites.get, ) @@ -685,6 +827,9 @@ def __init__(self, sites: AsyncSitesResource) -> None: self.delete = async_to_raw_response_wrapper( sites.delete, ) + self.edit = async_to_raw_response_wrapper( + sites.edit, + ) self.get = async_to_raw_response_wrapper( sites.get, ) @@ -718,6 +863,9 @@ def __init__(self, sites: SitesResource) -> None: self.delete = to_streamed_response_wrapper( sites.delete, ) + self.edit = to_streamed_response_wrapper( + sites.edit, + ) self.get = to_streamed_response_wrapper( sites.get, ) @@ -751,6 +899,9 @@ def __init__(self, sites: AsyncSitesResource) -> None: self.delete = async_to_streamed_response_wrapper( sites.delete, ) + self.edit = async_to_streamed_response_wrapper( + sites.edit, + ) self.get = async_to_streamed_response_wrapper( sites.get, ) diff --git a/src/cloudflare/resources/magic_transit/sites/wans.py b/src/cloudflare/resources/magic_transit/sites/wans.py index c41c8985728..90cba1d7d90 100644 --- a/src/cloudflare/resources/magic_transit/sites/wans.py +++ b/src/cloudflare/resources/magic_transit/sites/wans.py @@ -25,7 +25,7 @@ AsyncPaginator, make_request_options, ) -from ....types.magic_transit.sites import wan_create_params, wan_update_params +from ....types.magic_transit.sites import wan_edit_params, wan_create_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 @@ -60,7 +60,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> WANCreateResponse: """ - Creates a new WAN. + Creates a new Site WAN. Args: account_id: Identifier @@ -125,7 +125,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> WAN: """ - Update a specific WAN. + Update a specific Site WAN. Args: account_id: Identifier @@ -188,7 +188,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncSinglePage[WAN]: """ - Lists WANs associated with an account and site. + Lists Site WANs associated with an account. Args: account_id: Identifier @@ -230,7 +230,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> WAN: """ - Remove a specific WAN. + Remove a specific Site WAN. Args: account_id: Identifier @@ -265,6 +265,75 @@ def delete( cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) + def edit( + self, + wan_id: str, + *, + account_id: str, + site_id: str, + 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, + ) -> WAN: + """ + Patch a specific Site WAN. + + Args: + account_id: Identifier + + site_id: Identifier + + 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 + + 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 site_id: + raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") + if not wan_id: + raise ValueError(f"Expected a non-empty value for `wan_id` but received {wan_id!r}") + return self._patch( + f"/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}", + body=maybe_transform( + { + "name": name, + "physport": physport, + "priority": priority, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + wan_edit_params.WANEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[WAN]._unwrapper, + ), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), + ) + def get( self, wan_id: str, @@ -279,7 +348,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> WAN: """ - Get a specific WAN. + Get a specific Site WAN. Args: account_id: Identifier @@ -342,7 +411,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> WANCreateResponse: """ - Creates a new WAN. + Creates a new Site WAN. Args: account_id: Identifier @@ -407,7 +476,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> WAN: """ - Update a specific WAN. + Update a specific Site WAN. Args: account_id: Identifier @@ -470,7 +539,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[WAN, AsyncSinglePage[WAN]]: """ - Lists WANs associated with an account and site. + Lists Site WANs associated with an account. Args: account_id: Identifier @@ -512,7 +581,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> WAN: """ - Remove a specific WAN. + Remove a specific Site WAN. Args: account_id: Identifier @@ -547,6 +616,75 @@ async def delete( cast_to=cast(Type[WAN], ResultWrapper[WAN]), ) + async def edit( + self, + wan_id: str, + *, + account_id: str, + site_id: str, + 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, + ) -> WAN: + """ + Patch a specific Site WAN. + + Args: + account_id: Identifier + + site_id: Identifier + + 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 + + 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 site_id: + raise ValueError(f"Expected a non-empty value for `site_id` but received {site_id!r}") + if not wan_id: + raise ValueError(f"Expected a non-empty value for `wan_id` but received {wan_id!r}") + return await self._patch( + f"/accounts/{account_id}/magic/sites/{site_id}/wans/{wan_id}", + body=await async_maybe_transform( + { + "name": name, + "physport": physport, + "priority": priority, + "static_addressing": static_addressing, + "vlan_tag": vlan_tag, + }, + wan_edit_params.WANEditParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[WAN]._unwrapper, + ), + cast_to=cast(Type[WAN], ResultWrapper[WAN]), + ) + async def get( self, wan_id: str, @@ -561,7 +699,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> WAN: """ - Get a specific WAN. + Get a specific Site WAN. Args: account_id: Identifier @@ -613,6 +751,9 @@ def __init__(self, wans: WANsResource) -> None: self.delete = to_raw_response_wrapper( wans.delete, ) + self.edit = to_raw_response_wrapper( + wans.edit, + ) self.get = to_raw_response_wrapper( wans.get, ) @@ -634,6 +775,9 @@ def __init__(self, wans: AsyncWANsResource) -> None: self.delete = async_to_raw_response_wrapper( wans.delete, ) + self.edit = async_to_raw_response_wrapper( + wans.edit, + ) self.get = async_to_raw_response_wrapper( wans.get, ) @@ -655,6 +799,9 @@ def __init__(self, wans: WANsResource) -> None: self.delete = to_streamed_response_wrapper( wans.delete, ) + self.edit = to_streamed_response_wrapper( + wans.edit, + ) self.get = to_streamed_response_wrapper( wans.get, ) @@ -676,6 +823,9 @@ def __init__(self, wans: AsyncWANsResource) -> None: self.delete = async_to_streamed_response_wrapper( wans.delete, ) + self.edit = async_to_streamed_response_wrapper( + wans.edit, + ) self.get = async_to_streamed_response_wrapper( wans.get, ) diff --git a/src/cloudflare/resources/memberships.py b/src/cloudflare/resources/memberships.py index aac512175a7..b4c963fbea7 100644 --- a/src/cloudflare/resources/memberships.py +++ b/src/cloudflare/resources/memberships.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -55,7 +55,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MembershipUpdateResponse: + ) -> Optional[MembershipUpdateResponse]: """ Accept or reject this account invitation. @@ -74,22 +74,17 @@ def update( """ if not membership_id: raise ValueError(f"Expected a non-empty value for `membership_id` but received {membership_id!r}") - return cast( - MembershipUpdateResponse, - self._put( - f"/memberships/{membership_id}", - body=maybe_transform({"status": status}, membership_update_params.MembershipUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[MembershipUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[MembershipUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/memberships/{membership_id}", + body=maybe_transform({"status": status}, membership_update_params.MembershipUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[MembershipUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[MembershipUpdateResponse]], ResultWrapper[MembershipUpdateResponse]), ) def list( @@ -167,7 +162,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MembershipDeleteResponse: + ) -> Optional[MembershipDeleteResponse]: """ Remove the associated member from an account. @@ -191,9 +186,9 @@ def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[MembershipDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[MembershipDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[MembershipDeleteResponse], ResultWrapper[MembershipDeleteResponse]), + cast_to=cast(Type[Optional[MembershipDeleteResponse]], ResultWrapper[MembershipDeleteResponse]), ) def get( @@ -206,7 +201,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MembershipGetResponse: + ) -> Optional[MembershipGetResponse]: """ Get a specific membership. @@ -223,21 +218,16 @@ def get( """ if not membership_id: raise ValueError(f"Expected a non-empty value for `membership_id` but received {membership_id!r}") - return cast( - MembershipGetResponse, - self._get( - f"/memberships/{membership_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[MembershipGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[MembershipGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/memberships/{membership_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[MembershipGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[MembershipGetResponse]], ResultWrapper[MembershipGetResponse]), ) @@ -261,7 +251,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MembershipUpdateResponse: + ) -> Optional[MembershipUpdateResponse]: """ Accept or reject this account invitation. @@ -280,22 +270,17 @@ async def update( """ if not membership_id: raise ValueError(f"Expected a non-empty value for `membership_id` but received {membership_id!r}") - return cast( - MembershipUpdateResponse, - await self._put( - f"/memberships/{membership_id}", - body=await async_maybe_transform({"status": status}, membership_update_params.MembershipUpdateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[MembershipUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[MembershipUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/memberships/{membership_id}", + body=await async_maybe_transform({"status": status}, membership_update_params.MembershipUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[MembershipUpdateResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[MembershipUpdateResponse]], ResultWrapper[MembershipUpdateResponse]), ) def list( @@ -373,7 +358,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MembershipDeleteResponse: + ) -> Optional[MembershipDeleteResponse]: """ Remove the associated member from an account. @@ -397,9 +382,9 @@ async def delete( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[MembershipDeleteResponse]._unwrapper, + post_parser=ResultWrapper[Optional[MembershipDeleteResponse]]._unwrapper, ), - cast_to=cast(Type[MembershipDeleteResponse], ResultWrapper[MembershipDeleteResponse]), + cast_to=cast(Type[Optional[MembershipDeleteResponse]], ResultWrapper[MembershipDeleteResponse]), ) async def get( @@ -412,7 +397,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MembershipGetResponse: + ) -> Optional[MembershipGetResponse]: """ Get a specific membership. @@ -429,21 +414,16 @@ async def get( """ if not membership_id: raise ValueError(f"Expected a non-empty value for `membership_id` but received {membership_id!r}") - return cast( - MembershipGetResponse, - await self._get( - f"/memberships/{membership_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[MembershipGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[MembershipGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/memberships/{membership_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[MembershipGetResponse]]._unwrapper, ), + cast_to=cast(Type[Optional[MembershipGetResponse]], ResultWrapper[MembershipGetResponse]), ) diff --git a/src/cloudflare/resources/page_shield/__init__.py b/src/cloudflare/resources/page_shield/__init__.py index 42a42e10c4d..31bb6daa0ad 100644 --- a/src/cloudflare/resources/page_shield/__init__.py +++ b/src/cloudflare/resources/page_shield/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .cookies import ( + CookiesResource, + AsyncCookiesResource, + CookiesResourceWithRawResponse, + AsyncCookiesResourceWithRawResponse, + CookiesResourceWithStreamingResponse, + AsyncCookiesResourceWithStreamingResponse, +) from .scripts import ( ScriptsResource, AsyncScriptsResource, @@ -52,6 +60,12 @@ "AsyncScriptsResourceWithRawResponse", "ScriptsResourceWithStreamingResponse", "AsyncScriptsResourceWithStreamingResponse", + "CookiesResource", + "AsyncCookiesResource", + "CookiesResourceWithRawResponse", + "AsyncCookiesResourceWithRawResponse", + "CookiesResourceWithStreamingResponse", + "AsyncCookiesResourceWithStreamingResponse", "PageShieldResource", "AsyncPageShieldResource", "PageShieldResourceWithRawResponse", diff --git a/src/cloudflare/resources/page_shield/connections.py b/src/cloudflare/resources/page_shield/connections.py index c9d5a5c7c71..e961e1e4bc6 100644 --- a/src/cloudflare/resources/page_shield/connections.py +++ b/src/cloudflare/resources/page_shield/connections.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -16,6 +17,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) +from ..._wrappers import ResultWrapper from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( AsyncPaginator, @@ -161,14 +163,14 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Connection: + ) -> Optional[Connection]: """ Fetches a connection detected by Page Shield by connection ID. Args: zone_id: Identifier - connection_id: The ID of the resource. + connection_id: Identifier extra_headers: Send extra headers @@ -185,9 +187,13 @@ def get( return self._get( f"/zones/{zone_id}/page_shield/connections/{connection_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Connection]]._unwrapper, ), - cast_to=Connection, + cast_to=cast(Type[Optional[Connection]], ResultWrapper[Connection]), ) @@ -325,14 +331,14 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Connection: + ) -> Optional[Connection]: """ Fetches a connection detected by Page Shield by connection ID. Args: zone_id: Identifier - connection_id: The ID of the resource. + connection_id: Identifier extra_headers: Send extra headers @@ -349,9 +355,13 @@ async def get( return await self._get( f"/zones/{zone_id}/page_shield/connections/{connection_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[Connection]]._unwrapper, ), - cast_to=Connection, + cast_to=cast(Type[Optional[Connection]], ResultWrapper[Connection]), ) diff --git a/src/cloudflare/resources/page_shield/cookies.py b/src/cloudflare/resources/page_shield/cookies.py new file mode 100644 index 00000000000..d35ffba6734 --- /dev/null +++ b/src/cloudflare/resources/page_shield/cookies.py @@ -0,0 +1,412 @@ +# 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 +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.page_shield import cookie_list_params +from ...types.page_shield.cookie_get_response import CookieGetResponse +from ...types.page_shield.cookie_list_response import CookieListResponse + +__all__ = ["CookiesResource", "AsyncCookiesResource"] + + +class CookiesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CookiesResourceWithRawResponse: + return CookiesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CookiesResourceWithStreamingResponse: + return CookiesResourceWithStreamingResponse(self) + + def list( + self, + *, + zone_id: str, + direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + domain: str | NotGiven = NOT_GIVEN, + export: Literal["csv"] | NotGiven = NOT_GIVEN, + hosts: str | NotGiven = NOT_GIVEN, + http_only: bool | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + order_by: Literal["first_seen_at", "last_seen_at"] | NotGiven = NOT_GIVEN, + page: str | NotGiven = NOT_GIVEN, + page_url: str | NotGiven = NOT_GIVEN, + path: str | NotGiven = NOT_GIVEN, + per_page: float | NotGiven = NOT_GIVEN, + same_site: Literal["lax", "strict", "none"] | NotGiven = NOT_GIVEN, + secure: bool | NotGiven = NOT_GIVEN, + type: Literal["first_party", "unknown"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[CookieListResponse]: + """ + Lists all cookies collected by Page Shield. + + Args: + zone_id: Identifier + + direction: The direction used to sort returned cookies.' + + domain: Filters the returned cookies that match the specified domain attribute + + export: Export the list of cookies as a file. Cannot be used with per_page or page + options. + + hosts: Includes cookies that match one or more URL-encoded hostnames separated by + commas. + + Wildcards are supported at the start and end of each hostname to support starts + with, ends with and contains. If no wildcards are used, results will be filtered + by exact match + + http_only: Filters the returned cookies that are set with HttpOnly + + name: Filters the returned cookies that match the specified name. Wildcards are + supported at the start and end to support starts with, ends with and contains. + e.g. session\\** + + order_by: The field used to sort returned cookies. + + page: The current page number of the paginated results. + + page_url: Includes connections that match one or more page URLs (separated by commas) + where they were last seen + + Wildcards are supported at the start and end of each page URL to support starts + with, ends with and contains. If no wildcards are used, results will be filtered + by exact match + + path: Filters the returned cookies that match the specified path attribute + + per_page: The number of results per page. + + same_site: Filters the returned cookies that match the specified same_site attribute + + secure: Filters the returned cookies that are set with Secure + + type: Filters the returned cookies that match the specified type attribute + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/page_shield/cookies", + page=SyncSinglePage[CookieListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "direction": direction, + "domain": domain, + "export": export, + "hosts": hosts, + "http_only": http_only, + "name": name, + "order_by": order_by, + "page": page, + "page_url": page_url, + "path": path, + "per_page": per_page, + "same_site": same_site, + "secure": secure, + "type": type, + }, + cookie_list_params.CookieListParams, + ), + ), + model=CookieListResponse, + ) + + def get( + self, + cookie_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[CookieGetResponse]: + """ + Fetches a cookie collected by Page Shield by cookie ID. + + Args: + zone_id: Identifier + + cookie_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 cookie_id: + raise ValueError(f"Expected a non-empty value for `cookie_id` but received {cookie_id!r}") + return self._get( + f"/zones/{zone_id}/page_shield/cookies/{cookie_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[CookieGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[CookieGetResponse]], ResultWrapper[CookieGetResponse]), + ) + + +class AsyncCookiesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCookiesResourceWithRawResponse: + return AsyncCookiesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCookiesResourceWithStreamingResponse: + return AsyncCookiesResourceWithStreamingResponse(self) + + def list( + self, + *, + zone_id: str, + direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + domain: str | NotGiven = NOT_GIVEN, + export: Literal["csv"] | NotGiven = NOT_GIVEN, + hosts: str | NotGiven = NOT_GIVEN, + http_only: bool | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + order_by: Literal["first_seen_at", "last_seen_at"] | NotGiven = NOT_GIVEN, + page: str | NotGiven = NOT_GIVEN, + page_url: str | NotGiven = NOT_GIVEN, + path: str | NotGiven = NOT_GIVEN, + per_page: float | NotGiven = NOT_GIVEN, + same_site: Literal["lax", "strict", "none"] | NotGiven = NOT_GIVEN, + secure: bool | NotGiven = NOT_GIVEN, + type: Literal["first_party", "unknown"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this 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[CookieListResponse, AsyncSinglePage[CookieListResponse]]: + """ + Lists all cookies collected by Page Shield. + + Args: + zone_id: Identifier + + direction: The direction used to sort returned cookies.' + + domain: Filters the returned cookies that match the specified domain attribute + + export: Export the list of cookies as a file. Cannot be used with per_page or page + options. + + hosts: Includes cookies that match one or more URL-encoded hostnames separated by + commas. + + Wildcards are supported at the start and end of each hostname to support starts + with, ends with and contains. If no wildcards are used, results will be filtered + by exact match + + http_only: Filters the returned cookies that are set with HttpOnly + + name: Filters the returned cookies that match the specified name. Wildcards are + supported at the start and end to support starts with, ends with and contains. + e.g. session\\** + + order_by: The field used to sort returned cookies. + + page: The current page number of the paginated results. + + page_url: Includes connections that match one or more page URLs (separated by commas) + where they were last seen + + Wildcards are supported at the start and end of each page URL to support starts + with, ends with and contains. If no wildcards are used, results will be filtered + by exact match + + path: Filters the returned cookies that match the specified path attribute + + per_page: The number of results per page. + + same_site: Filters the returned cookies that match the specified same_site attribute + + secure: Filters the returned cookies that are set with Secure + + type: Filters the returned cookies that match the specified type attribute + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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}/page_shield/cookies", + page=AsyncSinglePage[CookieListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "direction": direction, + "domain": domain, + "export": export, + "hosts": hosts, + "http_only": http_only, + "name": name, + "order_by": order_by, + "page": page, + "page_url": page_url, + "path": path, + "per_page": per_page, + "same_site": same_site, + "secure": secure, + "type": type, + }, + cookie_list_params.CookieListParams, + ), + ), + model=CookieListResponse, + ) + + async def get( + self, + cookie_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[CookieGetResponse]: + """ + Fetches a cookie collected by Page Shield by cookie ID. + + Args: + zone_id: Identifier + + cookie_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 cookie_id: + raise ValueError(f"Expected a non-empty value for `cookie_id` but received {cookie_id!r}") + return await self._get( + f"/zones/{zone_id}/page_shield/cookies/{cookie_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[CookieGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[CookieGetResponse]], ResultWrapper[CookieGetResponse]), + ) + + +class CookiesResourceWithRawResponse: + def __init__(self, cookies: CookiesResource) -> None: + self._cookies = cookies + + self.list = to_raw_response_wrapper( + cookies.list, + ) + self.get = to_raw_response_wrapper( + cookies.get, + ) + + +class AsyncCookiesResourceWithRawResponse: + def __init__(self, cookies: AsyncCookiesResource) -> None: + self._cookies = cookies + + self.list = async_to_raw_response_wrapper( + cookies.list, + ) + self.get = async_to_raw_response_wrapper( + cookies.get, + ) + + +class CookiesResourceWithStreamingResponse: + def __init__(self, cookies: CookiesResource) -> None: + self._cookies = cookies + + self.list = to_streamed_response_wrapper( + cookies.list, + ) + self.get = to_streamed_response_wrapper( + cookies.get, + ) + + +class AsyncCookiesResourceWithStreamingResponse: + def __init__(self, cookies: AsyncCookiesResource) -> None: + self._cookies = cookies + + self.list = async_to_streamed_response_wrapper( + cookies.list, + ) + self.get = async_to_streamed_response_wrapper( + cookies.get, + ) diff --git a/src/cloudflare/resources/page_shield/page_shield.py b/src/cloudflare/resources/page_shield/page_shield.py index ef88a6b37e0..9e7d2e27f74 100644 --- a/src/cloudflare/resources/page_shield/page_shield.py +++ b/src/cloudflare/resources/page_shield/page_shield.py @@ -2,10 +2,18 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx +from .cookies import ( + CookiesResource, + AsyncCookiesResource, + CookiesResourceWithRawResponse, + AsyncCookiesResourceWithRawResponse, + CookiesResourceWithStreamingResponse, + AsyncCookiesResourceWithStreamingResponse, +) from .scripts import ( ScriptsResource, AsyncScriptsResource, @@ -67,6 +75,10 @@ def connections(self) -> ConnectionsResource: def scripts(self) -> ScriptsResource: return ScriptsResource(self._client) + @cached_property + def cookies(self) -> CookiesResource: + return CookiesResource(self._client) + @cached_property def with_raw_response(self) -> PageShieldResourceWithRawResponse: return PageShieldResourceWithRawResponse(self) @@ -88,7 +100,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldUpdateResponse: + ) -> Optional[PageShieldUpdateResponse]: """ Updates Page Shield settings. @@ -127,9 +139,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[PageShieldUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PageShieldUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[PageShieldUpdateResponse], ResultWrapper[PageShieldUpdateResponse]), + cast_to=cast(Type[Optional[PageShieldUpdateResponse]], ResultWrapper[PageShieldUpdateResponse]), ) def get( @@ -142,7 +154,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Setting: + ) -> Optional[Setting]: """ Fetches the Page Shield settings. @@ -166,9 +178,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Setting]._unwrapper, + post_parser=ResultWrapper[Optional[Setting]]._unwrapper, ), - cast_to=cast(Type[Setting], ResultWrapper[Setting]), + cast_to=cast(Type[Optional[Setting]], ResultWrapper[Setting]), ) @@ -185,6 +197,10 @@ def connections(self) -> AsyncConnectionsResource: def scripts(self) -> AsyncScriptsResource: return AsyncScriptsResource(self._client) + @cached_property + def cookies(self) -> AsyncCookiesResource: + return AsyncCookiesResource(self._client) + @cached_property def with_raw_response(self) -> AsyncPageShieldResourceWithRawResponse: return AsyncPageShieldResourceWithRawResponse(self) @@ -206,7 +222,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PageShieldUpdateResponse: + ) -> Optional[PageShieldUpdateResponse]: """ Updates Page Shield settings. @@ -245,9 +261,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[PageShieldUpdateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[PageShieldUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[PageShieldUpdateResponse], ResultWrapper[PageShieldUpdateResponse]), + cast_to=cast(Type[Optional[PageShieldUpdateResponse]], ResultWrapper[PageShieldUpdateResponse]), ) async def get( @@ -260,7 +276,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Setting: + ) -> Optional[Setting]: """ Fetches the Page Shield settings. @@ -284,9 +300,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Setting]._unwrapper, + post_parser=ResultWrapper[Optional[Setting]]._unwrapper, ), - cast_to=cast(Type[Setting], ResultWrapper[Setting]), + cast_to=cast(Type[Optional[Setting]], ResultWrapper[Setting]), ) @@ -313,6 +329,10 @@ def connections(self) -> ConnectionsResourceWithRawResponse: def scripts(self) -> ScriptsResourceWithRawResponse: return ScriptsResourceWithRawResponse(self._page_shield.scripts) + @cached_property + def cookies(self) -> CookiesResourceWithRawResponse: + return CookiesResourceWithRawResponse(self._page_shield.cookies) + class AsyncPageShieldResourceWithRawResponse: def __init__(self, page_shield: AsyncPageShieldResource) -> None: @@ -337,6 +357,10 @@ def connections(self) -> AsyncConnectionsResourceWithRawResponse: def scripts(self) -> AsyncScriptsResourceWithRawResponse: return AsyncScriptsResourceWithRawResponse(self._page_shield.scripts) + @cached_property + def cookies(self) -> AsyncCookiesResourceWithRawResponse: + return AsyncCookiesResourceWithRawResponse(self._page_shield.cookies) + class PageShieldResourceWithStreamingResponse: def __init__(self, page_shield: PageShieldResource) -> None: @@ -361,6 +385,10 @@ def connections(self) -> ConnectionsResourceWithStreamingResponse: def scripts(self) -> ScriptsResourceWithStreamingResponse: return ScriptsResourceWithStreamingResponse(self._page_shield.scripts) + @cached_property + def cookies(self) -> CookiesResourceWithStreamingResponse: + return CookiesResourceWithStreamingResponse(self._page_shield.cookies) + class AsyncPageShieldResourceWithStreamingResponse: def __init__(self, page_shield: AsyncPageShieldResource) -> None: @@ -384,3 +412,7 @@ def connections(self) -> AsyncConnectionsResourceWithStreamingResponse: @cached_property def scripts(self) -> AsyncScriptsResourceWithStreamingResponse: return AsyncScriptsResourceWithStreamingResponse(self._page_shield.scripts) + + @cached_property + def cookies(self) -> AsyncCookiesResourceWithStreamingResponse: + return AsyncCookiesResourceWithStreamingResponse(self._page_shield.cookies) diff --git a/src/cloudflare/resources/page_shield/policies.py b/src/cloudflare/resources/page_shield/policies.py index 2a0ecdd591b..de2822019e7 100644 --- a/src/cloudflare/resources/page_shield/policies.py +++ b/src/cloudflare/resources/page_shield/policies.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -19,13 +20,17 @@ 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.page_shield import policy_create_params, policy_update_params -from ...types.page_shield.policy import Policy +from ...types.page_shield.policy_get_response import PolicyGetResponse +from ...types.page_shield.policy_list_response import PolicyListResponse +from ...types.page_shield.policy_create_response import PolicyCreateResponse +from ...types.page_shield.policy_update_response import PolicyUpdateResponse __all__ = ["PoliciesResource", "AsyncPoliciesResource"] @@ -43,18 +48,18 @@ def create( self, *, zone_id: str, - action: Literal["allow", "log"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expression: str | NotGiven = NOT_GIVEN, - value: str | NotGiven = NOT_GIVEN, + action: Literal["allow", "log"], + description: str, + enabled: bool, + expression: str, + value: 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, - ) -> Policy: + ) -> Optional[PolicyCreateResponse]: """ Create a Page Shield policy. @@ -95,9 +100,13 @@ def create( policy_create_params.PolicyCreateParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyCreateResponse]]._unwrapper, ), - cast_to=Policy, + cast_to=cast(Type[Optional[PolicyCreateResponse]], ResultWrapper[PolicyCreateResponse]), ) def update( @@ -116,14 +125,14 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Policy: + ) -> Optional[PolicyUpdateResponse]: """ Update a Page Shield policy by ID. Args: zone_id: Identifier - policy_id: The ID of the policy. + policy_id: Identifier action: The action to take if the expression matches @@ -161,9 +170,13 @@ def update( policy_update_params.PolicyUpdateParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyUpdateResponse]]._unwrapper, ), - cast_to=Policy, + cast_to=cast(Type[Optional[PolicyUpdateResponse]], ResultWrapper[PolicyUpdateResponse]), ) def list( @@ -176,7 +189,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Policy]: + ) -> SyncSinglePage[PolicyListResponse]: """ Lists all Page Shield policies. @@ -195,11 +208,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[Policy], + page=SyncSinglePage[PolicyListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Policy, + model=PolicyListResponse, ) def delete( @@ -220,7 +233,7 @@ def delete( Args: zone_id: Identifier - policy_id: The ID of the policy. + policy_id: Identifier extra_headers: Send extra headers @@ -254,14 +267,14 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Policy: + ) -> Optional[PolicyGetResponse]: """ Fetches a Page Shield policy by ID. Args: zone_id: Identifier - policy_id: The ID of the policy. + policy_id: Identifier extra_headers: Send extra headers @@ -278,9 +291,13 @@ def get( return self._get( f"/zones/{zone_id}/page_shield/policies/{policy_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyGetResponse]]._unwrapper, ), - cast_to=Policy, + cast_to=cast(Type[Optional[PolicyGetResponse]], ResultWrapper[PolicyGetResponse]), ) @@ -297,18 +314,18 @@ async def create( self, *, zone_id: str, - action: Literal["allow", "log"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - enabled: bool | NotGiven = NOT_GIVEN, - expression: str | NotGiven = NOT_GIVEN, - value: str | NotGiven = NOT_GIVEN, + action: Literal["allow", "log"], + description: str, + enabled: bool, + expression: str, + value: 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, - ) -> Policy: + ) -> Optional[PolicyCreateResponse]: """ Create a Page Shield policy. @@ -349,9 +366,13 @@ async def create( policy_create_params.PolicyCreateParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyCreateResponse]]._unwrapper, ), - cast_to=Policy, + cast_to=cast(Type[Optional[PolicyCreateResponse]], ResultWrapper[PolicyCreateResponse]), ) async def update( @@ -370,14 +391,14 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Policy: + ) -> Optional[PolicyUpdateResponse]: """ Update a Page Shield policy by ID. Args: zone_id: Identifier - policy_id: The ID of the policy. + policy_id: Identifier action: The action to take if the expression matches @@ -415,9 +436,13 @@ async def update( policy_update_params.PolicyUpdateParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyUpdateResponse]]._unwrapper, ), - cast_to=Policy, + cast_to=cast(Type[Optional[PolicyUpdateResponse]], ResultWrapper[PolicyUpdateResponse]), ) def list( @@ -430,7 +455,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Policy, AsyncSinglePage[Policy]]: + ) -> AsyncPaginator[PolicyListResponse, AsyncSinglePage[PolicyListResponse]]: """ Lists all Page Shield policies. @@ -449,11 +474,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[Policy], + page=AsyncSinglePage[PolicyListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Policy, + model=PolicyListResponse, ) async def delete( @@ -474,7 +499,7 @@ async def delete( Args: zone_id: Identifier - policy_id: The ID of the policy. + policy_id: Identifier extra_headers: Send extra headers @@ -508,14 +533,14 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Policy: + ) -> Optional[PolicyGetResponse]: """ Fetches a Page Shield policy by ID. Args: zone_id: Identifier - policy_id: The ID of the policy. + policy_id: Identifier extra_headers: Send extra headers @@ -532,9 +557,13 @@ async def get( return await self._get( f"/zones/{zone_id}/page_shield/policies/{policy_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyGetResponse]]._unwrapper, ), - cast_to=Policy, + cast_to=cast(Type[Optional[PolicyGetResponse]], ResultWrapper[PolicyGetResponse]), ) diff --git a/src/cloudflare/resources/page_shield/scripts.py b/src/cloudflare/resources/page_shield/scripts.py index 147bef3320b..2a3e556f7cc 100644 --- a/src/cloudflare/resources/page_shield/scripts.py +++ b/src/cloudflare/resources/page_shield/scripts.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -16,6 +17,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) +from ..._wrappers import ResultWrapper from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( AsyncPaginator, @@ -169,14 +171,14 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScriptGetResponse: + ) -> Optional[ScriptGetResponse]: """ Fetches a script detected by Page Shield by script ID. Args: zone_id: Identifier - script_id: The ID of the resource. + script_id: Identifier extra_headers: Send extra headers @@ -193,9 +195,13 @@ def get( return self._get( f"/zones/{zone_id}/page_shield/scripts/{script_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ScriptGetResponse]]._unwrapper, ), - cast_to=ScriptGetResponse, + cast_to=cast(Type[Optional[ScriptGetResponse]], ResultWrapper[ScriptGetResponse]), ) @@ -340,14 +346,14 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScriptGetResponse: + ) -> Optional[ScriptGetResponse]: """ Fetches a script detected by Page Shield by script ID. Args: zone_id: Identifier - script_id: The ID of the resource. + script_id: Identifier extra_headers: Send extra headers @@ -364,9 +370,13 @@ async def get( return await self._get( f"/zones/{zone_id}/page_shield/scripts/{script_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ScriptGetResponse]]._unwrapper, ), - cast_to=ScriptGetResponse, + cast_to=cast(Type[Optional[ScriptGetResponse]], ResultWrapper[ScriptGetResponse]), ) diff --git a/src/cloudflare/resources/pagerules/pagerules.py b/src/cloudflare/resources/pagerules/pagerules.py index e27797213d8..440b172abde 100644 --- a/src/cloudflare/resources/pagerules/pagerules.py +++ b/src/cloudflare/resources/pagerules/pagerules.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Any, Type, Iterable, Optional, cast from typing_extensions import Literal @@ -63,6 +64,9 @@ def with_raw_response(self) -> PagerulesResourceWithRawResponse: def with_streaming_response(self) -> PagerulesResourceWithStreamingResponse: return PagerulesResourceWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def create( self, *, @@ -133,6 +137,9 @@ def create( ), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def update( self, pagerule_id: str, @@ -210,6 +217,9 @@ def update( ), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def list( self, *, @@ -271,6 +281,9 @@ def list( cast_to=cast(Type[PageruleListResponse], ResultWrapper[PageruleListResponse]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def delete( self, pagerule_id: str, @@ -315,6 +328,9 @@ def delete( cast_to=cast(Type[Optional[PageruleDeleteResponse]], ResultWrapper[PageruleDeleteResponse]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def edit( self, pagerule_id: str, @@ -390,6 +406,9 @@ def edit( ), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) def get( self, pagerule_id: str, @@ -453,6 +472,9 @@ def with_raw_response(self) -> AsyncPagerulesResourceWithRawResponse: def with_streaming_response(self) -> AsyncPagerulesResourceWithStreamingResponse: return AsyncPagerulesResourceWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def create( self, *, @@ -523,6 +545,9 @@ async def create( ), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def update( self, pagerule_id: str, @@ -600,6 +625,9 @@ async def update( ), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def list( self, *, @@ -661,6 +689,9 @@ async def list( cast_to=cast(Type[PageruleListResponse], ResultWrapper[PageruleListResponse]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def delete( self, pagerule_id: str, @@ -705,6 +736,9 @@ async def delete( cast_to=cast(Type[Optional[PageruleDeleteResponse]], ResultWrapper[PageruleDeleteResponse]), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def edit( self, pagerule_id: str, @@ -780,6 +814,9 @@ async def edit( ), ) + @typing_extensions.deprecated( + "The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details." + ) async def get( self, pagerule_id: str, @@ -834,23 +871,35 @@ class PagerulesResourceWithRawResponse: def __init__(self, pagerules: PagerulesResource) -> None: self._pagerules = pagerules - self.create = to_raw_response_wrapper( - pagerules.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = to_raw_response_wrapper( - pagerules.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = to_raw_response_wrapper( - pagerules.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_raw_response_wrapper( - pagerules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = to_raw_response_wrapper( - pagerules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = to_raw_response_wrapper( - pagerules.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + pagerules.get # pyright: ignore[reportDeprecated], + ) ) @cached_property @@ -862,23 +911,35 @@ class AsyncPagerulesResourceWithRawResponse: def __init__(self, pagerules: AsyncPagerulesResource) -> None: self._pagerules = pagerules - self.create = async_to_raw_response_wrapper( - pagerules.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_raw_response_wrapper( - pagerules.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_raw_response_wrapper( - pagerules.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_raw_response_wrapper( - pagerules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = async_to_raw_response_wrapper( - pagerules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_raw_response_wrapper( - pagerules.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + pagerules.get # pyright: ignore[reportDeprecated], + ) ) @cached_property @@ -890,23 +951,35 @@ class PagerulesResourceWithStreamingResponse: def __init__(self, pagerules: PagerulesResource) -> None: self._pagerules = pagerules - self.create = to_streamed_response_wrapper( - pagerules.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = to_streamed_response_wrapper( - pagerules.update, + self.update = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = to_streamed_response_wrapper( - pagerules.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_streamed_response_wrapper( - pagerules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = to_streamed_response_wrapper( - pagerules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = to_streamed_response_wrapper( - pagerules.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + pagerules.get # pyright: ignore[reportDeprecated], + ) ) @cached_property @@ -918,23 +991,35 @@ class AsyncPagerulesResourceWithStreamingResponse: def __init__(self, pagerules: AsyncPagerulesResource) -> None: self._pagerules = pagerules - self.create = async_to_streamed_response_wrapper( - pagerules.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.create # pyright: ignore[reportDeprecated], + ) ) - self.update = async_to_streamed_response_wrapper( - pagerules.update, + self.update = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.update # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_streamed_response_wrapper( - pagerules.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_streamed_response_wrapper( - pagerules.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = async_to_streamed_response_wrapper( - pagerules.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_streamed_response_wrapper( - pagerules.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + pagerules.get # pyright: ignore[reportDeprecated], + ) ) @cached_property diff --git a/src/cloudflare/resources/r2/__init__.py b/src/cloudflare/resources/r2/__init__.py index 96e202b807b..be9a0113617 100644 --- a/src/cloudflare/resources/r2/__init__.py +++ b/src/cloudflare/resources/r2/__init__.py @@ -24,6 +24,14 @@ BucketsResourceWithStreamingResponse, AsyncBucketsResourceWithStreamingResponse, ) +from .temporary_credentials import ( + TemporaryCredentialsResource, + AsyncTemporaryCredentialsResource, + TemporaryCredentialsResourceWithRawResponse, + AsyncTemporaryCredentialsResourceWithRawResponse, + TemporaryCredentialsResourceWithStreamingResponse, + AsyncTemporaryCredentialsResourceWithStreamingResponse, +) __all__ = [ "BucketsResource", @@ -38,6 +46,12 @@ "AsyncSippyResourceWithRawResponse", "SippyResourceWithStreamingResponse", "AsyncSippyResourceWithStreamingResponse", + "TemporaryCredentialsResource", + "AsyncTemporaryCredentialsResource", + "TemporaryCredentialsResourceWithRawResponse", + "AsyncTemporaryCredentialsResourceWithRawResponse", + "TemporaryCredentialsResourceWithStreamingResponse", + "AsyncTemporaryCredentialsResourceWithStreamingResponse", "R2Resource", "AsyncR2Resource", "R2ResourceWithRawResponse", diff --git a/src/cloudflare/resources/r2/buckets.py b/src/cloudflare/resources/r2/buckets.py index c7c04313e66..2b322b7a24c 100644 --- a/src/cloudflare/resources/r2/buckets.py +++ b/src/cloudflare/resources/r2/buckets.py @@ -47,6 +47,7 @@ def create( account_id: str, name: str, location_hint: Literal["apac", "eeur", "enam", "weur", "wnam"] | NotGiven = NOT_GIVEN, + storage_class: Literal["Standard", "InfrequentAccess"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -64,6 +65,8 @@ def create( location_hint: Location of the bucket + storage_class: Storage class for newly uploaded objects, unless specified otherwise. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -80,6 +83,7 @@ def create( { "name": name, "location_hint": location_hint, + "storage_class": storage_class, }, bucket_create_params.BucketCreateParams, ), @@ -267,6 +271,7 @@ async def create( account_id: str, name: str, location_hint: Literal["apac", "eeur", "enam", "weur", "wnam"] | NotGiven = NOT_GIVEN, + storage_class: Literal["Standard", "InfrequentAccess"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -284,6 +289,8 @@ async def create( location_hint: Location of the bucket + storage_class: Storage class for newly uploaded objects, unless specified otherwise. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -300,6 +307,7 @@ async def create( { "name": name, "location_hint": location_hint, + "storage_class": storage_class, }, bucket_create_params.BucketCreateParams, ), diff --git a/src/cloudflare/resources/r2/r2.py b/src/cloudflare/resources/r2/r2.py index 5bf7bfb501e..a9999cd369a 100644 --- a/src/cloudflare/resources/r2/r2.py +++ b/src/cloudflare/resources/r2/r2.py @@ -20,6 +20,14 @@ ) from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource +from .temporary_credentials import ( + TemporaryCredentialsResource, + AsyncTemporaryCredentialsResource, + TemporaryCredentialsResourceWithRawResponse, + AsyncTemporaryCredentialsResourceWithRawResponse, + TemporaryCredentialsResourceWithStreamingResponse, + AsyncTemporaryCredentialsResourceWithStreamingResponse, +) __all__ = ["R2Resource", "AsyncR2Resource"] @@ -33,6 +41,10 @@ def buckets(self) -> BucketsResource: def sippy(self) -> SippyResource: return SippyResource(self._client) + @cached_property + def temporary_credentials(self) -> TemporaryCredentialsResource: + return TemporaryCredentialsResource(self._client) + @cached_property def with_raw_response(self) -> R2ResourceWithRawResponse: return R2ResourceWithRawResponse(self) @@ -51,6 +63,10 @@ def buckets(self) -> AsyncBucketsResource: def sippy(self) -> AsyncSippyResource: return AsyncSippyResource(self._client) + @cached_property + def temporary_credentials(self) -> AsyncTemporaryCredentialsResource: + return AsyncTemporaryCredentialsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncR2ResourceWithRawResponse: return AsyncR2ResourceWithRawResponse(self) @@ -72,6 +88,10 @@ def buckets(self) -> BucketsResourceWithRawResponse: def sippy(self) -> SippyResourceWithRawResponse: return SippyResourceWithRawResponse(self._r2.sippy) + @cached_property + def temporary_credentials(self) -> TemporaryCredentialsResourceWithRawResponse: + return TemporaryCredentialsResourceWithRawResponse(self._r2.temporary_credentials) + class AsyncR2ResourceWithRawResponse: def __init__(self, r2: AsyncR2Resource) -> None: @@ -85,6 +105,10 @@ def buckets(self) -> AsyncBucketsResourceWithRawResponse: def sippy(self) -> AsyncSippyResourceWithRawResponse: return AsyncSippyResourceWithRawResponse(self._r2.sippy) + @cached_property + def temporary_credentials(self) -> AsyncTemporaryCredentialsResourceWithRawResponse: + return AsyncTemporaryCredentialsResourceWithRawResponse(self._r2.temporary_credentials) + class R2ResourceWithStreamingResponse: def __init__(self, r2: R2Resource) -> None: @@ -98,6 +122,10 @@ def buckets(self) -> BucketsResourceWithStreamingResponse: def sippy(self) -> SippyResourceWithStreamingResponse: return SippyResourceWithStreamingResponse(self._r2.sippy) + @cached_property + def temporary_credentials(self) -> TemporaryCredentialsResourceWithStreamingResponse: + return TemporaryCredentialsResourceWithStreamingResponse(self._r2.temporary_credentials) + class AsyncR2ResourceWithStreamingResponse: def __init__(self, r2: AsyncR2Resource) -> None: @@ -110,3 +138,7 @@ def buckets(self) -> AsyncBucketsResourceWithStreamingResponse: @cached_property def sippy(self) -> AsyncSippyResourceWithStreamingResponse: return AsyncSippyResourceWithStreamingResponse(self._r2.sippy) + + @cached_property + def temporary_credentials(self) -> AsyncTemporaryCredentialsResourceWithStreamingResponse: + return AsyncTemporaryCredentialsResourceWithStreamingResponse(self._r2.temporary_credentials) diff --git a/src/cloudflare/resources/r2/sippy.py b/src/cloudflare/resources/r2/sippy.py index e245dda32a2..7f134a5e730 100644 --- a/src/cloudflare/resources/r2/sippy.py +++ b/src/cloudflare/resources/r2/sippy.py @@ -114,7 +114,7 @@ def update( """ ... - @required_args(["account_id"], ["account_id"]) + @required_args(["account_id"]) def update( self, bucket_name: str, @@ -326,7 +326,7 @@ async def update( """ ... - @required_args(["account_id"], ["account_id"]) + @required_args(["account_id"]) async def update( self, bucket_name: str, diff --git a/src/cloudflare/resources/r2/temporary_credentials.py b/src/cloudflare/resources/r2/temporary_credentials.py new file mode 100644 index 00000000000..f621ecdab1a --- /dev/null +++ b/src/cloudflare/resources/r2/temporary_credentials.py @@ -0,0 +1,224 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Type, cast +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) +from ..._compat import cached_property +from ...types.r2 import temporary_credential_create_params +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._wrappers import ResultWrapper +from ..._base_client import ( + make_request_options, +) +from ...types.r2.temporary_credential_create_response import TemporaryCredentialCreateResponse + +__all__ = ["TemporaryCredentialsResource", "AsyncTemporaryCredentialsResource"] + + +class TemporaryCredentialsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TemporaryCredentialsResourceWithRawResponse: + return TemporaryCredentialsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TemporaryCredentialsResourceWithStreamingResponse: + return TemporaryCredentialsResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + bucket: str, + parent_access_key_id: str, + permission: Literal["admin-read-write", "admin-read-only", "object-read-write", "object-read-only"], + ttl_seconds: float, + objects: List[str] | NotGiven = NOT_GIVEN, + prefixes: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TemporaryCredentialCreateResponse: + """ + Creates temporary access credentials on a bucket that can be optionally scoped + to prefixes or objects. + + Args: + account_id: Account ID + + bucket: Name of the GCS bucket + + parent_access_key_id: The parent access key id to use for signing + + permission: Permissions allowed on the credentials + + ttl_seconds: How long the credentials will live for in seconds + + objects: Optional object paths to scope the credentials to + + prefixes: Optional prefix paths to scope the credentials to + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._post( + f"/accounts/{account_id}/r2/temp-access-credentials", + body=maybe_transform( + { + "bucket": bucket, + "parent_access_key_id": parent_access_key_id, + "permission": permission, + "ttl_seconds": ttl_seconds, + "objects": objects, + "prefixes": prefixes, + }, + temporary_credential_create_params.TemporaryCredentialCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[TemporaryCredentialCreateResponse]._unwrapper, + ), + cast_to=cast(Type[TemporaryCredentialCreateResponse], ResultWrapper[TemporaryCredentialCreateResponse]), + ) + + +class AsyncTemporaryCredentialsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTemporaryCredentialsResourceWithRawResponse: + return AsyncTemporaryCredentialsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTemporaryCredentialsResourceWithStreamingResponse: + return AsyncTemporaryCredentialsResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + bucket: str, + parent_access_key_id: str, + permission: Literal["admin-read-write", "admin-read-only", "object-read-write", "object-read-only"], + ttl_seconds: float, + objects: List[str] | NotGiven = NOT_GIVEN, + prefixes: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TemporaryCredentialCreateResponse: + """ + Creates temporary access credentials on a bucket that can be optionally scoped + to prefixes or objects. + + Args: + account_id: Account ID + + bucket: Name of the GCS bucket + + parent_access_key_id: The parent access key id to use for signing + + permission: Permissions allowed on the credentials + + ttl_seconds: How long the credentials will live for in seconds + + objects: Optional object paths to scope the credentials to + + prefixes: Optional prefix paths to scope the credentials to + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._post( + f"/accounts/{account_id}/r2/temp-access-credentials", + body=await async_maybe_transform( + { + "bucket": bucket, + "parent_access_key_id": parent_access_key_id, + "permission": permission, + "ttl_seconds": ttl_seconds, + "objects": objects, + "prefixes": prefixes, + }, + temporary_credential_create_params.TemporaryCredentialCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[TemporaryCredentialCreateResponse]._unwrapper, + ), + cast_to=cast(Type[TemporaryCredentialCreateResponse], ResultWrapper[TemporaryCredentialCreateResponse]), + ) + + +class TemporaryCredentialsResourceWithRawResponse: + def __init__(self, temporary_credentials: TemporaryCredentialsResource) -> None: + self._temporary_credentials = temporary_credentials + + self.create = to_raw_response_wrapper( + temporary_credentials.create, + ) + + +class AsyncTemporaryCredentialsResourceWithRawResponse: + def __init__(self, temporary_credentials: AsyncTemporaryCredentialsResource) -> None: + self._temporary_credentials = temporary_credentials + + self.create = async_to_raw_response_wrapper( + temporary_credentials.create, + ) + + +class TemporaryCredentialsResourceWithStreamingResponse: + def __init__(self, temporary_credentials: TemporaryCredentialsResource) -> None: + self._temporary_credentials = temporary_credentials + + self.create = to_streamed_response_wrapper( + temporary_credentials.create, + ) + + +class AsyncTemporaryCredentialsResourceWithStreamingResponse: + def __init__(self, temporary_credentials: AsyncTemporaryCredentialsResource) -> None: + self._temporary_credentials = temporary_credentials + + self.create = async_to_streamed_response_wrapper( + temporary_credentials.create, + ) diff --git a/src/cloudflare/resources/radar/bgp/__init__.py b/src/cloudflare/resources/radar/bgp/__init__.py index b143abf6005..1e54970bfb0 100644 --- a/src/cloudflare/resources/radar/bgp/__init__.py +++ b/src/cloudflare/resources/radar/bgp/__init__.py @@ -8,6 +8,14 @@ BGPResourceWithStreamingResponse, AsyncBGPResourceWithStreamingResponse, ) +from .ips import ( + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, +) from .top import ( TopResource, AsyncTopResource, @@ -66,6 +74,12 @@ "AsyncRoutesResourceWithRawResponse", "RoutesResourceWithStreamingResponse", "AsyncRoutesResourceWithStreamingResponse", + "IPsResource", + "AsyncIPsResource", + "IPsResourceWithRawResponse", + "AsyncIPsResourceWithRawResponse", + "IPsResourceWithStreamingResponse", + "AsyncIPsResourceWithStreamingResponse", "BGPResource", "AsyncBGPResource", "BGPResourceWithRawResponse", diff --git a/src/cloudflare/resources/radar/bgp/bgp.py b/src/cloudflare/resources/radar/bgp/bgp.py index 2eb211139be..0b0c2aa8a06 100644 --- a/src/cloudflare/resources/radar/bgp/bgp.py +++ b/src/cloudflare/resources/radar/bgp/bgp.py @@ -2,12 +2,20 @@ from __future__ import annotations -from typing import List, Type, Union, cast +from typing import List, Type, Union, Iterable, cast from datetime import datetime from typing_extensions import Literal import httpx +from .ips import ( + IPsResource, + AsyncIPsResource, + IPsResourceWithRawResponse, + AsyncIPsResourceWithRawResponse, + IPsResourceWithStreamingResponse, + AsyncIPsResourceWithStreamingResponse, +) from .top import ( TopResource, AsyncTopResource, @@ -83,6 +91,10 @@ def hijacks(self) -> HijacksResource: def routes(self) -> RoutesResource: return RoutesResource(self._client) + @cached_property + def ips(self) -> IPsResource: + return IPsResource(self._client) + @cached_property def with_raw_response(self) -> BGPResourceWithRawResponse: return BGPResourceWithRawResponse(self) @@ -120,7 +132,7 @@ def timeseries( date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, - prefix: List[str] | NotGiven = NOT_GIVEN, + prefix: Iterable[bgp_timeseries_params.Prefix] | NotGiven = NOT_GIVEN, update_type: List[Literal["ANNOUNCEMENT", "WITHDRAWAL"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -212,6 +224,10 @@ def hijacks(self) -> AsyncHijacksResource: def routes(self) -> AsyncRoutesResource: return AsyncRoutesResource(self._client) + @cached_property + def ips(self) -> AsyncIPsResource: + return AsyncIPsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncBGPResourceWithRawResponse: return AsyncBGPResourceWithRawResponse(self) @@ -249,7 +265,7 @@ async def timeseries( date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, - prefix: List[str] | NotGiven = NOT_GIVEN, + prefix: Iterable[bgp_timeseries_params.Prefix] | NotGiven = NOT_GIVEN, update_type: List[Literal["ANNOUNCEMENT", "WITHDRAWAL"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -348,6 +364,10 @@ def hijacks(self) -> HijacksResourceWithRawResponse: def routes(self) -> RoutesResourceWithRawResponse: return RoutesResourceWithRawResponse(self._bgp.routes) + @cached_property + def ips(self) -> IPsResourceWithRawResponse: + return IPsResourceWithRawResponse(self._bgp.ips) + class AsyncBGPResourceWithRawResponse: def __init__(self, bgp: AsyncBGPResource) -> None: @@ -373,6 +393,10 @@ def hijacks(self) -> AsyncHijacksResourceWithRawResponse: def routes(self) -> AsyncRoutesResourceWithRawResponse: return AsyncRoutesResourceWithRawResponse(self._bgp.routes) + @cached_property + def ips(self) -> AsyncIPsResourceWithRawResponse: + return AsyncIPsResourceWithRawResponse(self._bgp.ips) + class BGPResourceWithStreamingResponse: def __init__(self, bgp: BGPResource) -> None: @@ -398,6 +422,10 @@ def hijacks(self) -> HijacksResourceWithStreamingResponse: def routes(self) -> RoutesResourceWithStreamingResponse: return RoutesResourceWithStreamingResponse(self._bgp.routes) + @cached_property + def ips(self) -> IPsResourceWithStreamingResponse: + return IPsResourceWithStreamingResponse(self._bgp.ips) + class AsyncBGPResourceWithStreamingResponse: def __init__(self, bgp: AsyncBGPResource) -> None: @@ -422,3 +450,7 @@ def hijacks(self) -> AsyncHijacksResourceWithStreamingResponse: @cached_property def routes(self) -> AsyncRoutesResourceWithStreamingResponse: return AsyncRoutesResourceWithStreamingResponse(self._bgp.routes) + + @cached_property + def ips(self) -> AsyncIPsResourceWithStreamingResponse: + return AsyncIPsResourceWithStreamingResponse(self._bgp.ips) diff --git a/src/cloudflare/resources/radar/bgp/hijacks/events.py b/src/cloudflare/resources/radar/bgp/hijacks/events.py index 6844c5c06d6..6700a064beb 100644 --- a/src/cloudflare/resources/radar/bgp/hijacks/events.py +++ b/src/cloudflare/resources/radar/bgp/hijacks/events.py @@ -111,7 +111,7 @@ def list( per_page: Number of entries per page - prefix: The prefix hijacked during a BGP hijack event + prefix: Network prefix, IPv4 or IPv6. sort_by: Sort events by field @@ -243,7 +243,7 @@ def list( per_page: Number of entries per page - prefix: The prefix hijacked during a BGP hijack event + prefix: Network prefix, IPv4 or IPv6. sort_by: Sort events by field diff --git a/src/cloudflare/resources/radar/bgp/ips.py b/src/cloudflare/resources/radar/bgp/ips.py new file mode 100644 index 00000000000..62cfdacf32a --- /dev/null +++ b/src/cloudflare/resources/radar/bgp/ips.py @@ -0,0 +1,267 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, 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 ip_timeseries_params +from ....types.radar.bgp.ip_timeseries_response import IPTimeseriesResponse + +__all__ = ["IPsResource", "AsyncIPsResource"] + + +class IPsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> IPsResourceWithRawResponse: + return IPsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IPsResourceWithStreamingResponse: + return IPsResourceWithStreamingResponse(self) + + def timeseries( + self, + *, + asn: str | NotGiven = NOT_GIVEN, + 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, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + include_delay: bool | NotGiven = NOT_GIVEN, + location: str | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> IPTimeseriesResponse: + """ + Gets time-series data for the announced IP space count, represented as the + number of IPv4 /24s and IPv6 /48s, for a given ASN. + + Args: + asn: Comma separated list of ASNs. + + 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). + + format: Format results are returned in. + + include_delay: Include data delay meta information + + location: Comma separated list of locations. + + name: Array of names that will be used to name the series in responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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/ips/timeseries", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "asn": asn, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "format": format, + "include_delay": include_delay, + "location": location, + "name": name, + }, + ip_timeseries_params.IPTimeseriesParams, + ), + post_parser=ResultWrapper[IPTimeseriesResponse]._unwrapper, + ), + cast_to=cast(Type[IPTimeseriesResponse], ResultWrapper[IPTimeseriesResponse]), + ) + + +class AsyncIPsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncIPsResourceWithRawResponse: + return AsyncIPsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIPsResourceWithStreamingResponse: + return AsyncIPsResourceWithStreamingResponse(self) + + async def timeseries( + self, + *, + asn: str | NotGiven = NOT_GIVEN, + 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, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + include_delay: bool | NotGiven = NOT_GIVEN, + location: str | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> IPTimeseriesResponse: + """ + Gets time-series data for the announced IP space count, represented as the + number of IPv4 /24s and IPv6 /48s, for a given ASN. + + Args: + asn: Comma separated list of ASNs. + + 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). + + format: Format results are returned in. + + include_delay: Include data delay meta information + + location: Comma separated list of locations. + + name: Array of names that will be used to name the series in responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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/ips/timeseries", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "asn": asn, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "format": format, + "include_delay": include_delay, + "location": location, + "name": name, + }, + ip_timeseries_params.IPTimeseriesParams, + ), + post_parser=ResultWrapper[IPTimeseriesResponse]._unwrapper, + ), + cast_to=cast(Type[IPTimeseriesResponse], ResultWrapper[IPTimeseriesResponse]), + ) + + +class IPsResourceWithRawResponse: + def __init__(self, ips: IPsResource) -> None: + self._ips = ips + + self.timeseries = to_raw_response_wrapper( + ips.timeseries, + ) + + +class AsyncIPsResourceWithRawResponse: + def __init__(self, ips: AsyncIPsResource) -> None: + self._ips = ips + + self.timeseries = async_to_raw_response_wrapper( + ips.timeseries, + ) + + +class IPsResourceWithStreamingResponse: + def __init__(self, ips: IPsResource) -> None: + self._ips = ips + + self.timeseries = to_streamed_response_wrapper( + ips.timeseries, + ) + + +class AsyncIPsResourceWithStreamingResponse: + def __init__(self, ips: AsyncIPsResource) -> None: + self._ips = ips + + self.timeseries = async_to_streamed_response_wrapper( + ips.timeseries, + ) diff --git a/src/cloudflare/resources/radar/bgp/routes.py b/src/cloudflare/resources/radar/bgp/routes.py index cdb54f244f5..104c66fdd4d 100644 --- a/src/cloudflare/resources/radar/bgp/routes.py +++ b/src/cloudflare/resources/radar/bgp/routes.py @@ -2,8 +2,7 @@ from __future__ import annotations -from typing import Type, Union, cast -from datetime import datetime +from typing import Type, cast from typing_extensions import Literal import httpx @@ -25,11 +24,11 @@ from ...._base_client import ( make_request_options, ) -from ....types.radar.bgp import route_moas_params, route_stats_params, route_pfx2as_params, route_timeseries_params +from ....types.radar.bgp import route_ases_params, route_moas_params, route_stats_params, route_pfx2as_params +from ....types.radar.bgp.route_ases_response import RouteAsesResponse 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__ = ["RoutesResource", "AsyncRoutesResource"] @@ -43,6 +42,66 @@ def with_raw_response(self) -> RoutesResourceWithRawResponse: def with_streaming_response(self) -> RoutesResourceWithStreamingResponse: return RoutesResourceWithStreamingResponse(self) + def ases( + self, + *, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + location: str | NotGiven = NOT_GIVEN, + sort_by: Literal["cone", "pfxs", "ipv4", "ipv6", "rpki_valid", "rpki_invalid", "rpki_unknown"] + | 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, + ) -> RouteAsesResponse: + """ + List all ASes on current global routing tables with routing statistics + + Args: + format: Format results are returned in. + + limit: Limit the number of objects in the response. + + location: Location Alpha2 code. + + sort_by: Return order results by given type + + sort_order: Sort by value ascending or descending + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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/routes/ases", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "format": format, + "limit": limit, + "location": location, + "sort_by": sort_by, + "sort_order": sort_order, + }, + route_ases_params.RouteAsesParams, + ), + post_parser=ResultWrapper[RouteAsesResponse]._unwrapper, + ), + cast_to=cast(Type[RouteAsesResponse], ResultWrapper[RouteAsesResponse]), + ) + def moas( self, *, @@ -67,7 +126,7 @@ def moas( origin: Lookup MOASes originated by the given ASN - prefix: Lookup MOASes by prefix + prefix: Network prefix, IPv4 or IPv6. extra_headers: Send extra headers @@ -124,7 +183,7 @@ def pfx2as( origin: Lookup prefixes originated by the given ASN - prefix: Lookup origin ASNs of the given prefix + prefix: Network prefix, IPv4 or IPv6. rpki_status: Return only results with matching rpki status: valid, invalid or unknown @@ -209,60 +268,46 @@ def stats( cast_to=cast(Type[RouteStatsResponse], ResultWrapper[RouteStatsResponse]), ) - def timeseries( + +class AsyncRoutesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRoutesResourceWithRawResponse: + return AsyncRoutesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse: + return AsyncRoutesResourceWithStreamingResponse(self) + + async def ases( self, *, - asn: int | NotGiven = NOT_GIVEN, - 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, format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, - include_delay: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, location: str | NotGiven = NOT_GIVEN, + sort_by: Literal["cone", "pfxs", "ipv4", "ipv6", "rpki_valid", "rpki_invalid", "rpki_unknown"] + | 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, - ) -> RouteTimeseriesResponse: + ) -> RouteAsesResponse: """ - Gets time-series data for the announced IP space count, represented as the - number of IPv4 /24s and IPv6 /48s, for a given ASN. + List all ASes on current global routing tables with routing statistics Args: - asn: Single ASN as integer. - - 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). - format: Format results are returned in. - include_delay: Include data delay meta information + limit: Limit the number of objects in the response. location: Location Alpha2 code. + sort_by: Return order results by given type + + sort_order: Sort by value ascending or descending + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -271,40 +316,28 @@ def timeseries( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( - "/radar/bgp/routes/timeseries", + return await self._get( + "/radar/bgp/routes/ases", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( + query=await async_maybe_transform( { - "asn": asn, - "date_end": date_end, - "date_range": date_range, - "date_start": date_start, "format": format, - "include_delay": include_delay, + "limit": limit, "location": location, + "sort_by": sort_by, + "sort_order": sort_order, }, - route_timeseries_params.RouteTimeseriesParams, + route_ases_params.RouteAsesParams, ), - post_parser=ResultWrapper[RouteTimeseriesResponse]._unwrapper, + post_parser=ResultWrapper[RouteAsesResponse]._unwrapper, ), - cast_to=cast(Type[RouteTimeseriesResponse], ResultWrapper[RouteTimeseriesResponse]), + cast_to=cast(Type[RouteAsesResponse], ResultWrapper[RouteAsesResponse]), ) - -class AsyncRoutesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRoutesResourceWithRawResponse: - return AsyncRoutesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse: - return AsyncRoutesResourceWithStreamingResponse(self) - async def moas( self, *, @@ -329,7 +362,7 @@ async def moas( origin: Lookup MOASes originated by the given ASN - prefix: Lookup MOASes by prefix + prefix: Network prefix, IPv4 or IPv6. extra_headers: Send extra headers @@ -386,7 +419,7 @@ async def pfx2as( origin: Lookup prefixes originated by the given ASN - prefix: Lookup origin ASNs of the given prefix + prefix: Network prefix, IPv4 or IPv6. rpki_status: Return only results with matching rpki status: valid, invalid or unknown @@ -471,97 +504,14 @@ async def stats( cast_to=cast(Type[RouteStatsResponse], ResultWrapper[RouteStatsResponse]), ) - async def timeseries( - self, - *, - asn: int | NotGiven = NOT_GIVEN, - 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, - 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteTimeseriesResponse: - """ - Gets time-series data for the announced IP space count, represented as the - number of IPv4 /24s and IPv6 /48s, for a given ASN. - - Args: - asn: Single ASN as integer. - - 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). - - format: Format results are returned in. - - include_delay: Include data delay meta information - - location: Location Alpha2 code. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters 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/routes/timeseries", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "asn": asn, - "date_end": date_end, - "date_range": date_range, - "date_start": date_start, - "format": format, - "include_delay": include_delay, - "location": location, - }, - route_timeseries_params.RouteTimeseriesParams, - ), - post_parser=ResultWrapper[RouteTimeseriesResponse]._unwrapper, - ), - cast_to=cast(Type[RouteTimeseriesResponse], ResultWrapper[RouteTimeseriesResponse]), - ) - class RoutesResourceWithRawResponse: def __init__(self, routes: RoutesResource) -> None: self._routes = routes + self.ases = to_raw_response_wrapper( + routes.ases, + ) self.moas = to_raw_response_wrapper( routes.moas, ) @@ -571,15 +521,15 @@ def __init__(self, routes: RoutesResource) -> None: self.stats = to_raw_response_wrapper( routes.stats, ) - self.timeseries = to_raw_response_wrapper( - routes.timeseries, - ) class AsyncRoutesResourceWithRawResponse: def __init__(self, routes: AsyncRoutesResource) -> None: self._routes = routes + self.ases = async_to_raw_response_wrapper( + routes.ases, + ) self.moas = async_to_raw_response_wrapper( routes.moas, ) @@ -589,15 +539,15 @@ def __init__(self, routes: AsyncRoutesResource) -> None: self.stats = async_to_raw_response_wrapper( routes.stats, ) - self.timeseries = async_to_raw_response_wrapper( - routes.timeseries, - ) class RoutesResourceWithStreamingResponse: def __init__(self, routes: RoutesResource) -> None: self._routes = routes + self.ases = to_streamed_response_wrapper( + routes.ases, + ) self.moas = to_streamed_response_wrapper( routes.moas, ) @@ -607,15 +557,15 @@ def __init__(self, routes: RoutesResource) -> None: self.stats = to_streamed_response_wrapper( routes.stats, ) - self.timeseries = to_streamed_response_wrapper( - routes.timeseries, - ) class AsyncRoutesResourceWithStreamingResponse: def __init__(self, routes: AsyncRoutesResource) -> None: self._routes = routes + self.ases = async_to_streamed_response_wrapper( + routes.ases, + ) self.moas = async_to_streamed_response_wrapper( routes.moas, ) @@ -625,6 +575,3 @@ def __init__(self, routes: AsyncRoutesResource) -> None: self.stats = async_to_streamed_response_wrapper( routes.stats, ) - self.timeseries = async_to_streamed_response_wrapper( - routes.timeseries, - ) diff --git a/src/cloudflare/resources/radar/bgp/top/ases.py b/src/cloudflare/resources/radar/bgp/top/ases.py index 6a9a0994b59..c0b8db153c0 100644 --- a/src/cloudflare/resources/radar/bgp/top/ases.py +++ b/src/cloudflare/resources/radar/bgp/top/ases.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Union, cast +from typing import List, Type, Union, Iterable, cast from datetime import datetime from typing_extensions import Literal @@ -70,7 +70,7 @@ def get( format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, - prefix: List[str] | NotGiven = NOT_GIVEN, + prefix: Iterable[ase_get_params.Prefix] | NotGiven = NOT_GIVEN, update_type: List[Literal["ANNOUNCEMENT", "WITHDRAWAL"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -233,7 +233,7 @@ async def get( format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, name: List[str] | NotGiven = NOT_GIVEN, - prefix: List[str] | NotGiven = NOT_GIVEN, + prefix: Iterable[ase_get_params.Prefix] | NotGiven = NOT_GIVEN, update_type: List[Literal["ANNOUNCEMENT", "WITHDRAWAL"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/cloudflare/resources/radar/http/ases/__init__.py b/src/cloudflare/resources/radar/http/ases/__init__.py index 725f29e303a..88eb8b2a278 100644 --- a/src/cloudflare/resources/radar/http/ases/__init__.py +++ b/src/cloudflare/resources/radar/http/ases/__init__.py @@ -64,6 +64,14 @@ HTTPProtocolResourceWithStreamingResponse, AsyncHTTPProtocolResourceWithStreamingResponse, ) +from .browser_family import ( + BrowserFamilyResource, + AsyncBrowserFamilyResource, + BrowserFamilyResourceWithRawResponse, + AsyncBrowserFamilyResourceWithRawResponse, + BrowserFamilyResourceWithStreamingResponse, + AsyncBrowserFamilyResourceWithStreamingResponse, +) __all__ = [ "BotClassResource", @@ -108,6 +116,12 @@ "AsyncTLSVersionResourceWithRawResponse", "TLSVersionResourceWithStreamingResponse", "AsyncTLSVersionResourceWithStreamingResponse", + "BrowserFamilyResource", + "AsyncBrowserFamilyResource", + "BrowserFamilyResourceWithRawResponse", + "AsyncBrowserFamilyResourceWithRawResponse", + "BrowserFamilyResourceWithStreamingResponse", + "AsyncBrowserFamilyResourceWithStreamingResponse", "AsesResource", "AsyncAsesResource", "AsesResourceWithRawResponse", diff --git a/src/cloudflare/resources/radar/http/ases/ases.py b/src/cloudflare/resources/radar/http/ases/ases.py index 5802bbf3b71..4666cedea05 100644 --- a/src/cloudflare/resources/radar/http/ases/ases.py +++ b/src/cloudflare/resources/radar/http/ases/ases.py @@ -78,6 +78,14 @@ HTTPProtocolResourceWithStreamingResponse, AsyncHTTPProtocolResourceWithStreamingResponse, ) +from .browser_family import ( + BrowserFamilyResource, + AsyncBrowserFamilyResource, + BrowserFamilyResourceWithRawResponse, + AsyncBrowserFamilyResourceWithRawResponse, + BrowserFamilyResourceWithStreamingResponse, + AsyncBrowserFamilyResourceWithStreamingResponse, +) from ....._base_client import ( make_request_options, ) @@ -116,6 +124,10 @@ def os(self) -> OSResource: def tls_version(self) -> TLSVersionResource: return TLSVersionResource(self._client) + @cached_property + def browser_family(self) -> BrowserFamilyResource: + return BrowserFamilyResource(self._client) + @cached_property def with_raw_response(self) -> AsesResourceWithRawResponse: return AsesResourceWithRawResponse(self) @@ -129,6 +141,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -183,6 +196,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -236,6 +251,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -288,6 +304,10 @@ def os(self) -> AsyncOSResource: def tls_version(self) -> AsyncTLSVersionResource: return AsyncTLSVersionResource(self._client) + @cached_property + def browser_family(self) -> AsyncBrowserFamilyResource: + return AsyncBrowserFamilyResource(self._client) + @cached_property def with_raw_response(self) -> AsyncAsesResourceWithRawResponse: return AsyncAsesResourceWithRawResponse(self) @@ -301,6 +321,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -355,6 +376,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -408,6 +431,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -467,6 +491,10 @@ def os(self) -> OSResourceWithRawResponse: def tls_version(self) -> TLSVersionResourceWithRawResponse: return TLSVersionResourceWithRawResponse(self._ases.tls_version) + @cached_property + def browser_family(self) -> BrowserFamilyResourceWithRawResponse: + return BrowserFamilyResourceWithRawResponse(self._ases.browser_family) + class AsyncAsesResourceWithRawResponse: def __init__(self, ases: AsyncAsesResource) -> None: @@ -504,6 +532,10 @@ def os(self) -> AsyncOSResourceWithRawResponse: def tls_version(self) -> AsyncTLSVersionResourceWithRawResponse: return AsyncTLSVersionResourceWithRawResponse(self._ases.tls_version) + @cached_property + def browser_family(self) -> AsyncBrowserFamilyResourceWithRawResponse: + return AsyncBrowserFamilyResourceWithRawResponse(self._ases.browser_family) + class AsesResourceWithStreamingResponse: def __init__(self, ases: AsesResource) -> None: @@ -541,6 +573,10 @@ def os(self) -> OSResourceWithStreamingResponse: def tls_version(self) -> TLSVersionResourceWithStreamingResponse: return TLSVersionResourceWithStreamingResponse(self._ases.tls_version) + @cached_property + def browser_family(self) -> BrowserFamilyResourceWithStreamingResponse: + return BrowserFamilyResourceWithStreamingResponse(self._ases.browser_family) + class AsyncAsesResourceWithStreamingResponse: def __init__(self, ases: AsyncAsesResource) -> None: @@ -577,3 +613,7 @@ def os(self) -> AsyncOSResourceWithStreamingResponse: @cached_property def tls_version(self) -> AsyncTLSVersionResourceWithStreamingResponse: return AsyncTLSVersionResourceWithStreamingResponse(self._ases.tls_version) + + @cached_property + def browser_family(self) -> AsyncBrowserFamilyResourceWithStreamingResponse: + return AsyncBrowserFamilyResourceWithStreamingResponse(self._ases.browser_family) diff --git a/src/cloudflare/resources/radar/http/ases/bot_class.py b/src/cloudflare/resources/radar/http/ases/bot_class.py index 809ae7ff1de..d9665ba21c1 100644 --- a/src/cloudflare/resources/radar/http/ases/bot_class.py +++ b/src/cloudflare/resources/radar/http/ases/bot_class.py @@ -45,6 +45,7 @@ def get( bot_class: Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"], *, asn: List[str] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -100,6 +101,8 @@ def get( For example, `-174, 3356` excludes results from AS174, but includes results from AS3356. + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -154,6 +157,7 @@ def get( query=maybe_transform( { "asn": asn, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -191,6 +195,7 @@ async def get( bot_class: Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"], *, asn: List[str] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -246,6 +251,8 @@ async def get( For example, `-174, 3356` excludes results from AS174, but includes results from AS3356. + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -300,6 +307,7 @@ async def get( query=await async_maybe_transform( { "asn": asn, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/ases/browser_family.py b/src/cloudflare/resources/radar/http/ases/browser_family.py new file mode 100644 index 00000000000..93f2d1bcc91 --- /dev/null +++ b/src/cloudflare/resources/radar/http/ases/browser_family.py @@ -0,0 +1,363 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, 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.http.ases import browser_family_get_params +from .....types.radar.http.ases.browser_family_get_response import BrowserFamilyGetResponse + +__all__ = ["BrowserFamilyResource", "AsyncBrowserFamilyResource"] + + +class BrowserFamilyResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BrowserFamilyResourceWithRawResponse: + return BrowserFamilyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BrowserFamilyResourceWithStreamingResponse: + return BrowserFamilyResourceWithStreamingResponse(self) + + def get( + self, + browser_family: Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"], + *, + asn: List[str] | NotGiven = NOT_GIVEN, + bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + continent: List[str] | NotGiven = NOT_GIVEN, + date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + date_range: List[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + ] + | NotGiven = NOT_GIVEN, + date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + device_type: List[Literal["DESKTOP", "MOBILE", "OTHER"]] | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + http_protocol: List[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, + http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, + ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + location: List[str] | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]] + | NotGiven = NOT_GIVEN, + tls_version: List[Literal["TLSv1_0", "TLSv1_1", "TLSv1_2", "TLSv1_3", "TLSvQUIC"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BrowserFamilyGetResponse: + """ + Get the top autonomous systems (AS), by HTTP traffic, of the requested browser + family. Values are a percentage out of the total traffic. + + Args: + browser_family: Browser family. + + asn: Array of comma separated list of ASNs, start with `-` to exclude from results. + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + + bot_class: Filter for bot class. Refer to + [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + + continent: Array of comma separated list of continents (alpha-2 continent codes). Start + with `-` to exclude from results. For example, `-EU,NA` excludes results from + Europe, but includes results from North America. + + date_end: End of the date range (inclusive). + + date_range: For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + + date_start: Array of datetimes to filter the start of a series. + + device_type: Filter for device type. + + format: Format results are returned in. + + http_protocol: Filter for http protocol. + + http_version: Filter for http version. + + ip_version: Filter for ip version. + + limit: Limit the number of objects in the response. + + location: Array of comma separated list of locations (alpha-2 country codes). Start with + `-` to exclude from results. For example, `-US,PT` excludes results from the US, + but includes results from PT. + + name: Array of names that will be used to name the series in responses. + + os: Filter for os name. + + tls_version: Filter for tls version. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not browser_family: + raise ValueError(f"Expected a non-empty value for `browser_family` but received {browser_family!r}") + return self._get( + f"/radar/http/top/ases/browser_family/{browser_family}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "asn": asn, + "bot_class": bot_class, + "continent": continent, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "device_type": device_type, + "format": format, + "http_protocol": http_protocol, + "http_version": http_version, + "ip_version": ip_version, + "limit": limit, + "location": location, + "name": name, + "os": os, + "tls_version": tls_version, + }, + browser_family_get_params.BrowserFamilyGetParams, + ), + post_parser=ResultWrapper[BrowserFamilyGetResponse]._unwrapper, + ), + cast_to=cast(Type[BrowserFamilyGetResponse], ResultWrapper[BrowserFamilyGetResponse]), + ) + + +class AsyncBrowserFamilyResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBrowserFamilyResourceWithRawResponse: + return AsyncBrowserFamilyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBrowserFamilyResourceWithStreamingResponse: + return AsyncBrowserFamilyResourceWithStreamingResponse(self) + + async def get( + self, + browser_family: Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"], + *, + asn: List[str] | NotGiven = NOT_GIVEN, + bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + continent: List[str] | NotGiven = NOT_GIVEN, + date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + date_range: List[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + ] + | NotGiven = NOT_GIVEN, + date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + device_type: List[Literal["DESKTOP", "MOBILE", "OTHER"]] | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + http_protocol: List[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, + http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, + ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + location: List[str] | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]] + | NotGiven = NOT_GIVEN, + tls_version: List[Literal["TLSv1_0", "TLSv1_1", "TLSv1_2", "TLSv1_3", "TLSvQUIC"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BrowserFamilyGetResponse: + """ + Get the top autonomous systems (AS), by HTTP traffic, of the requested browser + family. Values are a percentage out of the total traffic. + + Args: + browser_family: Browser family. + + asn: Array of comma separated list of ASNs, start with `-` to exclude from results. + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + + bot_class: Filter for bot class. Refer to + [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + + continent: Array of comma separated list of continents (alpha-2 continent codes). Start + with `-` to exclude from results. For example, `-EU,NA` excludes results from + Europe, but includes results from North America. + + date_end: End of the date range (inclusive). + + date_range: For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + + date_start: Array of datetimes to filter the start of a series. + + device_type: Filter for device type. + + format: Format results are returned in. + + http_protocol: Filter for http protocol. + + http_version: Filter for http version. + + ip_version: Filter for ip version. + + limit: Limit the number of objects in the response. + + location: Array of comma separated list of locations (alpha-2 country codes). Start with + `-` to exclude from results. For example, `-US,PT` excludes results from the US, + but includes results from PT. + + name: Array of names that will be used to name the series in responses. + + os: Filter for os name. + + tls_version: Filter for tls version. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not browser_family: + raise ValueError(f"Expected a non-empty value for `browser_family` but received {browser_family!r}") + return await self._get( + f"/radar/http/top/ases/browser_family/{browser_family}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "asn": asn, + "bot_class": bot_class, + "continent": continent, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "device_type": device_type, + "format": format, + "http_protocol": http_protocol, + "http_version": http_version, + "ip_version": ip_version, + "limit": limit, + "location": location, + "name": name, + "os": os, + "tls_version": tls_version, + }, + browser_family_get_params.BrowserFamilyGetParams, + ), + post_parser=ResultWrapper[BrowserFamilyGetResponse]._unwrapper, + ), + cast_to=cast(Type[BrowserFamilyGetResponse], ResultWrapper[BrowserFamilyGetResponse]), + ) + + +class BrowserFamilyResourceWithRawResponse: + def __init__(self, browser_family: BrowserFamilyResource) -> None: + self._browser_family = browser_family + + self.get = to_raw_response_wrapper( + browser_family.get, + ) + + +class AsyncBrowserFamilyResourceWithRawResponse: + def __init__(self, browser_family: AsyncBrowserFamilyResource) -> None: + self._browser_family = browser_family + + self.get = async_to_raw_response_wrapper( + browser_family.get, + ) + + +class BrowserFamilyResourceWithStreamingResponse: + def __init__(self, browser_family: BrowserFamilyResource) -> None: + self._browser_family = browser_family + + self.get = to_streamed_response_wrapper( + browser_family.get, + ) + + +class AsyncBrowserFamilyResourceWithStreamingResponse: + def __init__(self, browser_family: AsyncBrowserFamilyResource) -> None: + self._browser_family = browser_family + + self.get = async_to_streamed_response_wrapper( + browser_family.get, + ) diff --git a/src/cloudflare/resources/radar/http/ases/device_type.py b/src/cloudflare/resources/radar/http/ases/device_type.py index 6bad8da2bc3..3c74d3c5e77 100644 --- a/src/cloudflare/resources/radar/http/ases/device_type.py +++ b/src/cloudflare/resources/radar/http/ases/device_type.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -100,6 +101,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -153,6 +156,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -190,6 +194,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -244,6 +249,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -297,6 +304,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/ases/http_method.py b/src/cloudflare/resources/radar/http/ases/http_method.py index 9d6f41fb2b9..bbf7d121de4 100644 --- a/src/cloudflare/resources/radar/http/ases/http_method.py +++ b/src/cloudflare/resources/radar/http/ases/http_method.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -100,6 +101,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -153,6 +156,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -190,6 +194,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -244,6 +249,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -297,6 +304,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/ases/http_protocol.py b/src/cloudflare/resources/radar/http/ases/http_protocol.py index b3ef2da221b..980a72d60c2 100644 --- a/src/cloudflare/resources/radar/http/ases/http_protocol.py +++ b/src/cloudflare/resources/radar/http/ases/http_protocol.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -99,6 +100,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -150,6 +153,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -186,6 +190,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -239,6 +244,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -290,6 +297,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/ases/ip_version.py b/src/cloudflare/resources/radar/http/ases/ip_version.py index b62867a8aa9..13d9e9d31a5 100644 --- a/src/cloudflare/resources/radar/http/ases/ip_version.py +++ b/src/cloudflare/resources/radar/http/ases/ip_version.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -100,6 +101,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -153,6 +156,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -190,6 +194,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -244,6 +249,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -297,6 +304,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/ases/os.py b/src/cloudflare/resources/radar/http/ases/os.py index 4b9be3919f3..33c0223fddf 100644 --- a/src/cloudflare/resources/radar/http/ases/os.py +++ b/src/cloudflare/resources/radar/http/ases/os.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -90,7 +91,7 @@ def get( systems. Values are a percentage out of the total traffic. Args: - os: IP version. + os: Operating system. asn: Array of comma separated list of ASNs, start with `-` to exclude from results. For example, `-174, 3356` excludes results from AS174, but includes results from @@ -99,6 +100,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -152,6 +155,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -189,6 +193,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -233,7 +238,7 @@ async def get( systems. Values are a percentage out of the total traffic. Args: - os: IP version. + os: Operating system. asn: Array of comma separated list of ASNs, start with `-` to exclude from results. For example, `-174, 3356` excludes results from AS174, but includes results from @@ -242,6 +247,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -295,6 +302,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/ases/tls_version.py b/src/cloudflare/resources/radar/http/ases/tls_version.py index 10cd0b988e2..8b002599f70 100644 --- a/src/cloudflare/resources/radar/http/ases/tls_version.py +++ b/src/cloudflare/resources/radar/http/ases/tls_version.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -100,6 +101,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -153,6 +156,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -190,6 +194,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -244,6 +249,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -297,6 +304,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/http.py b/src/cloudflare/resources/radar/http/http.py index b8a704fd14d..9f32cbdd054 100644 --- a/src/cloudflare/resources/radar/http/http.py +++ b/src/cloudflare/resources/radar/http/http.py @@ -2,6 +2,12 @@ from __future__ import annotations +from typing import List, Type, Union, cast +from datetime import datetime +from typing_extensions import Literal + +import httpx + from .top import ( TopResource, AsyncTopResource, @@ -26,6 +32,11 @@ SummaryResourceWithStreamingResponse, AsyncSummaryResourceWithStreamingResponse, ) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) from .ases.ases import AsesResource, AsyncAsesResource from .locations import ( LocationsResource, @@ -37,6 +48,17 @@ ) 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 ....types.radar import http_timeseries_params +from ...._base_client import ( + make_request_options, +) from .timeseries_groups import ( TimeseriesGroupsResource, AsyncTimeseriesGroupsResource, @@ -46,6 +68,7 @@ AsyncTimeseriesGroupsResourceWithStreamingResponse, ) from .locations.locations import LocationsResource, AsyncLocationsResource +from ....types.radar.http_timeseries_response import HTTPTimeseriesResponse __all__ = ["HTTPResource", "AsyncHTTPResource"] @@ -79,6 +102,110 @@ def with_raw_response(self) -> HTTPResourceWithRawResponse: def with_streaming_response(self) -> HTTPResourceWithStreamingResponse: return HTTPResourceWithStreamingResponse(self) + def timeseries( + self, + *, + agg_interval: Literal["15m", "1h", "1d", "1w"] | NotGiven = NOT_GIVEN, + asn: List[str] | NotGiven = NOT_GIVEN, + continent: List[str] | NotGiven = NOT_GIVEN, + date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + date_range: List[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + ] + | NotGiven = NOT_GIVEN, + date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + location: List[str] | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> HTTPTimeseriesResponse: + """ + Get HTTP requests over time. + + Args: + agg_interval: Aggregation interval results should be returned in (for example, in 15 minutes + or 1 hour intervals). Refer to + [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + + asn: Array of comma separated list of ASNs, start with `-` to exclude from results. + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + + continent: Array of comma separated list of continents (alpha-2 continent codes). Start + with `-` to exclude from results. For example, `-EU,NA` excludes results from + Europe, but includes results from North America. + + date_end: End of the date range (inclusive). + + date_range: For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + + date_start: Array of datetimes to filter the start of a series. + + format: Format results are returned in. + + location: Array of comma separated list of locations (alpha-2 country codes). Start with + `-` to exclude from results. For example, `-US,PT` excludes results from the US, + but includes results from PT. + + name: Array of names that will be used to name the series in responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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/http/timeseries", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "agg_interval": agg_interval, + "asn": asn, + "continent": continent, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "format": format, + "location": location, + "name": name, + }, + http_timeseries_params.HTTPTimeseriesParams, + ), + post_parser=ResultWrapper[HTTPTimeseriesResponse]._unwrapper, + ), + cast_to=cast(Type[HTTPTimeseriesResponse], ResultWrapper[HTTPTimeseriesResponse]), + ) + class AsyncHTTPResource(AsyncAPIResource): @cached_property @@ -109,11 +236,119 @@ def with_raw_response(self) -> AsyncHTTPResourceWithRawResponse: def with_streaming_response(self) -> AsyncHTTPResourceWithStreamingResponse: return AsyncHTTPResourceWithStreamingResponse(self) + async def timeseries( + self, + *, + agg_interval: Literal["15m", "1h", "1d", "1w"] | NotGiven = NOT_GIVEN, + asn: List[str] | NotGiven = NOT_GIVEN, + continent: List[str] | NotGiven = NOT_GIVEN, + date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + date_range: List[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + ] + | NotGiven = NOT_GIVEN, + date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + location: List[str] | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> HTTPTimeseriesResponse: + """ + Get HTTP requests over time. + + Args: + agg_interval: Aggregation interval results should be returned in (for example, in 15 minutes + or 1 hour intervals). Refer to + [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + + asn: Array of comma separated list of ASNs, start with `-` to exclude from results. + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + + continent: Array of comma separated list of continents (alpha-2 continent codes). Start + with `-` to exclude from results. For example, `-EU,NA` excludes results from + Europe, but includes results from North America. + + date_end: End of the date range (inclusive). + + date_range: For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + + date_start: Array of datetimes to filter the start of a series. + + format: Format results are returned in. + + location: Array of comma separated list of locations (alpha-2 country codes). Start with + `-` to exclude from results. For example, `-US,PT` excludes results from the US, + but includes results from PT. + + name: Array of names that will be used to name the series in responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters 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/http/timeseries", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "agg_interval": agg_interval, + "asn": asn, + "continent": continent, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "format": format, + "location": location, + "name": name, + }, + http_timeseries_params.HTTPTimeseriesParams, + ), + post_parser=ResultWrapper[HTTPTimeseriesResponse]._unwrapper, + ), + cast_to=cast(Type[HTTPTimeseriesResponse], ResultWrapper[HTTPTimeseriesResponse]), + ) + class HTTPResourceWithRawResponse: def __init__(self, http: HTTPResource) -> None: self._http = http + self.timeseries = to_raw_response_wrapper( + http.timeseries, + ) + @cached_property def top(self) -> TopResourceWithRawResponse: return TopResourceWithRawResponse(self._http.top) @@ -139,6 +374,10 @@ class AsyncHTTPResourceWithRawResponse: def __init__(self, http: AsyncHTTPResource) -> None: self._http = http + self.timeseries = async_to_raw_response_wrapper( + http.timeseries, + ) + @cached_property def top(self) -> AsyncTopResourceWithRawResponse: return AsyncTopResourceWithRawResponse(self._http.top) @@ -164,6 +403,10 @@ class HTTPResourceWithStreamingResponse: def __init__(self, http: HTTPResource) -> None: self._http = http + self.timeseries = to_streamed_response_wrapper( + http.timeseries, + ) + @cached_property def top(self) -> TopResourceWithStreamingResponse: return TopResourceWithStreamingResponse(self._http.top) @@ -189,6 +432,10 @@ class AsyncHTTPResourceWithStreamingResponse: def __init__(self, http: AsyncHTTPResource) -> None: self._http = http + self.timeseries = async_to_streamed_response_wrapper( + http.timeseries, + ) + @cached_property def top(self) -> AsyncTopResourceWithStreamingResponse: return AsyncTopResourceWithStreamingResponse(self._http.top) diff --git a/src/cloudflare/resources/radar/http/locations/__init__.py b/src/cloudflare/resources/radar/http/locations/__init__.py index 6ea85e36a11..3e402801e47 100644 --- a/src/cloudflare/resources/radar/http/locations/__init__.py +++ b/src/cloudflare/resources/radar/http/locations/__init__.py @@ -64,6 +64,14 @@ HTTPProtocolResourceWithStreamingResponse, AsyncHTTPProtocolResourceWithStreamingResponse, ) +from .browser_family import ( + BrowserFamilyResource, + AsyncBrowserFamilyResource, + BrowserFamilyResourceWithRawResponse, + AsyncBrowserFamilyResourceWithRawResponse, + BrowserFamilyResourceWithStreamingResponse, + AsyncBrowserFamilyResourceWithStreamingResponse, +) __all__ = [ "BotClassResource", @@ -108,6 +116,12 @@ "AsyncTLSVersionResourceWithRawResponse", "TLSVersionResourceWithStreamingResponse", "AsyncTLSVersionResourceWithStreamingResponse", + "BrowserFamilyResource", + "AsyncBrowserFamilyResource", + "BrowserFamilyResourceWithRawResponse", + "AsyncBrowserFamilyResourceWithRawResponse", + "BrowserFamilyResourceWithStreamingResponse", + "AsyncBrowserFamilyResourceWithStreamingResponse", "LocationsResource", "AsyncLocationsResource", "LocationsResourceWithRawResponse", diff --git a/src/cloudflare/resources/radar/http/locations/bot_class.py b/src/cloudflare/resources/radar/http/locations/bot_class.py index 6507e30fff9..e19b3d4ee2e 100644 --- a/src/cloudflare/resources/radar/http/locations/bot_class.py +++ b/src/cloudflare/resources/radar/http/locations/bot_class.py @@ -45,6 +45,7 @@ def get( bot_class: Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"], *, asn: List[str] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -100,6 +101,8 @@ def get( For example, `-174, 3356` excludes results from AS174, but includes results from AS3356. + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -154,6 +157,7 @@ def get( query=maybe_transform( { "asn": asn, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -191,6 +195,7 @@ async def get( bot_class: Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"], *, asn: List[str] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -246,6 +251,8 @@ async def get( For example, `-174, 3356` excludes results from AS174, but includes results from AS3356. + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -300,6 +307,7 @@ async def get( query=await async_maybe_transform( { "asn": asn, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/locations/browser_family.py b/src/cloudflare/resources/radar/http/locations/browser_family.py new file mode 100644 index 00000000000..42a6dfc2c94 --- /dev/null +++ b/src/cloudflare/resources/radar/http/locations/browser_family.py @@ -0,0 +1,365 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, 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.http.locations import browser_family_get_params +from .....types.radar.http.locations.browser_family_get_response import BrowserFamilyGetResponse + +__all__ = ["BrowserFamilyResource", "AsyncBrowserFamilyResource"] + + +class BrowserFamilyResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BrowserFamilyResourceWithRawResponse: + return BrowserFamilyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BrowserFamilyResourceWithStreamingResponse: + return BrowserFamilyResourceWithStreamingResponse(self) + + def get( + self, + browser_family: Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"], + *, + asn: List[str] | NotGiven = NOT_GIVEN, + bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + continent: List[str] | NotGiven = NOT_GIVEN, + date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + date_range: List[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + ] + | NotGiven = NOT_GIVEN, + date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + device_type: List[Literal["DESKTOP", "MOBILE", "OTHER"]] | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + http_protocol: List[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, + http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, + ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + location: List[str] | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]] + | NotGiven = NOT_GIVEN, + tls_version: List[Literal["TLSv1_0", "TLSv1_1", "TLSv1_2", "TLSv1_3", "TLSvQUIC"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BrowserFamilyGetResponse: + """Get the top locations, by HTTP traffic, of the requested browser family. + + Values + are a percentage out of the total traffic. + + Args: + browser_family: Browser family. + + asn: Array of comma separated list of ASNs, start with `-` to exclude from results. + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + + bot_class: Filter for bot class. Refer to + [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + + continent: Array of comma separated list of continents (alpha-2 continent codes). Start + with `-` to exclude from results. For example, `-EU,NA` excludes results from + Europe, but includes results from North America. + + date_end: End of the date range (inclusive). + + date_range: For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + + date_start: Array of datetimes to filter the start of a series. + + device_type: Filter for device type. + + format: Format results are returned in. + + http_protocol: Filter for http protocol. + + http_version: Filter for http version. + + ip_version: Filter for ip version. + + limit: Limit the number of objects in the response. + + location: Array of comma separated list of locations (alpha-2 country codes). Start with + `-` to exclude from results. For example, `-US,PT` excludes results from the US, + but includes results from PT. + + name: Array of names that will be used to name the series in responses. + + os: Filter for os name. + + tls_version: Filter for tls version. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not browser_family: + raise ValueError(f"Expected a non-empty value for `browser_family` but received {browser_family!r}") + return self._get( + f"/radar/http/top/locations/browser_family/{browser_family}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "asn": asn, + "bot_class": bot_class, + "continent": continent, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "device_type": device_type, + "format": format, + "http_protocol": http_protocol, + "http_version": http_version, + "ip_version": ip_version, + "limit": limit, + "location": location, + "name": name, + "os": os, + "tls_version": tls_version, + }, + browser_family_get_params.BrowserFamilyGetParams, + ), + post_parser=ResultWrapper[BrowserFamilyGetResponse]._unwrapper, + ), + cast_to=cast(Type[BrowserFamilyGetResponse], ResultWrapper[BrowserFamilyGetResponse]), + ) + + +class AsyncBrowserFamilyResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBrowserFamilyResourceWithRawResponse: + return AsyncBrowserFamilyResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBrowserFamilyResourceWithStreamingResponse: + return AsyncBrowserFamilyResourceWithStreamingResponse(self) + + async def get( + self, + browser_family: Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"], + *, + asn: List[str] | NotGiven = NOT_GIVEN, + bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + continent: List[str] | NotGiven = NOT_GIVEN, + date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + date_range: List[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + ] + | NotGiven = NOT_GIVEN, + date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, + device_type: List[Literal["DESKTOP", "MOBILE", "OTHER"]] | NotGiven = NOT_GIVEN, + format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN, + http_protocol: List[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN, + http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN, + ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + location: List[str] | NotGiven = NOT_GIVEN, + name: List[str] | NotGiven = NOT_GIVEN, + os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]] + | NotGiven = NOT_GIVEN, + tls_version: List[Literal["TLSv1_0", "TLSv1_1", "TLSv1_2", "TLSv1_3", "TLSvQUIC"]] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BrowserFamilyGetResponse: + """Get the top locations, by HTTP traffic, of the requested browser family. + + Values + are a percentage out of the total traffic. + + Args: + browser_family: Browser family. + + asn: Array of comma separated list of ASNs, start with `-` to exclude from results. + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + + bot_class: Filter for bot class. Refer to + [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + + continent: Array of comma separated list of continents (alpha-2 continent codes). Start + with `-` to exclude from results. For example, `-EU,NA` excludes results from + Europe, but includes results from North America. + + date_end: End of the date range (inclusive). + + date_range: For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + + date_start: Array of datetimes to filter the start of a series. + + device_type: Filter for device type. + + format: Format results are returned in. + + http_protocol: Filter for http protocol. + + http_version: Filter for http version. + + ip_version: Filter for ip version. + + limit: Limit the number of objects in the response. + + location: Array of comma separated list of locations (alpha-2 country codes). Start with + `-` to exclude from results. For example, `-US,PT` excludes results from the US, + but includes results from PT. + + name: Array of names that will be used to name the series in responses. + + os: Filter for os name. + + tls_version: Filter for tls version. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not browser_family: + raise ValueError(f"Expected a non-empty value for `browser_family` but received {browser_family!r}") + return await self._get( + f"/radar/http/top/locations/browser_family/{browser_family}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "asn": asn, + "bot_class": bot_class, + "continent": continent, + "date_end": date_end, + "date_range": date_range, + "date_start": date_start, + "device_type": device_type, + "format": format, + "http_protocol": http_protocol, + "http_version": http_version, + "ip_version": ip_version, + "limit": limit, + "location": location, + "name": name, + "os": os, + "tls_version": tls_version, + }, + browser_family_get_params.BrowserFamilyGetParams, + ), + post_parser=ResultWrapper[BrowserFamilyGetResponse]._unwrapper, + ), + cast_to=cast(Type[BrowserFamilyGetResponse], ResultWrapper[BrowserFamilyGetResponse]), + ) + + +class BrowserFamilyResourceWithRawResponse: + def __init__(self, browser_family: BrowserFamilyResource) -> None: + self._browser_family = browser_family + + self.get = to_raw_response_wrapper( + browser_family.get, + ) + + +class AsyncBrowserFamilyResourceWithRawResponse: + def __init__(self, browser_family: AsyncBrowserFamilyResource) -> None: + self._browser_family = browser_family + + self.get = async_to_raw_response_wrapper( + browser_family.get, + ) + + +class BrowserFamilyResourceWithStreamingResponse: + def __init__(self, browser_family: BrowserFamilyResource) -> None: + self._browser_family = browser_family + + self.get = to_streamed_response_wrapper( + browser_family.get, + ) + + +class AsyncBrowserFamilyResourceWithStreamingResponse: + def __init__(self, browser_family: AsyncBrowserFamilyResource) -> None: + self._browser_family = browser_family + + self.get = async_to_streamed_response_wrapper( + browser_family.get, + ) diff --git a/src/cloudflare/resources/radar/http/locations/device_type.py b/src/cloudflare/resources/radar/http/locations/device_type.py index cb9ae569c73..db12278738c 100644 --- a/src/cloudflare/resources/radar/http/locations/device_type.py +++ b/src/cloudflare/resources/radar/http/locations/device_type.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -101,6 +102,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -154,6 +157,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -191,6 +195,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -246,6 +251,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -299,6 +306,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/locations/http_method.py b/src/cloudflare/resources/radar/http/locations/http_method.py index fd17679a21b..c524a57a4dc 100644 --- a/src/cloudflare/resources/radar/http/locations/http_method.py +++ b/src/cloudflare/resources/radar/http/locations/http_method.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -101,6 +102,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -154,6 +157,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -191,6 +195,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -246,6 +251,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -299,6 +306,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/locations/http_protocol.py b/src/cloudflare/resources/radar/http/locations/http_protocol.py index 68bc53b8b5f..76b7013a00d 100644 --- a/src/cloudflare/resources/radar/http/locations/http_protocol.py +++ b/src/cloudflare/resources/radar/http/locations/http_protocol.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -100,6 +101,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -151,6 +154,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -187,6 +191,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -241,6 +246,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -292,6 +299,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/locations/ip_version.py b/src/cloudflare/resources/radar/http/locations/ip_version.py index 26d202727d4..2eba4d7db23 100644 --- a/src/cloudflare/resources/radar/http/locations/ip_version.py +++ b/src/cloudflare/resources/radar/http/locations/ip_version.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -100,6 +101,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -153,6 +156,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -190,6 +194,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -244,6 +249,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -297,6 +304,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/locations/locations.py b/src/cloudflare/resources/radar/http/locations/locations.py index 63301a082cc..0839a8f25ae 100644 --- a/src/cloudflare/resources/radar/http/locations/locations.py +++ b/src/cloudflare/resources/radar/http/locations/locations.py @@ -78,6 +78,14 @@ HTTPProtocolResourceWithStreamingResponse, AsyncHTTPProtocolResourceWithStreamingResponse, ) +from .browser_family import ( + BrowserFamilyResource, + AsyncBrowserFamilyResource, + BrowserFamilyResourceWithRawResponse, + AsyncBrowserFamilyResourceWithRawResponse, + BrowserFamilyResourceWithStreamingResponse, + AsyncBrowserFamilyResourceWithStreamingResponse, +) from ....._base_client import ( make_request_options, ) @@ -116,6 +124,10 @@ def os(self) -> OSResource: def tls_version(self) -> TLSVersionResource: return TLSVersionResource(self._client) + @cached_property + def browser_family(self) -> BrowserFamilyResource: + return BrowserFamilyResource(self._client) + @cached_property def with_raw_response(self) -> LocationsResourceWithRawResponse: return LocationsResourceWithRawResponse(self) @@ -129,6 +141,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -183,6 +196,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -236,6 +251,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -288,6 +304,10 @@ def os(self) -> AsyncOSResource: def tls_version(self) -> AsyncTLSVersionResource: return AsyncTLSVersionResource(self._client) + @cached_property + def browser_family(self) -> AsyncBrowserFamilyResource: + return AsyncBrowserFamilyResource(self._client) + @cached_property def with_raw_response(self) -> AsyncLocationsResourceWithRawResponse: return AsyncLocationsResourceWithRawResponse(self) @@ -301,6 +321,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -355,6 +376,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -408,6 +431,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -467,6 +491,10 @@ def os(self) -> OSResourceWithRawResponse: def tls_version(self) -> TLSVersionResourceWithRawResponse: return TLSVersionResourceWithRawResponse(self._locations.tls_version) + @cached_property + def browser_family(self) -> BrowserFamilyResourceWithRawResponse: + return BrowserFamilyResourceWithRawResponse(self._locations.browser_family) + class AsyncLocationsResourceWithRawResponse: def __init__(self, locations: AsyncLocationsResource) -> None: @@ -504,6 +532,10 @@ def os(self) -> AsyncOSResourceWithRawResponse: def tls_version(self) -> AsyncTLSVersionResourceWithRawResponse: return AsyncTLSVersionResourceWithRawResponse(self._locations.tls_version) + @cached_property + def browser_family(self) -> AsyncBrowserFamilyResourceWithRawResponse: + return AsyncBrowserFamilyResourceWithRawResponse(self._locations.browser_family) + class LocationsResourceWithStreamingResponse: def __init__(self, locations: LocationsResource) -> None: @@ -541,6 +573,10 @@ def os(self) -> OSResourceWithStreamingResponse: def tls_version(self) -> TLSVersionResourceWithStreamingResponse: return TLSVersionResourceWithStreamingResponse(self._locations.tls_version) + @cached_property + def browser_family(self) -> BrowserFamilyResourceWithStreamingResponse: + return BrowserFamilyResourceWithStreamingResponse(self._locations.browser_family) + class AsyncLocationsResourceWithStreamingResponse: def __init__(self, locations: AsyncLocationsResource) -> None: @@ -577,3 +613,7 @@ def os(self) -> AsyncOSResourceWithStreamingResponse: @cached_property def tls_version(self) -> AsyncTLSVersionResourceWithStreamingResponse: return AsyncTLSVersionResourceWithStreamingResponse(self._locations.tls_version) + + @cached_property + def browser_family(self) -> AsyncBrowserFamilyResourceWithStreamingResponse: + return AsyncBrowserFamilyResourceWithStreamingResponse(self._locations.browser_family) diff --git a/src/cloudflare/resources/radar/http/locations/os.py b/src/cloudflare/resources/radar/http/locations/os.py index 6564789c347..1b89d9d2a66 100644 --- a/src/cloudflare/resources/radar/http/locations/os.py +++ b/src/cloudflare/resources/radar/http/locations/os.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -90,7 +91,7 @@ def get( Values are a percentage out of the total traffic. Args: - os: IP version. + os: Operating system. asn: Array of comma separated list of ASNs, start with `-` to exclude from results. For example, `-174, 3356` excludes results from AS174, but includes results from @@ -99,6 +100,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -152,6 +155,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -189,6 +193,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -233,7 +238,7 @@ async def get( Values are a percentage out of the total traffic. Args: - os: IP version. + os: Operating system. asn: Array of comma separated list of ASNs, start with `-` to exclude from results. For example, `-174, 3356` excludes results from AS174, but includes results from @@ -242,6 +247,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -295,6 +302,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/locations/tls_version.py b/src/cloudflare/resources/radar/http/locations/tls_version.py index 9a43d75f252..c1fd6d54336 100644 --- a/src/cloudflare/resources/radar/http/locations/tls_version.py +++ b/src/cloudflare/resources/radar/http/locations/tls_version.py @@ -46,6 +46,7 @@ def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -100,6 +101,8 @@ def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -153,6 +156,7 @@ def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -190,6 +194,7 @@ async def get( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -244,6 +249,8 @@ async def get( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -297,6 +304,7 @@ async def get( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/radar/http/top.py b/src/cloudflare/resources/radar/http/top.py index b96c3aa3671..7cd13feaadd 100644 --- a/src/cloudflare/resources/radar/http/top.py +++ b/src/cloudflare/resources/radar/http/top.py @@ -46,6 +46,7 @@ def browser_families( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -100,6 +101,8 @@ def browser_families( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -153,6 +156,7 @@ def browser_families( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -180,6 +184,7 @@ def browsers( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -234,6 +239,8 @@ def browsers( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -287,6 +294,7 @@ def browsers( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -324,6 +332,7 @@ async def browser_families( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -378,6 +387,8 @@ async def browser_families( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -431,6 +442,7 @@ async def browser_families( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, @@ -458,6 +470,7 @@ async def browsers( *, asn: List[str] | NotGiven = NOT_GIVEN, bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN, + browser_family: List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]] | NotGiven = NOT_GIVEN, continent: List[str] | NotGiven = NOT_GIVEN, date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN, date_range: List[ @@ -512,6 +525,8 @@ async def browsers( bot_class: Filter for bot class. Refer to [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + browser_family: Filter for browser family. + continent: Array of comma separated list of continents (alpha-2 continent codes). Start with `-` to exclude from results. For example, `-EU,NA` excludes results from Europe, but includes results from North America. @@ -565,6 +580,7 @@ async def browsers( { "asn": asn, "bot_class": bot_class, + "browser_family": browser_family, "continent": continent, "date_end": date_end, "date_range": date_range, diff --git a/src/cloudflare/resources/rate_limits.py b/src/cloudflare/resources/rate_limits.py index caae09d9f21..37c05e4d0ac 100644 --- a/src/cloudflare/resources/rate_limits.py +++ b/src/cloudflare/resources/rate_limits.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Any, Type, cast import httpx @@ -44,6 +45,9 @@ def with_raw_response(self) -> RateLimitsResourceWithRawResponse: def with_streaming_response(self) -> RateLimitsResourceWithStreamingResponse: return RateLimitsResourceWithStreamingResponse(self) + @typing_extensions.deprecated( + "Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details." + ) def create( self, zone_identifier: str, @@ -92,6 +96,9 @@ def create( ), ) + @typing_extensions.deprecated( + "Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details." + ) def list( self, zone_identifier: str, @@ -145,6 +152,9 @@ def list( model=RateLimit, ) + @typing_extensions.deprecated( + "Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details." + ) def delete( self, id: str, @@ -189,6 +199,9 @@ def delete( cast_to=cast(Type[RateLimitDeleteResponse], ResultWrapper[RateLimitDeleteResponse]), ) + @typing_extensions.deprecated( + "Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details." + ) def edit( self, id: str, @@ -240,6 +253,9 @@ def edit( ), ) + @typing_extensions.deprecated( + "Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details." + ) def get( self, id: str, @@ -299,6 +315,9 @@ def with_raw_response(self) -> AsyncRateLimitsResourceWithRawResponse: def with_streaming_response(self) -> AsyncRateLimitsResourceWithStreamingResponse: return AsyncRateLimitsResourceWithStreamingResponse(self) + @typing_extensions.deprecated( + "Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details." + ) async def create( self, zone_identifier: str, @@ -347,6 +366,9 @@ async def create( ), ) + @typing_extensions.deprecated( + "Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details." + ) def list( self, zone_identifier: str, @@ -400,6 +422,9 @@ def list( model=RateLimit, ) + @typing_extensions.deprecated( + "Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details." + ) async def delete( self, id: str, @@ -444,6 +469,9 @@ async def delete( cast_to=cast(Type[RateLimitDeleteResponse], ResultWrapper[RateLimitDeleteResponse]), ) + @typing_extensions.deprecated( + "Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details." + ) async def edit( self, id: str, @@ -495,6 +523,9 @@ async def edit( ), ) + @typing_extensions.deprecated( + "Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details." + ) async def get( self, id: str, @@ -549,20 +580,30 @@ class RateLimitsResourceWithRawResponse: def __init__(self, rate_limits: RateLimitsResource) -> None: self._rate_limits = rate_limits - self.create = to_raw_response_wrapper( - rate_limits.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rate_limits.create # pyright: ignore[reportDeprecated], + ) ) - self.list = to_raw_response_wrapper( - rate_limits.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rate_limits.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_raw_response_wrapper( - rate_limits.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rate_limits.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = to_raw_response_wrapper( - rate_limits.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rate_limits.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = to_raw_response_wrapper( - rate_limits.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + rate_limits.get # pyright: ignore[reportDeprecated], + ) ) @@ -570,20 +611,30 @@ class AsyncRateLimitsResourceWithRawResponse: def __init__(self, rate_limits: AsyncRateLimitsResource) -> None: self._rate_limits = rate_limits - self.create = async_to_raw_response_wrapper( - rate_limits.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rate_limits.create # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_raw_response_wrapper( - rate_limits.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rate_limits.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_raw_response_wrapper( - rate_limits.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rate_limits.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = async_to_raw_response_wrapper( - rate_limits.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rate_limits.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_raw_response_wrapper( - rate_limits.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + rate_limits.get # pyright: ignore[reportDeprecated], + ) ) @@ -591,20 +642,30 @@ class RateLimitsResourceWithStreamingResponse: def __init__(self, rate_limits: RateLimitsResource) -> None: self._rate_limits = rate_limits - self.create = to_streamed_response_wrapper( - rate_limits.create, + self.create = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rate_limits.create # pyright: ignore[reportDeprecated], + ) ) - self.list = to_streamed_response_wrapper( - rate_limits.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rate_limits.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = to_streamed_response_wrapper( - rate_limits.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rate_limits.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = to_streamed_response_wrapper( - rate_limits.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rate_limits.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = to_streamed_response_wrapper( - rate_limits.get, + self.get = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + rate_limits.get # pyright: ignore[reportDeprecated], + ) ) @@ -612,18 +673,28 @@ class AsyncRateLimitsResourceWithStreamingResponse: def __init__(self, rate_limits: AsyncRateLimitsResource) -> None: self._rate_limits = rate_limits - self.create = async_to_streamed_response_wrapper( - rate_limits.create, + self.create = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rate_limits.create # pyright: ignore[reportDeprecated], + ) ) - self.list = async_to_streamed_response_wrapper( - rate_limits.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rate_limits.list # pyright: ignore[reportDeprecated], + ) ) - self.delete = async_to_streamed_response_wrapper( - rate_limits.delete, + self.delete = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rate_limits.delete # pyright: ignore[reportDeprecated], + ) ) - self.edit = async_to_streamed_response_wrapper( - rate_limits.edit, + self.edit = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rate_limits.edit # pyright: ignore[reportDeprecated], + ) ) - self.get = async_to_streamed_response_wrapper( - rate_limits.get, + self.get = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + rate_limits.get # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/cloudflare/resources/rulesets/phases/phases.py b/src/cloudflare/resources/rulesets/phases/phases.py index 5cb0317d0fa..9f6a6755eb3 100644 --- a/src/cloudflare/resources/rulesets/phases/phases.py +++ b/src/cloudflare/resources/rulesets/phases/phases.py @@ -31,8 +31,7 @@ from ...._base_client import ( make_request_options, ) -from ....types.rulesets import Kind, Phase, phase_update_params -from ....types.rulesets.kind import Kind +from ....types.rulesets import Phase, phase_update_params from ....types.rulesets.phase import Phase from ....types.rulesets.phase_get_response import PhaseGetResponse from ....types.rulesets.phase_update_response import PhaseUpdateResponse @@ -61,9 +60,7 @@ def update( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - kind: Kind | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - phase: Phase | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -85,12 +82,8 @@ def update( description: An informative description of the ruleset. - kind: The kind of the ruleset. - name: The human-readable name of the ruleset. - phase: The phase of the ruleset. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -119,9 +112,7 @@ def update( { "rules": rules, "description": description, - "kind": kind, "name": name, - "phase": phase, }, phase_update_params.PhaseUpdateParams, ), @@ -215,9 +206,7 @@ async def update( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - kind: Kind | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, - phase: Phase | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via 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 +228,8 @@ async def update( description: An informative description of the ruleset. - kind: The kind of the ruleset. - name: The human-readable name of the ruleset. - phase: The phase of the ruleset. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -273,9 +258,7 @@ async def update( { "rules": rules, "description": description, - "kind": kind, "name": name, - "phase": phase, }, phase_update_params.PhaseUpdateParams, ), diff --git a/src/cloudflare/resources/rulesets/phases/versions.py b/src/cloudflare/resources/rulesets/phases/versions.py index 60967a5872f..93fbc705d12 100644 --- a/src/cloudflare/resources/rulesets/phases/versions.py +++ b/src/cloudflare/resources/rulesets/phases/versions.py @@ -23,8 +23,8 @@ ) from ....types.rulesets import Phase from ....types.rulesets.phase import Phase -from ....types.rulesets.ruleset import Ruleset from ....types.rulesets.phases.version_get_response import VersionGetResponse +from ....types.rulesets.phases.version_list_response import VersionListResponse __all__ = ["VersionsResource", "AsyncVersionsResource"] @@ -50,7 +50,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Ruleset]: + ) -> SyncSinglePage[VersionListResponse]: """ Fetches the versions of an account or zone entry point ruleset. @@ -85,11 +85,11 @@ def list( 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[Ruleset], + page=SyncSinglePage[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=VersionListResponse, ) def get( @@ -176,7 +176,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]: + ) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]: """ Fetches the versions of an account or zone entry point ruleset. @@ -211,11 +211,11 @@ def list( 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[Ruleset], + page=AsyncSinglePage[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=VersionListResponse, ) async def get( diff --git a/src/cloudflare/resources/rulesets/rules.py b/src/cloudflare/resources/rulesets/rules.py index 48621b0a6bf..ecf569b9efa 100644 --- a/src/cloudflare/resources/rulesets/rules.py +++ b/src/cloudflare/resources/rulesets/rules.py @@ -943,6 +943,186 @@ def create( """ ... + @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_custom_field"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.RulesetsLogCustomFieldRuleActionParameters | 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["ddos_dynamic"] | 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["force_connection_close"] | 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 + """ + ... + def create( self, ruleset_id: str, @@ -965,6 +1145,9 @@ def create( | Literal["set_config"] | Literal["skip"] | Literal["set_cache_settings"] + | Literal["log_custom_field"] + | Literal["ddos_dynamic"] + | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_create_params.BlockRuleActionParameters | object @@ -978,6 +1161,7 @@ def create( | rule_create_params.SetConfigRuleActionParameters | rule_create_params.SkipRuleActionParameters | rule_create_params.SetCacheSettingsRuleActionParameters + | rule_create_params.RulesetsLogCustomFieldRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, @@ -2007,23 +2191,7 @@ def edit( """ ... - @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"], - ) + @overload def edit( self, rule_id: str, @@ -2032,35 +2200,8 @@ def edit( 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, + action: Literal["log_custom_field"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.RulesetsLogCustomFieldRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, @@ -2073,56 +2214,450 @@ def edit( 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") + """ + Updates an existing rule in an account or zone ruleset. - 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") + Args: + ruleset_id: The unique ID of the ruleset. - 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]), - ) + 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["ddos_dynamic"] | 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["force_connection_close"] | 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 + """ + ... + + @required_args(["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"] + | Literal["log_custom_field"] + | Literal["ddos_dynamic"] + | Literal["force_connection_close"] + | 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 + | rule_edit_params.RulesetsLogCustomFieldRuleActionParameters + | 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. -class AsyncRulesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRulesResourceWithRawResponse: - return AsyncRulesResourceWithRawResponse(self) + expression: The expression defining which traffic will match the rule. - @cached_property - def with_streaming_response(self) -> AsyncRulesResourceWithStreamingResponse: - return AsyncRulesResourceWithStreamingResponse(self) + 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( @@ -2132,8 +2667,8 @@ async def create( 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, + 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, @@ -2192,7 +2727,7 @@ async def create( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, id: str | NotGiven = NOT_GIVEN, - action: Literal["challenge"] | 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, @@ -2252,8 +2787,8 @@ async def create( 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, + 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, @@ -2312,8 +2847,8 @@ async def create( 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, + 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, @@ -2372,8 +2907,8 @@ async def create( 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, + 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, @@ -2432,8 +2967,8 @@ async def create( 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_create_params.RewriteRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, @@ -2492,8 +3027,8 @@ async def create( 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, + 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, @@ -2552,8 +3087,8 @@ async def create( 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, + 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, @@ -2612,8 +3147,8 @@ async def create( 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, + 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, @@ -2672,8 +3207,8 @@ async def create( 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, + 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, @@ -2732,8 +3267,8 @@ async def create( 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, + 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, @@ -2792,8 +3327,8 @@ async def create( 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, + 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, @@ -2852,8 +3387,8 @@ async def create( 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, + action: Literal["log_custom_field"] | NotGiven = NOT_GIVEN, + action_parameters: rule_create_params.RulesetsLogCustomFieldRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, @@ -2912,8 +3447,8 @@ async def create( 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, + action: Literal["ddos_dynamic"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, @@ -2972,8 +3507,8 @@ async def create( 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, + action: Literal["force_connection_close"] | NotGiven = NOT_GIVEN, + action_parameters: object | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, expression: str | NotGiven = NOT_GIVEN, @@ -3046,6 +3581,9 @@ async def create( | Literal["set_config"] | Literal["skip"] | Literal["set_cache_settings"] + | Literal["log_custom_field"] + | Literal["ddos_dynamic"] + | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_create_params.BlockRuleActionParameters | object @@ -3059,6 +3597,7 @@ async def create( | rule_create_params.SetConfigRuleActionParameters | rule_create_params.SkipRuleActionParameters | rule_create_params.SetCacheSettingsRuleActionParameters + | rule_create_params.RulesetsLogCustomFieldRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, @@ -4088,23 +4627,190 @@ async def edit( """ ... - @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"], - ) + @overload + 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["log_custom_field"] | NotGiven = NOT_GIVEN, + action_parameters: rule_edit_params.RulesetsLogCustomFieldRuleActionParameters | 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, + *, + ruleset_id: str, + account_id: str | NotGiven = NOT_GIVEN, + zone_id: str | NotGiven = NOT_GIVEN, + id: str | NotGiven = NOT_GIVEN, + action: Literal["ddos_dynamic"] | 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 + 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["force_connection_close"] | 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 + """ + ... + + @required_args(["ruleset_id"]) async def edit( self, rule_id: str, @@ -4128,6 +4834,9 @@ async def edit( | Literal["set_config"] | Literal["skip"] | Literal["set_cache_settings"] + | Literal["log_custom_field"] + | Literal["ddos_dynamic"] + | Literal["force_connection_close"] | NotGiven = NOT_GIVEN, action_parameters: rule_edit_params.BlockRuleActionParameters | object @@ -4141,6 +4850,7 @@ async def edit( | rule_edit_params.SetConfigRuleActionParameters | rule_edit_params.SkipRuleActionParameters | rule_edit_params.SetCacheSettingsRuleActionParameters + | rule_edit_params.RulesetsLogCustomFieldRuleActionParameters | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, enabled: bool | NotGiven = NOT_GIVEN, diff --git a/src/cloudflare/resources/rulesets/rulesets.py b/src/cloudflare/resources/rulesets/rulesets.py index f28542d39f5..7347798d5fd 100644 --- a/src/cloudflare/resources/rulesets/rulesets.py +++ b/src/cloudflare/resources/rulesets/rulesets.py @@ -54,8 +54,8 @@ from .versions.versions import VersionsResource, AsyncVersionsResource from ...types.rulesets.kind import Kind from ...types.rulesets.phase import Phase -from ...types.rulesets.ruleset import Ruleset from ...types.rulesets.ruleset_get_response import RulesetGetResponse +from ...types.rulesets.ruleset_list_response import RulesetListResponse from ...types.rulesets.ruleset_create_response import RulesetCreateResponse from ...types.rulesets.ruleset_update_response import RulesetUpdateResponse @@ -253,7 +253,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Ruleset]: + ) -> SyncSinglePage[RulesetListResponse]: """ Fetches all rulesets. @@ -284,11 +284,11 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets", - page=SyncSinglePage[Ruleset], + page=SyncSinglePage[RulesetListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=RulesetListResponse, ) def delete( @@ -594,7 +594,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]: + ) -> AsyncPaginator[RulesetListResponse, AsyncSinglePage[RulesetListResponse]]: """ Fetches all rulesets. @@ -625,11 +625,11 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets", - page=AsyncSinglePage[Ruleset], + page=AsyncSinglePage[RulesetListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=RulesetListResponse, ) async def delete( diff --git a/src/cloudflare/resources/rulesets/versions/versions.py b/src/cloudflare/resources/rulesets/versions/versions.py index 134fb1882b9..d19afd50795 100644 --- a/src/cloudflare/resources/rulesets/versions/versions.py +++ b/src/cloudflare/resources/rulesets/versions/versions.py @@ -29,8 +29,8 @@ AsyncPaginator, make_request_options, ) -from ....types.rulesets.ruleset import Ruleset from ....types.rulesets.version_get_response import VersionGetResponse +from ....types.rulesets.version_list_response import VersionListResponse __all__ = ["VersionsResource", "AsyncVersionsResource"] @@ -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[Ruleset]: + ) -> SyncSinglePage[VersionListResponse]: """ Fetches the versions of an account or zone ruleset. @@ -95,11 +95,11 @@ def list( 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[Ruleset], + page=SyncSinglePage[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=VersionListResponse, ) def delete( @@ -249,7 +249,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]: + ) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]: """ Fetches the versions of an account or zone ruleset. @@ -284,11 +284,11 @@ def list( 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[Ruleset], + page=AsyncSinglePage[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=VersionListResponse, ) async def delete( diff --git a/src/cloudflare/resources/storage/analytics.py b/src/cloudflare/resources/storage/analytics.py index 9a0621a4f2c..dfef4b35536 100644 --- a/src/cloudflare/resources/storage/analytics.py +++ b/src/cloudflare/resources/storage/analytics.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -50,7 +50,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Schema: + ) -> Optional[Schema]: """ Retrieves Workers KV request metrics for the given account. @@ -77,9 +77,9 @@ def list( extra_body=extra_body, timeout=timeout, query=maybe_transform({"query": query}, analytics_list_params.AnalyticsListParams), - post_parser=ResultWrapper[Schema]._unwrapper, + post_parser=ResultWrapper[Optional[Schema]]._unwrapper, ), - cast_to=cast(Type[Schema], ResultWrapper[Schema]), + cast_to=cast(Type[Optional[Schema]], ResultWrapper[Schema]), ) def stored( @@ -93,7 +93,7 @@ def stored( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Components: + ) -> Optional[Components]: """ Retrieves Workers KV stored data metrics for the given account. @@ -120,9 +120,9 @@ def stored( extra_body=extra_body, timeout=timeout, query=maybe_transform({"query": query}, analytics_stored_params.AnalyticsStoredParams), - post_parser=ResultWrapper[Components]._unwrapper, + post_parser=ResultWrapper[Optional[Components]]._unwrapper, ), - cast_to=cast(Type[Components], ResultWrapper[Components]), + cast_to=cast(Type[Optional[Components]], ResultWrapper[Components]), ) @@ -146,7 +146,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Schema: + ) -> Optional[Schema]: """ Retrieves Workers KV request metrics for the given account. @@ -173,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[Schema]._unwrapper, + post_parser=ResultWrapper[Optional[Schema]]._unwrapper, ), - cast_to=cast(Type[Schema], ResultWrapper[Schema]), + cast_to=cast(Type[Optional[Schema]], ResultWrapper[Schema]), ) async def stored( @@ -189,7 +189,7 @@ async def stored( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Components: + ) -> Optional[Components]: """ Retrieves Workers KV stored data metrics for the given account. @@ -216,9 +216,9 @@ async def stored( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"query": query}, analytics_stored_params.AnalyticsStoredParams), - post_parser=ResultWrapper[Components]._unwrapper, + post_parser=ResultWrapper[Optional[Components]]._unwrapper, ), - cast_to=cast(Type[Components], ResultWrapper[Components]), + cast_to=cast(Type[Optional[Components]], ResultWrapper[Components]), ) diff --git a/src/cloudflare/resources/user/invites.py b/src/cloudflare/resources/user/invites.py index 197fa07e530..84d658ed708 100644 --- a/src/cloudflare/resources/user/invites.py +++ b/src/cloudflare/resources/user/invites.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -28,8 +28,6 @@ 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__ = ["InvitesResource", "AsyncInvitesResource"] @@ -74,7 +72,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InviteEditResponse: + ) -> object: """ Responds to an invitation. @@ -93,22 +91,17 @@ def edit( """ if not invite_id: raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}") - return cast( - InviteEditResponse, - self._patch( - f"/user/invites/{invite_id}", - body=maybe_transform({"status": status}, invite_edit_params.InviteEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[InviteEditResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[InviteEditResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._patch( + f"/user/invites/{invite_id}", + body=maybe_transform({"status": status}, invite_edit_params.InviteEditParams), + 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( @@ -121,7 +114,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InviteGetResponse: + ) -> object: """ Gets the details of an invitation. @@ -138,21 +131,16 @@ def get( """ if not invite_id: raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}") - return cast( - InviteGetResponse, - self._get( - f"/user/invites/{invite_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[InviteGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[InviteGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/user/invites/{invite_id}", + 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]), ) @@ -196,7 +184,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InviteEditResponse: + ) -> object: """ Responds to an invitation. @@ -215,22 +203,17 @@ async def edit( """ if not invite_id: raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}") - return cast( - InviteEditResponse, - await self._patch( - f"/user/invites/{invite_id}", - body=await async_maybe_transform({"status": status}, invite_edit_params.InviteEditParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[InviteEditResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[InviteEditResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._patch( + f"/user/invites/{invite_id}", + body=await async_maybe_transform({"status": status}, invite_edit_params.InviteEditParams), + 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( @@ -243,7 +226,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InviteGetResponse: + ) -> object: """ Gets the details of an invitation. @@ -260,21 +243,16 @@ async def get( """ if not invite_id: raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}") - return cast( - InviteGetResponse, - await self._get( - f"/user/invites/{invite_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[InviteGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[InviteGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/user/invites/{invite_id}", + 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]), ) diff --git a/src/cloudflare/resources/user/organizations.py b/src/cloudflare/resources/user/organizations.py index daf90da2aed..be94b8acb6a 100644 --- a/src/cloudflare/resources/user/organizations.py +++ b/src/cloudflare/resources/user/organizations.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -25,7 +25,6 @@ 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__ = ["OrganizationsResource", "AsyncOrganizationsResource"] @@ -152,7 +151,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OrganizationGetResponse: + ) -> object: """ Gets a specific organization the user is associated with. @@ -169,21 +168,16 @@ def get( """ if not organization_id: raise ValueError(f"Expected a non-empty value for `organization_id` but received {organization_id!r}") - return cast( - OrganizationGetResponse, - self._get( - f"/user/organizations/{organization_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OrganizationGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OrganizationGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/user/organizations/{organization_id}", + 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]), ) @@ -308,7 +302,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OrganizationGetResponse: + ) -> object: """ Gets a specific organization the user is associated with. @@ -325,21 +319,16 @@ async def get( """ if not organization_id: raise ValueError(f"Expected a non-empty value for `organization_id` but received {organization_id!r}") - return cast( - OrganizationGetResponse, - await self._get( - f"/user/organizations/{organization_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OrganizationGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[OrganizationGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/user/organizations/{organization_id}", + 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]), ) diff --git a/src/cloudflare/resources/user/tokens/permission_groups.py b/src/cloudflare/resources/user/tokens/permission_groups.py index 427b3944862..28efd8ca0e4 100644 --- a/src/cloudflare/resources/user/tokens/permission_groups.py +++ b/src/cloudflare/resources/user/tokens/permission_groups.py @@ -41,7 +41,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> SyncSinglePage[object]: - """Find all available permission groups.""" + """Find all available permission groups for API Tokens""" return self._get_api_list( "/user/tokens/permission_groups", page=SyncSinglePage[object], @@ -71,7 +71,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> AsyncPaginator[object, AsyncSinglePage[object]]: - """Find all available permission groups.""" + """Find all available permission groups for API Tokens""" return self._get_api_list( "/user/tokens/permission_groups", page=AsyncSinglePage[object], diff --git a/src/cloudflare/resources/user/tokens/tokens.py b/src/cloudflare/resources/user/tokens/tokens.py index 5a71d4cfdb1..877a4388e81 100644 --- a/src/cloudflare/resources/user/tokens/tokens.py +++ b/src/cloudflare/resources/user/tokens/tokens.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Union, Iterable, Optional, cast +from typing import Type, Union, Iterable, Optional, cast from datetime import datetime from typing_extensions import Literal @@ -45,10 +45,8 @@ 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__ = ["TokensResource", "AsyncTokensResource"] @@ -85,7 +83,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenCreateResponse: + ) -> Optional[TokenCreateResponse]: """ Create a new access token. @@ -124,9 +122,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TokenCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TokenCreateResponse]]._unwrapper, ), - cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]), + cast_to=cast(Type[Optional[TokenCreateResponse]], ResultWrapper[TokenCreateResponse]), ) def update( @@ -145,7 +143,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenUpdateResponse: + ) -> object: """ Update an existing token. @@ -169,32 +167,27 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - return cast( - TokenUpdateResponse, - self._put( - f"/user/tokens/{token_id}", - body=maybe_transform( - { - "name": name, - "policies": policies, - "status": status, - "condition": condition, - "expires_on": expires_on, - "not_before": not_before, - }, - token_update_params.TokenUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TokenUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[TokenUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._put( + f"/user/tokens/{token_id}", + body=maybe_transform( + { + "name": name, + "policies": policies, + "status": status, + "condition": condition, + "expires_on": expires_on, + "not_before": not_before, + }, + token_update_params.TokenUpdateParams, ), + 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 list( @@ -293,7 +286,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenGetResponse: + ) -> object: """ Get information about a specific token. @@ -306,21 +299,16 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - return cast( - TokenGetResponse, - self._get( - f"/user/tokens/{token_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TokenGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[TokenGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/user/tokens/{token_id}", + 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 verify( @@ -332,7 +320,7 @@ def verify( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenVerifyResponse: + ) -> Optional[TokenVerifyResponse]: """Test whether a token works.""" return self._get( "/user/tokens/verify", @@ -341,9 +329,9 @@ def verify( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TokenVerifyResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TokenVerifyResponse]]._unwrapper, ), - cast_to=cast(Type[TokenVerifyResponse], ResultWrapper[TokenVerifyResponse]), + cast_to=cast(Type[Optional[TokenVerifyResponse]], ResultWrapper[TokenVerifyResponse]), ) @@ -378,7 +366,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]: """ Create a new access token. @@ -417,9 +405,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TokenCreateResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TokenCreateResponse]]._unwrapper, ), - cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]), + cast_to=cast(Type[Optional[TokenCreateResponse]], ResultWrapper[TokenCreateResponse]), ) async def update( @@ -438,7 +426,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenUpdateResponse: + ) -> object: """ Update an existing token. @@ -462,32 +450,27 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - return cast( - TokenUpdateResponse, - await self._put( - f"/user/tokens/{token_id}", - body=await async_maybe_transform( - { - "name": name, - "policies": policies, - "status": status, - "condition": condition, - "expires_on": expires_on, - "not_before": not_before, - }, - token_update_params.TokenUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TokenUpdateResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[TokenUpdateResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._put( + f"/user/tokens/{token_id}", + body=await async_maybe_transform( + { + "name": name, + "policies": policies, + "status": status, + "condition": condition, + "expires_on": expires_on, + "not_before": not_before, + }, + token_update_params.TokenUpdateParams, ), + 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 list( @@ -586,7 +569,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenGetResponse: + ) -> object: """ Get information about a specific token. @@ -599,21 +582,16 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - return cast( - TokenGetResponse, - await self._get( - f"/user/tokens/{token_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TokenGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[TokenGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/user/tokens/{token_id}", + 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 verify( @@ -625,7 +603,7 @@ async def verify( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TokenVerifyResponse: + ) -> Optional[TokenVerifyResponse]: """Test whether a token works.""" return await self._get( "/user/tokens/verify", @@ -634,9 +612,9 @@ async def verify( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[TokenVerifyResponse]._unwrapper, + post_parser=ResultWrapper[Optional[TokenVerifyResponse]]._unwrapper, ), - cast_to=cast(Type[TokenVerifyResponse], ResultWrapper[TokenVerifyResponse]), + cast_to=cast(Type[Optional[TokenVerifyResponse]], ResultWrapper[TokenVerifyResponse]), ) diff --git a/src/cloudflare/resources/user/tokens/value.py b/src/cloudflare/resources/user/tokens/value.py index 1a35ddc543e..90195f2c4d2 100644 --- a/src/cloudflare/resources/user/tokens/value.py +++ b/src/cloudflare/resources/user/tokens/value.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -70,7 +70,7 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Value]._unwrapper, + post_parser=ResultWrapper[Optional[Value]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) @@ -117,7 +117,7 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Value]._unwrapper, + post_parser=ResultWrapper[Optional[Value]]._unwrapper, ), cast_to=cast(Type[str], ResultWrapper[str]), ) diff --git a/src/cloudflare/resources/user/user.py b/src/cloudflare/resources/user/user.py index 3e9117a3321..083b24efdb0 100644 --- a/src/cloudflare/resources/user/user.py +++ b/src/cloudflare/resources/user/user.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Optional, cast +from typing import Type, Optional, cast import httpx @@ -74,8 +74,6 @@ make_request_options, ) 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"] @@ -127,7 +125,7 @@ def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserEditResponse: + ) -> object: """ Edit part of your user details. @@ -150,31 +148,26 @@ def edit( timeout: Override the client-level default timeout for this request, in seconds """ - return cast( - UserEditResponse, - self._patch( - "/user", - body=maybe_transform( - { - "country": country, - "first_name": first_name, - "last_name": last_name, - "telephone": telephone, - "zipcode": zipcode, - }, - user_edit_params.UserEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[UserEditResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[UserEditResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._patch( + "/user", + body=maybe_transform( + { + "country": country, + "first_name": first_name, + "last_name": last_name, + "telephone": telephone, + "zipcode": zipcode, + }, + user_edit_params.UserEditParams, ), + 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( @@ -186,23 +179,18 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserGetResponse: + ) -> object: """User Details""" - return cast( - UserGetResponse, - self._get( - "/user", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[UserGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[UserGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._get( + "/user", + 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]), ) @@ -253,7 +241,7 @@ async def edit( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserEditResponse: + ) -> object: """ Edit part of your user details. @@ -276,31 +264,26 @@ async def edit( timeout: Override the client-level default timeout for this request, in seconds """ - return cast( - UserEditResponse, - await self._patch( - "/user", - body=await async_maybe_transform( - { - "country": country, - "first_name": first_name, - "last_name": last_name, - "telephone": telephone, - "zipcode": zipcode, - }, - user_edit_params.UserEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[UserEditResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[UserEditResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._patch( + "/user", + body=await async_maybe_transform( + { + "country": country, + "first_name": first_name, + "last_name": last_name, + "telephone": telephone, + "zipcode": zipcode, + }, + user_edit_params.UserEditParams, + ), + 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( @@ -312,23 +295,18 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserGetResponse: + ) -> object: """User Details""" - return cast( - UserGetResponse, - await self._get( - "/user", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[UserGetResponse]._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[UserGetResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._get( + "/user", + 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]), ) diff --git a/src/cloudflare/resources/vectorize/indexes.py b/src/cloudflare/resources/vectorize/indexes.py index b58a753d658..fb9cdaeb7f0 100644 --- a/src/cloudflare/resources/vectorize/indexes.py +++ b/src/cloudflare/resources/vectorize/indexes.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes from ..._utils import ( maybe_transform, async_maybe_transform, @@ -375,7 +375,7 @@ def insert( index_name: str, *, account_id: str, - body: object, + body: FileTypes, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -390,6 +390,8 @@ def insert( Args: account_id: Identifier + body: ndjson file containing vectors to insert. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -487,7 +489,7 @@ def upsert( index_name: str, *, account_id: str, - body: object, + body: FileTypes, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -502,6 +504,8 @@ def upsert( Args: account_id: Identifier + body: ndjson file containing vectors to upsert. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -859,7 +863,7 @@ async def insert( index_name: str, *, account_id: str, - body: object, + body: FileTypes, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -874,6 +878,8 @@ async def insert( Args: account_id: Identifier + body: ndjson file containing vectors to insert. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -971,7 +977,7 @@ async def upsert( index_name: str, *, account_id: str, - body: object, + body: FileTypes, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -986,6 +992,8 @@ async def upsert( Args: account_id: Identifier + body: ndjson file containing vectors to upsert. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/cloudflare/resources/warp_connector.py b/src/cloudflare/resources/warp_connector.py index e614da171ef..b2df61979db 100644 --- a/src/cloudflare/resources/warp_connector.py +++ b/src/cloudflare/resources/warp_connector.py @@ -4,6 +4,7 @@ from typing import Any, Union, cast from datetime import datetime +from typing_extensions import Literal import httpx @@ -105,6 +106,7 @@ def list( name: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + status: Literal["inactive", "degraded", "healthy", "down"] | 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, @@ -133,6 +135,11 @@ def list( per_page: Number of results to display. + status: 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). + uuid: UUID of the tunnel. extra_headers: Send extra headers @@ -162,6 +169,7 @@ def list( "name": name, "page": page, "per_page": per_page, + "status": status, "uuid": uuid, "was_active_at": was_active_at, "was_inactive_at": was_inactive_at, @@ -456,6 +464,7 @@ def list( name: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + status: Literal["inactive", "degraded", "healthy", "down"] | 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, @@ -484,6 +493,11 @@ def list( per_page: Number of results to display. + status: 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). + uuid: UUID of the tunnel. extra_headers: Send extra headers @@ -513,6 +527,7 @@ def list( "name": name, "page": page, "per_page": per_page, + "status": status, "uuid": uuid, "was_active_at": was_active_at, "was_inactive_at": was_inactive_at, diff --git a/src/cloudflare/resources/workers/ai/__init__.py b/src/cloudflare/resources/workers/ai/__init__.py new file mode 100644 index 00000000000..4921cf245a4 --- /dev/null +++ b/src/cloudflare/resources/workers/ai/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .ai import ( + AIResource, + AsyncAIResource, + AIResourceWithRawResponse, + AsyncAIResourceWithRawResponse, + AIResourceWithStreamingResponse, + AsyncAIResourceWithStreamingResponse, +) +from .models import ( + ModelsResource, + AsyncModelsResource, + ModelsResourceWithRawResponse, + AsyncModelsResourceWithRawResponse, + ModelsResourceWithStreamingResponse, + AsyncModelsResourceWithStreamingResponse, +) + +__all__ = [ + "ModelsResource", + "AsyncModelsResource", + "ModelsResourceWithRawResponse", + "AsyncModelsResourceWithRawResponse", + "ModelsResourceWithStreamingResponse", + "AsyncModelsResourceWithStreamingResponse", + "AIResource", + "AsyncAIResource", + "AIResourceWithRawResponse", + "AsyncAIResourceWithRawResponse", + "AIResourceWithStreamingResponse", + "AsyncAIResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/workers/ai.py b/src/cloudflare/resources/workers/ai/ai.py similarity index 96% rename from src/cloudflare/resources/workers/ai.py rename to src/cloudflare/resources/workers/ai/ai.py index 56733d0cbfd..86d294ec5fa 100644 --- a/src/cloudflare/resources/workers/ai.py +++ b/src/cloudflare/resources/workers/ai/ai.py @@ -6,31 +6,44 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( +from .models import ( + ModelsResource, + AsyncModelsResource, + ModelsResourceWithRawResponse, + AsyncModelsResourceWithRawResponse, + ModelsResourceWithStreamingResponse, + AsyncModelsResourceWithStreamingResponse, +) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( required_args, maybe_transform, async_maybe_transform, ) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._wrappers import ResultWrapper -from ..._base_client import ( +from ...._wrappers import ResultWrapper +from .models.models import ModelsResource, AsyncModelsResource +from ...._base_client import ( make_request_options, ) -from ...types.workers import ai_run_params -from ...types.workers.ai_run_response import AIRunResponse +from ....types.workers import ai_run_params +from ....types.workers.ai_run_response import AIRunResponse __all__ = ["AIResource", "AsyncAIResource"] class AIResource(SyncAPIResource): + @cached_property + def models(self) -> ModelsResource: + return ModelsResource(self._client) + @cached_property def with_raw_response(self) -> AIResourceWithRawResponse: return AIResourceWithRawResponse(self) @@ -458,14 +471,11 @@ def run( ["account_id", "text"], ["account_id", "prompt"], ["account_id", "sentences", "source"], - ["account_id", "text"], ["account_id", "audio"], ["account_id", "image"], ["account_id"], - ["account_id"], ["account_id", "target_lang", "text"], ["account_id", "input_text"], - ["account_id", "image"], ) def run( self, @@ -547,6 +557,10 @@ def run( class AsyncAIResource(AsyncAPIResource): + @cached_property + def models(self) -> AsyncModelsResource: + return AsyncModelsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncAIResourceWithRawResponse: return AsyncAIResourceWithRawResponse(self) @@ -974,14 +988,11 @@ async def run( ["account_id", "text"], ["account_id", "prompt"], ["account_id", "sentences", "source"], - ["account_id", "text"], ["account_id", "audio"], ["account_id", "image"], ["account_id"], - ["account_id"], ["account_id", "target_lang", "text"], ["account_id", "input_text"], - ["account_id", "image"], ) async def run( self, @@ -1070,6 +1081,10 @@ def __init__(self, ai: AIResource) -> None: ai.run, ) + @cached_property + def models(self) -> ModelsResourceWithRawResponse: + return ModelsResourceWithRawResponse(self._ai.models) + class AsyncAIResourceWithRawResponse: def __init__(self, ai: AsyncAIResource) -> None: @@ -1079,6 +1094,10 @@ def __init__(self, ai: AsyncAIResource) -> None: ai.run, ) + @cached_property + def models(self) -> AsyncModelsResourceWithRawResponse: + return AsyncModelsResourceWithRawResponse(self._ai.models) + class AIResourceWithStreamingResponse: def __init__(self, ai: AIResource) -> None: @@ -1088,6 +1107,10 @@ def __init__(self, ai: AIResource) -> None: ai.run, ) + @cached_property + def models(self) -> ModelsResourceWithStreamingResponse: + return ModelsResourceWithStreamingResponse(self._ai.models) + class AsyncAIResourceWithStreamingResponse: def __init__(self, ai: AsyncAIResource) -> None: @@ -1096,3 +1119,7 @@ def __init__(self, ai: AsyncAIResource) -> None: self.run = async_to_streamed_response_wrapper( ai.run, ) + + @cached_property + def models(self) -> AsyncModelsResourceWithStreamingResponse: + return AsyncModelsResourceWithStreamingResponse(self._ai.models) diff --git a/src/cloudflare/resources/workers/ai/models/__init__.py b/src/cloudflare/resources/workers/ai/models/__init__.py new file mode 100644 index 00000000000..9ccd4fa07fb --- /dev/null +++ b/src/cloudflare/resources/workers/ai/models/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .models import ( + ModelsResource, + AsyncModelsResource, + ModelsResourceWithRawResponse, + AsyncModelsResourceWithRawResponse, + ModelsResourceWithStreamingResponse, + AsyncModelsResourceWithStreamingResponse, +) +from .schema import ( + SchemaResource, + AsyncSchemaResource, + SchemaResourceWithRawResponse, + AsyncSchemaResourceWithRawResponse, + SchemaResourceWithStreamingResponse, + AsyncSchemaResourceWithStreamingResponse, +) + +__all__ = [ + "SchemaResource", + "AsyncSchemaResource", + "SchemaResourceWithRawResponse", + "AsyncSchemaResourceWithRawResponse", + "SchemaResourceWithStreamingResponse", + "AsyncSchemaResourceWithStreamingResponse", + "ModelsResource", + "AsyncModelsResource", + "ModelsResourceWithRawResponse", + "AsyncModelsResourceWithRawResponse", + "ModelsResourceWithStreamingResponse", + "AsyncModelsResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/workers/ai/models/models.py b/src/cloudflare/resources/workers/ai/models/models.py new file mode 100644 index 00000000000..8f90eb7304d --- /dev/null +++ b/src/cloudflare/resources/workers/ai/models/models.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .schema import ( + SchemaResource, + AsyncSchemaResource, + SchemaResourceWithRawResponse, + AsyncSchemaResourceWithRawResponse, + SchemaResourceWithStreamingResponse, + AsyncSchemaResourceWithStreamingResponse, +) +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["ModelsResource", "AsyncModelsResource"] + + +class ModelsResource(SyncAPIResource): + @cached_property + def schema(self) -> SchemaResource: + return SchemaResource(self._client) + + @cached_property + def with_raw_response(self) -> ModelsResourceWithRawResponse: + return ModelsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ModelsResourceWithStreamingResponse: + return ModelsResourceWithStreamingResponse(self) + + +class AsyncModelsResource(AsyncAPIResource): + @cached_property + def schema(self) -> AsyncSchemaResource: + return AsyncSchemaResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: + return AsyncModelsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncModelsResourceWithStreamingResponse: + return AsyncModelsResourceWithStreamingResponse(self) + + +class ModelsResourceWithRawResponse: + def __init__(self, models: ModelsResource) -> None: + self._models = models + + @cached_property + def schema(self) -> SchemaResourceWithRawResponse: + return SchemaResourceWithRawResponse(self._models.schema) + + +class AsyncModelsResourceWithRawResponse: + def __init__(self, models: AsyncModelsResource) -> None: + self._models = models + + @cached_property + def schema(self) -> AsyncSchemaResourceWithRawResponse: + return AsyncSchemaResourceWithRawResponse(self._models.schema) + + +class ModelsResourceWithStreamingResponse: + def __init__(self, models: ModelsResource) -> None: + self._models = models + + @cached_property + def schema(self) -> SchemaResourceWithStreamingResponse: + return SchemaResourceWithStreamingResponse(self._models.schema) + + +class AsyncModelsResourceWithStreamingResponse: + def __init__(self, models: AsyncModelsResource) -> None: + self._models = models + + @cached_property + def schema(self) -> AsyncSchemaResourceWithStreamingResponse: + return AsyncSchemaResourceWithStreamingResponse(self._models.schema) diff --git a/src/cloudflare/resources/workers/ai/models/schema.py b/src/cloudflare/resources/workers/ai/models/schema.py new file mode 100644 index 00000000000..934b517b989 --- /dev/null +++ b/src/cloudflare/resources/workers/ai/models/schema.py @@ -0,0 +1,166 @@ +# 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.ai.models import schema_get_params + +__all__ = ["SchemaResource", "AsyncSchemaResource"] + + +class SchemaResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SchemaResourceWithRawResponse: + return SchemaResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SchemaResourceWithStreamingResponse: + return SchemaResourceWithStreamingResponse(self) + + def get( + self, + *, + account_id: str, + model: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> object: + """ + Get Model Schema + + Args: + model: Model Name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get( + f"/accounts/{account_id}/ai/models/schema", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"model": model}, schema_get_params.SchemaGetParams), + post_parser=ResultWrapper[object]._unwrapper, + ), + cast_to=cast(Type[object], ResultWrapper[object]), + ) + + +class AsyncSchemaResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSchemaResourceWithRawResponse: + return AsyncSchemaResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSchemaResourceWithStreamingResponse: + return AsyncSchemaResourceWithStreamingResponse(self) + + async def get( + self, + *, + account_id: str, + model: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> object: + """ + Get Model Schema + + Args: + model: Model Name + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._get( + f"/accounts/{account_id}/ai/models/schema", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"model": model}, schema_get_params.SchemaGetParams), + post_parser=ResultWrapper[object]._unwrapper, + ), + cast_to=cast(Type[object], ResultWrapper[object]), + ) + + +class SchemaResourceWithRawResponse: + def __init__(self, schema: SchemaResource) -> None: + self._schema = schema + + self.get = to_raw_response_wrapper( + schema.get, + ) + + +class AsyncSchemaResourceWithRawResponse: + def __init__(self, schema: AsyncSchemaResource) -> None: + self._schema = schema + + self.get = async_to_raw_response_wrapper( + schema.get, + ) + + +class SchemaResourceWithStreamingResponse: + def __init__(self, schema: SchemaResource) -> None: + self._schema = schema + + self.get = to_streamed_response_wrapper( + schema.get, + ) + + +class AsyncSchemaResourceWithStreamingResponse: + def __init__(self, schema: AsyncSchemaResource) -> None: + self._schema = schema + + self.get = async_to_streamed_response_wrapper( + schema.get, + ) diff --git a/src/cloudflare/resources/workers/scripts/scripts.py b/src/cloudflare/resources/workers/scripts/scripts.py index 2ae2c62f3a7..4ad655e6f59 100644 --- a/src/cloudflare/resources/workers/scripts/scripts.py +++ b/src/cloudflare/resources/workers/scripts/scripts.py @@ -207,7 +207,7 @@ def update( """ ... - @required_args(["account_id"], ["account_id"]) + @required_args(["account_id"]) def update( self, script_name: str, @@ -499,7 +499,7 @@ async def update( """ ... - @required_args(["account_id"], ["account_id"]) + @required_args(["account_id"]) async def update( self, script_name: str, diff --git a/src/cloudflare/resources/workers/scripts/versions.py b/src/cloudflare/resources/workers/scripts/versions.py index 493ece2bd84..a13d69c5e8d 100644 --- a/src/cloudflare/resources/workers/scripts/versions.py +++ b/src/cloudflare/resources/workers/scripts/versions.py @@ -22,10 +22,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncV4PagePagination, AsyncV4PagePagination from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.workers.scripts import version_create_params +from ....types.workers.scripts import version_list_params, 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 @@ -113,13 +115,16 @@ def list( script_name: str, *, account_id: str, + deployable: bool | 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, - ) -> Optional[VersionListResponse]: + ) -> SyncV4PagePagination[VersionListResponse]: """List of Worker Versions. The first version in the list is the latest version. @@ -129,6 +134,12 @@ def list( script_name: Name of the script. + deployable: Only return versions that can be used in a deployment. Ignores pagination. + + page: Current page. + + per_page: Items per-page. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -141,16 +152,24 @@ def list( 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( + return self._get_api_list( f"/accounts/{account_id}/workers/scripts/{script_name}/versions", + page=SyncV4PagePagination[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[VersionListResponse]]._unwrapper, + query=maybe_transform( + { + "deployable": deployable, + "page": page, + "per_page": per_page, + }, + version_list_params.VersionListParams, + ), ), - cast_to=cast(Type[Optional[VersionListResponse]], ResultWrapper[VersionListResponse]), + model=VersionListResponse, ) def get( @@ -276,18 +295,21 @@ async def create( cast_to=cast(Type[Optional[VersionCreateResponse]], ResultWrapper[VersionCreateResponse]), ) - async def list( + def list( self, script_name: str, *, account_id: str, + deployable: bool | 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, - ) -> Optional[VersionListResponse]: + ) -> AsyncPaginator[VersionListResponse, AsyncV4PagePagination[VersionListResponse]]: """List of Worker Versions. The first version in the list is the latest version. @@ -297,6 +319,12 @@ async def list( script_name: Name of the script. + deployable: Only return versions that can be used in a deployment. Ignores pagination. + + page: Current page. + + per_page: Items per-page. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -309,16 +337,24 @@ async def list( 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( + return self._get_api_list( f"/accounts/{account_id}/workers/scripts/{script_name}/versions", + page=AsyncV4PagePagination[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[VersionListResponse]]._unwrapper, + query=maybe_transform( + { + "deployable": deployable, + "page": page, + "per_page": per_page, + }, + version_list_params.VersionListParams, + ), ), - cast_to=cast(Type[Optional[VersionListResponse]], ResultWrapper[VersionListResponse]), + model=VersionListResponse, ) async def get( diff --git a/src/cloudflare/resources/workers/workers.py b/src/cloudflare/resources/workers/workers.py index 195b4a21670..55326950c01 100644 --- a/src/cloudflare/resources/workers/workers.py +++ b/src/cloudflare/resources/workers/workers.py @@ -10,6 +10,7 @@ AIResourceWithStreamingResponse, AsyncAIResourceWithStreamingResponse, ) +from .ai.ai import AIResource, AsyncAIResource from .domains import ( DomainsResource, AsyncDomainsResource, 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 eaaece76d7b..82979ddf8ce 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 @@ -188,7 +188,7 @@ def update( """ ... - @required_args(["account_id", "dispatch_namespace"], ["account_id", "dispatch_namespace"]) + @required_args(["account_id", "dispatch_namespace"]) def update( self, script_name: str, @@ -455,7 +455,7 @@ async def update( """ ... - @required_args(["account_id", "dispatch_namespace"], ["account_id", "dispatch_namespace"]) + @required_args(["account_id", "dispatch_namespace"]) async def update( self, script_name: str, diff --git a/src/cloudflare/resources/zero_trust/access/__init__.py b/src/cloudflare/resources/zero_trust/access/__init__.py index b34af407a86..d3fe1996f9d 100644 --- a/src/cloudflare/resources/zero_trust/access/__init__.py +++ b/src/cloudflare/resources/zero_trust/access/__init__.py @@ -48,6 +48,14 @@ GroupsResourceWithStreamingResponse, AsyncGroupsResourceWithStreamingResponse, ) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) from .bookmarks import ( BookmarksResource, AsyncBookmarksResource, @@ -150,6 +158,12 @@ "AsyncTagsResourceWithRawResponse", "TagsResourceWithStreamingResponse", "AsyncTagsResourceWithStreamingResponse", + "PoliciesResource", + "AsyncPoliciesResource", + "PoliciesResourceWithRawResponse", + "AsyncPoliciesResourceWithRawResponse", + "PoliciesResourceWithStreamingResponse", + "AsyncPoliciesResourceWithStreamingResponse", "AccessResource", "AsyncAccessResource", "AccessResourceWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/access/access.py b/src/cloudflare/resources/zero_trust/access/access.py index 6707c0f7745..b0be13c5cb8 100644 --- a/src/cloudflare/resources/zero_trust/access/access.py +++ b/src/cloudflare/resources/zero_trust/access/access.py @@ -42,6 +42,14 @@ GroupsResourceWithStreamingResponse, AsyncGroupsResourceWithStreamingResponse, ) +from .policies import ( + PoliciesResource, + AsyncPoliciesResource, + PoliciesResourceWithRawResponse, + AsyncPoliciesResourceWithRawResponse, + PoliciesResourceWithStreamingResponse, + AsyncPoliciesResourceWithStreamingResponse, +) from .bookmarks import ( BookmarksResource, AsyncBookmarksResource, @@ -133,6 +141,10 @@ def custom_pages(self) -> CustomPagesResource: def tags(self) -> TagsResource: return TagsResource(self._client) + @cached_property + def policies(self) -> PoliciesResource: + return PoliciesResource(self._client) + @cached_property def with_raw_response(self) -> AccessResourceWithRawResponse: return AccessResourceWithRawResponse(self) @@ -183,6 +195,10 @@ def custom_pages(self) -> AsyncCustomPagesResource: def tags(self) -> AsyncTagsResource: return AsyncTagsResource(self._client) + @cached_property + def policies(self) -> AsyncPoliciesResource: + return AsyncPoliciesResource(self._client) + @cached_property def with_raw_response(self) -> AsyncAccessResourceWithRawResponse: return AsyncAccessResourceWithRawResponse(self) @@ -236,6 +252,10 @@ def custom_pages(self) -> CustomPagesResourceWithRawResponse: def tags(self) -> TagsResourceWithRawResponse: return TagsResourceWithRawResponse(self._access.tags) + @cached_property + def policies(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self._access.policies) + class AsyncAccessResourceWithRawResponse: def __init__(self, access: AsyncAccessResource) -> None: @@ -281,6 +301,10 @@ def custom_pages(self) -> AsyncCustomPagesResourceWithRawResponse: def tags(self) -> AsyncTagsResourceWithRawResponse: return AsyncTagsResourceWithRawResponse(self._access.tags) + @cached_property + def policies(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self._access.policies) + class AccessResourceWithStreamingResponse: def __init__(self, access: AccessResource) -> None: @@ -326,6 +350,10 @@ def custom_pages(self) -> CustomPagesResourceWithStreamingResponse: def tags(self) -> TagsResourceWithStreamingResponse: return TagsResourceWithStreamingResponse(self._access.tags) + @cached_property + def policies(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self._access.policies) + class AsyncAccessResourceWithStreamingResponse: def __init__(self, access: AsyncAccessResource) -> None: @@ -370,3 +398,7 @@ def custom_pages(self) -> AsyncCustomPagesResourceWithStreamingResponse: @cached_property def tags(self) -> AsyncTagsResourceWithStreamingResponse: return AsyncTagsResourceWithStreamingResponse(self._access.tags) + + @cached_property + def policies(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self._access.policies) diff --git a/src/cloudflare/resources/zero_trust/access/applications/applications.py b/src/cloudflare/resources/zero_trust/access/applications/applications.py index 3192d3b31f5..10d54f8e800 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/applications.py +++ b/src/cloudflare/resources/zero_trust/access/applications/applications.py @@ -54,13 +54,16 @@ application_create_params, application_update_params, ) -from .....types.zero_trust.access.application import Application from .....types.zero_trust.access.allowed_idps import AllowedIdPs from .....types.zero_trust.access.app_id_param import AppIDParam from .....types.zero_trust.access.application_type import ApplicationType from .....types.zero_trust.access.cors_headers_param import CORSHeadersParam from .....types.zero_trust.access.self_hosted_domains import SelfHostedDomains +from .....types.zero_trust.access.application_get_response import ApplicationGetResponse +from .....types.zero_trust.access.application_list_response import ApplicationListResponse +from .....types.zero_trust.access.application_create_response import ApplicationCreateResponse from .....types.zero_trust.access.application_delete_response import ApplicationDeleteResponse +from .....types.zero_trust.access.application_update_response import ApplicationUpdateResponse __all__ = ["ApplicationsResource", "AsyncApplicationsResource"] @@ -109,7 +112,9 @@ def create( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.SelfHostedApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_create_params.SelfHostedApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -121,7 +126,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -175,9 +180,16 @@ def create( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -213,7 +225,9 @@ def create( custom_pages: List[str] | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + policies: List[application_create_params.SaaSApplicationPolicy] | NotGiven = NOT_GIVEN, saas_app: application_create_params.SaaSApplicationSaaSApp | NotGiven = NOT_GIVEN, + scim_config: application_create_params.SaaSApplicationSCIMConfig | 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. @@ -222,7 +236,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -245,6 +259,13 @@ def create( name: The name of the application. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + tags: The tags you want assigned to an application. Tags are used to filter applications in the App Launcher dashboard. @@ -283,7 +304,9 @@ def create( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.BrowserSSHApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_create_params.BrowserSSHApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -295,7 +318,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -349,9 +372,16 @@ def create( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -398,7 +428,9 @@ def create( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.BrowserVncApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_create_params.BrowserVncApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -410,7 +442,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -464,9 +496,16 @@ def create( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -499,6 +538,8 @@ def create( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.AppLauncherApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_create_params.AppLauncherApplicationSCIMConfig | 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. @@ -506,7 +547,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -523,6 +564,13 @@ def create( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -546,6 +594,8 @@ def create( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.DeviceEnrollmentPermissionsApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_create_params.DeviceEnrollmentPermissionsApplicationSCIMConfig | 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. @@ -553,7 +603,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -570,6 +620,13 @@ def create( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -593,6 +650,8 @@ def create( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.BrowserIsolationPermissionsApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_create_params.BrowserIsolationPermissionsApplicationSCIMConfig | 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. @@ -600,7 +659,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -617,6 +676,13 @@ def create( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -641,6 +707,7 @@ def create( domain: str | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + scim_config: application_create_params.BookmarkApplicationSCIMConfig | 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. @@ -649,7 +716,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -666,6 +733,9 @@ def create( name: The name of the application. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + tags: The tags you want assigned to an application. Tags are used to filter applications in the App Launcher dashboard. @@ -703,7 +773,9 @@ def create( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.SelfHostedApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_create_params.SelfHostedApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -716,7 +788,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -730,7 +802,7 @@ def create( account_or_zone = "zones" account_or_zone_id = zone_id return cast( - Optional[Application], + Optional[ApplicationCreateResponse], self._post( f"/{account_or_zone}/{account_or_zone_id}/access/apps", body=maybe_transform( @@ -752,7 +824,9 @@ def create( "name": name, "options_preflight_bypass": options_preflight_bypass, "path_cookie_attribute": path_cookie_attribute, + "policies": policies, "same_site_cookie_attribute": same_site_cookie_attribute, + "scim_config": scim_config, "self_hosted_domains": self_hosted_domains, "service_auth_401_redirect": service_auth_401_redirect, "session_duration": session_duration, @@ -767,10 +841,10 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Application]]._unwrapper, + post_parser=ResultWrapper[Optional[ApplicationCreateResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[Application] + Any, ResultWrapper[ApplicationCreateResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -799,7 +873,9 @@ def update( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.SelfHostedApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_update_params.SelfHostedApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -811,7 +887,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -867,9 +943,16 @@ def update( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -906,7 +989,9 @@ def update( custom_pages: List[str] | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + policies: List[application_update_params.SaaSApplicationPolicy] | NotGiven = NOT_GIVEN, saas_app: application_update_params.SaaSApplicationSaaSApp | NotGiven = NOT_GIVEN, + scim_config: application_update_params.SaaSApplicationSCIMConfig | 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. @@ -915,7 +1000,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -940,6 +1025,13 @@ def update( name: The name of the application. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + tags: The tags you want assigned to an application. Tags are used to filter applications in the App Launcher dashboard. @@ -979,7 +1071,9 @@ def update( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.BrowserSSHApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_update_params.BrowserSSHApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -991,7 +1085,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -1047,9 +1141,16 @@ def update( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -1097,7 +1198,9 @@ def update( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.BrowserVncApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_update_params.BrowserVncApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -1109,7 +1212,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -1165,9 +1268,16 @@ def update( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -1201,6 +1311,8 @@ def update( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.AppLauncherApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_update_params.AppLauncherApplicationSCIMConfig | 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. @@ -1208,7 +1320,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -1227,6 +1339,13 @@ def update( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -1251,6 +1370,8 @@ def update( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.DeviceEnrollmentPermissionsApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_update_params.DeviceEnrollmentPermissionsApplicationSCIMConfig | 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. @@ -1258,7 +1379,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -1277,6 +1398,13 @@ def update( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -1301,6 +1429,8 @@ def update( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.BrowserIsolationPermissionsApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_update_params.BrowserIsolationPermissionsApplicationSCIMConfig | 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. @@ -1308,7 +1438,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -1327,6 +1457,13 @@ def update( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -1352,6 +1489,7 @@ def update( domain: str | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + scim_config: application_update_params.BookmarkApplicationSCIMConfig | 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. @@ -1360,7 +1498,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -1379,6 +1517,9 @@ def update( name: The name of the application. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + tags: The tags you want assigned to an application. Tags are used to filter applications in the App Launcher dashboard. @@ -1417,7 +1558,9 @@ def update( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.SelfHostedApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_update_params.SelfHostedApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -1430,7 +1573,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1444,7 +1587,7 @@ def update( account_or_zone = "zones" account_or_zone_id = zone_id return cast( - Optional[Application], + Optional[ApplicationUpdateResponse], self._put( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}", body=maybe_transform( @@ -1466,7 +1609,9 @@ def update( "name": name, "options_preflight_bypass": options_preflight_bypass, "path_cookie_attribute": path_cookie_attribute, + "policies": policies, "same_site_cookie_attribute": same_site_cookie_attribute, + "scim_config": scim_config, "self_hosted_domains": self_hosted_domains, "service_auth_401_redirect": service_auth_401_redirect, "session_duration": session_duration, @@ -1481,10 +1626,10 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Application]]._unwrapper, + post_parser=ResultWrapper[Optional[ApplicationUpdateResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[Application] + Any, ResultWrapper[ApplicationUpdateResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -1500,7 +1645,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Application]: + ) -> SyncSinglePage[ApplicationListResponse]: """ Lists all Access applications in an account or zone. @@ -1531,11 +1676,11 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps", - page=SyncSinglePage[Application], + page=SyncSinglePage[ApplicationListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=cast(Any, Application), # Union types cannot be passed in as arguments in the type system + model=cast(Any, ApplicationListResponse), # Union types cannot be passed in as arguments in the type system ) def delete( @@ -1605,7 +1750,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationGetResponse]: """ Fetches information about an Access application. @@ -1637,7 +1782,7 @@ def get( account_or_zone = "zones" account_or_zone_id = zone_id return cast( - Optional[Application], + Optional[ApplicationGetResponse], self._get( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}", options=make_request_options( @@ -1645,10 +1790,10 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Application]]._unwrapper, + post_parser=ResultWrapper[Optional[ApplicationGetResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[Application] + Any, ResultWrapper[ApplicationGetResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -1753,7 +1898,9 @@ async def create( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.SelfHostedApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_create_params.SelfHostedApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -1765,7 +1912,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -1819,9 +1966,16 @@ async def create( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -1857,7 +2011,9 @@ async def create( custom_pages: List[str] | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + policies: List[application_create_params.SaaSApplicationPolicy] | NotGiven = NOT_GIVEN, saas_app: application_create_params.SaaSApplicationSaaSApp | NotGiven = NOT_GIVEN, + scim_config: application_create_params.SaaSApplicationSCIMConfig | 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. @@ -1866,7 +2022,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -1889,6 +2045,13 @@ async def create( name: The name of the application. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + tags: The tags you want assigned to an application. Tags are used to filter applications in the App Launcher dashboard. @@ -1927,7 +2090,9 @@ async def create( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.BrowserSSHApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_create_params.BrowserSSHApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -1939,7 +2104,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -1993,9 +2158,16 @@ async def create( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -2042,7 +2214,9 @@ async def create( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.BrowserVncApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_create_params.BrowserVncApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -2054,7 +2228,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -2108,9 +2282,16 @@ async def create( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -2143,6 +2324,8 @@ async def create( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.AppLauncherApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_create_params.AppLauncherApplicationSCIMConfig | 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. @@ -2150,7 +2333,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -2167,6 +2350,13 @@ async def create( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -2190,6 +2380,8 @@ async def create( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.DeviceEnrollmentPermissionsApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_create_params.DeviceEnrollmentPermissionsApplicationSCIMConfig | 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. @@ -2197,7 +2389,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -2214,6 +2406,13 @@ async def create( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -2237,6 +2436,8 @@ async def create( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.BrowserIsolationPermissionsApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_create_params.BrowserIsolationPermissionsApplicationSCIMConfig | 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. @@ -2244,7 +2445,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -2261,6 +2462,13 @@ async def create( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -2285,6 +2493,7 @@ async def create( domain: str | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + scim_config: application_create_params.BookmarkApplicationSCIMConfig | 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. @@ -2293,7 +2502,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: """ Adds a new application to Access. @@ -2310,6 +2519,9 @@ async def create( name: The name of the application. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + tags: The tags you want assigned to an application. Tags are used to filter applications in the App Launcher dashboard. @@ -2347,7 +2559,9 @@ async def create( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_create_params.SelfHostedApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_create_params.SelfHostedApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -2360,7 +2574,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationCreateResponse]: if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -2374,7 +2588,7 @@ async def create( account_or_zone = "zones" account_or_zone_id = zone_id return cast( - Optional[Application], + Optional[ApplicationCreateResponse], await self._post( f"/{account_or_zone}/{account_or_zone_id}/access/apps", body=await async_maybe_transform( @@ -2396,7 +2610,9 @@ async def create( "name": name, "options_preflight_bypass": options_preflight_bypass, "path_cookie_attribute": path_cookie_attribute, + "policies": policies, "same_site_cookie_attribute": same_site_cookie_attribute, + "scim_config": scim_config, "self_hosted_domains": self_hosted_domains, "service_auth_401_redirect": service_auth_401_redirect, "session_duration": session_duration, @@ -2411,10 +2627,10 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Application]]._unwrapper, + post_parser=ResultWrapper[Optional[ApplicationCreateResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[Application] + Any, ResultWrapper[ApplicationCreateResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -2443,7 +2659,9 @@ async def update( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.SelfHostedApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_update_params.SelfHostedApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -2455,7 +2673,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -2511,9 +2729,16 @@ async def update( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -2550,7 +2775,9 @@ async def update( custom_pages: List[str] | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + policies: List[application_update_params.SaaSApplicationPolicy] | NotGiven = NOT_GIVEN, saas_app: application_update_params.SaaSApplicationSaaSApp | NotGiven = NOT_GIVEN, + scim_config: application_update_params.SaaSApplicationSCIMConfig | 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. @@ -2559,7 +2786,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -2584,6 +2811,13 @@ async def update( name: The name of the application. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + tags: The tags you want assigned to an application. Tags are used to filter applications in the App Launcher dashboard. @@ -2623,7 +2857,9 @@ async def update( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.BrowserSSHApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_update_params.BrowserSSHApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -2635,7 +2871,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -2691,9 +2927,16 @@ async def update( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -2741,7 +2984,9 @@ async def update( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.BrowserVncApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_update_params.BrowserVncApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -2753,7 +2998,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -2809,9 +3054,16 @@ async def update( 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 + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + same_site_cookie_attribute: Sets the SameSite cookie setting, which provides increased security against CSRF attacks. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + self_hosted_domains: List of domains that Access will secure. service_auth_401_redirect: Returns a 401 status code when the request is blocked by a Service Auth policy. @@ -2845,6 +3097,8 @@ async def update( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.AppLauncherApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_update_params.AppLauncherApplicationSCIMConfig | 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. @@ -2852,7 +3106,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -2871,6 +3125,13 @@ async def update( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -2895,6 +3156,8 @@ async def update( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.DeviceEnrollmentPermissionsApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_update_params.DeviceEnrollmentPermissionsApplicationSCIMConfig | 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. @@ -2902,7 +3165,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -2921,6 +3184,13 @@ async def update( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -2945,6 +3215,8 @@ async def update( zone_id: str | NotGiven = NOT_GIVEN, allowed_idps: List[AllowedIdPs] | NotGiven = NOT_GIVEN, auto_redirect_to_identity: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.BrowserIsolationPermissionsApplicationPolicy] | NotGiven = NOT_GIVEN, + scim_config: application_update_params.BrowserIsolationPermissionsApplicationSCIMConfig | 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. @@ -2952,7 +3224,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -2971,6 +3243,13 @@ async def update( auto_redirect_to_identity: When set to `true`, users skip the identity provider selection step during login. You must specify only one identity provider in allowed_idps. + policies: The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + session_duration: 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. @@ -2996,6 +3275,7 @@ async def update( domain: str | NotGiven = NOT_GIVEN, logo_url: str | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, + scim_config: application_update_params.BookmarkApplicationSCIMConfig | 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. @@ -3004,7 +3284,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: """ Updates an Access application. @@ -3023,6 +3303,9 @@ async def update( name: The name of the application. + scim_config: Configuration for provisioning to this application via SCIM. This is currently + in closed beta. + tags: The tags you want assigned to an application. Tags are used to filter applications in the App Launcher dashboard. @@ -3061,7 +3344,9 @@ async def update( name: str | NotGiven = NOT_GIVEN, options_preflight_bypass: bool | NotGiven = NOT_GIVEN, path_cookie_attribute: bool | NotGiven = NOT_GIVEN, + policies: List[application_update_params.SelfHostedApplicationPolicy] | NotGiven = NOT_GIVEN, same_site_cookie_attribute: str | NotGiven = NOT_GIVEN, + scim_config: application_update_params.SelfHostedApplicationSCIMConfig | NotGiven = NOT_GIVEN, self_hosted_domains: List[SelfHostedDomains] | NotGiven = NOT_GIVEN, service_auth_401_redirect: bool | NotGiven = NOT_GIVEN, session_duration: str | NotGiven = NOT_GIVEN, @@ -3074,7 +3359,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationUpdateResponse]: if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -3088,7 +3373,7 @@ async def update( account_or_zone = "zones" account_or_zone_id = zone_id return cast( - Optional[Application], + Optional[ApplicationUpdateResponse], await self._put( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}", body=await async_maybe_transform( @@ -3110,7 +3395,9 @@ async def update( "name": name, "options_preflight_bypass": options_preflight_bypass, "path_cookie_attribute": path_cookie_attribute, + "policies": policies, "same_site_cookie_attribute": same_site_cookie_attribute, + "scim_config": scim_config, "self_hosted_domains": self_hosted_domains, "service_auth_401_redirect": service_auth_401_redirect, "session_duration": session_duration, @@ -3125,10 +3412,10 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Application]]._unwrapper, + post_parser=ResultWrapper[Optional[ApplicationUpdateResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[Application] + Any, ResultWrapper[ApplicationUpdateResponse] ), # Union types cannot be passed in as arguments in the type system ), ) @@ -3144,7 +3431,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Application, AsyncSinglePage[Application]]: + ) -> AsyncPaginator[ApplicationListResponse, AsyncSinglePage[ApplicationListResponse]]: """ Lists all Access applications in an account or zone. @@ -3175,11 +3462,11 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps", - page=AsyncSinglePage[Application], + page=AsyncSinglePage[ApplicationListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=cast(Any, Application), # Union types cannot be passed in as arguments in the type system + model=cast(Any, ApplicationListResponse), # Union types cannot be passed in as arguments in the type system ) async def delete( @@ -3249,7 +3536,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Application]: + ) -> Optional[ApplicationGetResponse]: """ Fetches information about an Access application. @@ -3281,7 +3568,7 @@ async def get( account_or_zone = "zones" account_or_zone_id = zone_id return cast( - Optional[Application], + Optional[ApplicationGetResponse], await self._get( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}", options=make_request_options( @@ -3289,10 +3576,10 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Application]]._unwrapper, + post_parser=ResultWrapper[Optional[ApplicationGetResponse]]._unwrapper, ), cast_to=cast( - Any, ResultWrapper[Application] + Any, ResultWrapper[ApplicationGetResponse] ), # Union types cannot be passed in as arguments in the type system ), ) diff --git a/src/cloudflare/resources/zero_trust/access/applications/cas.py b/src/cloudflare/resources/zero_trust/access/applications/cas.py index 36c6f5f0483..6dcc2e9f3d9 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/cas.py +++ b/src/cloudflare/resources/zero_trust/access/applications/cas.py @@ -40,7 +40,7 @@ def with_streaming_response(self) -> CAsResourceWithStreamingResponse: def create( self, - uuid: str, + app_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -55,7 +55,7 @@ def create( Generates a new short-lived certificate CA and public key. Args: - uuid: UUID + app_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -69,8 +69,8 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -86,7 +86,7 @@ def create( return cast( Optional[CACreateResponse], self._post( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/ca", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -151,7 +151,7 @@ def list( def delete( self, - uuid: str, + app_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -166,7 +166,7 @@ def delete( Deletes a short-lived certificate CA. Args: - uuid: UUID + app_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -180,8 +180,8 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -195,7 +195,7 @@ def delete( account_or_zone = "zones" account_or_zone_id = zone_id return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/ca", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -208,7 +208,7 @@ def delete( def get( self, - uuid: str, + app_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -223,7 +223,7 @@ def get( Fetches a short-lived certificate CA and its public key. Args: - uuid: UUID + app_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -237,8 +237,8 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -254,7 +254,7 @@ def get( return cast( Optional[CAGetResponse], self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/ca", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -280,7 +280,7 @@ def with_streaming_response(self) -> AsyncCAsResourceWithStreamingResponse: async def create( self, - uuid: str, + app_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -295,7 +295,7 @@ async def create( Generates a new short-lived certificate CA and public key. Args: - uuid: UUID + app_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -309,8 +309,8 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -326,7 +326,7 @@ async def create( return cast( Optional[CACreateResponse], await self._post( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/ca", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -391,7 +391,7 @@ def list( async def delete( self, - uuid: str, + app_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -406,7 +406,7 @@ async def delete( Deletes a short-lived certificate CA. Args: - uuid: UUID + app_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -420,8 +420,8 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -435,7 +435,7 @@ async def delete( account_or_zone = "zones" account_or_zone_id = zone_id return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/ca", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -448,7 +448,7 @@ async def delete( async def get( self, - uuid: str, + app_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -463,7 +463,7 @@ async def get( Fetches a short-lived certificate CA and its public key. Args: - uuid: UUID + app_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -477,8 +477,8 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -494,7 +494,7 @@ async def get( return cast( Optional[CAGetResponse], await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/ca", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/ca", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/zero_trust/access/applications/policies.py b/src/cloudflare/resources/zero_trust/access/applications/policies.py index 14423705cf1..bbea31c3736 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/policies.py +++ b/src/cloudflare/resources/zero_trust/access/applications/policies.py @@ -3,7 +3,6 @@ from __future__ import annotations from typing import Type, Iterable, Optional, cast -from typing_extensions import Literal import httpx @@ -26,11 +25,16 @@ AsyncPaginator, make_request_options, ) +from .....types.zero_trust.access import Decision +from .....types.zero_trust.access.decision import Decision 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.policy_get_response import PolicyGetResponse from .....types.zero_trust.access.applications.approval_group_param import ApprovalGroupParam +from .....types.zero_trust.access.applications.policy_list_response import PolicyListResponse +from .....types.zero_trust.access.applications.policy_create_response import PolicyCreateResponse from .....types.zero_trust.access.applications.policy_delete_response import PolicyDeleteResponse +from .....types.zero_trust.access.applications.policy_update_response import PolicyUpdateResponse __all__ = ["PoliciesResource", "AsyncPoliciesResource"] @@ -46,9 +50,9 @@ def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: def create( self, - uuid: str, + app_id: str, *, - decision: Literal["allow", "deny", "non_identity", "bypass"], + decision: Decision, include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, @@ -68,12 +72,15 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Policy]: + ) -> Optional[PolicyCreateResponse]: """ - Create a new Access policy for an application. + Creates a policy applying exclusive to a single application that defines the + users or groups who can reach it. We recommend creating a reusable policy + instead and subsequently referencing its ID in the application's 'policies' + array. Args: - uuid: UUID + app_id: UUID decision: The action Access will take if a user matches this policy. @@ -98,7 +105,8 @@ def create( this policy. 'Client Web Isolation' must be on for the account in order to use this feature. - precedence: The order of execution for this policy. Must be unique for each policy. + precedence: The order of execution for this policy. Must be unique for each policy within an + app. purpose_justification_prompt: A custom message that will appear on the purpose justification screen. @@ -119,8 +127,8 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -134,7 +142,7 @@ def create( account_or_zone = "zones" account_or_zone_id = zone_id return self._post( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/policies", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/policies", body=maybe_transform( { "decision": decision, @@ -157,17 +165,17 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Policy]]._unwrapper, + post_parser=ResultWrapper[Optional[PolicyCreateResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), + cast_to=cast(Type[Optional[PolicyCreateResponse]], ResultWrapper[PolicyCreateResponse]), ) def update( self, - uuid: str, + policy_id: str, *, - uuid1: str, - decision: Literal["allow", "deny", "non_identity", "bypass"], + app_id: str, + decision: Decision, include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, @@ -187,14 +195,16 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Policy]: - """ - Update a configured Access policy. + ) -> Optional[PolicyUpdateResponse]: + """Updates an Access policy specific to an application. + + To update a reusable + policy, use the /account or zones/{account or zone_id}/policies/{uid} endpoint. Args: - uuid1: UUID + app_id: UUID - uuid: UUID + policy_id: UUID decision: The action Access will take if a user matches this policy. @@ -219,7 +229,8 @@ def update( this policy. 'Client Web Isolation' must be on for the account in order to use this feature. - precedence: The order of execution for this policy. Must be unique for each policy. + precedence: The order of execution for this policy. Must be unique for each policy within an + app. purpose_justification_prompt: A custom message that will appear on the purpose justification screen. @@ -240,10 +251,10 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid1: - 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 app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") + if not policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -257,7 +268,7 @@ def update( account_or_zone = "zones" account_or_zone_id = zone_id return self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/policies/{policy_id}", body=maybe_transform( { "decision": decision, @@ -280,14 +291,14 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Policy]]._unwrapper, + post_parser=ResultWrapper[Optional[PolicyUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), + cast_to=cast(Type[Optional[PolicyUpdateResponse]], ResultWrapper[PolicyUpdateResponse]), ) def list( self, - uuid: str, + app_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -297,12 +308,14 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Policy]: - """ - Lists Access policies configured for an application. + ) -> SyncSinglePage[PolicyListResponse]: + """Lists Access policies configured for an application. + + Returns both exclusively + scoped and reusable policies used by the application. Args: - uuid: UUID + app_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -316,8 +329,8 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -331,19 +344,19 @@ def list( 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[Policy], + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/policies", + page=SyncSinglePage[PolicyListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Policy, + model=PolicyListResponse, ) def delete( self, - uuid: str, + policy_id: str, *, - uuid1: str, + app_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. @@ -353,13 +366,15 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[PolicyDeleteResponse]: - """ - Delete an Access policy. + """Deletes an Access policy specific to an application. + + To delete a reusable + policy, use the /account or zones/{account or zone_id}/policies/{uid} endpoint. Args: - uuid1: UUID + app_id: UUID - uuid: UUID + policy_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -373,10 +388,10 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid1: - 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 app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") + if not policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -390,7 +405,7 @@ def delete( account_or_zone = "zones" account_or_zone_id = zone_id return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/policies/{policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -403,9 +418,9 @@ def delete( def get( self, - uuid: str, + policy_id: str, *, - uuid1: str, + app_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. @@ -414,14 +429,16 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Policy]: - """ - Fetches a single Access policy. + ) -> Optional[PolicyGetResponse]: + """Fetches a single Access policy configured for an application. + + Returns both + exclusively owned and reusable policies used by the application. Args: - uuid1: UUID + app_id: UUID - uuid: UUID + policy_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -435,10 +452,10 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid1: - 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 app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") + if not policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -452,15 +469,15 @@ def get( account_or_zone = "zones" account_or_zone_id = zone_id return self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/policies/{policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Policy]]._unwrapper, + post_parser=ResultWrapper[Optional[PolicyGetResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), + cast_to=cast(Type[Optional[PolicyGetResponse]], ResultWrapper[PolicyGetResponse]), ) @@ -475,9 +492,9 @@ def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: async def create( self, - uuid: str, + app_id: str, *, - decision: Literal["allow", "deny", "non_identity", "bypass"], + decision: Decision, include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, @@ -497,12 +514,15 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Policy]: + ) -> Optional[PolicyCreateResponse]: """ - Create a new Access policy for an application. + Creates a policy applying exclusive to a single application that defines the + users or groups who can reach it. We recommend creating a reusable policy + instead and subsequently referencing its ID in the application's 'policies' + array. Args: - uuid: UUID + app_id: UUID decision: The action Access will take if a user matches this policy. @@ -527,7 +547,8 @@ async def create( this policy. 'Client Web Isolation' must be on for the account in order to use this feature. - precedence: The order of execution for this policy. Must be unique for each policy. + precedence: The order of execution for this policy. Must be unique for each policy within an + app. purpose_justification_prompt: A custom message that will appear on the purpose justification screen. @@ -548,8 +569,8 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -563,7 +584,7 @@ async def create( account_or_zone = "zones" account_or_zone_id = zone_id return await self._post( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/policies", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/policies", body=await async_maybe_transform( { "decision": decision, @@ -586,17 +607,17 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Policy]]._unwrapper, + post_parser=ResultWrapper[Optional[PolicyCreateResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), + cast_to=cast(Type[Optional[PolicyCreateResponse]], ResultWrapper[PolicyCreateResponse]), ) async def update( self, - uuid: str, + policy_id: str, *, - uuid1: str, - decision: Literal["allow", "deny", "non_identity", "bypass"], + app_id: str, + decision: Decision, include: Iterable[AccessRuleParam], name: str, account_id: str | NotGiven = NOT_GIVEN, @@ -616,14 +637,16 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Policy]: - """ - Update a configured Access policy. + ) -> Optional[PolicyUpdateResponse]: + """Updates an Access policy specific to an application. + + To update a reusable + policy, use the /account or zones/{account or zone_id}/policies/{uid} endpoint. Args: - uuid1: UUID + app_id: UUID - uuid: UUID + policy_id: UUID decision: The action Access will take if a user matches this policy. @@ -648,7 +671,8 @@ async def update( this policy. 'Client Web Isolation' must be on for the account in order to use this feature. - precedence: The order of execution for this policy. Must be unique for each policy. + precedence: The order of execution for this policy. Must be unique for each policy within an + app. purpose_justification_prompt: A custom message that will appear on the purpose justification screen. @@ -669,10 +693,10 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid1: - 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 app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") + if not policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -686,7 +710,7 @@ async def update( account_or_zone = "zones" account_or_zone_id = zone_id return await self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/policies/{policy_id}", body=await async_maybe_transform( { "decision": decision, @@ -709,14 +733,14 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Policy]]._unwrapper, + post_parser=ResultWrapper[Optional[PolicyUpdateResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), + cast_to=cast(Type[Optional[PolicyUpdateResponse]], ResultWrapper[PolicyUpdateResponse]), ) def list( self, - uuid: str, + app_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -726,12 +750,14 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Policy, AsyncSinglePage[Policy]]: - """ - Lists Access policies configured for an application. + ) -> AsyncPaginator[PolicyListResponse, AsyncSinglePage[PolicyListResponse]]: + """Lists Access policies configured for an application. + + Returns both exclusively + scoped and reusable policies used by the application. Args: - uuid: UUID + app_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -745,8 +771,8 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -760,19 +786,19 @@ def list( 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[Policy], + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/policies", + page=AsyncSinglePage[PolicyListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Policy, + model=PolicyListResponse, ) async def delete( self, - uuid: str, + policy_id: str, *, - uuid1: str, + app_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. @@ -782,13 +808,15 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[PolicyDeleteResponse]: - """ - Delete an Access policy. + """Deletes an Access policy specific to an application. + + To delete a reusable + policy, use the /account or zones/{account or zone_id}/policies/{uid} endpoint. Args: - uuid1: UUID + app_id: UUID - uuid: UUID + policy_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -802,10 +830,10 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid1: - 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 app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") + if not policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -819,7 +847,7 @@ async def delete( account_or_zone = "zones" account_or_zone_id = zone_id return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/policies/{policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -832,9 +860,9 @@ async def delete( async def get( self, - uuid: str, + policy_id: str, *, - uuid1: str, + app_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. @@ -843,14 +871,16 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Policy]: - """ - Fetches a single Access policy. + ) -> Optional[PolicyGetResponse]: + """Fetches a single Access policy configured for an application. + + Returns both + exclusively owned and reusable policies used by the application. Args: - uuid1: UUID + app_id: UUID - uuid: UUID + policy_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -864,10 +894,10 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid1: - 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 app_id: + raise ValueError(f"Expected a non-empty value for `app_id` but received {app_id!r}") + if not policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -881,15 +911,15 @@ async def get( account_or_zone = "zones" account_or_zone_id = zone_id return await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid1}/policies/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/apps/{app_id}/policies/{policy_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Policy]]._unwrapper, + post_parser=ResultWrapper[Optional[PolicyGetResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[Policy]], ResultWrapper[Policy]), + cast_to=cast(Type[Optional[PolicyGetResponse]], ResultWrapper[PolicyGetResponse]), ) diff --git a/src/cloudflare/resources/zero_trust/access/bookmarks.py b/src/cloudflare/resources/zero_trust/access/bookmarks.py index 00f06515c4c..f6d07c482c2 100644 --- a/src/cloudflare/resources/zero_trust/access/bookmarks.py +++ b/src/cloudflare/resources/zero_trust/access/bookmarks.py @@ -43,9 +43,9 @@ def with_streaming_response(self) -> BookmarksResourceWithStreamingResponse: def create( self, - uuid: str, + bookmark_id: str, *, - 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. @@ -58,7 +58,7 @@ def create( Create a new Bookmark application. Args: - uuid: UUID + bookmark_id: UUID extra_headers: Send extra headers @@ -68,12 +68,12 @@ def create( 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}") - 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 bookmark_id: + raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}") return self._post( - f"/accounts/{identifier}/access/bookmarks/{uuid}", + f"/accounts/{account_id}/access/bookmarks/{bookmark_id}", body=maybe_transform(body, bookmark_create_params.BookmarkCreateParams), options=make_request_options( extra_headers=extra_headers, @@ -87,9 +87,9 @@ def create( def update( self, - uuid: str, + bookmark_id: str, *, - 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. @@ -102,7 +102,7 @@ def update( Updates a configured Bookmark application. Args: - uuid: UUID + bookmark_id: UUID extra_headers: Send extra headers @@ -112,12 +112,12 @@ def update( 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}") - 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 bookmark_id: + raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}") return self._put( - f"/accounts/{identifier}/access/bookmarks/{uuid}", + f"/accounts/{account_id}/access/bookmarks/{bookmark_id}", body=maybe_transform(body, bookmark_update_params.BookmarkUpdateParams), options=make_request_options( extra_headers=extra_headers, @@ -131,8 +131,8 @@ def update( def list( 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, @@ -152,10 +152,10 @@ def list( 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}") + 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/{identifier}/access/bookmarks", + f"/accounts/{account_id}/access/bookmarks", page=SyncSinglePage[Bookmark], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -165,9 +165,9 @@ def list( def delete( self, - uuid: str, + bookmark_id: str, *, - 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, @@ -179,7 +179,7 @@ def delete( Deletes a Bookmark application. Args: - uuid: UUID + bookmark_id: UUID extra_headers: Send extra headers @@ -189,12 +189,12 @@ def delete( 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}") - 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 bookmark_id: + raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}") return self._delete( - f"/accounts/{identifier}/access/bookmarks/{uuid}", + f"/accounts/{account_id}/access/bookmarks/{bookmark_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -207,9 +207,9 @@ def delete( def get( self, - uuid: str, + bookmark_id: str, *, - 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, @@ -221,7 +221,7 @@ def get( Fetches a single Bookmark application. Args: - uuid: UUID + bookmark_id: UUID extra_headers: Send extra headers @@ -231,12 +231,12 @@ def get( 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}") - 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 bookmark_id: + raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}") return self._get( - f"/accounts/{identifier}/access/bookmarks/{uuid}", + f"/accounts/{account_id}/access/bookmarks/{bookmark_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -259,9 +259,9 @@ def with_streaming_response(self) -> AsyncBookmarksResourceWithStreamingResponse async def create( self, - uuid: str, + bookmark_id: str, *, - 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. @@ -274,7 +274,7 @@ async def create( Create a new Bookmark application. Args: - uuid: UUID + bookmark_id: UUID extra_headers: Send extra headers @@ -284,12 +284,12 @@ async def create( 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}") - 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 bookmark_id: + raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}") return await self._post( - f"/accounts/{identifier}/access/bookmarks/{uuid}", + f"/accounts/{account_id}/access/bookmarks/{bookmark_id}", body=await async_maybe_transform(body, bookmark_create_params.BookmarkCreateParams), options=make_request_options( extra_headers=extra_headers, @@ -303,9 +303,9 @@ async def create( async def update( self, - uuid: str, + bookmark_id: str, *, - 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. @@ -318,7 +318,7 @@ async def update( Updates a configured Bookmark application. Args: - uuid: UUID + bookmark_id: UUID extra_headers: Send extra headers @@ -328,12 +328,12 @@ async def update( 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}") - 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 bookmark_id: + raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}") return await self._put( - f"/accounts/{identifier}/access/bookmarks/{uuid}", + f"/accounts/{account_id}/access/bookmarks/{bookmark_id}", body=await async_maybe_transform(body, bookmark_update_params.BookmarkUpdateParams), options=make_request_options( extra_headers=extra_headers, @@ -347,8 +347,8 @@ async def update( def list( 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, @@ -368,10 +368,10 @@ def list( 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}") + 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/{identifier}/access/bookmarks", + f"/accounts/{account_id}/access/bookmarks", page=AsyncSinglePage[Bookmark], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -381,9 +381,9 @@ def list( async def delete( self, - uuid: str, + bookmark_id: str, *, - 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, @@ -395,7 +395,7 @@ async def delete( Deletes a Bookmark application. Args: - uuid: UUID + bookmark_id: UUID extra_headers: Send extra headers @@ -405,12 +405,12 @@ async def delete( 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}") - 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 bookmark_id: + raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}") return await self._delete( - f"/accounts/{identifier}/access/bookmarks/{uuid}", + f"/accounts/{account_id}/access/bookmarks/{bookmark_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -423,9 +423,9 @@ async def delete( async def get( self, - uuid: str, + bookmark_id: str, *, - 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, @@ -437,7 +437,7 @@ async def get( Fetches a single Bookmark application. Args: - uuid: UUID + bookmark_id: UUID extra_headers: Send extra headers @@ -447,12 +447,12 @@ async def get( 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}") - 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 bookmark_id: + raise ValueError(f"Expected a non-empty value for `bookmark_id` but received {bookmark_id!r}") return await self._get( - f"/accounts/{identifier}/access/bookmarks/{uuid}", + f"/accounts/{account_id}/access/bookmarks/{bookmark_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/zero_trust/access/certificates/certificates.py b/src/cloudflare/resources/zero_trust/access/certificates/certificates.py index e0e729cb755..3bcae016b10 100644 --- a/src/cloudflare/resources/zero_trust/access/certificates/certificates.py +++ b/src/cloudflare/resources/zero_trust/access/certificates/certificates.py @@ -125,7 +125,7 @@ def create( def update( self, - uuid: str, + certificate_id: str, *, associated_hostnames: List[AssociatedHostnames], account_id: str | NotGiven = NOT_GIVEN, @@ -142,7 +142,7 @@ def update( Updates a configured mTLS certificate. Args: - uuid: UUID + certificate_id: UUID associated_hostnames: The hostnames of the applications that will use this certificate. @@ -160,8 +160,8 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not certificate_id: + raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -175,7 +175,7 @@ def update( account_or_zone = "zones" account_or_zone_id = zone_id return self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{certificate_id}", body=maybe_transform( { "associated_hostnames": associated_hostnames, @@ -244,7 +244,7 @@ def list( def delete( self, - uuid: str, + certificate_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -259,7 +259,7 @@ def delete( Deletes an mTLS certificate. Args: - uuid: UUID + certificate_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -273,8 +273,8 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not certificate_id: + raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -288,7 +288,7 @@ def delete( account_or_zone = "zones" account_or_zone_id = zone_id return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{certificate_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -301,7 +301,7 @@ def delete( def get( self, - uuid: str, + certificate_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -316,7 +316,7 @@ def get( Fetches a single mTLS certificate. Args: - uuid: UUID + certificate_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -330,8 +330,8 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not certificate_id: + raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -345,7 +345,7 @@ def get( account_or_zone = "zones" account_or_zone_id = zone_id return self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{certificate_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -441,7 +441,7 @@ async def create( async def update( self, - uuid: str, + certificate_id: str, *, associated_hostnames: List[AssociatedHostnames], account_id: str | NotGiven = NOT_GIVEN, @@ -458,7 +458,7 @@ async def update( Updates a configured mTLS certificate. Args: - uuid: UUID + certificate_id: UUID associated_hostnames: The hostnames of the applications that will use this certificate. @@ -476,8 +476,8 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not certificate_id: + raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -491,7 +491,7 @@ async def update( account_or_zone = "zones" account_or_zone_id = zone_id return await self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{certificate_id}", body=await async_maybe_transform( { "associated_hostnames": associated_hostnames, @@ -560,7 +560,7 @@ def list( async def delete( self, - uuid: str, + certificate_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -575,7 +575,7 @@ async def delete( Deletes an mTLS certificate. Args: - uuid: UUID + certificate_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -589,8 +589,8 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not certificate_id: + raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -604,7 +604,7 @@ async def delete( account_or_zone = "zones" account_or_zone_id = zone_id return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{certificate_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -617,7 +617,7 @@ async def delete( async def get( self, - uuid: str, + certificate_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -632,7 +632,7 @@ async def get( Fetches a single mTLS certificate. Args: - uuid: UUID + certificate_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -646,8 +646,8 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not certificate_id: + raise ValueError(f"Expected a non-empty value for `certificate_id` but received {certificate_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -661,7 +661,7 @@ async def get( account_or_zone = "zones" account_or_zone_id = zone_id return await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/certificates/{certificate_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/zero_trust/access/custom_pages.py b/src/cloudflare/resources/zero_trust/access/custom_pages.py index 1314c7e01b9..d7eae2f7f7d 100644 --- a/src/cloudflare/resources/zero_trust/access/custom_pages.py +++ b/src/cloudflare/resources/zero_trust/access/custom_pages.py @@ -45,8 +45,8 @@ def with_streaming_response(self) -> CustomPagesResourceWithStreamingResponse: def create( self, - identifier: str, *, + account_id: str, custom_html: str, name: str, type: Literal["identity_denied", "forbidden"], @@ -62,7 +62,7 @@ def create( Create a custom page Args: - identifier: Identifier + account_id: Identifier custom_html: Custom page HTML. @@ -80,10 +80,10 @@ def create( 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}") + 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/{identifier}/access/custom_pages", + f"/accounts/{account_id}/access/custom_pages", body=maybe_transform( { "custom_html": custom_html, @@ -105,9 +105,9 @@ def create( def update( self, - uuid: str, + custom_page_id: str, *, - identifier: str, + account_id: str, custom_html: str, name: str, type: Literal["identity_denied", "forbidden"], @@ -123,9 +123,9 @@ def update( Update a custom page Args: - identifier: Identifier + account_id: Identifier - uuid: UUID + custom_page_id: UUID custom_html: Custom page HTML. @@ -143,12 +143,12 @@ def update( 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}") - 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 custom_page_id: + raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}") return self._put( - f"/accounts/{identifier}/access/custom_pages/{uuid}", + f"/accounts/{account_id}/access/custom_pages/{custom_page_id}", body=maybe_transform( { "custom_html": custom_html, @@ -170,8 +170,8 @@ def update( def list( 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, @@ -183,7 +183,7 @@ def list( List custom pages Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -193,10 +193,10 @@ def list( 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}") + 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/{identifier}/access/custom_pages", + f"/accounts/{account_id}/access/custom_pages", page=SyncSinglePage[CustomPageWithoutHTML], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -206,9 +206,9 @@ def list( def delete( self, - uuid: str, + custom_page_id: str, *, - 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, @@ -220,9 +220,9 @@ def delete( Delete a custom page Args: - identifier: Identifier + account_id: Identifier - uuid: UUID + custom_page_id: UUID extra_headers: Send extra headers @@ -232,12 +232,12 @@ def delete( 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}") - 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 custom_page_id: + raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}") return self._delete( - f"/accounts/{identifier}/access/custom_pages/{uuid}", + f"/accounts/{account_id}/access/custom_pages/{custom_page_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -250,9 +250,9 @@ def delete( def get( self, - uuid: str, + custom_page_id: str, *, - 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, @@ -264,9 +264,9 @@ def get( Fetches a custom page and also returns its HTML. Args: - identifier: Identifier + account_id: Identifier - uuid: UUID + custom_page_id: UUID extra_headers: Send extra headers @@ -276,12 +276,12 @@ def get( 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}") - 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 custom_page_id: + raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}") return self._get( - f"/accounts/{identifier}/access/custom_pages/{uuid}", + f"/accounts/{account_id}/access/custom_pages/{custom_page_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -304,8 +304,8 @@ def with_streaming_response(self) -> AsyncCustomPagesResourceWithStreamingRespon async def create( self, - identifier: str, *, + account_id: str, custom_html: str, name: str, type: Literal["identity_denied", "forbidden"], @@ -321,7 +321,7 @@ async def create( Create a custom page Args: - identifier: Identifier + account_id: Identifier custom_html: Custom page HTML. @@ -339,10 +339,10 @@ async def create( 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}") + 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/{identifier}/access/custom_pages", + f"/accounts/{account_id}/access/custom_pages", body=await async_maybe_transform( { "custom_html": custom_html, @@ -364,9 +364,9 @@ async def create( async def update( self, - uuid: str, + custom_page_id: str, *, - identifier: str, + account_id: str, custom_html: str, name: str, type: Literal["identity_denied", "forbidden"], @@ -382,9 +382,9 @@ async def update( Update a custom page Args: - identifier: Identifier + account_id: Identifier - uuid: UUID + custom_page_id: UUID custom_html: Custom page HTML. @@ -402,12 +402,12 @@ async def update( 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}") - 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 custom_page_id: + raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}") return await self._put( - f"/accounts/{identifier}/access/custom_pages/{uuid}", + f"/accounts/{account_id}/access/custom_pages/{custom_page_id}", body=await async_maybe_transform( { "custom_html": custom_html, @@ -429,8 +429,8 @@ async def update( def list( 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, @@ -442,7 +442,7 @@ def list( List custom pages Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -452,10 +452,10 @@ def list( 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}") + 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/{identifier}/access/custom_pages", + f"/accounts/{account_id}/access/custom_pages", page=AsyncSinglePage[CustomPageWithoutHTML], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -465,9 +465,9 @@ def list( async def delete( self, - uuid: str, + custom_page_id: str, *, - 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, @@ -479,9 +479,9 @@ async def delete( Delete a custom page Args: - identifier: Identifier + account_id: Identifier - uuid: UUID + custom_page_id: UUID extra_headers: Send extra headers @@ -491,12 +491,12 @@ async def delete( 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}") - 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 custom_page_id: + raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}") return await self._delete( - f"/accounts/{identifier}/access/custom_pages/{uuid}", + f"/accounts/{account_id}/access/custom_pages/{custom_page_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -509,9 +509,9 @@ async def delete( async def get( self, - uuid: str, + custom_page_id: str, *, - 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, @@ -523,9 +523,9 @@ async def get( Fetches a custom page and also returns its HTML. Args: - identifier: Identifier + account_id: Identifier - uuid: UUID + custom_page_id: UUID extra_headers: Send extra headers @@ -535,12 +535,12 @@ async def get( 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}") - 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 custom_page_id: + raise ValueError(f"Expected a non-empty value for `custom_page_id` but received {custom_page_id!r}") return await self._get( - f"/accounts/{identifier}/access/custom_pages/{uuid}", + f"/accounts/{account_id}/access/custom_pages/{custom_page_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/zero_trust/access/groups.py b/src/cloudflare/resources/zero_trust/access/groups.py index 62bde18942b..8b9ee6bf716 100644 --- a/src/cloudflare/resources/zero_trust/access/groups.py +++ b/src/cloudflare/resources/zero_trust/access/groups.py @@ -124,7 +124,7 @@ def create( def update( self, - uuid: str, + group_id: str, *, include: Iterable[AccessRuleParam], name: str, @@ -144,7 +144,7 @@ def update( Updates a configured Access group. Args: - uuid: UUID + group_id: UUID include: Rules evaluated with an OR logical operator. A user needs to meet only one of the Include rules. @@ -171,8 +171,8 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -186,7 +186,7 @@ def update( account_or_zone = "zones" account_or_zone_id = zone_id return self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}", body=maybe_transform( { "include": include, @@ -258,7 +258,7 @@ def list( def delete( self, - uuid: str, + group_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -273,7 +273,7 @@ def delete( Deletes an Access group. Args: - uuid: UUID + group_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -287,8 +287,8 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -302,7 +302,7 @@ def delete( account_or_zone = "zones" account_or_zone_id = zone_id return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -315,7 +315,7 @@ def delete( def get( self, - uuid: str, + group_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -330,7 +330,7 @@ def get( Fetches a single Access group. Args: - uuid: UUID + group_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -344,8 +344,8 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -359,7 +359,7 @@ def get( account_or_zone = "zones" account_or_zone_id = zone_id return self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -462,7 +462,7 @@ async def create( async def update( self, - uuid: str, + group_id: str, *, include: Iterable[AccessRuleParam], name: str, @@ -482,7 +482,7 @@ async def update( Updates a configured Access group. Args: - uuid: UUID + group_id: UUID include: Rules evaluated with an OR logical operator. A user needs to meet only one of the Include rules. @@ -509,8 +509,8 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -524,7 +524,7 @@ async def update( account_or_zone = "zones" account_or_zone_id = zone_id return await self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}", body=await async_maybe_transform( { "include": include, @@ -596,7 +596,7 @@ def list( async def delete( self, - uuid: str, + group_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -611,7 +611,7 @@ async def delete( Deletes an Access group. Args: - uuid: UUID + group_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -625,8 +625,8 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -640,7 +640,7 @@ async def delete( account_or_zone = "zones" account_or_zone_id = zone_id return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -653,7 +653,7 @@ async def delete( async def get( self, - uuid: str, + group_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -668,7 +668,7 @@ async def get( Fetches a single Access group. Args: - uuid: UUID + group_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -682,8 +682,8 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not group_id: + raise ValueError(f"Expected a non-empty value for `group_id` but received {group_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -697,7 +697,7 @@ async def get( account_or_zone = "zones" account_or_zone_id = zone_id return await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/groups/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/groups/{group_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/zero_trust/access/keys.py b/src/cloudflare/resources/zero_trust/access/keys.py index dcb6a69a3d2..ac04e6b775d 100644 --- a/src/cloudflare/resources/zero_trust/access/keys.py +++ b/src/cloudflare/resources/zero_trust/access/keys.py @@ -42,8 +42,8 @@ def with_streaming_response(self) -> KeysResourceWithStreamingResponse: def update( self, - identifier: str, *, + account_id: str, key_rotation_interval_days: float, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -56,7 +56,7 @@ def update( Updates the Access key rotation settings for an account. Args: - identifier: Identifier + account_id: Identifier key_rotation_interval_days: The number of days between key rotations. @@ -68,12 +68,12 @@ def update( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( Optional[KeyUpdateResponse], self._put( - f"/accounts/{identifier}/access/keys", + f"/accounts/{account_id}/access/keys", body=maybe_transform( {"key_rotation_interval_days": key_rotation_interval_days}, key_update_params.KeyUpdateParams ), @@ -92,8 +92,8 @@ def update( 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, @@ -105,7 +105,7 @@ def get( Gets the Access key rotation settings for an account. Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -115,12 +115,12 @@ def get( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( Optional[KeyGetResponse], self._get( - f"/accounts/{identifier}/access/keys", + f"/accounts/{account_id}/access/keys", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -136,8 +136,8 @@ def get( def rotate( 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, @@ -149,7 +149,7 @@ def rotate( Perfoms a key rotation for an account. Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -159,12 +159,12 @@ def rotate( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( Optional[KeyRotateResponse], self._post( - f"/accounts/{identifier}/access/keys/rotate", + f"/accounts/{account_id}/access/keys/rotate", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -190,8 +190,8 @@ def with_streaming_response(self) -> AsyncKeysResourceWithStreamingResponse: async def update( self, - identifier: str, *, + account_id: str, key_rotation_interval_days: float, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -204,7 +204,7 @@ async def update( Updates the Access key rotation settings for an account. Args: - identifier: Identifier + account_id: Identifier key_rotation_interval_days: The number of days between key rotations. @@ -216,12 +216,12 @@ async def update( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( Optional[KeyUpdateResponse], await self._put( - f"/accounts/{identifier}/access/keys", + f"/accounts/{account_id}/access/keys", body=await async_maybe_transform( {"key_rotation_interval_days": key_rotation_interval_days}, key_update_params.KeyUpdateParams ), @@ -240,8 +240,8 @@ async def update( 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, @@ -253,7 +253,7 @@ async def get( Gets the Access key rotation settings for an account. Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -263,12 +263,12 @@ async def get( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( Optional[KeyGetResponse], await self._get( - f"/accounts/{identifier}/access/keys", + f"/accounts/{account_id}/access/keys", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -284,8 +284,8 @@ async def get( async def rotate( 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, @@ -297,7 +297,7 @@ async def rotate( Perfoms a key rotation for an account. Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -307,12 +307,12 @@ async def rotate( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return cast( Optional[KeyRotateResponse], await self._post( - f"/accounts/{identifier}/access/keys/rotate", + f"/accounts/{account_id}/access/keys/rotate", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, 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 8425be9c392..64cd98c6c50 100644 --- a/src/cloudflare/resources/zero_trust/access/logs/access_requests.py +++ b/src/cloudflare/resources/zero_trust/access/logs/access_requests.py @@ -2,11 +2,17 @@ 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 ....._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,6 +25,7 @@ from ....._base_client import ( make_request_options, ) +from .....types.zero_trust.access.logs import access_request_list_params from .....types.zero_trust.access.logs.access_request_list_response import AccessRequestListResponse __all__ = ["AccessRequestsResource", "AsyncAccessRequestsResource"] @@ -35,8 +42,12 @@ def with_streaming_response(self) -> AccessRequestsResourceWithStreamingResponse def list( self, - identifier: str, *, + account_id: str, + direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, + limit: int | 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, @@ -48,7 +59,15 @@ def list( Gets a list of Access authentication audit logs for an account. Args: - identifier: Identifier + account_id: Identifier + + direction: The chronological sorting order for the logs. + + limit: The maximum number of log entries to retrieve. + + since: The earliest event timestamp to query. + + until: The latest event timestamp to query. extra_headers: Send extra headers @@ -58,15 +77,24 @@ def list( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get( - f"/accounts/{identifier}/access/logs/access_requests", + f"/accounts/{account_id}/access/logs/access_requests", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, + query=maybe_transform( + { + "direction": direction, + "limit": limit, + "since": since, + "until": until, + }, + access_request_list_params.AccessRequestListParams, + ), post_parser=ResultWrapper[Optional[AccessRequestListResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AccessRequestListResponse]], ResultWrapper[AccessRequestListResponse]), @@ -84,8 +112,12 @@ def with_streaming_response(self) -> AsyncAccessRequestsResourceWithStreamingRes async def list( self, - identifier: str, *, + account_id: str, + direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN, + limit: int | 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, @@ -97,7 +129,15 @@ async def list( Gets a list of Access authentication audit logs for an account. Args: - identifier: Identifier + account_id: Identifier + + direction: The chronological sorting order for the logs. + + limit: The maximum number of log entries to retrieve. + + since: The earliest event timestamp to query. + + until: The latest event timestamp to query. extra_headers: Send extra headers @@ -107,15 +147,24 @@ async def list( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._get( - f"/accounts/{identifier}/access/logs/access_requests", + f"/accounts/{account_id}/access/logs/access_requests", 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, + "limit": limit, + "since": since, + "until": until, + }, + access_request_list_params.AccessRequestListParams, + ), post_parser=ResultWrapper[Optional[AccessRequestListResponse]]._unwrapper, ), cast_to=cast(Type[Optional[AccessRequestListResponse]], ResultWrapper[AccessRequestListResponse]), diff --git a/src/cloudflare/resources/zero_trust/access/policies.py b/src/cloudflare/resources/zero_trust/access/policies.py new file mode 100644 index 00000000000..6cddea86c29 --- /dev/null +++ b/src/cloudflare/resources/zero_trust/access/policies.py @@ -0,0 +1,784 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Iterable, Optional, cast + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage +from ...._base_client import ( + AsyncPaginator, + make_request_options, +) +from ....types.zero_trust.access import Decision, policy_create_params, policy_update_params +from ....types.zero_trust.access.decision import Decision +from ....types.zero_trust.access_rule_param import AccessRuleParam +from ....types.zero_trust.access.policy_get_response import PolicyGetResponse +from ....types.zero_trust.access.policy_list_response import PolicyListResponse +from ....types.zero_trust.access.policy_create_response import PolicyCreateResponse +from ....types.zero_trust.access.policy_delete_response import PolicyDeleteResponse +from ....types.zero_trust.access.policy_update_response import PolicyUpdateResponse +from ....types.zero_trust.access.applications.approval_group_param import ApprovalGroupParam + +__all__ = ["PoliciesResource", "AsyncPoliciesResource"] + + +class PoliciesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PoliciesResourceWithRawResponse: + return PoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PoliciesResourceWithStreamingResponse: + return PoliciesResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + decision: Decision, + include: Iterable[AccessRuleParam], + name: str, + approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, + approval_required: bool | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, + isolation_required: bool | NotGiven = NOT_GIVEN, + purpose_justification_prompt: str | NotGiven = NOT_GIVEN, + purpose_justification_required: bool | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[PolicyCreateResponse]: + """ + Creates a new Access reusable policy. + + Args: + account_id: Identifier + + decision: The action Access will take if a user matches this policy. + + include: Rules evaluated with an OR logical operator. A user needs to meet only one of + the Include rules. + + name: The name of the Access policy. + + approval_groups: Administrators who can approve a temporary authentication request. + + approval_required: Requires the user to request access from an administrator at the start of each + session. + + exclude: Rules evaluated with a NOT logical operator. To match the policy, a user cannot + meet any of the Exclude rules. + + isolation_required: 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. + + purpose_justification_prompt: A custom message that will appear on the purpose justification screen. + + purpose_justification_required: Require users to enter a justification when they log in to the application. + + require: Rules evaluated with an AND logical operator. To match the policy, a user must + meet all of the Require rules. + + session_duration: 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. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._post( + f"/accounts/{account_id}/access/policies", + body=maybe_transform( + { + "decision": decision, + "include": include, + "name": name, + "approval_groups": approval_groups, + "approval_required": approval_required, + "exclude": exclude, + "isolation_required": isolation_required, + "purpose_justification_prompt": purpose_justification_prompt, + "purpose_justification_required": purpose_justification_required, + "require": require, + "session_duration": session_duration, + }, + policy_create_params.PolicyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[PolicyCreateResponse]], ResultWrapper[PolicyCreateResponse]), + ) + + def update( + self, + policy_id: str, + *, + account_id: str, + decision: Decision, + include: Iterable[AccessRuleParam], + name: str, + approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, + approval_required: bool | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, + isolation_required: bool | NotGiven = NOT_GIVEN, + purpose_justification_prompt: str | NotGiven = NOT_GIVEN, + purpose_justification_required: bool | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[PolicyUpdateResponse]: + """ + Updates a Access reusable policy. + + Args: + account_id: Identifier + + policy_id: The UUID of the policy + + decision: The action Access will take if a user matches this policy. + + include: Rules evaluated with an OR logical operator. A user needs to meet only one of + the Include rules. + + name: The name of the Access policy. + + approval_groups: Administrators who can approve a temporary authentication request. + + approval_required: Requires the user to request access from an administrator at the start of each + session. + + exclude: Rules evaluated with a NOT logical operator. To match the policy, a user cannot + meet any of the Exclude rules. + + isolation_required: 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. + + purpose_justification_prompt: A custom message that will appear on the purpose justification screen. + + purpose_justification_required: Require users to enter a justification when they log in to the application. + + require: Rules evaluated with an AND logical operator. To match the policy, a user must + meet all of the Require rules. + + session_duration: 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. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return self._put( + f"/accounts/{account_id}/access/policies/{policy_id}", + body=maybe_transform( + { + "decision": decision, + "include": include, + "name": name, + "approval_groups": approval_groups, + "approval_required": approval_required, + "exclude": exclude, + "isolation_required": isolation_required, + "purpose_justification_prompt": purpose_justification_prompt, + "purpose_justification_required": purpose_justification_required, + "require": require, + "session_duration": session_duration, + }, + policy_update_params.PolicyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[PolicyUpdateResponse]], ResultWrapper[PolicyUpdateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[PolicyListResponse]: + """ + Lists Access reusable policies. + + Args: + account_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/access/policies", + page=SyncSinglePage[PolicyListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=PolicyListResponse, + ) + + def delete( + self, + policy_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[PolicyDeleteResponse]: + """ + Deletes an Access reusable policy. + + Args: + account_id: Identifier + + policy_id: The UUID of the policy + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return self._delete( + f"/accounts/{account_id}/access/policies/{policy_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[PolicyDeleteResponse]], ResultWrapper[PolicyDeleteResponse]), + ) + + def get( + self, + policy_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[PolicyGetResponse]: + """ + Fetches a single Access reusable policy. + + Args: + account_id: Identifier + + policy_id: The UUID of the policy + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return self._get( + f"/accounts/{account_id}/access/policies/{policy_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[PolicyGetResponse]], ResultWrapper[PolicyGetResponse]), + ) + + +class AsyncPoliciesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: + return AsyncPoliciesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPoliciesResourceWithStreamingResponse: + return AsyncPoliciesResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + decision: Decision, + include: Iterable[AccessRuleParam], + name: str, + approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, + approval_required: bool | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, + isolation_required: bool | NotGiven = NOT_GIVEN, + purpose_justification_prompt: str | NotGiven = NOT_GIVEN, + purpose_justification_required: bool | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[PolicyCreateResponse]: + """ + Creates a new Access reusable policy. + + Args: + account_id: Identifier + + decision: The action Access will take if a user matches this policy. + + include: Rules evaluated with an OR logical operator. A user needs to meet only one of + the Include rules. + + name: The name of the Access policy. + + approval_groups: Administrators who can approve a temporary authentication request. + + approval_required: Requires the user to request access from an administrator at the start of each + session. + + exclude: Rules evaluated with a NOT logical operator. To match the policy, a user cannot + meet any of the Exclude rules. + + isolation_required: 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. + + purpose_justification_prompt: A custom message that will appear on the purpose justification screen. + + purpose_justification_required: Require users to enter a justification when they log in to the application. + + require: Rules evaluated with an AND logical operator. To match the policy, a user must + meet all of the Require rules. + + session_duration: 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. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._post( + f"/accounts/{account_id}/access/policies", + body=await async_maybe_transform( + { + "decision": decision, + "include": include, + "name": name, + "approval_groups": approval_groups, + "approval_required": approval_required, + "exclude": exclude, + "isolation_required": isolation_required, + "purpose_justification_prompt": purpose_justification_prompt, + "purpose_justification_required": purpose_justification_required, + "require": require, + "session_duration": session_duration, + }, + policy_create_params.PolicyCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[PolicyCreateResponse]], ResultWrapper[PolicyCreateResponse]), + ) + + async def update( + self, + policy_id: str, + *, + account_id: str, + decision: Decision, + include: Iterable[AccessRuleParam], + name: str, + approval_groups: Iterable[ApprovalGroupParam] | NotGiven = NOT_GIVEN, + approval_required: bool | NotGiven = NOT_GIVEN, + exclude: Iterable[AccessRuleParam] | NotGiven = NOT_GIVEN, + isolation_required: bool | NotGiven = NOT_GIVEN, + purpose_justification_prompt: str | NotGiven = NOT_GIVEN, + purpose_justification_required: bool | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[PolicyUpdateResponse]: + """ + Updates a Access reusable policy. + + Args: + account_id: Identifier + + policy_id: The UUID of the policy + + decision: The action Access will take if a user matches this policy. + + include: Rules evaluated with an OR logical operator. A user needs to meet only one of + the Include rules. + + name: The name of the Access policy. + + approval_groups: Administrators who can approve a temporary authentication request. + + approval_required: Requires the user to request access from an administrator at the start of each + session. + + exclude: Rules evaluated with a NOT logical operator. To match the policy, a user cannot + meet any of the Exclude rules. + + isolation_required: 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. + + purpose_justification_prompt: A custom message that will appear on the purpose justification screen. + + purpose_justification_required: Require users to enter a justification when they log in to the application. + + require: Rules evaluated with an AND logical operator. To match the policy, a user must + meet all of the Require rules. + + session_duration: 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. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return await self._put( + f"/accounts/{account_id}/access/policies/{policy_id}", + body=await async_maybe_transform( + { + "decision": decision, + "include": include, + "name": name, + "approval_groups": approval_groups, + "approval_required": approval_required, + "exclude": exclude, + "isolation_required": isolation_required, + "purpose_justification_prompt": purpose_justification_prompt, + "purpose_justification_required": purpose_justification_required, + "require": require, + "session_duration": session_duration, + }, + policy_update_params.PolicyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[PolicyUpdateResponse]], ResultWrapper[PolicyUpdateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[PolicyListResponse, AsyncSinglePage[PolicyListResponse]]: + """ + Lists Access reusable policies. + + Args: + account_id: Identifier + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/access/policies", + page=AsyncSinglePage[PolicyListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=PolicyListResponse, + ) + + async def delete( + self, + policy_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[PolicyDeleteResponse]: + """ + Deletes an Access reusable policy. + + Args: + account_id: Identifier + + policy_id: The UUID of the policy + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return await self._delete( + f"/accounts/{account_id}/access/policies/{policy_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyDeleteResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[PolicyDeleteResponse]], ResultWrapper[PolicyDeleteResponse]), + ) + + async def get( + self, + policy_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[PolicyGetResponse]: + """ + Fetches a single Access reusable policy. + + Args: + account_id: Identifier + + policy_id: The UUID of the policy + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 policy_id: + raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") + return await self._get( + f"/accounts/{account_id}/access/policies/{policy_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[PolicyGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[PolicyGetResponse]], ResultWrapper[PolicyGetResponse]), + ) + + +class PoliciesResourceWithRawResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.create = to_raw_response_wrapper( + policies.create, + ) + self.update = to_raw_response_wrapper( + policies.update, + ) + self.list = to_raw_response_wrapper( + policies.list, + ) + self.delete = to_raw_response_wrapper( + policies.delete, + ) + self.get = to_raw_response_wrapper( + policies.get, + ) + + +class AsyncPoliciesResourceWithRawResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.create = async_to_raw_response_wrapper( + policies.create, + ) + self.update = async_to_raw_response_wrapper( + policies.update, + ) + self.list = async_to_raw_response_wrapper( + policies.list, + ) + self.delete = async_to_raw_response_wrapper( + policies.delete, + ) + self.get = async_to_raw_response_wrapper( + policies.get, + ) + + +class PoliciesResourceWithStreamingResponse: + def __init__(self, policies: PoliciesResource) -> None: + self._policies = policies + + self.create = to_streamed_response_wrapper( + policies.create, + ) + self.update = to_streamed_response_wrapper( + policies.update, + ) + self.list = to_streamed_response_wrapper( + policies.list, + ) + self.delete = to_streamed_response_wrapper( + policies.delete, + ) + self.get = to_streamed_response_wrapper( + policies.get, + ) + + +class AsyncPoliciesResourceWithStreamingResponse: + def __init__(self, policies: AsyncPoliciesResource) -> None: + self._policies = policies + + self.create = async_to_streamed_response_wrapper( + policies.create, + ) + self.update = async_to_streamed_response_wrapper( + policies.update, + ) + self.list = async_to_streamed_response_wrapper( + policies.list, + ) + self.delete = async_to_streamed_response_wrapper( + policies.delete, + ) + self.get = async_to_streamed_response_wrapper( + policies.get, + ) diff --git a/src/cloudflare/resources/zero_trust/access/service_tokens.py b/src/cloudflare/resources/zero_trust/access/service_tokens.py index 716761647d3..066ae6dc2ac 100644 --- a/src/cloudflare/resources/zero_trust/access/service_tokens.py +++ b/src/cloudflare/resources/zero_trust/access/service_tokens.py @@ -114,7 +114,7 @@ def create( def update( self, - uuid: str, + service_token_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -131,7 +131,7 @@ def update( Updates a configured service token. Args: - uuid: UUID + service_token_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -151,8 +151,8 @@ def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not service_token_id: + raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -166,7 +166,7 @@ def update( account_or_zone = "zones" account_or_zone_id = zone_id return self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{service_token_id}", body=maybe_transform( { "duration": duration, @@ -235,7 +235,7 @@ def list( def delete( self, - uuid: str, + service_token_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -250,7 +250,7 @@ def delete( Deletes a service token. Args: - uuid: UUID + service_token_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -264,8 +264,8 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not service_token_id: + raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -279,7 +279,64 @@ def delete( account_or_zone = "zones" account_or_zone_id = zone_id return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{service_token_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, + ), + cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), + ) + + def get( + self, + service_token_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, + ) -> Optional[ServiceToken]: + """ + Fetches a single service token. + + Args: + service_token_id: UUID + + 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 service_token_id: + raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_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._get( + f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{service_token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -292,9 +349,9 @@ def delete( def refresh( self, - uuid: str, + service_token_id: str, *, - 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, @@ -306,9 +363,9 @@ def refresh( Refreshes the expiration of a service token. Args: - identifier: Identifier + account_id: Identifier - uuid: UUID + service_token_id: UUID extra_headers: Send extra headers @@ -318,12 +375,12 @@ def refresh( 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}") - 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 service_token_id: + raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}") return self._post( - f"/accounts/{identifier}/access/service_tokens/{uuid}/refresh", + f"/accounts/{account_id}/access/service_tokens/{service_token_id}/refresh", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -336,9 +393,9 @@ def refresh( def rotate( self, - uuid: str, + service_token_id: str, *, - 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, @@ -350,9 +407,9 @@ def rotate( Generates a new Client Secret for a service token and revokes the old one. Args: - identifier: Identifier + account_id: Identifier - uuid: UUID + service_token_id: UUID extra_headers: Send extra headers @@ -362,12 +419,12 @@ def rotate( 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}") - 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 service_token_id: + raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}") return self._post( - f"/accounts/{identifier}/access/service_tokens/{uuid}/rotate", + f"/accounts/{account_id}/access/service_tokens/{service_token_id}/rotate", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -460,7 +517,7 @@ async def create( async def update( self, - uuid: str, + service_token_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -477,7 +534,7 @@ async def update( Updates a configured service token. Args: - uuid: UUID + service_token_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -497,8 +554,8 @@ async def update( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not service_token_id: + raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -512,7 +569,7 @@ async def update( account_or_zone = "zones" account_or_zone_id = zone_id return await self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{service_token_id}", body=await async_maybe_transform( { "duration": duration, @@ -581,7 +638,7 @@ def list( async def delete( self, - uuid: str, + service_token_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -596,7 +653,7 @@ async def delete( Deletes a service token. Args: - uuid: UUID + service_token_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -610,8 +667,8 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not service_token_id: + raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}") if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -625,7 +682,64 @@ async def delete( account_or_zone = "zones" account_or_zone_id = zone_id return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{service_token_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ServiceToken]]._unwrapper, + ), + cast_to=cast(Type[Optional[ServiceToken]], ResultWrapper[ServiceToken]), + ) + + async def get( + self, + service_token_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, + ) -> Optional[ServiceToken]: + """ + Fetches a single service token. + + Args: + service_token_id: UUID + + 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 service_token_id: + raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_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 await self._get( + f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens/{service_token_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -638,9 +752,9 @@ async def delete( async def refresh( self, - uuid: str, + service_token_id: str, *, - 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, @@ -652,9 +766,9 @@ async def refresh( Refreshes the expiration of a service token. Args: - identifier: Identifier + account_id: Identifier - uuid: UUID + service_token_id: UUID extra_headers: Send extra headers @@ -664,12 +778,12 @@ async def refresh( 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}") - 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 service_token_id: + raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}") return await self._post( - f"/accounts/{identifier}/access/service_tokens/{uuid}/refresh", + f"/accounts/{account_id}/access/service_tokens/{service_token_id}/refresh", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -682,9 +796,9 @@ async def refresh( async def rotate( self, - uuid: str, + service_token_id: str, *, - 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, @@ -696,9 +810,9 @@ async def rotate( Generates a new Client Secret for a service token and revokes the old one. Args: - identifier: Identifier + account_id: Identifier - uuid: UUID + service_token_id: UUID extra_headers: Send extra headers @@ -708,12 +822,12 @@ async def rotate( 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}") - 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 service_token_id: + raise ValueError(f"Expected a non-empty value for `service_token_id` but received {service_token_id!r}") return await self._post( - f"/accounts/{identifier}/access/service_tokens/{uuid}/rotate", + f"/accounts/{account_id}/access/service_tokens/{service_token_id}/rotate", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -741,6 +855,9 @@ def __init__(self, service_tokens: ServiceTokensResource) -> None: self.delete = to_raw_response_wrapper( service_tokens.delete, ) + self.get = to_raw_response_wrapper( + service_tokens.get, + ) self.refresh = to_raw_response_wrapper( service_tokens.refresh, ) @@ -765,6 +882,9 @@ def __init__(self, service_tokens: AsyncServiceTokensResource) -> None: self.delete = async_to_raw_response_wrapper( service_tokens.delete, ) + self.get = async_to_raw_response_wrapper( + service_tokens.get, + ) self.refresh = async_to_raw_response_wrapper( service_tokens.refresh, ) @@ -789,6 +909,9 @@ def __init__(self, service_tokens: ServiceTokensResource) -> None: self.delete = to_streamed_response_wrapper( service_tokens.delete, ) + self.get = to_streamed_response_wrapper( + service_tokens.get, + ) self.refresh = to_streamed_response_wrapper( service_tokens.refresh, ) @@ -813,6 +936,9 @@ def __init__(self, service_tokens: AsyncServiceTokensResource) -> None: self.delete = async_to_streamed_response_wrapper( service_tokens.delete, ) + self.get = async_to_streamed_response_wrapper( + service_tokens.get, + ) self.refresh = async_to_streamed_response_wrapper( service_tokens.refresh, ) diff --git a/src/cloudflare/resources/zero_trust/access/tags.py b/src/cloudflare/resources/zero_trust/access/tags.py index d7ba373faf7..70cc924d5c3 100644 --- a/src/cloudflare/resources/zero_trust/access/tags.py +++ b/src/cloudflare/resources/zero_trust/access/tags.py @@ -43,8 +43,8 @@ def with_streaming_response(self) -> TagsResourceWithStreamingResponse: def create( self, - identifier: str, *, + account_id: str, 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. @@ -57,7 +57,7 @@ def create( Create a tag Args: - identifier: Identifier + account_id: Identifier name: The name of the tag @@ -69,10 +69,10 @@ def create( 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}") + 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/{identifier}/access/tags", + f"/accounts/{account_id}/access/tags", body=maybe_transform({"name": name}, tag_create_params.TagCreateParams), options=make_request_options( extra_headers=extra_headers, @@ -88,7 +88,7 @@ def update( self, tag_name: str, *, - identifier: str, + account_id: str, 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. @@ -101,7 +101,7 @@ def update( Update a tag Args: - identifier: Identifier + account_id: Identifier tag_name: The name of the tag @@ -115,12 +115,12 @@ def update( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not tag_name: raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") return self._put( - f"/accounts/{identifier}/access/tags/{tag_name}", + f"/accounts/{account_id}/access/tags/{tag_name}", body=maybe_transform({"name": name}, tag_update_params.TagUpdateParams), options=make_request_options( extra_headers=extra_headers, @@ -134,8 +134,8 @@ def update( def list( 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, @@ -147,7 +147,7 @@ def list( List tags Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -157,10 +157,10 @@ def list( 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}") + 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/{identifier}/access/tags", + f"/accounts/{account_id}/access/tags", page=SyncSinglePage[Tag], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -170,9 +170,9 @@ def list( def delete( self, - name: str, + tag_name: str, *, - 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, @@ -184,9 +184,9 @@ def delete( Delete a tag Args: - identifier: Identifier + account_id: Identifier - name: The name of the tag + tag_name: The name of the tag extra_headers: Send extra headers @@ -196,12 +196,12 @@ def delete( 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}") - if not name: - raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not tag_name: + raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") return self._delete( - f"/accounts/{identifier}/access/tags/{name}", + f"/accounts/{account_id}/access/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -214,9 +214,9 @@ def delete( def get( self, - name: str, + tag_name: str, *, - 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, @@ -228,9 +228,9 @@ def get( Get a tag Args: - identifier: Identifier + account_id: Identifier - name: The name of the tag + tag_name: The name of the tag extra_headers: Send extra headers @@ -240,12 +240,12 @@ def get( 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}") - if not name: - raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not tag_name: + raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") return self._get( - f"/accounts/{identifier}/access/tags/{name}", + f"/accounts/{account_id}/access/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -268,8 +268,8 @@ def with_streaming_response(self) -> AsyncTagsResourceWithStreamingResponse: async def create( self, - identifier: str, *, + account_id: str, 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. @@ -282,7 +282,7 @@ async def create( Create a tag Args: - identifier: Identifier + account_id: Identifier name: The name of the tag @@ -294,10 +294,10 @@ async def create( 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}") + 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/{identifier}/access/tags", + f"/accounts/{account_id}/access/tags", body=await async_maybe_transform({"name": name}, tag_create_params.TagCreateParams), options=make_request_options( extra_headers=extra_headers, @@ -313,7 +313,7 @@ async def update( self, tag_name: str, *, - identifier: str, + account_id: str, 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. @@ -326,7 +326,7 @@ async def update( Update a tag Args: - identifier: Identifier + account_id: Identifier tag_name: The name of the tag @@ -340,12 +340,12 @@ async def update( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not tag_name: raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") return await self._put( - f"/accounts/{identifier}/access/tags/{tag_name}", + f"/accounts/{account_id}/access/tags/{tag_name}", body=await async_maybe_transform({"name": name}, tag_update_params.TagUpdateParams), options=make_request_options( extra_headers=extra_headers, @@ -359,8 +359,8 @@ async def update( def list( 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, @@ -372,7 +372,7 @@ def list( List tags Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -382,10 +382,10 @@ def list( 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}") + 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/{identifier}/access/tags", + f"/accounts/{account_id}/access/tags", page=AsyncSinglePage[Tag], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -395,9 +395,9 @@ def list( async def delete( self, - name: str, + tag_name: str, *, - 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, @@ -409,9 +409,9 @@ async def delete( Delete a tag Args: - identifier: Identifier + account_id: Identifier - name: The name of the tag + tag_name: The name of the tag extra_headers: Send extra headers @@ -421,12 +421,12 @@ async def delete( 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}") - if not name: - raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not tag_name: + raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") return await self._delete( - f"/accounts/{identifier}/access/tags/{name}", + f"/accounts/{account_id}/access/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -439,9 +439,9 @@ async def delete( async def get( self, - name: str, + tag_name: str, *, - 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, @@ -453,9 +453,9 @@ async def get( Get a tag Args: - identifier: Identifier + account_id: Identifier - name: The name of the tag + tag_name: The name of the tag extra_headers: Send extra headers @@ -465,12 +465,12 @@ async def get( 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}") - if not name: - raise ValueError(f"Expected a non-empty value for `name` but received {name!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not tag_name: + raise ValueError(f"Expected a non-empty value for `tag_name` but received {tag_name!r}") return await self._get( - f"/accounts/{identifier}/access/tags/{name}", + f"/accounts/{account_id}/access/tags/{tag_name}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, 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 0a39ccddb3d..766bec75c17 100644 --- a/src/cloudflare/resources/zero_trust/access/users/active_sessions.py +++ b/src/cloudflare/resources/zero_trust/access/users/active_sessions.py @@ -38,9 +38,9 @@ def with_streaming_response(self) -> ActiveSessionsResourceWithStreamingResponse def list( self, - id: str, + user_id: str, *, - 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, @@ -52,9 +52,9 @@ def list( Get active sessions for a single user. Args: - identifier: Identifier + account_id: Identifier - id: UUID + user_id: UUID extra_headers: Send extra headers @@ -64,12 +64,12 @@ def list( 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}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") return self._get_api_list( - f"/accounts/{identifier}/access/users/{id}/active_sessions", + f"/accounts/{account_id}/access/users/{user_id}/active_sessions", page=SyncSinglePage[ActiveSessionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -81,8 +81,8 @@ def get( self, nonce: str, *, - identifier: str, - id: str, + account_id: str, + user_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, @@ -94,9 +94,9 @@ def get( Get an active session for a single user. Args: - identifier: Identifier + account_id: Identifier - id: UUID + user_id: UUID extra_headers: Send extra headers @@ -106,14 +106,14 @@ def get( 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}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") if not nonce: raise ValueError(f"Expected a non-empty value for `nonce` but received {nonce!r}") return self._get( - f"/accounts/{identifier}/access/users/{id}/active_sessions/{nonce}", + f"/accounts/{account_id}/access/users/{user_id}/active_sessions/{nonce}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -136,9 +136,9 @@ def with_streaming_response(self) -> AsyncActiveSessionsResourceWithStreamingRes def list( self, - id: str, + user_id: str, *, - 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, @@ -150,9 +150,9 @@ def list( Get active sessions for a single user. Args: - identifier: Identifier + account_id: Identifier - id: UUID + user_id: UUID extra_headers: Send extra headers @@ -162,12 +162,12 @@ def list( 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}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") return self._get_api_list( - f"/accounts/{identifier}/access/users/{id}/active_sessions", + f"/accounts/{account_id}/access/users/{user_id}/active_sessions", page=AsyncSinglePage[ActiveSessionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -179,8 +179,8 @@ async def get( self, nonce: str, *, - identifier: str, - id: str, + account_id: str, + user_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, @@ -192,9 +192,9 @@ async def get( Get an active session for a single user. Args: - identifier: Identifier + account_id: Identifier - id: UUID + user_id: UUID extra_headers: Send extra headers @@ -204,14 +204,14 @@ async def get( 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}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") if not nonce: raise ValueError(f"Expected a non-empty value for `nonce` but received {nonce!r}") return await self._get( - f"/accounts/{identifier}/access/users/{id}/active_sessions/{nonce}", + f"/accounts/{account_id}/access/users/{user_id}/active_sessions/{nonce}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, 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 6b2b7d19f57..30e2b404147 100644 --- a/src/cloudflare/resources/zero_trust/access/users/failed_logins.py +++ b/src/cloudflare/resources/zero_trust/access/users/failed_logins.py @@ -34,9 +34,9 @@ def with_streaming_response(self) -> FailedLoginsResourceWithStreamingResponse: def list( self, - id: str, + user_id: str, *, - 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, @@ -48,9 +48,9 @@ def list( Get all failed login attempts for a single user. Args: - identifier: Identifier + account_id: Identifier - id: UUID + user_id: UUID extra_headers: Send extra headers @@ -60,12 +60,12 @@ def list( 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}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") return self._get_api_list( - f"/accounts/{identifier}/access/users/{id}/failed_logins", + f"/accounts/{account_id}/access/users/{user_id}/failed_logins", page=SyncSinglePage[FailedLoginListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -85,9 +85,9 @@ def with_streaming_response(self) -> AsyncFailedLoginsResourceWithStreamingRespo def list( self, - id: str, + user_id: str, *, - 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, @@ -99,9 +99,9 @@ def list( Get all failed login attempts for a single user. Args: - identifier: Identifier + account_id: Identifier - id: UUID + user_id: UUID extra_headers: Send extra headers @@ -111,12 +111,12 @@ def list( 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}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not user_id: + raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") return self._get_api_list( - f"/accounts/{identifier}/access/users/{id}/failed_logins", + f"/accounts/{account_id}/access/users/{user_id}/failed_logins", page=AsyncSinglePage[FailedLoginListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py b/src/cloudflare/resources/zero_trust/access/users/last_seen_identity.py index 4e913e2720c..e1ac12e3aed 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 @@ -35,9 +35,9 @@ def with_streaming_response(self) -> LastSeenIdentityResourceWithStreamingRespon def get( self, - id: str, + user_id: str, *, - 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, @@ -49,9 +49,9 @@ def get( Get last seen identity for a single user. Args: - identifier: Identifier + account_id: Identifier - id: UUID + user_id: UUID extra_headers: Send extra headers @@ -61,12 +61,12 @@ def get( 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}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!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/{identifier}/access/users/{id}/last_seen_identity", + f"/accounts/{account_id}/access/users/{user_id}/last_seen_identity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -89,9 +89,9 @@ def with_streaming_response(self) -> AsyncLastSeenIdentityResourceWithStreamingR async def get( self, - id: str, + user_id: str, *, - 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, @@ -103,9 +103,9 @@ async def get( Get last seen identity for a single user. Args: - identifier: Identifier + account_id: Identifier - id: UUID + user_id: UUID extra_headers: Send extra headers @@ -115,12 +115,12 @@ async def get( 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}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!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/{identifier}/access/users/{id}/last_seen_identity", + f"/accounts/{account_id}/access/users/{user_id}/last_seen_identity", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/zero_trust/access/users/users.py b/src/cloudflare/resources/zero_trust/access/users/users.py index 97bce1fa075..9021838eaff 100644 --- a/src/cloudflare/resources/zero_trust/access/users/users.py +++ b/src/cloudflare/resources/zero_trust/access/users/users.py @@ -70,8 +70,8 @@ def with_streaming_response(self) -> UsersResourceWithStreamingResponse: def list( 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, @@ -83,7 +83,7 @@ def list( Gets a list of users for an account. Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -93,10 +93,10 @@ def list( 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}") + 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/{identifier}/access/users", + f"/accounts/{account_id}/access/users", page=SyncSinglePage[AccessUser], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -128,8 +128,8 @@ def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: def list( 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, @@ -141,7 +141,7 @@ def list( Gets a list of users for an account. Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -151,10 +151,10 @@ def list( 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}") + 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/{identifier}/access/users", + f"/accounts/{account_id}/access/users", page=AsyncSinglePage[AccessUser], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/cloudflare/resources/zero_trust/dex/colos.py b/src/cloudflare/resources/zero_trust/dex/colos.py index 6423b82ef5a..82c072ad419 100644 --- a/src/cloudflare/resources/zero_trust/dex/colos.py +++ b/src/cloudflare/resources/zero_trust/dex/colos.py @@ -39,8 +39,8 @@ def list( self, *, account_id: str, - time_end: str, - time_start: str, + from_: str, + to: str, sort_by: Literal["fleet-status-usage", "application-tests-usage"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -55,9 +55,9 @@ def list( are also returned and sorted alphabetically. Args: - time_end: End time for connection period in RFC3339 (ISO 8601) format. + from_: Start time for connection period in RFC3339 (ISO 8601) format. - time_start: Start time for connection period in RFC3339 (ISO 8601) format. + to: End time for connection period in RFC3339 (ISO 8601) format. sort_by: Type of usage that colos should be sorted by. If unspecified, returns all Cloudflare colos sorted alphabetically. @@ -82,8 +82,8 @@ def list( timeout=timeout, query=maybe_transform( { - "time_end": time_end, - "time_start": time_start, + "from_": from_, + "to": to, "sort_by": sort_by, }, colo_list_params.ColoListParams, @@ -106,8 +106,8 @@ def list( self, *, account_id: str, - time_end: str, - time_start: str, + from_: str, + to: str, sort_by: Literal["fleet-status-usage", "application-tests-usage"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -122,9 +122,9 @@ def list( are also returned and sorted alphabetically. Args: - time_end: End time for connection period in RFC3339 (ISO 8601) format. + from_: Start time for connection period in RFC3339 (ISO 8601) format. - time_start: Start time for connection period in RFC3339 (ISO 8601) format. + to: End time for connection period in RFC3339 (ISO 8601) format. sort_by: Type of usage that colos should be sorted by. If unspecified, returns all Cloudflare colos sorted alphabetically. @@ -149,8 +149,8 @@ def list( timeout=timeout, query=maybe_transform( { - "time_end": time_end, - "time_start": time_start, + "from_": from_, + "to": to, "sort_by": sort_by, }, colo_list_params.ColoListParams, 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 34a786574f9..1aec99e00cf 100644 --- a/src/cloudflare/resources/zero_trust/dex/fleet_status/devices.py +++ b/src/cloudflare/resources/zero_trust/dex/fleet_status/devices.py @@ -40,10 +40,11 @@ def list( self, *, account_id: str, + from_: str, page: float, per_page: float, - time_end: str, - time_start: str, + source: Literal["last_seen", "hourly", "raw"], + to: str, colo: str | NotGiven = NOT_GIVEN, device_id: str | NotGiven = NOT_GIVEN, mode: str | NotGiven = NOT_GIVEN, @@ -63,13 +64,20 @@ def list( List details for devices using WARP Args: + from_: Timestamp in ISO format + page: Page number of paginated results per_page: Number of items per page - time_end: Timestamp in ISO format + source: + Source: + + - `hourly` - device details aggregated hourly, up to 7 days prior + - `last_seen` - device details, up to 24 hours prior + - `raw` - device details, up to 7 days prior - time_start: Timestamp in ISO format + to: Timestamp in ISO format colo: Cloudflare colo @@ -105,10 +113,11 @@ def list( timeout=timeout, query=maybe_transform( { + "from_": from_, "page": page, "per_page": per_page, - "time_end": time_end, - "time_start": time_start, + "source": source, + "to": to, "colo": colo, "device_id": device_id, "mode": mode, @@ -137,10 +146,11 @@ def list( self, *, account_id: str, + from_: str, page: float, per_page: float, - time_end: str, - time_start: str, + source: Literal["last_seen", "hourly", "raw"], + to: str, colo: str | NotGiven = NOT_GIVEN, device_id: str | NotGiven = NOT_GIVEN, mode: str | NotGiven = NOT_GIVEN, @@ -160,13 +170,20 @@ def list( List details for devices using WARP Args: + from_: Timestamp in ISO format + page: Page number of paginated results per_page: Number of items per page - time_end: Timestamp in ISO format + source: + Source: + + - `hourly` - device details aggregated hourly, up to 7 days prior + - `last_seen` - device details, up to 24 hours prior + - `raw` - device details, up to 7 days prior - time_start: Timestamp in ISO format + to: Timestamp in ISO format colo: Cloudflare colo @@ -202,10 +219,11 @@ def list( timeout=timeout, query=maybe_transform( { + "from_": from_, "page": page, "per_page": per_page, - "time_end": time_end, - "time_start": time_start, + "source": source, + "to": to, "colo": colo, "device_id": device_id, "mode": mode, 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 23033b3ea99..fd44aab6d52 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 @@ -95,8 +95,8 @@ def over_time( self, *, account_id: str, - time_end: str, - time_start: str, + from_: str, + to: str, colo: str | NotGiven = NOT_GIVEN, device_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. @@ -110,9 +110,9 @@ def over_time( List details for devices using WARP, up to 7 days Args: - time_end: Timestamp in ISO format + from_: Timestamp in ISO format - time_start: Timestamp in ISO format + to: Timestamp in ISO format colo: Cloudflare colo @@ -138,8 +138,8 @@ def over_time( timeout=timeout, query=maybe_transform( { - "time_end": time_end, - "time_start": time_start, + "from_": from_, + "to": to, "colo": colo, "device_id": device_id, }, @@ -210,8 +210,8 @@ async def over_time( self, *, account_id: str, - time_end: str, - time_start: str, + from_: str, + to: str, colo: str | NotGiven = NOT_GIVEN, device_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. @@ -225,9 +225,9 @@ async def over_time( List details for devices using WARP, up to 7 days Args: - time_end: Timestamp in ISO format + from_: Timestamp in ISO format - time_start: Timestamp in ISO format + to: Timestamp in ISO format colo: Cloudflare colo @@ -253,8 +253,8 @@ async def over_time( timeout=timeout, query=await async_maybe_transform( { - "time_end": time_end, - "time_start": time_start, + "from_": from_, + "to": to, "colo": colo, "device_id": device_id, }, 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 31b71442618..efeb1dec67e 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 @@ -56,9 +56,9 @@ def get( test_id: str, *, account_id: str, + from_: str, interval: Literal["minute", "hour"], - time_end: str, - time_start: str, + to: str, colo: str | NotGiven = NOT_GIVEN, device_id: 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. @@ -75,11 +75,11 @@ def get( Args: test_id: API Resource UUID tag. - interval: Time interval for aggregate time slots. + from_: Start time for aggregate metrics in ISO ms - time_end: End time for aggregate metrics in ISO ms + interval: Time interval for aggregate time slots. - time_start: Start time for aggregate metrics in ISO ms + to: End time for aggregate metrics in ISO ms colo: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. @@ -108,9 +108,9 @@ def get( timeout=timeout, query=maybe_transform( { + "from_": from_, "interval": interval, - "time_end": time_end, - "time_start": time_start, + "to": to, "colo": colo, "device_id": device_id, }, @@ -140,9 +140,9 @@ async def get( test_id: str, *, account_id: str, + from_: str, interval: Literal["minute", "hour"], - time_end: str, - time_start: str, + to: str, colo: str | NotGiven = NOT_GIVEN, device_id: 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. @@ -159,11 +159,11 @@ async def get( Args: test_id: API Resource UUID tag. - interval: Time interval for aggregate time slots. + from_: Start time for aggregate metrics in ISO ms - time_end: End time for aggregate metrics in ISO ms + interval: Time interval for aggregate time slots. - time_start: Start time for aggregate metrics in ISO ms + to: End time for aggregate metrics in ISO ms colo: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. @@ -192,9 +192,9 @@ async def get( timeout=timeout, query=await async_maybe_transform( { + "from_": from_, "interval": interval, - "time_end": time_end, - "time_start": time_start, + "to": to, "colo": colo, "device_id": device_id, }, 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 b8b4330a11c..3f38cee74f1 100644 --- a/src/cloudflare/resources/zero_trust/dex/http_tests/percentiles.py +++ b/src/cloudflare/resources/zero_trust/dex/http_tests/percentiles.py @@ -43,8 +43,8 @@ def get( test_id: str, *, account_id: str, - time_end: str, - time_start: str, + from_: str, + to: str, colo: str | NotGiven = NOT_GIVEN, device_id: 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. @@ -61,9 +61,9 @@ def get( Args: test_id: API Resource UUID tag. - time_end: End time for aggregate metrics in ISO format + from_: Start time for aggregate metrics in ISO format - time_start: Start time for aggregate metrics in ISO format + to: End time for aggregate metrics in ISO format colo: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. @@ -92,8 +92,8 @@ def get( timeout=timeout, query=maybe_transform( { - "time_end": time_end, - "time_start": time_start, + "from_": from_, + "to": to, "colo": colo, "device_id": device_id, }, @@ -119,8 +119,8 @@ async def get( test_id: str, *, account_id: str, - time_end: str, - time_start: str, + from_: str, + to: str, colo: str | NotGiven = NOT_GIVEN, device_id: 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. @@ -137,9 +137,9 @@ async def get( Args: test_id: API Resource UUID tag. - time_end: End time for aggregate metrics in ISO format + from_: Start time for aggregate metrics in ISO format - time_start: Start time for aggregate metrics in ISO format + to: End time for aggregate metrics in ISO format colo: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. @@ -168,8 +168,8 @@ async def get( timeout=timeout, query=await async_maybe_transform( { - "time_end": time_end, - "time_start": time_start, + "from_": from_, + "to": to, "colo": colo, "device_id": device_id, }, diff --git a/src/cloudflare/resources/zero_trust/dex/traceroute_tests.py b/src/cloudflare/resources/zero_trust/dex/traceroute_tests.py index ebbf05826a8..865312380a0 100644 --- a/src/cloudflare/resources/zero_trust/dex/traceroute_tests.py +++ b/src/cloudflare/resources/zero_trust/dex/traceroute_tests.py @@ -50,9 +50,9 @@ def get( test_id: str, *, account_id: str, + from_: str, interval: Literal["minute", "hour"], - time_end: str, - time_start: str, + to: str, colo: str | NotGiven = NOT_GIVEN, device_id: 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. @@ -69,11 +69,11 @@ def get( Args: test_id: API Resource UUID tag. - interval: Time interval for aggregate time slots. + from_: Start time for aggregate metrics in ISO ms - time_end: End time for aggregate metrics in ISO ms + interval: Time interval for aggregate time slots. - time_start: Start time for aggregate metrics in ISO ms + to: End time for aggregate metrics in ISO ms colo: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. @@ -102,9 +102,9 @@ def get( timeout=timeout, query=maybe_transform( { + "from_": from_, "interval": interval, - "time_end": time_end, - "time_start": time_start, + "to": to, "colo": colo, "device_id": device_id, }, @@ -121,9 +121,9 @@ def network_path( *, account_id: str, device_id: str, + from_: str, interval: Literal["minute", "hour"], - time_end: str, - time_start: str, + to: 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, @@ -139,11 +139,11 @@ def network_path( device_id: Device to filter tracroute result runs to - interval: Time interval for aggregate time slots. + from_: Start time for aggregate metrics in ISO ms - time_end: End time for aggregate metrics in ISO ms + interval: Time interval for aggregate time slots. - time_start: Start time for aggregate metrics in ISO ms + to: End time for aggregate metrics in ISO ms extra_headers: Send extra headers @@ -167,9 +167,9 @@ def network_path( query=maybe_transform( { "device_id": device_id, + "from_": from_, "interval": interval, - "time_end": time_end, - "time_start": time_start, + "to": to, }, traceroute_test_network_path_params.TracerouteTestNetworkPathParams, ), @@ -183,8 +183,8 @@ def percentiles( test_id: str, *, account_id: str, - time_end: str, - time_start: str, + from_: str, + to: str, colo: str | NotGiven = NOT_GIVEN, device_id: 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. @@ -201,9 +201,9 @@ def percentiles( Args: test_id: API Resource UUID tag. - time_end: End time for aggregate metrics in ISO format + from_: Start time for aggregate metrics in ISO format - time_start: Start time for aggregate metrics in ISO format + to: End time for aggregate metrics in ISO format colo: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. @@ -232,8 +232,8 @@ def percentiles( timeout=timeout, query=maybe_transform( { - "time_end": time_end, - "time_start": time_start, + "from_": from_, + "to": to, "colo": colo, "device_id": device_id, }, @@ -261,9 +261,9 @@ async def get( test_id: str, *, account_id: str, + from_: str, interval: Literal["minute", "hour"], - time_end: str, - time_start: str, + to: str, colo: str | NotGiven = NOT_GIVEN, device_id: 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. @@ -280,11 +280,11 @@ async def get( Args: test_id: API Resource UUID tag. - interval: Time interval for aggregate time slots. + from_: Start time for aggregate metrics in ISO ms - time_end: End time for aggregate metrics in ISO ms + interval: Time interval for aggregate time slots. - time_start: Start time for aggregate metrics in ISO ms + to: End time for aggregate metrics in ISO ms colo: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. @@ -313,9 +313,9 @@ async def get( timeout=timeout, query=await async_maybe_transform( { + "from_": from_, "interval": interval, - "time_end": time_end, - "time_start": time_start, + "to": to, "colo": colo, "device_id": device_id, }, @@ -332,9 +332,9 @@ async def network_path( *, account_id: str, device_id: str, + from_: str, interval: Literal["minute", "hour"], - time_end: str, - time_start: str, + to: 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, @@ -350,11 +350,11 @@ async def network_path( device_id: Device to filter tracroute result runs to - interval: Time interval for aggregate time slots. + from_: Start time for aggregate metrics in ISO ms - time_end: End time for aggregate metrics in ISO ms + interval: Time interval for aggregate time slots. - time_start: Start time for aggregate metrics in ISO ms + to: End time for aggregate metrics in ISO ms extra_headers: Send extra headers @@ -378,9 +378,9 @@ async def network_path( query=await async_maybe_transform( { "device_id": device_id, + "from_": from_, "interval": interval, - "time_end": time_end, - "time_start": time_start, + "to": to, }, traceroute_test_network_path_params.TracerouteTestNetworkPathParams, ), @@ -394,8 +394,8 @@ async def percentiles( test_id: str, *, account_id: str, - time_end: str, - time_start: str, + from_: str, + to: str, colo: str | NotGiven = NOT_GIVEN, device_id: 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. @@ -412,9 +412,9 @@ async def percentiles( Args: test_id: API Resource UUID tag. - time_end: End time for aggregate metrics in ISO format + from_: Start time for aggregate metrics in ISO format - time_start: Start time for aggregate metrics in ISO format + to: End time for aggregate metrics in ISO format colo: Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. @@ -443,8 +443,8 @@ async def percentiles( timeout=timeout, query=await async_maybe_transform( { - "time_end": time_end, - "time_start": time_start, + "from_": from_, + "to": to, "colo": colo, "device_id": device_id, }, diff --git a/src/cloudflare/resources/zero_trust/dlp/datasets/upload.py b/src/cloudflare/resources/zero_trust/dlp/datasets/upload.py index 8ae70bace70..ffbd13882e4 100644 --- a/src/cloudflare/resources/zero_trust/dlp/datasets/upload.py +++ b/src/cloudflare/resources/zero_trust/dlp/datasets/upload.py @@ -85,7 +85,7 @@ def edit( *, account_id: str, dataset_id: str, - body: object, + 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, @@ -178,7 +178,7 @@ async def edit( *, account_id: str, dataset_id: str, - body: object, + 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, diff --git a/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py b/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py index c1b0d3b653f..6ff679a7bc6 100644 --- a/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py +++ b/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py @@ -20,14 +20,13 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( - AsyncPaginator, make_request_options, ) from ....types.zero_trust.gateway import proxy_endpoint_edit_params, proxy_endpoint_create_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_get_response import ProxyEndpointGetResponse from ....types.zero_trust.gateway.proxy_endpoint_delete_response import ProxyEndpointDeleteResponse __all__ = ["ProxyEndpointsResource", "AsyncProxyEndpointsResource"] @@ -102,9 +101,9 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[ProxyEndpoint]: + ) -> Optional[ProxyEndpoint]: """ - Fetches a single Zero Trust Gateway proxy endpoint. + Fetches all Zero Trust Gateway proxy endpoints for an account. Args: extra_headers: Send extra headers @@ -117,13 +116,16 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get_api_list( + return self._get( f"/accounts/{account_id}/gateway/proxy_endpoints", - page=SyncSinglePage[ProxyEndpoint], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, ), - model=ProxyEndpoint, + cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) def delete( @@ -235,9 +237,9 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ProxyEndpoint]: + ) -> Optional[ProxyEndpointGetResponse]: """ - Fetches all Zero Trust Gateway proxy endpoints for an account. + Fetches a single Zero Trust Gateway proxy endpoint. Args: extra_headers: Send extra headers @@ -259,9 +261,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpointGetResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), + cast_to=cast(Type[Optional[ProxyEndpointGetResponse]], ResultWrapper[ProxyEndpointGetResponse]), ) @@ -324,7 +326,7 @@ async def create( cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) - def list( + async def list( self, *, account_id: str, @@ -334,9 +336,9 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ProxyEndpoint, AsyncSinglePage[ProxyEndpoint]]: + ) -> Optional[ProxyEndpoint]: """ - Fetches a single Zero Trust Gateway proxy endpoint. + Fetches all Zero Trust Gateway proxy endpoints for an account. Args: extra_headers: Send extra headers @@ -349,13 +351,16 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get_api_list( + return await self._get( f"/accounts/{account_id}/gateway/proxy_endpoints", - page=AsyncSinglePage[ProxyEndpoint], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, ), - model=ProxyEndpoint, + cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), ) async def delete( @@ -467,9 +472,9 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ProxyEndpoint]: + ) -> Optional[ProxyEndpointGetResponse]: """ - Fetches all Zero Trust Gateway proxy endpoints for an account. + Fetches a single Zero Trust Gateway proxy endpoint. Args: extra_headers: Send extra headers @@ -491,9 +496,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[ProxyEndpoint]]._unwrapper, + post_parser=ResultWrapper[Optional[ProxyEndpointGetResponse]]._unwrapper, ), - cast_to=cast(Type[Optional[ProxyEndpoint]], ResultWrapper[ProxyEndpoint]), + cast_to=cast(Type[Optional[ProxyEndpointGetResponse]], ResultWrapper[ProxyEndpointGetResponse]), ) diff --git a/src/cloudflare/resources/zero_trust/identity_providers.py b/src/cloudflare/resources/zero_trust/identity_providers.py index 3e9508b349d..f3d72e3068d 100644 --- a/src/cloudflare/resources/zero_trust/identity_providers.py +++ b/src/cloudflare/resources/zero_trust/identity_providers.py @@ -32,7 +32,7 @@ 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.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 @@ -59,7 +59,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -107,7 +107,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -155,7 +155,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -203,7 +203,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -251,7 +251,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -299,7 +299,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -347,7 +347,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -395,7 +395,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -443,7 +443,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -491,7 +491,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -539,7 +539,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -587,7 +587,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -635,7 +635,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -683,7 +683,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -722,22 +722,7 @@ def create( """ ... - @required_args( - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ) + @required_args(["config", "name", "type"]) def create( self, *, @@ -756,7 +741,7 @@ def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -805,14 +790,14 @@ def create( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AzureADConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -824,7 +809,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -856,14 +841,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessCentrifyConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -875,7 +860,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -907,14 +892,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: GenericOAuthConfigParam, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -926,7 +911,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -958,14 +943,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: GenericOAuthConfigParam, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -977,7 +962,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1009,14 +994,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessGoogleConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1028,7 +1013,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1060,14 +1045,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessGoogleAppsConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1079,7 +1064,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1111,14 +1096,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: GenericOAuthConfigParam, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1130,7 +1115,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1162,14 +1147,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessOIDCConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1181,7 +1166,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1213,14 +1198,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessOktaConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1232,7 +1217,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1264,14 +1249,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessOneloginConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1283,7 +1268,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1315,14 +1300,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessPingoneConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1334,7 +1319,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1366,14 +1351,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessSAMLConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1385,7 +1370,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1417,14 +1402,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: GenericOAuthConfigParam, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1436,7 +1421,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1468,14 +1453,14 @@ def update( @overload def update( self, - uuid: str, + identity_provider_id: str, *, config: object, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1487,7 +1472,7 @@ def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1516,25 +1501,10 @@ def update( """ ... - @required_args( - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ) + @required_args(["config", "name", "type"]) def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AzureADConfig | identity_provider_update_params.AccessCentrifyConfig @@ -1551,7 +1521,7 @@ def update( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1559,8 +1529,10 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not identity_provider_id: + raise ValueError( + f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!r}" + ) if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1576,7 +1548,7 @@ def update( return cast( Optional[IdentityProvider], self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{identity_provider_id}", body=maybe_transform( { "config": config, @@ -1652,7 +1624,7 @@ def list( def delete( self, - uuid: str, + identity_provider_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -1667,7 +1639,7 @@ def delete( Deletes an identity provider from Access. Args: - uuid: UUID + identity_provider_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -1681,8 +1653,10 @@ def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not identity_provider_id: + raise ValueError( + f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!r}" + ) if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1696,7 +1670,7 @@ def delete( account_or_zone = "zones" account_or_zone_id = zone_id return self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{identity_provider_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1709,7 +1683,7 @@ def delete( def get( self, - uuid: str, + identity_provider_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -1724,7 +1698,7 @@ def get( Fetches a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -1738,8 +1712,10 @@ def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not identity_provider_id: + raise ValueError( + f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!r}" + ) if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -1755,7 +1731,7 @@ def get( return cast( Optional[IdentityProvider], self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{identity_provider_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -1788,7 +1764,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1836,7 +1812,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1884,7 +1860,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1932,7 +1908,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -1980,7 +1956,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2028,7 +2004,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2076,7 +2052,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2124,7 +2100,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2172,7 +2148,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2220,7 +2196,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2268,7 +2244,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2316,7 +2292,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2364,7 +2340,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2412,7 +2388,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2451,22 +2427,7 @@ async def create( """ ... - @required_args( - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ) + @required_args(["config", "name", "type"]) async def create( self, *, @@ -2485,7 +2446,7 @@ async def create( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2534,14 +2495,14 @@ async def create( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AzureADConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2553,7 +2514,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -2585,14 +2546,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessCentrifyConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2604,7 +2565,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -2636,14 +2597,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: GenericOAuthConfigParam, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2655,7 +2616,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -2687,14 +2648,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: GenericOAuthConfigParam, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2706,7 +2667,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -2738,14 +2699,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessGoogleConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2757,7 +2718,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -2789,14 +2750,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessGoogleAppsConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2808,7 +2769,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -2840,14 +2801,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: GenericOAuthConfigParam, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2859,7 +2820,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -2891,14 +2852,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessOIDCConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2910,7 +2871,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -2942,14 +2903,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessOktaConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -2961,7 +2922,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -2993,14 +2954,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessOneloginConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -3012,7 +2973,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -3044,14 +3005,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessPingoneConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -3063,7 +3024,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -3095,14 +3056,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AccessSAMLConfig, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -3114,7 +3075,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -3146,14 +3107,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: GenericOAuthConfigParam, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -3165,7 +3126,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -3197,14 +3158,14 @@ async def update( @overload async def update( self, - uuid: str, + identity_provider_id: str, *, config: object, name: str, type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -3216,7 +3177,7 @@ async def update( Updates a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID config: The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -3245,25 +3206,10 @@ async def update( """ ... - @required_args( - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ["config", "name", "type"], - ) + @required_args(["config", "name", "type"]) async def update( self, - uuid: str, + identity_provider_id: str, *, config: identity_provider_update_params.AzureADConfig | identity_provider_update_params.AccessCentrifyConfig @@ -3280,7 +3226,7 @@ async def update( type: IdentityProviderType, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, - scim_config: ScimConfigParam | 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, @@ -3288,8 +3234,10 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IdentityProvider]: - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not identity_provider_id: + raise ValueError( + f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!r}" + ) if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -3305,7 +3253,7 @@ async def update( return cast( Optional[IdentityProvider], await self._put( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{identity_provider_id}", body=await async_maybe_transform( { "config": config, @@ -3381,7 +3329,7 @@ def list( async def delete( self, - uuid: str, + identity_provider_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -3396,7 +3344,7 @@ async def delete( Deletes an identity provider from Access. Args: - uuid: UUID + identity_provider_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -3410,8 +3358,10 @@ async def delete( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not identity_provider_id: + raise ValueError( + f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!r}" + ) if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -3425,7 +3375,7 @@ async def delete( account_or_zone = "zones" account_or_zone_id = zone_id return await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{identity_provider_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -3438,7 +3388,7 @@ async def delete( async def get( self, - uuid: str, + identity_provider_id: str, *, account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, @@ -3453,7 +3403,7 @@ async def get( Fetches a configured identity provider. Args: - uuid: UUID + identity_provider_id: UUID account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -3467,8 +3417,10 @@ async def get( timeout: Override the client-level default timeout for this request, in seconds """ - if not uuid: - raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") + if not identity_provider_id: + raise ValueError( + f"Expected a non-empty value for `identity_provider_id` but received {identity_provider_id!r}" + ) if account_id and zone_id: raise ValueError("You cannot provide both account_id and zone_id") @@ -3484,7 +3436,7 @@ async def get( return cast( Optional[IdentityProvider], await self._get( - f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{uuid}", + f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers/{identity_provider_id}", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/zero_trust/risk_scoring/__init__.py b/src/cloudflare/resources/zero_trust/risk_scoring/__init__.py index 786697e73dd..444ef4d0a98 100644 --- a/src/cloudflare/resources/zero_trust/risk_scoring/__init__.py +++ b/src/cloudflare/resources/zero_trust/risk_scoring/__init__.py @@ -16,6 +16,14 @@ BehavioursResourceWithStreamingResponse, AsyncBehavioursResourceWithStreamingResponse, ) +from .integrations import ( + IntegrationsResource, + AsyncIntegrationsResource, + IntegrationsResourceWithRawResponse, + AsyncIntegrationsResourceWithRawResponse, + IntegrationsResourceWithStreamingResponse, + AsyncIntegrationsResourceWithStreamingResponse, +) from .risk_scoring import ( RiskScoringResource, AsyncRiskScoringResource, @@ -38,6 +46,12 @@ "AsyncSummaryResourceWithRawResponse", "SummaryResourceWithStreamingResponse", "AsyncSummaryResourceWithStreamingResponse", + "IntegrationsResource", + "AsyncIntegrationsResource", + "IntegrationsResourceWithRawResponse", + "AsyncIntegrationsResourceWithRawResponse", + "IntegrationsResourceWithStreamingResponse", + "AsyncIntegrationsResourceWithStreamingResponse", "RiskScoringResource", "AsyncRiskScoringResource", "RiskScoringResourceWithRawResponse", diff --git a/src/cloudflare/resources/zero_trust/risk_scoring/integrations/__init__.py b/src/cloudflare/resources/zero_trust/risk_scoring/integrations/__init__.py new file mode 100644 index 00000000000..8de5cdc289c --- /dev/null +++ b/src/cloudflare/resources/zero_trust/risk_scoring/integrations/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .references import ( + ReferencesResource, + AsyncReferencesResource, + ReferencesResourceWithRawResponse, + AsyncReferencesResourceWithRawResponse, + ReferencesResourceWithStreamingResponse, + AsyncReferencesResourceWithStreamingResponse, +) +from .integrations import ( + IntegrationsResource, + AsyncIntegrationsResource, + IntegrationsResourceWithRawResponse, + AsyncIntegrationsResourceWithRawResponse, + IntegrationsResourceWithStreamingResponse, + AsyncIntegrationsResourceWithStreamingResponse, +) + +__all__ = [ + "ReferencesResource", + "AsyncReferencesResource", + "ReferencesResourceWithRawResponse", + "AsyncReferencesResourceWithRawResponse", + "ReferencesResourceWithStreamingResponse", + "AsyncReferencesResourceWithStreamingResponse", + "IntegrationsResource", + "AsyncIntegrationsResource", + "IntegrationsResourceWithRawResponse", + "AsyncIntegrationsResourceWithRawResponse", + "IntegrationsResourceWithStreamingResponse", + "AsyncIntegrationsResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/zero_trust/risk_scoring/integrations/integrations.py b/src/cloudflare/resources/zero_trust/risk_scoring/integrations/integrations.py new file mode 100644 index 00000000000..093cacc5ea2 --- /dev/null +++ b/src/cloudflare/resources/zero_trust/risk_scoring/integrations/integrations.py @@ -0,0 +1,631 @@ +# 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 .references import ( + ReferencesResource, + AsyncReferencesResource, + ReferencesResourceWithRawResponse, + AsyncReferencesResourceWithRawResponse, + ReferencesResourceWithStreamingResponse, + AsyncReferencesResourceWithStreamingResponse, +) +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage +from ....._base_client import ( + AsyncPaginator, + make_request_options, +) +from .....types.zero_trust.risk_scoring import integration_create_params, integration_update_params +from .....types.zero_trust.risk_scoring.integration_get_response import IntegrationGetResponse +from .....types.zero_trust.risk_scoring.integration_list_response import IntegrationListResponse +from .....types.zero_trust.risk_scoring.integration_create_response import IntegrationCreateResponse +from .....types.zero_trust.risk_scoring.integration_update_response import IntegrationUpdateResponse + +__all__ = ["IntegrationsResource", "AsyncIntegrationsResource"] + + +class IntegrationsResource(SyncAPIResource): + @cached_property + def references(self) -> ReferencesResource: + return ReferencesResource(self._client) + + @cached_property + def with_raw_response(self) -> IntegrationsResourceWithRawResponse: + return IntegrationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IntegrationsResourceWithStreamingResponse: + return IntegrationsResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + integration_type: Literal["Okta"], + tenant_url: str, + reference_id: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[IntegrationCreateResponse]: + """ + Create new risk score integration. + + Args: + tenant_url: The base url of the tenant, e.g. "https://tenant.okta.com" + + reference_id: A reference id that can be supplied by the client. Currently this should be set + to the Access-Okta IDP ID (a UUIDv4). + https://developers.cloudflare.com/api/operations/access-identity-providers-get-an-access-identity-provider + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._post( + f"/accounts/{account_id}/zt_risk_scoring/integrations", + body=maybe_transform( + { + "integration_type": integration_type, + "tenant_url": tenant_url, + "reference_id": reference_id, + }, + integration_create_params.IntegrationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IntegrationCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[IntegrationCreateResponse]], ResultWrapper[IntegrationCreateResponse]), + ) + + def update( + self, + integration_id: str, + *, + account_id: str, + active: bool, + tenant_url: str, + reference_id: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[IntegrationUpdateResponse]: + """ + Update a risk score integration. + + Overwrite the reference_id, tenant_url, and active values with the ones provided + + Args: + active: Whether this integration is enabled. If disabled, no risk changes will be + exported to the third-party. + + tenant_url: The base url of the tenant, e.g. "https://tenant.okta.com" + + reference_id: A reference id that can be supplied by the client. Currently this should be set + to the Access-Okta IDP ID (a UUIDv4). + https://developers.cloudflare.com/api/operations/access-identity-providers-get-an-access-identity-provider + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 integration_id: + raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") + return self._put( + f"/accounts/{account_id}/zt_risk_scoring/integrations/{integration_id}", + body=maybe_transform( + { + "active": active, + "tenant_url": tenant_url, + "reference_id": reference_id, + }, + integration_update_params.IntegrationUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IntegrationUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[IntegrationUpdateResponse]], ResultWrapper[IntegrationUpdateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[IntegrationListResponse]: + """ + List all risk score integrations for the account. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/zt_risk_scoring/integrations", + page=SyncSinglePage[IntegrationListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=IntegrationListResponse, + ) + + def delete( + self, + integration_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, + ) -> object: + """ + Delete a risk score integration. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not integration_id: + raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") + return self._delete( + f"/accounts/{account_id}/zt_risk_scoring/integrations/{integration_id}", + 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( + self, + integration_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[IntegrationGetResponse]: + """ + Get risk score integration by 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 account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not integration_id: + raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") + return self._get( + f"/accounts/{account_id}/zt_risk_scoring/integrations/{integration_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IntegrationGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[IntegrationGetResponse]], ResultWrapper[IntegrationGetResponse]), + ) + + +class AsyncIntegrationsResource(AsyncAPIResource): + @cached_property + def references(self) -> AsyncReferencesResource: + return AsyncReferencesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncIntegrationsResourceWithRawResponse: + return AsyncIntegrationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIntegrationsResourceWithStreamingResponse: + return AsyncIntegrationsResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + integration_type: Literal["Okta"], + tenant_url: str, + reference_id: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[IntegrationCreateResponse]: + """ + Create new risk score integration. + + Args: + tenant_url: The base url of the tenant, e.g. "https://tenant.okta.com" + + reference_id: A reference id that can be supplied by the client. Currently this should be set + to the Access-Okta IDP ID (a UUIDv4). + https://developers.cloudflare.com/api/operations/access-identity-providers-get-an-access-identity-provider + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._post( + f"/accounts/{account_id}/zt_risk_scoring/integrations", + body=await async_maybe_transform( + { + "integration_type": integration_type, + "tenant_url": tenant_url, + "reference_id": reference_id, + }, + integration_create_params.IntegrationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IntegrationCreateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[IntegrationCreateResponse]], ResultWrapper[IntegrationCreateResponse]), + ) + + async def update( + self, + integration_id: str, + *, + account_id: str, + active: bool, + tenant_url: str, + reference_id: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[IntegrationUpdateResponse]: + """ + Update a risk score integration. + + Overwrite the reference_id, tenant_url, and active values with the ones provided + + Args: + active: Whether this integration is enabled. If disabled, no risk changes will be + exported to the third-party. + + tenant_url: The base url of the tenant, e.g. "https://tenant.okta.com" + + reference_id: A reference id that can be supplied by the client. Currently this should be set + to the Access-Okta IDP ID (a UUIDv4). + https://developers.cloudflare.com/api/operations/access-identity-providers-get-an-access-identity-provider + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the 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 integration_id: + raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") + return await self._put( + f"/accounts/{account_id}/zt_risk_scoring/integrations/{integration_id}", + body=await async_maybe_transform( + { + "active": active, + "tenant_url": tenant_url, + "reference_id": reference_id, + }, + integration_update_params.IntegrationUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IntegrationUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[IntegrationUpdateResponse]], ResultWrapper[IntegrationUpdateResponse]), + ) + + def list( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[IntegrationListResponse, AsyncSinglePage[IntegrationListResponse]]: + """ + List all risk score integrations for the account. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/zt_risk_scoring/integrations", + page=AsyncSinglePage[IntegrationListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=IntegrationListResponse, + ) + + async def delete( + self, + integration_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, + ) -> object: + """ + Delete a risk score integration. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not integration_id: + raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") + return await self._delete( + f"/accounts/{account_id}/zt_risk_scoring/integrations/{integration_id}", + 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( + self, + integration_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[IntegrationGetResponse]: + """ + Get risk score integration by 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 account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not integration_id: + raise ValueError(f"Expected a non-empty value for `integration_id` but received {integration_id!r}") + return await self._get( + f"/accounts/{account_id}/zt_risk_scoring/integrations/{integration_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[IntegrationGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[IntegrationGetResponse]], ResultWrapper[IntegrationGetResponse]), + ) + + +class IntegrationsResourceWithRawResponse: + def __init__(self, integrations: IntegrationsResource) -> None: + self._integrations = integrations + + self.create = to_raw_response_wrapper( + integrations.create, + ) + self.update = to_raw_response_wrapper( + integrations.update, + ) + self.list = to_raw_response_wrapper( + integrations.list, + ) + self.delete = to_raw_response_wrapper( + integrations.delete, + ) + self.get = to_raw_response_wrapper( + integrations.get, + ) + + @cached_property + def references(self) -> ReferencesResourceWithRawResponse: + return ReferencesResourceWithRawResponse(self._integrations.references) + + +class AsyncIntegrationsResourceWithRawResponse: + def __init__(self, integrations: AsyncIntegrationsResource) -> None: + self._integrations = integrations + + self.create = async_to_raw_response_wrapper( + integrations.create, + ) + self.update = async_to_raw_response_wrapper( + integrations.update, + ) + self.list = async_to_raw_response_wrapper( + integrations.list, + ) + self.delete = async_to_raw_response_wrapper( + integrations.delete, + ) + self.get = async_to_raw_response_wrapper( + integrations.get, + ) + + @cached_property + def references(self) -> AsyncReferencesResourceWithRawResponse: + return AsyncReferencesResourceWithRawResponse(self._integrations.references) + + +class IntegrationsResourceWithStreamingResponse: + def __init__(self, integrations: IntegrationsResource) -> None: + self._integrations = integrations + + self.create = to_streamed_response_wrapper( + integrations.create, + ) + self.update = to_streamed_response_wrapper( + integrations.update, + ) + self.list = to_streamed_response_wrapper( + integrations.list, + ) + self.delete = to_streamed_response_wrapper( + integrations.delete, + ) + self.get = to_streamed_response_wrapper( + integrations.get, + ) + + @cached_property + def references(self) -> ReferencesResourceWithStreamingResponse: + return ReferencesResourceWithStreamingResponse(self._integrations.references) + + +class AsyncIntegrationsResourceWithStreamingResponse: + def __init__(self, integrations: AsyncIntegrationsResource) -> None: + self._integrations = integrations + + self.create = async_to_streamed_response_wrapper( + integrations.create, + ) + self.update = async_to_streamed_response_wrapper( + integrations.update, + ) + self.list = async_to_streamed_response_wrapper( + integrations.list, + ) + self.delete = async_to_streamed_response_wrapper( + integrations.delete, + ) + self.get = async_to_streamed_response_wrapper( + integrations.get, + ) + + @cached_property + def references(self) -> AsyncReferencesResourceWithStreamingResponse: + return AsyncReferencesResourceWithStreamingResponse(self._integrations.references) diff --git a/src/cloudflare/resources/zero_trust/risk_scoring/integrations/references.py b/src/cloudflare/resources/zero_trust/risk_scoring/integrations/references.py new file mode 100644 index 00000000000..604fb052a84 --- /dev/null +++ b/src/cloudflare/resources/zero_trust/risk_scoring/integrations/references.py @@ -0,0 +1,160 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Optional, cast + +import httpx + +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._compat import cached_property +from ....._resource import SyncAPIResource, AsyncAPIResource +from ....._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ....._wrappers import ResultWrapper +from ....._base_client import ( + make_request_options, +) +from .....types.zero_trust.risk_scoring.integrations.reference_get_response import ReferenceGetResponse + +__all__ = ["ReferencesResource", "AsyncReferencesResource"] + + +class ReferencesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ReferencesResourceWithRawResponse: + return ReferencesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ReferencesResourceWithStreamingResponse: + return ReferencesResourceWithStreamingResponse(self) + + def get( + self, + reference_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[ReferenceGetResponse]: + """ + Get risk score integration by reference 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 account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not reference_id: + raise ValueError(f"Expected a non-empty value for `reference_id` but received {reference_id!r}") + return self._get( + f"/accounts/{account_id}/zt_risk_scoring/integrations/reference_id/{reference_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ReferenceGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[ReferenceGetResponse]], ResultWrapper[ReferenceGetResponse]), + ) + + +class AsyncReferencesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncReferencesResourceWithRawResponse: + return AsyncReferencesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncReferencesResourceWithStreamingResponse: + return AsyncReferencesResourceWithStreamingResponse(self) + + async def get( + self, + reference_id: str, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[ReferenceGetResponse]: + """ + Get risk score integration by reference 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 account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + if not reference_id: + raise ValueError(f"Expected a non-empty value for `reference_id` but received {reference_id!r}") + return await self._get( + f"/accounts/{account_id}/zt_risk_scoring/integrations/reference_id/{reference_id}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[ReferenceGetResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[ReferenceGetResponse]], ResultWrapper[ReferenceGetResponse]), + ) + + +class ReferencesResourceWithRawResponse: + def __init__(self, references: ReferencesResource) -> None: + self._references = references + + self.get = to_raw_response_wrapper( + references.get, + ) + + +class AsyncReferencesResourceWithRawResponse: + def __init__(self, references: AsyncReferencesResource) -> None: + self._references = references + + self.get = async_to_raw_response_wrapper( + references.get, + ) + + +class ReferencesResourceWithStreamingResponse: + def __init__(self, references: ReferencesResource) -> None: + self._references = references + + self.get = to_streamed_response_wrapper( + references.get, + ) + + +class AsyncReferencesResourceWithStreamingResponse: + def __init__(self, references: AsyncReferencesResource) -> None: + self._references = references + + self.get = async_to_streamed_response_wrapper( + references.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 index fcf0c234dca..653f23f6bf0 100644 --- a/src/cloudflare/resources/zero_trust/risk_scoring/risk_scoring.py +++ b/src/cloudflare/resources/zero_trust/risk_scoring/risk_scoring.py @@ -37,10 +37,19 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from .integrations import ( + IntegrationsResource, + AsyncIntegrationsResource, + IntegrationsResourceWithRawResponse, + AsyncIntegrationsResourceWithRawResponse, + IntegrationsResourceWithStreamingResponse, + AsyncIntegrationsResourceWithStreamingResponse, +) from ...._base_client import ( make_request_options, ) from ....types.zero_trust import risk_scoring_get_params +from .integrations.integrations import IntegrationsResource, AsyncIntegrationsResource from ....types.zero_trust.risk_scoring_get_response import RiskScoringGetResponse from ....types.zero_trust.risk_scoring_reset_response import RiskScoringResetResponse @@ -56,6 +65,10 @@ def behaviours(self) -> BehavioursResource: def summary(self) -> SummaryResource: return SummaryResource(self._client) + @cached_property + def integrations(self) -> IntegrationsResource: + return IntegrationsResource(self._client) + @cached_property def with_raw_response(self) -> RiskScoringResourceWithRawResponse: return RiskScoringResourceWithRawResponse(self) @@ -180,6 +193,10 @@ def behaviours(self) -> AsyncBehavioursResource: def summary(self) -> AsyncSummaryResource: return AsyncSummaryResource(self._client) + @cached_property + def integrations(self) -> AsyncIntegrationsResource: + return AsyncIntegrationsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncRiskScoringResourceWithRawResponse: return AsyncRiskScoringResourceWithRawResponse(self) @@ -314,6 +331,10 @@ def behaviours(self) -> BehavioursResourceWithRawResponse: def summary(self) -> SummaryResourceWithRawResponse: return SummaryResourceWithRawResponse(self._risk_scoring.summary) + @cached_property + def integrations(self) -> IntegrationsResourceWithRawResponse: + return IntegrationsResourceWithRawResponse(self._risk_scoring.integrations) + class AsyncRiskScoringResourceWithRawResponse: def __init__(self, risk_scoring: AsyncRiskScoringResource) -> None: @@ -334,6 +355,10 @@ def behaviours(self) -> AsyncBehavioursResourceWithRawResponse: def summary(self) -> AsyncSummaryResourceWithRawResponse: return AsyncSummaryResourceWithRawResponse(self._risk_scoring.summary) + @cached_property + def integrations(self) -> AsyncIntegrationsResourceWithRawResponse: + return AsyncIntegrationsResourceWithRawResponse(self._risk_scoring.integrations) + class RiskScoringResourceWithStreamingResponse: def __init__(self, risk_scoring: RiskScoringResource) -> None: @@ -354,6 +379,10 @@ def behaviours(self) -> BehavioursResourceWithStreamingResponse: def summary(self) -> SummaryResourceWithStreamingResponse: return SummaryResourceWithStreamingResponse(self._risk_scoring.summary) + @cached_property + def integrations(self) -> IntegrationsResourceWithStreamingResponse: + return IntegrationsResourceWithStreamingResponse(self._risk_scoring.integrations) + class AsyncRiskScoringResourceWithStreamingResponse: def __init__(self, risk_scoring: AsyncRiskScoringResource) -> None: @@ -373,3 +402,7 @@ def behaviours(self) -> AsyncBehavioursResourceWithStreamingResponse: @cached_property def summary(self) -> AsyncSummaryResourceWithStreamingResponse: return AsyncSummaryResourceWithStreamingResponse(self._risk_scoring.summary) + + @cached_property + def integrations(self) -> AsyncIntegrationsResourceWithStreamingResponse: + return AsyncIntegrationsResourceWithStreamingResponse(self._risk_scoring.integrations) diff --git a/src/cloudflare/resources/zero_trust/seats.py b/src/cloudflare/resources/zero_trust/seats.py index c1368cd0512..fa9fbe00220 100644 --- a/src/cloudflare/resources/zero_trust/seats.py +++ b/src/cloudflare/resources/zero_trust/seats.py @@ -40,8 +40,8 @@ def with_streaming_response(self) -> SeatsResourceWithStreamingResponse: def edit( self, - identifier: str, *, + account_id: str, body: Iterable[seat_edit_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. @@ -55,7 +55,7 @@ def edit( are set to false. Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -65,10 +65,10 @@ def edit( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._patch( - f"/accounts/{identifier}/access/seats", + f"/accounts/{account_id}/access/seats", body=maybe_transform(body, seat_edit_params.SeatEditParams), options=make_request_options( extra_headers=extra_headers, @@ -92,8 +92,8 @@ def with_streaming_response(self) -> AsyncSeatsResourceWithStreamingResponse: async def edit( self, - identifier: str, *, + account_id: str, body: Iterable[seat_edit_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. @@ -107,7 +107,7 @@ async def edit( are set to false. Args: - identifier: Identifier + account_id: Identifier extra_headers: Send extra headers @@ -117,10 +117,10 @@ async def edit( 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}") + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._patch( - f"/accounts/{identifier}/access/seats", + f"/accounts/{account_id}/access/seats", body=await async_maybe_transform(body, seat_edit_params.SeatEditParams), options=make_request_options( extra_headers=extra_headers, diff --git a/src/cloudflare/resources/zero_trust/tunnels/tunnels.py b/src/cloudflare/resources/zero_trust/tunnels/tunnels.py index 228c4044763..4133b87dcf2 100644 --- a/src/cloudflare/resources/zero_trust/tunnels/tunnels.py +++ b/src/cloudflare/resources/zero_trust/tunnels/tunnels.py @@ -4,6 +4,7 @@ from typing import Any, Type, Union, cast from datetime import datetime +from typing_extensions import Literal import httpx @@ -169,6 +170,7 @@ def list( name: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + status: Literal["inactive", "degraded", "healthy", "down"] | NotGiven = NOT_GIVEN, tun_types: str | NotGiven = NOT_GIVEN, uuid: str | NotGiven = NOT_GIVEN, was_active_at: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -198,6 +200,11 @@ def list( per_page: Number of results to display. + status: 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_types: The types of tunnels to filter separated by a comma. uuid: UUID of the tunnel. @@ -229,6 +236,7 @@ def list( "name": name, "page": page, "per_page": per_page, + "status": status, "tun_types": tun_types, "uuid": uuid, "was_active_at": was_active_at, @@ -485,6 +493,7 @@ def list( name: str | NotGiven = NOT_GIVEN, page: float | NotGiven = NOT_GIVEN, per_page: float | NotGiven = NOT_GIVEN, + status: Literal["inactive", "degraded", "healthy", "down"] | NotGiven = NOT_GIVEN, tun_types: str | NotGiven = NOT_GIVEN, uuid: str | NotGiven = NOT_GIVEN, was_active_at: Union[str, datetime] | NotGiven = NOT_GIVEN, @@ -514,6 +523,11 @@ def list( per_page: Number of results to display. + status: 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_types: The types of tunnels to filter separated by a comma. uuid: UUID of the tunnel. @@ -545,6 +559,7 @@ def list( "name": name, "page": page, "per_page": per_page, + "status": status, "tun_types": tun_types, "uuid": uuid, "was_active_at": was_active_at, diff --git a/src/cloudflare/resources/zones/__init__.py b/src/cloudflare/resources/zones/__init__.py index fe02e52f39d..06e8291ed86 100644 --- a/src/cloudflare/resources/zones/__init__.py +++ b/src/cloudflare/resources/zones/__init__.py @@ -24,14 +24,6 @@ SettingsResourceWithStreamingResponse, AsyncSettingsResourceWithStreamingResponse, ) -from .dns_settings import ( - DNSSettingsResource, - AsyncDNSSettingsResource, - DNSSettingsResourceWithRawResponse, - AsyncDNSSettingsResourceWithRawResponse, - DNSSettingsResourceWithStreamingResponse, - AsyncDNSSettingsResourceWithStreamingResponse, -) from .subscriptions import ( SubscriptionsResource, AsyncSubscriptionsResource, @@ -64,12 +56,6 @@ "AsyncActivationCheckResourceWithRawResponse", "ActivationCheckResourceWithStreamingResponse", "AsyncActivationCheckResourceWithStreamingResponse", - "DNSSettingsResource", - "AsyncDNSSettingsResource", - "DNSSettingsResourceWithRawResponse", - "AsyncDNSSettingsResourceWithRawResponse", - "DNSSettingsResourceWithStreamingResponse", - "AsyncDNSSettingsResourceWithStreamingResponse", "SettingsResource", "AsyncSettingsResource", "SettingsResourceWithRawResponse", diff --git a/src/cloudflare/resources/zones/dns_settings.py b/src/cloudflare/resources/zones/dns_settings.py deleted file mode 100644 index 6da4a2d86ff..00000000000 --- a/src/cloudflare/resources/zones/dns_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 - -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 ...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__ = ["DNSSettingsResource", "AsyncDNSSettingsResource"] - - -class DNSSettingsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> DNSSettingsResourceWithRawResponse: - return DNSSettingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DNSSettingsResourceWithStreamingResponse: - return DNSSettingsResourceWithStreamingResponse(self) - - def edit( - self, - *, - zone_id: str, - 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, - ) -> 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 - - 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}/dns_settings", - 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[Optional[DNSSetting]]._unwrapper, - ), - cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), - ) - - 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[DNSSetting]: - """ - Show DNS settings 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( - f"/zones/{zone_id}/dns_settings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DNSSetting]]._unwrapper, - ), - cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), - ) - - -class AsyncDNSSettingsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncDNSSettingsResourceWithRawResponse: - return AsyncDNSSettingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDNSSettingsResourceWithStreamingResponse: - return AsyncDNSSettingsResourceWithStreamingResponse(self) - - async def edit( - self, - *, - zone_id: str, - 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, - ) -> 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 - - 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}/dns_settings", - body=await async_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[Optional[DNSSetting]]._unwrapper, - ), - cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), - ) - - 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[DNSSetting]: - """ - Show DNS settings 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 await self._get( - f"/zones/{zone_id}/dns_settings", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[DNSSetting]]._unwrapper, - ), - cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]), - ) - - -class DNSSettingsResourceWithRawResponse: - def __init__(self, dns_settings: DNSSettingsResource) -> None: - self._dns_settings = dns_settings - - self.edit = to_raw_response_wrapper( - dns_settings.edit, - ) - self.get = to_raw_response_wrapper( - dns_settings.get, - ) - - -class AsyncDNSSettingsResourceWithRawResponse: - def __init__(self, dns_settings: AsyncDNSSettingsResource) -> None: - self._dns_settings = dns_settings - - self.edit = async_to_raw_response_wrapper( - dns_settings.edit, - ) - self.get = async_to_raw_response_wrapper( - dns_settings.get, - ) - - -class DNSSettingsResourceWithStreamingResponse: - def __init__(self, dns_settings: DNSSettingsResource) -> None: - self._dns_settings = dns_settings - - self.edit = to_streamed_response_wrapper( - dns_settings.edit, - ) - self.get = to_streamed_response_wrapper( - dns_settings.get, - ) - - -class AsyncDNSSettingsResourceWithStreamingResponse: - def __init__(self, dns_settings: AsyncDNSSettingsResource) -> None: - self._dns_settings = dns_settings - - self.edit = async_to_streamed_response_wrapper( - dns_settings.edit, - ) - self.get = async_to_streamed_response_wrapper( - dns_settings.get, - ) diff --git a/src/cloudflare/resources/zones/zones.py b/src/cloudflare/resources/zones/zones.py index 6256a5db72a..2584b9a48a9 100644 --- a/src/cloudflare/resources/zones/zones.py +++ b/src/cloudflare/resources/zones/zones.py @@ -38,14 +38,6 @@ ) from ..._wrappers import ResultWrapper from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from .dns_settings import ( - DNSSettingsResource, - AsyncDNSSettingsResource, - DNSSettingsResourceWithRawResponse, - AsyncDNSSettingsResourceWithRawResponse, - DNSSettingsResourceWithStreamingResponse, - AsyncDNSSettingsResourceWithStreamingResponse, -) from ...types.zones import zone_edit_params, zone_list_params, zone_create_params from .subscriptions import ( SubscriptionsResource, @@ -88,10 +80,6 @@ class ZonesResource(SyncAPIResource): def activation_check(self) -> ActivationCheckResource: return ActivationCheckResource(self._client) - @cached_property - def dns_settings(self) -> DNSSettingsResource: - return DNSSettingsResource(self._client) - @cached_property def settings(self) -> SettingsResource: return SettingsResource(self._client) @@ -392,10 +380,6 @@ class AsyncZonesResource(AsyncAPIResource): def activation_check(self) -> AsyncActivationCheckResource: return AsyncActivationCheckResource(self._client) - @cached_property - def dns_settings(self) -> AsyncDNSSettingsResource: - return AsyncDNSSettingsResource(self._client) - @cached_property def settings(self) -> AsyncSettingsResource: return AsyncSettingsResource(self._client) @@ -715,10 +699,6 @@ def __init__(self, zones: ZonesResource) -> None: def activation_check(self) -> ActivationCheckResourceWithRawResponse: return ActivationCheckResourceWithRawResponse(self._zones.activation_check) - @cached_property - def dns_settings(self) -> DNSSettingsResourceWithRawResponse: - return DNSSettingsResourceWithRawResponse(self._zones.dns_settings) - @cached_property def settings(self) -> SettingsResourceWithRawResponse: return SettingsResourceWithRawResponse(self._zones.settings) @@ -760,10 +740,6 @@ def __init__(self, zones: AsyncZonesResource) -> None: def activation_check(self) -> AsyncActivationCheckResourceWithRawResponse: return AsyncActivationCheckResourceWithRawResponse(self._zones.activation_check) - @cached_property - def dns_settings(self) -> AsyncDNSSettingsResourceWithRawResponse: - return AsyncDNSSettingsResourceWithRawResponse(self._zones.dns_settings) - @cached_property def settings(self) -> AsyncSettingsResourceWithRawResponse: return AsyncSettingsResourceWithRawResponse(self._zones.settings) @@ -805,10 +781,6 @@ def __init__(self, zones: ZonesResource) -> None: def activation_check(self) -> ActivationCheckResourceWithStreamingResponse: return ActivationCheckResourceWithStreamingResponse(self._zones.activation_check) - @cached_property - def dns_settings(self) -> DNSSettingsResourceWithStreamingResponse: - return DNSSettingsResourceWithStreamingResponse(self._zones.dns_settings) - @cached_property def settings(self) -> SettingsResourceWithStreamingResponse: return SettingsResourceWithStreamingResponse(self._zones.settings) @@ -850,10 +822,6 @@ def __init__(self, zones: AsyncZonesResource) -> None: def activation_check(self) -> AsyncActivationCheckResourceWithStreamingResponse: return AsyncActivationCheckResourceWithStreamingResponse(self._zones.activation_check) - @cached_property - def dns_settings(self) -> AsyncDNSSettingsResourceWithStreamingResponse: - return AsyncDNSSettingsResourceWithStreamingResponse(self._zones.dns_settings) - @cached_property def settings(self) -> AsyncSettingsResourceWithStreamingResponse: return AsyncSettingsResourceWithStreamingResponse(self._zones.settings) diff --git a/src/cloudflare/types/accounts/__init__.py b/src/cloudflare/types/accounts/__init__.py index 71487082562..4379841c49a 100644 --- a/src/cloudflare/types/accounts/__init__.py +++ b/src/cloudflare/types/accounts/__init__.py @@ -4,14 +4,13 @@ from .status import Status as Status 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_get_response import MemberGetResponse as MemberGetResponse from .member_create_params import MemberCreateParams as MemberCreateParams from .member_list_response import MemberListResponse as MemberListResponse from .member_update_params import MemberUpdateParams as MemberUpdateParams from .account_update_params import AccountUpdateParams as AccountUpdateParams -from .user_with_invite_code import UserWithInviteCode as UserWithInviteCode +from .member_create_response import MemberCreateResponse as MemberCreateResponse from .member_delete_response import MemberDeleteResponse as MemberDeleteResponse -from .account_update_response import AccountUpdateResponse as AccountUpdateResponse +from .member_update_response import MemberUpdateResponse as MemberUpdateResponse diff --git a/src/cloudflare/types/accounts/account.py b/src/cloudflare/types/accounts/account.py index 8c402e4bac9..1c26f03b23e 100644 --- a/src/cloudflare/types/accounts/account.py +++ b/src/cloudflare/types/accounts/account.py @@ -10,6 +10,9 @@ class Settings(BaseModel): + abuse_contact_email: Optional[str] = None + """Sets an abuse contact email to notify for abuse reports.""" + default_nameservers: Optional[Literal["cloudflare.standard", "custom.account", "custom.tenant"]] = None """ Specifies the default nameservers to be used for new zones added to this diff --git a/src/cloudflare/types/accounts/account_update_params.py b/src/cloudflare/types/accounts/account_update_params.py index 031f13d3375..3b472cb0778 100644 --- a/src/cloudflare/types/accounts/account_update_params.py +++ b/src/cloudflare/types/accounts/account_update_params.py @@ -18,6 +18,9 @@ class AccountUpdateParams(TypedDict, total=False): class Settings(TypedDict, total=False): + abuse_contact_email: str + """Sets an abuse contact email to notify for abuse reports.""" + default_nameservers: Literal["cloudflare.standard", "custom.account", "custom.tenant"] """ Specifies the default nameservers to be used for new zones added to this diff --git a/src/cloudflare/types/accounts/member_create_params.py b/src/cloudflare/types/accounts/member_create_params.py index 69acda8f5da..793e4eb5199 100644 --- a/src/cloudflare/types/accounts/member_create_params.py +++ b/src/cloudflare/types/accounts/member_create_params.py @@ -2,14 +2,22 @@ from __future__ import annotations -from typing import List +from typing import List, Union, Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["MemberCreateParams"] +__all__ = [ + "MemberCreateParams", + "IAMCreateMemberWithRoles", + "IAMCreateMemberWithPolicies", + "IAMCreateMemberWithPoliciesPolicy", + "IAMCreateMemberWithPoliciesPolicyPermissionGroup", + "IAMCreateMemberWithPoliciesPolicyResourceGroup", +] -class MemberCreateParams(TypedDict, total=False): +class IAMCreateMemberWithRoles(TypedDict, total=False): account_id: Required[str] + """Account identifier tag.""" email: Required[str] """The contact email address of the user.""" @@ -18,3 +26,40 @@ class MemberCreateParams(TypedDict, total=False): """Array of roles associated with this member.""" status: Literal["accepted", "pending"] + + +class IAMCreateMemberWithPolicies(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + email: Required[str] + """The contact email address of the user.""" + + policies: Required[Iterable[IAMCreateMemberWithPoliciesPolicy]] + """Array of policies associated with this member.""" + + status: Literal["accepted", "pending"] + + +class IAMCreateMemberWithPoliciesPolicyPermissionGroup(TypedDict, total=False): + id: Required[str] + """Identifier of the group.""" + + +class IAMCreateMemberWithPoliciesPolicyResourceGroup(TypedDict, total=False): + id: Required[str] + """Identifier of the group.""" + + +class IAMCreateMemberWithPoliciesPolicy(TypedDict, total=False): + access: Required[Literal["allow", "deny"]] + """Allow or deny operations against the resources.""" + + permission_groups: Required[Iterable[IAMCreateMemberWithPoliciesPolicyPermissionGroup]] + """A set of permission groups that are specified to the policy.""" + + resource_groups: Required[Iterable[IAMCreateMemberWithPoliciesPolicyResourceGroup]] + """A list of resource groups that the policy applies to.""" + + +MemberCreateParams = Union[IAMCreateMemberWithRoles, IAMCreateMemberWithPolicies] diff --git a/src/cloudflare/types/accounts/member_create_response.py b/src/cloudflare/types/accounts/member_create_response.py new file mode 100644 index 00000000000..dd71bbe04ce --- /dev/null +++ b/src/cloudflare/types/accounts/member_create_response.py @@ -0,0 +1,112 @@ +# 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 ..shared.role import Role + +__all__ = [ + "MemberCreateResponse", + "Policy", + "PolicyPermissionGroup", + "PolicyResourceGroup", + "PolicyResourceGroupScope", + "PolicyResourceGroupScopeObject", + "User", +] + + +class PolicyPermissionGroup(BaseModel): + id: str + """Identifier of the group.""" + + meta: Optional[object] = None + """Attributes associated to the permission group.""" + + name: Optional[str] = None + """Name of the group.""" + + +class PolicyResourceGroupScopeObject(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class PolicyResourceGroupScope(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: List[PolicyResourceGroupScopeObject] + """A list of scope objects for additional context.""" + + +class PolicyResourceGroup(BaseModel): + id: str + """Identifier of the group.""" + + scope: List[PolicyResourceGroupScope] + """The scope associated to the resource group""" + + meta: Optional[object] = None + """Attributes associated to the resource group.""" + + name: Optional[str] = None + """Name of the resource group.""" + + +class Policy(BaseModel): + id: Optional[str] = None + """Policy identifier.""" + + access: Optional[Literal["allow", "deny"]] = None + """Allow or deny operations against the resources.""" + + permission_groups: Optional[List[PolicyPermissionGroup]] = None + """A set of permission groups that are specified to the policy.""" + + resource_groups: Optional[List[PolicyResourceGroup]] = None + """A list of resource groups that the policy applies to.""" + + +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 MemberCreateResponse(BaseModel): + id: Optional[str] = None + """Membership identifier tag.""" + + policies: Optional[List[Policy]] = None + """Access policy for the membership""" + + roles: Optional[List[Role]] = None + """Roles assigned to this Member.""" + + status: Optional[Literal["accepted", "pending"]] = None + """A member's status in the account.""" + + user: Optional[User] = None + """Details of the user associated to the membership.""" diff --git a/src/cloudflare/types/accounts/member_get_response.py b/src/cloudflare/types/accounts/member_get_response.py new file mode 100644 index 00000000000..61da641cd72 --- /dev/null +++ b/src/cloudflare/types/accounts/member_get_response.py @@ -0,0 +1,112 @@ +# 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 ..shared.role import Role + +__all__ = [ + "MemberGetResponse", + "Policy", + "PolicyPermissionGroup", + "PolicyResourceGroup", + "PolicyResourceGroupScope", + "PolicyResourceGroupScopeObject", + "User", +] + + +class PolicyPermissionGroup(BaseModel): + id: str + """Identifier of the group.""" + + meta: Optional[object] = None + """Attributes associated to the permission group.""" + + name: Optional[str] = None + """Name of the group.""" + + +class PolicyResourceGroupScopeObject(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class PolicyResourceGroupScope(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: List[PolicyResourceGroupScopeObject] + """A list of scope objects for additional context.""" + + +class PolicyResourceGroup(BaseModel): + id: str + """Identifier of the group.""" + + scope: List[PolicyResourceGroupScope] + """The scope associated to the resource group""" + + meta: Optional[object] = None + """Attributes associated to the resource group.""" + + name: Optional[str] = None + """Name of the resource group.""" + + +class Policy(BaseModel): + id: Optional[str] = None + """Policy identifier.""" + + access: Optional[Literal["allow", "deny"]] = None + """Allow or deny operations against the resources.""" + + permission_groups: Optional[List[PolicyPermissionGroup]] = None + """A set of permission groups that are specified to the policy.""" + + resource_groups: Optional[List[PolicyResourceGroup]] = None + """A list of resource groups that the policy applies to.""" + + +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 MemberGetResponse(BaseModel): + id: Optional[str] = None + """Membership identifier tag.""" + + policies: Optional[List[Policy]] = None + """Access policy for the membership""" + + roles: Optional[List[Role]] = None + """Roles assigned to this Member.""" + + status: Optional[Literal["accepted", "pending"]] = None + """A member's status in the account.""" + + user: Optional[User] = None + """Details of the user associated to the membership.""" diff --git a/src/cloudflare/types/accounts/member_list_params.py b/src/cloudflare/types/accounts/member_list_params.py index 1b594104750..cda9328b103 100644 --- a/src/cloudflare/types/accounts/member_list_params.py +++ b/src/cloudflare/types/accounts/member_list_params.py @@ -9,6 +9,7 @@ class MemberListParams(TypedDict, total=False): account_id: Required[str] + """Account identifier tag.""" direction: Literal["asc", "desc"] """Direction to order results.""" diff --git a/src/cloudflare/types/accounts/member_list_response.py b/src/cloudflare/types/accounts/member_list_response.py index ca5c995cf44..5a8a4f49c10 100644 --- a/src/cloudflare/types/accounts/member_list_response.py +++ b/src/cloudflare/types/accounts/member_list_response.py @@ -6,21 +6,107 @@ from ..._models import BaseModel from ..shared.role import Role -__all__ = ["MemberListResponse"] +__all__ = [ + "MemberListResponse", + "Policy", + "PolicyPermissionGroup", + "PolicyResourceGroup", + "PolicyResourceGroupScope", + "PolicyResourceGroupScopeObject", + "User", +] -class MemberListResponse(BaseModel): +class PolicyPermissionGroup(BaseModel): id: str - """Identifier""" + """Identifier of the group.""" + + meta: Optional[object] = None + """Attributes associated to the permission group.""" + + name: Optional[str] = None + """Name of the group.""" + + +class PolicyResourceGroupScopeObject(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class PolicyResourceGroupScope(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: List[PolicyResourceGroupScopeObject] + """A list of scope objects for additional context.""" + + +class PolicyResourceGroup(BaseModel): + id: str + """Identifier of the group.""" + + scope: List[PolicyResourceGroupScope] + """The scope associated to the resource group""" + + meta: Optional[object] = None + """Attributes associated to the resource group.""" + + name: Optional[str] = None + """Name of the resource group.""" + +class Policy(BaseModel): + id: Optional[str] = None + """Policy identifier.""" + + access: Optional[Literal["allow", "deny"]] = None + """Allow or deny operations against the resources.""" + + permission_groups: Optional[List[PolicyPermissionGroup]] = None + """A set of permission groups that are specified to the policy.""" + + resource_groups: Optional[List[PolicyResourceGroup]] = None + """A list of resource groups that the policy applies to.""" + + +class User(BaseModel): email: str """The contact email address of the user.""" - name: Optional[str] = None - """Member Name.""" + id: Optional[str] = None + """Identifier""" + + first_name: Optional[str] = None + """User's first name""" - roles: List[Role] + 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 MemberListResponse(BaseModel): + id: Optional[str] = None + """Membership identifier tag.""" + + policies: Optional[List[Policy]] = None + """Access policy for the membership""" + + roles: Optional[List[Role]] = None """Roles assigned to this Member.""" - status: Literal["accepted", "invited"] - """A member's status in the organization.""" + status: Optional[Literal["accepted", "pending"]] = None + """A member's status in the account.""" + + user: Optional[User] = None + """Details of the user associated to the membership.""" diff --git a/src/cloudflare/types/accounts/member_update_params.py b/src/cloudflare/types/accounts/member_update_params.py index 48139d2a39b..e95d51f43fa 100644 --- a/src/cloudflare/types/accounts/member_update_params.py +++ b/src/cloudflare/types/accounts/member_update_params.py @@ -2,19 +2,60 @@ from __future__ import annotations -from typing import Iterable -from typing_extensions import Required, TypedDict +from typing import Union, Iterable +from typing_extensions import Literal, Required, TypedDict -__all__ = ["MemberUpdateParams", "Role"] +__all__ = [ + "MemberUpdateParams", + "Member", + "MemberRole", + "IAMUpdateMemberWithPolicies", + "IAMUpdateMemberWithPoliciesPolicy", + "IAMUpdateMemberWithPoliciesPolicyPermissionGroup", + "IAMUpdateMemberWithPoliciesPolicyResourceGroup", +] -class MemberUpdateParams(TypedDict, total=False): +class Member(TypedDict, total=False): account_id: Required[str] + """Account identifier tag.""" - roles: Required[Iterable[Role]] + roles: Iterable[MemberRole] """Roles assigned to this member.""" -class Role(TypedDict, total=False): +class MemberRole(TypedDict, total=False): id: Required[str] """Role identifier tag.""" + + +class IAMUpdateMemberWithPolicies(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + policies: Required[Iterable[IAMUpdateMemberWithPoliciesPolicy]] + """Array of policies associated with this member.""" + + +class IAMUpdateMemberWithPoliciesPolicyPermissionGroup(TypedDict, total=False): + id: Required[str] + """Identifier of the group.""" + + +class IAMUpdateMemberWithPoliciesPolicyResourceGroup(TypedDict, total=False): + id: Required[str] + """Identifier of the group.""" + + +class IAMUpdateMemberWithPoliciesPolicy(TypedDict, total=False): + access: Required[Literal["allow", "deny"]] + """Allow or deny operations against the resources.""" + + permission_groups: Required[Iterable[IAMUpdateMemberWithPoliciesPolicyPermissionGroup]] + """A set of permission groups that are specified to the policy.""" + + resource_groups: Required[Iterable[IAMUpdateMemberWithPoliciesPolicyResourceGroup]] + """A list of resource groups that the policy applies to.""" + + +MemberUpdateParams = Union[Member, IAMUpdateMemberWithPolicies] diff --git a/src/cloudflare/types/accounts/member_update_response.py b/src/cloudflare/types/accounts/member_update_response.py new file mode 100644 index 00000000000..0c92f9b20fb --- /dev/null +++ b/src/cloudflare/types/accounts/member_update_response.py @@ -0,0 +1,112 @@ +# 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 ..shared.role import Role + +__all__ = [ + "MemberUpdateResponse", + "Policy", + "PolicyPermissionGroup", + "PolicyResourceGroup", + "PolicyResourceGroupScope", + "PolicyResourceGroupScopeObject", + "User", +] + + +class PolicyPermissionGroup(BaseModel): + id: str + """Identifier of the group.""" + + meta: Optional[object] = None + """Attributes associated to the permission group.""" + + name: Optional[str] = None + """Name of the group.""" + + +class PolicyResourceGroupScopeObject(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class PolicyResourceGroupScope(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: List[PolicyResourceGroupScopeObject] + """A list of scope objects for additional context.""" + + +class PolicyResourceGroup(BaseModel): + id: str + """Identifier of the group.""" + + scope: List[PolicyResourceGroupScope] + """The scope associated to the resource group""" + + meta: Optional[object] = None + """Attributes associated to the resource group.""" + + name: Optional[str] = None + """Name of the resource group.""" + + +class Policy(BaseModel): + id: Optional[str] = None + """Policy identifier.""" + + access: Optional[Literal["allow", "deny"]] = None + """Allow or deny operations against the resources.""" + + permission_groups: Optional[List[PolicyPermissionGroup]] = None + """A set of permission groups that are specified to the policy.""" + + resource_groups: Optional[List[PolicyResourceGroup]] = None + """A list of resource groups that the policy applies to.""" + + +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 MemberUpdateResponse(BaseModel): + id: Optional[str] = None + """Membership identifier tag.""" + + policies: Optional[List[Policy]] = None + """Access policy for the membership""" + + roles: Optional[List[Role]] = None + """Roles assigned to this Member.""" + + status: Optional[Literal["accepted", "pending"]] = None + """A member's status in the account.""" + + user: Optional[User] = None + """Details of the user associated to the membership.""" diff --git a/src/cloudflare/types/accounts/role_get_response.py b/src/cloudflare/types/accounts/role_get_response.py deleted file mode 100644 index 50bca84535e..00000000000 --- a/src/cloudflare/types/accounts/role_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, Optional - -__all__ = ["RoleGetResponse"] - -RoleGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/accounts/user_with_invite_code.py b/src/cloudflare/types/accounts/user_with_invite_code.py deleted file mode 100644 index ab928845355..00000000000 --- a/src/cloudflare/types/accounts/user_with_invite_code.py +++ /dev/null @@ -1,82 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from ..._models import BaseModel -from ..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 2ea66f6d7f8..1c96d654c50 100644 --- a/src/cloudflare/types/addressing/__init__.py +++ b/src/cloudflare/types/addressing/__init__.py @@ -16,3 +16,10 @@ from .address_map_create_response import AddressMapCreateResponse as AddressMapCreateResponse from .address_map_delete_response import AddressMapDeleteResponse as AddressMapDeleteResponse from .loa_document_create_response import LOADocumentCreateResponse as LOADocumentCreateResponse +from .regional_hostname_edit_params import RegionalHostnameEditParams as RegionalHostnameEditParams +from .regional_hostname_get_response import RegionalHostnameGetResponse as RegionalHostnameGetResponse +from .regional_hostname_create_params import RegionalHostnameCreateParams as RegionalHostnameCreateParams +from .regional_hostname_edit_response import RegionalHostnameEditResponse as RegionalHostnameEditResponse +from .regional_hostname_list_response import RegionalHostnameListResponse as RegionalHostnameListResponse +from .regional_hostname_create_response import RegionalHostnameCreateResponse as RegionalHostnameCreateResponse +from .regional_hostname_delete_response import RegionalHostnameDeleteResponse as RegionalHostnameDeleteResponse diff --git a/src/cloudflare/types/addressing/address_map_create_params.py b/src/cloudflare/types/addressing/address_map_create_params.py index 5ecc49b6e6e..b0eae43afc8 100644 --- a/src/cloudflare/types/addressing/address_map_create_params.py +++ b/src/cloudflare/types/addressing/address_map_create_params.py @@ -2,10 +2,14 @@ from __future__ import annotations -from typing import Optional -from typing_extensions import Required, TypedDict +from typing import List, Union, Iterable, Optional +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict -__all__ = ["AddressMapCreateParams"] +from .kind import Kind +from ..._utils import PropertyInfo + +__all__ = ["AddressMapCreateParams", "Membership"] class AddressMapCreateParams(TypedDict, total=False): @@ -24,3 +28,21 @@ class AddressMapCreateParams(TypedDict, total=False): Cloudflare's DNS will not respond with IP addresses on an Address Map until the map is enabled. """ + + ips: List[str] + + memberships: Iterable[Membership] + """Zones and Accounts which will be assigned IPs on this Address Map. + + A zone membership will take priority over an account membership. + """ + + +class Membership(TypedDict, total=False): + created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + + identifier: str + """The identifier for the membership (eg. a zone or account tag).""" + + kind: Kind + """The type of the membership.""" diff --git a/src/cloudflare/types/addressing/address_map_create_response.py b/src/cloudflare/types/addressing/address_map_create_response.py index d4eb788e2df..032e1166d18 100644 --- a/src/cloudflare/types/addressing/address_map_create_response.py +++ b/src/cloudflare/types/addressing/address_map_create_response.py @@ -23,7 +23,7 @@ class Membership(BaseModel): created_at: Optional[datetime] = None identifier: Optional[str] = None - """Identifier""" + """The identifier for the membership (eg. a zone or account tag).""" kind: Optional[Kind] = None """The type of the membership.""" diff --git a/src/cloudflare/types/addressing/address_map_get_response.py b/src/cloudflare/types/addressing/address_map_get_response.py index 06bdfc92ed8..0eb306ccdbd 100644 --- a/src/cloudflare/types/addressing/address_map_get_response.py +++ b/src/cloudflare/types/addressing/address_map_get_response.py @@ -23,7 +23,7 @@ class Membership(BaseModel): created_at: Optional[datetime] = None identifier: Optional[str] = None - """Identifier""" + """The identifier for the membership (eg. a zone or account tag).""" kind: Optional[Kind] = None """The type of the membership.""" diff --git a/src/cloudflare/types/addressing/regional_hostname_create_params.py b/src/cloudflare/types/addressing/regional_hostname_create_params.py new file mode 100644 index 00000000000..630c2f0bed3 --- /dev/null +++ b/src/cloudflare/types/addressing/regional_hostname_create_params.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["RegionalHostnameCreateParams"] + + +class RegionalHostnameCreateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + hostname: Required[str] + """DNS hostname to be regionalized, must be a subdomain of the zone. + + Wildcards are supported for one level, e.g `*.example.com` + """ + + region_key: Required[str] + """Identifying key for the region""" diff --git a/src/cloudflare/types/addressing/regional_hostname_create_response.py b/src/cloudflare/types/addressing/regional_hostname_create_response.py new file mode 100644 index 00000000000..f2717ccf6ed --- /dev/null +++ b/src/cloudflare/types/addressing/regional_hostname_create_response.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["RegionalHostnameCreateResponse"] + + +class RegionalHostnameCreateResponse(BaseModel): + created_on: datetime + """When the regional hostname was created""" + + hostname: str + """DNS hostname to be regionalized, must be a subdomain of the zone. + + Wildcards are supported for one level, e.g `*.example.com` + """ + + region_key: str + """Identifying key for the region""" diff --git a/src/cloudflare/types/addressing/regional_hostname_delete_response.py b/src/cloudflare/types/addressing/regional_hostname_delete_response.py new file mode 100644 index 00000000000..1031166663d --- /dev/null +++ b/src/cloudflare/types/addressing/regional_hostname_delete_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel +from ..shared.response_info import ResponseInfo + +__all__ = ["RegionalHostnameDeleteResponse"] + + +class RegionalHostnameDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/addressing/regional_hostname_edit_params.py b/src/cloudflare/types/addressing/regional_hostname_edit_params.py new file mode 100644 index 00000000000..a205f2de604 --- /dev/null +++ b/src/cloudflare/types/addressing/regional_hostname_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__ = ["RegionalHostnameEditParams"] + + +class RegionalHostnameEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + region_key: Required[str] + """Identifying key for the region""" diff --git a/src/cloudflare/types/addressing/regional_hostname_edit_response.py b/src/cloudflare/types/addressing/regional_hostname_edit_response.py new file mode 100644 index 00000000000..06a760610de --- /dev/null +++ b/src/cloudflare/types/addressing/regional_hostname_edit_response.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["RegionalHostnameEditResponse"] + + +class RegionalHostnameEditResponse(BaseModel): + created_on: datetime + """When the regional hostname was created""" + + hostname: str + """DNS hostname to be regionalized, must be a subdomain of the zone. + + Wildcards are supported for one level, e.g `*.example.com` + """ + + region_key: str + """Identifying key for the region""" diff --git a/src/cloudflare/types/addressing/regional_hostname_get_response.py b/src/cloudflare/types/addressing/regional_hostname_get_response.py new file mode 100644 index 00000000000..24fe021f2fe --- /dev/null +++ b/src/cloudflare/types/addressing/regional_hostname_get_response.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["RegionalHostnameGetResponse"] + + +class RegionalHostnameGetResponse(BaseModel): + created_on: datetime + """When the regional hostname was created""" + + hostname: str + """DNS hostname to be regionalized, must be a subdomain of the zone. + + Wildcards are supported for one level, e.g `*.example.com` + """ + + region_key: str + """Identifying key for the region""" diff --git a/src/cloudflare/types/addressing/regional_hostname_list_response.py b/src/cloudflare/types/addressing/regional_hostname_list_response.py new file mode 100644 index 00000000000..fe454021dc0 --- /dev/null +++ b/src/cloudflare/types/addressing/regional_hostname_list_response.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime + +from ..._models import BaseModel + +__all__ = ["RegionalHostnameListResponse"] + + +class RegionalHostnameListResponse(BaseModel): + created_on: datetime + """When the regional hostname was created""" + + hostname: str + """DNS hostname to be regionalized, must be a subdomain of the zone. + + Wildcards are supported for one level, e.g `*.example.com` + """ + + region_key: str + """Identifying key for the region""" diff --git a/src/cloudflare/types/addressing/regional_hostnames/__init__.py b/src/cloudflare/types/addressing/regional_hostnames/__init__.py new file mode 100644 index 00000000000..cf8fe425ff5 --- /dev/null +++ b/src/cloudflare/types/addressing/regional_hostnames/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .region_list_response import RegionListResponse as RegionListResponse diff --git a/src/cloudflare/types/addressing/regional_hostnames/region_list_response.py b/src/cloudflare/types/addressing/regional_hostnames/region_list_response.py new file mode 100644 index 00000000000..d17c6577e43 --- /dev/null +++ b/src/cloudflare/types/addressing/regional_hostnames/region_list_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["RegionListResponse"] + + +class RegionListResponse(BaseModel): + key: Optional[str] = None + """Identifying key for the region""" + + label: Optional[str] = None + """Human-readable text label for the region""" diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_create_params.py b/src/cloudflare/types/ai_gateway/ai_gateway_create_params.py index c961028df1c..666a25e174e 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_create_params.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_create_params.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Optional +from typing_extensions import Literal, Required, TypedDict __all__ = ["AIGatewayCreateParams"] @@ -10,18 +11,17 @@ class AIGatewayCreateParams(TypedDict, total=False): account_id: Required[str] + id: Required[str] + """gateway id""" + cache_invalidate_on_update: Required[bool] - cache_ttl: Required[int] + cache_ttl: Required[Optional[int]] collect_logs: Required[bool] - name: Required[str] - - slug: Required[str] - - rate_limiting_interval: int + rate_limiting_interval: Required[Optional[int]] - rate_limiting_limit: int + rate_limiting_limit: Required[Optional[int]] - rate_limiting_technique: str + rate_limiting_technique: Required[Literal["fixed", "sliding"]] diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_create_response.py b/src/cloudflare/types/ai_gateway/ai_gateway_create_response.py index d64bb08d610..0b9b7af0175 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_create_response.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_create_response.py @@ -2,6 +2,7 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel @@ -10,10 +11,11 @@ class Task(BaseModel): id: str + """gateway id""" cache_invalidate_on_update: bool - cache_ttl: int + cache_ttl: Optional[int] = None collect_logs: bool @@ -21,15 +23,11 @@ class Task(BaseModel): modified_at: datetime - name: str - - slug: str - rate_limiting_interval: Optional[int] = None rate_limiting_limit: Optional[int] = None - rate_limiting_technique: Optional[str] = None + rate_limiting_technique: Literal["fixed", "sliding"] class AIGatewayCreateResponse(BaseModel): diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_delete_response.py b/src/cloudflare/types/ai_gateway/ai_gateway_delete_response.py index ded796d9e59..e66ae46e886 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_delete_response.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_delete_response.py @@ -2,6 +2,7 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel @@ -10,10 +11,11 @@ class AIGatewayDeleteResponse(BaseModel): id: str + """gateway id""" cache_invalidate_on_update: bool - cache_ttl: int + cache_ttl: Optional[int] = None collect_logs: bool @@ -21,12 +23,8 @@ class AIGatewayDeleteResponse(BaseModel): modified_at: datetime - name: str - - slug: str - rate_limiting_interval: Optional[int] = None rate_limiting_limit: Optional[int] = None - rate_limiting_technique: Optional[str] = None + rate_limiting_technique: Literal["fixed", "sliding"] diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_get_response.py b/src/cloudflare/types/ai_gateway/ai_gateway_get_response.py index e8a52224fee..d62e61d19b2 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_get_response.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_get_response.py @@ -2,6 +2,7 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel @@ -10,10 +11,11 @@ class AIGatewayGetResponse(BaseModel): id: str + """gateway id""" cache_invalidate_on_update: bool - cache_ttl: int + cache_ttl: Optional[int] = None collect_logs: bool @@ -21,12 +23,8 @@ class AIGatewayGetResponse(BaseModel): modified_at: datetime - name: str - - slug: str - rate_limiting_interval: Optional[int] = None rate_limiting_limit: Optional[int] = None - rate_limiting_technique: Optional[str] = None + rate_limiting_technique: Literal["fixed", "sliding"] diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py b/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py index 183008d94a3..71961792462 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_list_params.py @@ -11,6 +11,7 @@ class AIGatewayListParams(TypedDict, total=False): account_id: Required[str] id: str + """gateway id""" order_by: str """Order By Column Name""" diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_list_response.py b/src/cloudflare/types/ai_gateway/ai_gateway_list_response.py index 701d72dd550..bd4a36e0bfb 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_list_response.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_list_response.py @@ -2,6 +2,7 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel @@ -10,10 +11,11 @@ class AIGatewayListResponse(BaseModel): id: str + """gateway id""" cache_invalidate_on_update: bool - cache_ttl: int + cache_ttl: Optional[int] = None collect_logs: bool @@ -21,12 +23,8 @@ class AIGatewayListResponse(BaseModel): modified_at: datetime - name: str - - slug: str - rate_limiting_interval: Optional[int] = None rate_limiting_limit: Optional[int] = None - rate_limiting_technique: Optional[str] = None + rate_limiting_technique: Literal["fixed", "sliding"] diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_update_params.py b/src/cloudflare/types/ai_gateway/ai_gateway_update_params.py index 0e8898de606..05588bd7cf3 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_update_params.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_update_params.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Optional +from typing_extensions import Literal, Required, TypedDict __all__ = ["AIGatewayUpdateParams"] @@ -12,16 +13,12 @@ class AIGatewayUpdateParams(TypedDict, total=False): cache_invalidate_on_update: Required[bool] - cache_ttl: Required[int] + cache_ttl: Required[Optional[int]] collect_logs: Required[bool] - name: Required[str] + rate_limiting_interval: Required[Optional[int]] - slug: Required[str] + rate_limiting_limit: Required[Optional[int]] - rate_limiting_interval: int - - rate_limiting_limit: int - - rate_limiting_technique: str + rate_limiting_technique: Required[Literal["fixed", "sliding"]] diff --git a/src/cloudflare/types/ai_gateway/ai_gateway_update_response.py b/src/cloudflare/types/ai_gateway/ai_gateway_update_response.py index 89e6238af2d..f07218099b5 100644 --- a/src/cloudflare/types/ai_gateway/ai_gateway_update_response.py +++ b/src/cloudflare/types/ai_gateway/ai_gateway_update_response.py @@ -2,6 +2,7 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel @@ -10,10 +11,11 @@ class AIGatewayUpdateResponse(BaseModel): id: str + """gateway id""" cache_invalidate_on_update: bool - cache_ttl: int + cache_ttl: Optional[int] = None collect_logs: bool @@ -21,12 +23,8 @@ class AIGatewayUpdateResponse(BaseModel): modified_at: datetime - name: str - - slug: str - rate_limiting_interval: Optional[int] = None rate_limiting_limit: Optional[int] = None - rate_limiting_technique: Optional[str] = None + rate_limiting_technique: Literal["fixed", "sliding"] diff --git a/src/cloudflare/types/ai_gateway/log_get_response.py b/src/cloudflare/types/ai_gateway/log_get_response.py index 052d5d9d921..c78976e56d4 100644 --- a/src/cloudflare/types/ai_gateway/log_get_response.py +++ b/src/cloudflare/types/ai_gateway/log_get_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from datetime import datetime from ..._models import BaseModel @@ -33,5 +33,17 @@ class LogGetResponseItem(BaseModel): tokens_out: int + metadata: Optional[str] = None + + request_content_type: Optional[str] = None + + request_type: Optional[str] = None + + response_content_type: Optional[str] = None + + status_code: Optional[int] = None + + step: Optional[int] = None + LogGetResponse = List[LogGetResponseItem] diff --git a/src/cloudflare/types/alerting/available_alert_list_response.py b/src/cloudflare/types/alerting/available_alert_list_response.py index 10470fec71c..b0ff8190634 100644 --- a/src/cloudflare/types/alerting/available_alert_list_response.py +++ b/src/cloudflare/types/alerting/available_alert_list_response.py @@ -1,7 +1,27 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import Dict, List, Optional -__all__ = ["AvailableAlertListResponse"] +from ..._models import BaseModel -AvailableAlertListResponse = Union[List[object], str, object, None] +__all__ = ["AvailableAlertListResponse", "AvailableAlertListResponseItem"] + + +class AvailableAlertListResponseItem(BaseModel): + description: Optional[str] = None + """Describes the alert type.""" + + display_name: Optional[str] = None + """Alert type name.""" + + filter_options: Optional[List[object]] = None + """Format of additional configuration options (filters) for the alert type. + + Data type of filters during policy creation: Array of strings. + """ + + type: Optional[str] = None + """Use this value when creating and updating a notification policy.""" + + +AvailableAlertListResponse = Dict[str, List[AvailableAlertListResponseItem]] diff --git a/src/cloudflare/types/alerting/destinations/eligible_get_response.py b/src/cloudflare/types/alerting/destinations/eligible_get_response.py index fa08c934e4b..127867de2c7 100644 --- a/src/cloudflare/types/alerting/destinations/eligible_get_response.py +++ b/src/cloudflare/types/alerting/destinations/eligible_get_response.py @@ -1,7 +1,26 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import Dict, List, Optional +from typing_extensions import Literal -__all__ = ["EligibleGetResponse"] +from ...._models import BaseModel -EligibleGetResponse = Union[List[object], str, object, None] +__all__ = ["EligibleGetResponse", "EligibleGetResponseItem"] + + +class EligibleGetResponseItem(BaseModel): + eligible: Optional[bool] = None + """Determines whether or not the account is eligible for the delivery mechanism.""" + + ready: Optional[bool] = None + """Beta flag. + + Users can create a policy with a mechanism that is not ready, but we cannot + guarantee successful delivery of notifications. + """ + + type: Optional[Literal["email", "pagerduty", "webhook"]] = None + """Determines type of delivery mechanism.""" + + +EligibleGetResponse = Dict[str, List[EligibleGetResponseItem]] diff --git a/src/cloudflare/types/alerting/destinations/pagerduty_delete_response.py b/src/cloudflare/types/alerting/destinations/pagerduty_delete_response.py index 3171e8788bc..958d795048c 100644 --- a/src/cloudflare/types/alerting/destinations/pagerduty_delete_response.py +++ b/src/cloudflare/types/alerting/destinations/pagerduty_delete_response.py @@ -1,7 +1,34 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List, Optional +from typing_extensions import Literal -__all__ = ["PagerdutyDeleteResponse"] +from ...._models import BaseModel +from ...shared.response_info import ResponseInfo -PagerdutyDeleteResponse = Union[List[object], str, object, None] +__all__ = ["PagerdutyDeleteResponse", "ResultInfo"] + + +class ResultInfo(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""" + + +class PagerdutyDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" + + result_info: Optional[ResultInfo] = None diff --git a/src/cloudflare/types/alerting/destinations/webhook_delete_response.py b/src/cloudflare/types/alerting/destinations/webhook_delete_response.py index 2869927bb58..eef159b9921 100644 --- a/src/cloudflare/types/alerting/destinations/webhook_delete_response.py +++ b/src/cloudflare/types/alerting/destinations/webhook_delete_response.py @@ -1,7 +1,34 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List, Optional +from typing_extensions import Literal -__all__ = ["WebhookDeleteResponse"] +from ...._models import BaseModel +from ...shared.response_info import ResponseInfo -WebhookDeleteResponse = Union[List[object], str, object, None] +__all__ = ["WebhookDeleteResponse", "ResultInfo"] + + +class ResultInfo(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""" + + +class WebhookDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" + + result_info: Optional[ResultInfo] = None diff --git a/src/cloudflare/types/alerting/policy_delete_response.py b/src/cloudflare/types/alerting/policy_delete_response.py index f211604e11c..d0feccf6ae2 100644 --- a/src/cloudflare/types/alerting/policy_delete_response.py +++ b/src/cloudflare/types/alerting/policy_delete_response.py @@ -1,7 +1,34 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List, Optional +from typing_extensions import Literal -__all__ = ["PolicyDeleteResponse"] +from ..._models import BaseModel +from ..shared.response_info import ResponseInfo -PolicyDeleteResponse = Union[List[object], str, object, None] +__all__ = ["PolicyDeleteResponse", "ResultInfo"] + + +class ResultInfo(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""" + + +class PolicyDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" + + result_info: Optional[ResultInfo] = None diff --git a/src/cloudflare/types/api_gateway/__init__.py b/src/cloudflare/types/api_gateway/__init__.py new file mode 100644 index 00000000000..15e921a339f --- /dev/null +++ b/src/cloudflare/types/api_gateway/__init__.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .message import Message as Message +from .api_shield import APIShield as APIShield +from .configuration import Configuration as Configuration +from .public_schema import PublicSchema as PublicSchema +from .schema_upload import SchemaUpload as SchemaUpload +from .schema_list_params import SchemaListParams as SchemaListParams +from .discovery_operation import DiscoveryOperation as DiscoveryOperation +from .operation_get_params import OperationGetParams as OperationGetParams +from .schema_list_response import SchemaListResponse as SchemaListResponse +from .operation_list_params import OperationListParams as OperationListParams +from .discovery_get_response import DiscoveryGetResponse as DiscoveryGetResponse +from .user_schema_get_params import UserSchemaGetParams as UserSchemaGetParams +from .operation_create_params import OperationCreateParams as OperationCreateParams +from .user_schema_edit_params import UserSchemaEditParams as UserSchemaEditParams +from .user_schema_list_params import UserSchemaListParams as UserSchemaListParams +from .configuration_get_params import ConfigurationGetParams as ConfigurationGetParams +from .operation_create_response import OperationCreateResponse as OperationCreateResponse +from .operation_delete_response import OperationDeleteResponse as OperationDeleteResponse +from .user_schema_create_params import UserSchemaCreateParams as UserSchemaCreateParams +from .configuration_update_params import ConfigurationUpdateParams as ConfigurationUpdateParams +from .user_schema_delete_response import UserSchemaDeleteResponse as UserSchemaDeleteResponse +from .configuration_update_response import ConfigurationUpdateResponse as ConfigurationUpdateResponse +from .schema_validation_edit_params import SchemaValidationEditParams as SchemaValidationEditParams diff --git a/src/cloudflare/types/api_gateway/api_shield.py b/src/cloudflare/types/api_gateway/api_shield.py new file mode 100644 index 00000000000..5bb350083c2 --- /dev/null +++ b/src/cloudflare/types/api_gateway/api_shield.py @@ -0,0 +1,99 @@ +# 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__ = [ + "APIShield", + "Features", + "FeaturesAPIShieldOperationFeatureThresholds", + "FeaturesAPIShieldOperationFeatureThresholdsThresholds", + "FeaturesAPIShieldOperationFeatureParameterSchemas", + "FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas", + "FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas", +] + + +class FeaturesAPIShieldOperationFeatureThresholdsThresholds(BaseModel): + auth_id_tokens: Optional[int] = None + """The total number of auth-ids seen across this calculation.""" + + data_points: Optional[int] = None + """The number of data points used for the threshold suggestion calculation.""" + + last_updated: Optional[datetime] = None + + p50: Optional[int] = None + """The p50 quantile of requests (in period_seconds).""" + + p90: Optional[int] = None + """The p90 quantile of requests (in period_seconds).""" + + p99: Optional[int] = None + """The p99 quantile of requests (in period_seconds).""" + + period_seconds: Optional[int] = None + """The period over which this threshold is suggested.""" + + requests: Optional[int] = None + """The estimated number of requests covered by these calculations.""" + + suggested_threshold: Optional[int] = None + """The suggested threshold in requests done by the same auth_id or period_seconds.""" + + +class FeaturesAPIShieldOperationFeatureThresholds(BaseModel): + thresholds: Optional[FeaturesAPIShieldOperationFeatureThresholdsThresholds] = None + + +class FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas(BaseModel): + parameters: Optional[List[object]] = None + """An array containing the learned parameter schemas.""" + + responses: Optional[object] = None + """An empty response object. + + This field is required to yield a valid operation schema. + """ + + +class FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas(BaseModel): + last_updated: Optional[datetime] = None + + parameter_schemas: Optional[ + FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas + ] = None + """An operation schema object containing a response.""" + + +class FeaturesAPIShieldOperationFeatureParameterSchemas(BaseModel): + parameter_schemas: FeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas + + +Features = Union[FeaturesAPIShieldOperationFeatureThresholds, FeaturesAPIShieldOperationFeatureParameterSchemas] + + +class APIShield(BaseModel): + endpoint: str + """ + The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + """ + + host: str + """RFC3986-compliant host.""" + + last_updated: datetime + + method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"] + """The HTTP method used to access the endpoint.""" + + operation_id: str + """UUID identifier""" + + features: Optional[Features] = None diff --git a/src/cloudflare/types/api_gateway/configuration.py b/src/cloudflare/types/api_gateway/configuration.py new file mode 100644 index 00000000000..855946241b2 --- /dev/null +++ b/src/cloudflare/types/api_gateway/configuration.py @@ -0,0 +1,46 @@ +# 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__ = [ + "Configuration", + "AuthIDCharacteristic", + "AuthIDCharacteristicAPIShieldAuthIDCharacteristic", + "AuthIDCharacteristicAPIShieldAuthIDCharacteristicJwtClaim", +] + + +class AuthIDCharacteristicAPIShieldAuthIDCharacteristic(BaseModel): + name: str + """The name of the characteristic field, i.e., the header or cookie name.""" + + type: Literal["header", "cookie"] + """The type of characteristic.""" + + +class AuthIDCharacteristicAPIShieldAuthIDCharacteristicJwtClaim(BaseModel): + name: str + """ + Claim location expressed as `$(token_config_id):$(json_path)`, where + `token_config_id` is the ID of the token configuration used in validating the + JWT, and `json_path` is a RFC 9535 JSONPath + (https://goessner.net/articles/JsonPath/, + https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in + dot or bracket notation, may only specify literal keys or array indexes, and + must return a singleton value, which will be interpreted as a string. + """ + + type: Literal["jwt"] + """The type of characteristic.""" + + +AuthIDCharacteristic = Union[ + AuthIDCharacteristicAPIShieldAuthIDCharacteristic, AuthIDCharacteristicAPIShieldAuthIDCharacteristicJwtClaim +] + + +class Configuration(BaseModel): + auth_id_characteristics: Optional[List[AuthIDCharacteristic]] = None diff --git a/src/cloudflare/types/api_gateway/configuration_get_params.py b/src/cloudflare/types/api_gateway/configuration_get_params.py new file mode 100644 index 00000000000..c1be0a862e8 --- /dev/null +++ b/src/cloudflare/types/api_gateway/configuration_get_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 import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ConfigurationGetParams"] + + +class ConfigurationGetParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + properties: List[Literal["auth_id_characteristics"]] + """Requests information about certain properties.""" diff --git a/src/cloudflare/types/api_gateway/configuration_update_params.py b/src/cloudflare/types/api_gateway/configuration_update_params.py new file mode 100644 index 00000000000..52c7aff9ed0 --- /dev/null +++ b/src/cloudflare/types/api_gateway/configuration_update_params.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, Iterable +from typing_extensions import Literal, Required, TypedDict + +__all__ = [ + "ConfigurationUpdateParams", + "AuthIDCharacteristic", + "AuthIDCharacteristicAPIShieldAuthIDCharacteristic", + "AuthIDCharacteristicAPIShieldAuthIDCharacteristicJwtClaim", +] + + +class ConfigurationUpdateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + auth_id_characteristics: Iterable[AuthIDCharacteristic] + + +class AuthIDCharacteristicAPIShieldAuthIDCharacteristic(TypedDict, total=False): + name: Required[str] + """The name of the characteristic field, i.e., the header or cookie name.""" + + type: Required[Literal["header", "cookie"]] + """The type of characteristic.""" + + +class AuthIDCharacteristicAPIShieldAuthIDCharacteristicJwtClaim(TypedDict, total=False): + name: Required[str] + """ + Claim location expressed as `$(token_config_id):$(json_path)`, where + `token_config_id` is the ID of the token configuration used in validating the + JWT, and `json_path` is a RFC 9535 JSONPath + (https://goessner.net/articles/JsonPath/, + https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in + dot or bracket notation, may only specify literal keys or array indexes, and + must return a singleton value, which will be interpreted as a string. + """ + + type: Required[Literal["jwt"]] + """The type of characteristic.""" + + +AuthIDCharacteristic = Union[ + AuthIDCharacteristicAPIShieldAuthIDCharacteristic, AuthIDCharacteristicAPIShieldAuthIDCharacteristicJwtClaim +] diff --git a/src/cloudflare/types/accounts/account_update_response.py b/src/cloudflare/types/api_gateway/configuration_update_response.py similarity index 52% rename from src/cloudflare/types/accounts/account_update_response.py rename to src/cloudflare/types/api_gateway/configuration_update_response.py index a10025d46aa..efe6f827dda 100644 --- a/src/cloudflare/types/accounts/account_update_response.py +++ b/src/cloudflare/types/api_gateway/configuration_update_response.py @@ -2,6 +2,6 @@ from typing import Union, Optional -__all__ = ["AccountUpdateResponse"] +__all__ = ["ConfigurationUpdateResponse"] -AccountUpdateResponse = Union[Optional[str], Optional[object]] +ConfigurationUpdateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/api_gateway/discovery/__init__.py b/src/cloudflare/types/api_gateway/discovery/__init__.py new file mode 100644 index 00000000000..91d80c2cedc --- /dev/null +++ b/src/cloudflare/types/api_gateway/discovery/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .operation_edit_params import OperationEditParams as OperationEditParams +from .operation_list_params import OperationListParams as OperationListParams +from .operation_edit_response import OperationEditResponse as OperationEditResponse diff --git a/src/cloudflare/types/api_gateway/discovery/operation_edit_params.py b/src/cloudflare/types/api_gateway/discovery/operation_edit_params.py new file mode 100644 index 00000000000..903d84d39fc --- /dev/null +++ b/src/cloudflare/types/api_gateway/discovery/operation_edit_params.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["OperationEditParams"] + + +class OperationEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + state: Literal["review", "ignored"] + """Mark state of operation in API Discovery + + - `review` - Mark operation as for review + - `ignored` - Mark operation as ignored + """ diff --git a/src/cloudflare/types/api_gateway/discovery/operation_edit_response.py b/src/cloudflare/types/api_gateway/discovery/operation_edit_response.py new file mode 100644 index 00000000000..ff7f58a5efc --- /dev/null +++ b/src/cloudflare/types/api_gateway/discovery/operation_edit_response.py @@ -0,0 +1,18 @@ +# 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__ = ["OperationEditResponse"] + + +class OperationEditResponse(BaseModel): + state: Optional[Literal["review", "saved", "ignored"]] = None + """State of operation in API Discovery + + - `review` - Operation is not saved into API Shield Endpoint Management + - `saved` - Operation is saved into API Shield Endpoint Management + - `ignored` - Operation is marked as ignored + """ diff --git a/src/cloudflare/types/api_gateway/discovery/operation_list_params.py b/src/cloudflare/types/api_gateway/discovery/operation_list_params.py new file mode 100644 index 00000000000..978fee2d4bb --- /dev/null +++ b/src/cloudflare/types/api_gateway/discovery/operation_list_params.py @@ -0,0 +1,62 @@ +# 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__ = ["OperationListParams"] + + +class OperationListParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + diff: bool + """ + When `true`, only return API Discovery results that are not saved into API + Shield Endpoint Management + """ + + direction: Literal["asc", "desc"] + """Direction to order results.""" + + endpoint: str + """Filter results to only include endpoints containing this pattern.""" + + host: List[str] + """Filter results to only include the specified hosts.""" + + method: List[str] + """Filter results to only include the specified HTTP methods.""" + + order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"] + """Field to order by""" + + origin: Literal["ML", "SessionIdentifier"] + """ + Filter results to only include discovery results sourced from a particular + discovery engine + + - `ML` - Discovered operations that were sourced using ML API Discovery + - `SessionIdentifier` - Discovered operations that were sourced using Session + Identifier API Discovery + """ + + page: object + """Page number of paginated results.""" + + per_page: object + """Maximum number of results per page.""" + + state: Literal["review", "saved", "ignored"] + """Filter results to only include discovery results in a particular state. + + States are as follows + + - `review` - Discovered operations that are not saved into API Shield Endpoint + Management + - `saved` - Discovered operations that are already saved into API Shield + Endpoint Management + - `ignored` - Discovered operations that have been marked as ignored + """ diff --git a/src/cloudflare/types/api_gateway/discovery_get_response.py b/src/cloudflare/types/api_gateway/discovery_get_response.py new file mode 100644 index 00000000000..ac55c572760 --- /dev/null +++ b/src/cloudflare/types/api_gateway/discovery_get_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 datetime import datetime + +from ..._models import BaseModel + +__all__ = ["DiscoveryGetResponse"] + + +class DiscoveryGetResponse(BaseModel): + schemas: Optional[List[object]] = None + + timestamp: Optional[datetime] = None diff --git a/src/cloudflare/types/api_gateway/discovery_operation.py b/src/cloudflare/types/api_gateway/discovery_operation.py new file mode 100644 index 00000000000..bf9570a9176 --- /dev/null +++ b/src/cloudflare/types/api_gateway/discovery_operation.py @@ -0,0 +1,57 @@ +# 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__ = ["DiscoveryOperation", "Features", "FeaturesTrafficStats"] + + +class FeaturesTrafficStats(BaseModel): + last_updated: datetime + + period_seconds: int + """The period in seconds these statistics were computed over""" + + requests: float + """The average number of requests seen during this period""" + + +class Features(BaseModel): + traffic_stats: Optional[FeaturesTrafficStats] = None + + +class DiscoveryOperation(BaseModel): + id: str + """UUID identifier""" + + endpoint: str + """ + The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + """ + + host: str + """RFC3986-compliant host.""" + + last_updated: datetime + + method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"] + """The HTTP method used to access the endpoint.""" + + origin: List[Literal["ML", "SessionIdentifier"]] + """API discovery engine(s) that discovered this operation""" + + state: Literal["review", "saved", "ignored"] + """State of operation in API Discovery + + - `review` - Operation is not saved into API Shield Endpoint Management + - `saved` - Operation is saved into API Shield Endpoint Management + - `ignored` - Operation is marked as ignored + """ + + features: Optional[Features] = None diff --git a/src/cloudflare/types/api_gateway/message.py b/src/cloudflare/types/api_gateway/message.py new file mode 100644 index 00000000000..a09437a8d14 --- /dev/null +++ b/src/cloudflare/types/api_gateway/message.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..shared.response_info import ResponseInfo + +__all__ = ["Message"] + +Message = List[ResponseInfo] diff --git a/src/cloudflare/types/api_gateway/operation_create_params.py b/src/cloudflare/types/api_gateway/operation_create_params.py new file mode 100644 index 00000000000..dbfa97bf6e8 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operation_create_params.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["OperationCreateParams", "Body"] + + +class OperationCreateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + body: Required[Iterable[Body]] + + +class Body(TypedDict, total=False): + endpoint: Required[str] + """ + The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + """ + + host: Required[str] + """RFC3986-compliant host.""" + + method: Required[Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"]] + """The HTTP method used to access the endpoint.""" diff --git a/src/cloudflare/types/api_gateway/operation_create_response.py b/src/cloudflare/types/api_gateway/operation_create_response.py new file mode 100644 index 00000000000..2244d14cf30 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operation_create_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .api_shield import APIShield + +__all__ = ["OperationCreateResponse"] + +OperationCreateResponse = List[APIShield] diff --git a/src/cloudflare/types/user/organization_get_response.py b/src/cloudflare/types/api_gateway/operation_delete_response.py similarity index 55% rename from src/cloudflare/types/user/organization_get_response.py rename to src/cloudflare/types/api_gateway/operation_delete_response.py index 4ba74b46f85..5c1266decb6 100644 --- a/src/cloudflare/types/user/organization_get_response.py +++ b/src/cloudflare/types/api_gateway/operation_delete_response.py @@ -2,6 +2,6 @@ from typing import Union, Optional -__all__ = ["OrganizationGetResponse"] +__all__ = ["OperationDeleteResponse"] -OrganizationGetResponse = Union[Optional[str], Optional[object]] +OperationDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/api_gateway/operation_get_params.py b/src/cloudflare/types/api_gateway/operation_get_params.py new file mode 100644 index 00000000000..e752e501aae --- /dev/null +++ b/src/cloudflare/types/api_gateway/operation_get_params.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["OperationGetParams"] + + +class OperationGetParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] + """Add feature(s) to the results. + + The feature name that is given here corresponds to the resulting feature object. + Have a look at the top-level object description for more details on the specific + meaning. + """ diff --git a/src/cloudflare/types/api_gateway/operation_list_params.py b/src/cloudflare/types/api_gateway/operation_list_params.py new file mode 100644 index 00000000000..d36dac5d172 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operation_list_params.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 List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["OperationListParams"] + + +class OperationListParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + direction: Literal["asc", "desc"] + """Direction to order results.""" + + endpoint: str + """Filter results to only include endpoints containing this pattern.""" + + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] + """Add feature(s) to the results. + + The feature name that is given here corresponds to the resulting feature object. + Have a look at the top-level object description for more details on the specific + meaning. + """ + + host: List[str] + """Filter results to only include the specified hosts.""" + + method: List[str] + """Filter results to only include the specified HTTP methods.""" + + order: Literal["method", "host", "endpoint", "thresholds.$key"] + """Field to order by. + + When requesting a feature, the feature keys are available for ordering as well, + e.g., `thresholds.suggested_threshold`. + """ + + page: object + """Page number of paginated results.""" + + per_page: float + """Number of results to return per page""" diff --git a/src/cloudflare/types/api_gateway/operations/__init__.py b/src/cloudflare/types/api_gateway/operations/__init__.py new file mode 100644 index 00000000000..12668aae6be --- /dev/null +++ b/src/cloudflare/types/api_gateway/operations/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .settings_multiple_request import SettingsMultipleRequest as SettingsMultipleRequest +from .schema_validation_edit_params import SchemaValidationEditParams as SchemaValidationEditParams +from .schema_validation_get_response import SchemaValidationGetResponse as SchemaValidationGetResponse +from .schema_validation_update_params import SchemaValidationUpdateParams as SchemaValidationUpdateParams +from .settings_multiple_request_param import SettingsMultipleRequestParam as SettingsMultipleRequestParam +from .schema_validation_update_response import SchemaValidationUpdateResponse as SchemaValidationUpdateResponse diff --git a/src/cloudflare/types/api_gateway/operations/schema_validation_edit_params.py b/src/cloudflare/types/api_gateway/operations/schema_validation_edit_params.py new file mode 100644 index 00000000000..45926402aa5 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operations/schema_validation_edit_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 + +from .settings_multiple_request_param import SettingsMultipleRequestParam + +__all__ = ["SchemaValidationEditParams"] + + +class SchemaValidationEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + settings_multiple_request: Required[SettingsMultipleRequestParam] diff --git a/src/cloudflare/types/api_gateway/operations/schema_validation_get_response.py b/src/cloudflare/types/api_gateway/operations/schema_validation_get_response.py new file mode 100644 index 00000000000..32fdc4cb3d4 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operations/schema_validation_get_response.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__ = ["SchemaValidationGetResponse"] + + +class SchemaValidationGetResponse(BaseModel): + mitigation_action: Optional[Literal["log", "block", "none"]] = None + """When set, this applies a mitigation action to this operation + + - `log` log request when request does not conform to schema for this operation + - `block` deny access to the site when request does not conform to schema for + this operation + - `none` will skip mitigation for this operation + - `null` indicates that no operation level mitigation is in place, see Zone + Level Schema Validation Settings for mitigation action that will be applied + """ diff --git a/src/cloudflare/types/api_gateway/operations/schema_validation_update_params.py b/src/cloudflare/types/api_gateway/operations/schema_validation_update_params.py new file mode 100644 index 00000000000..e9975b01cda --- /dev/null +++ b/src/cloudflare/types/api_gateway/operations/schema_validation_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 import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["SchemaValidationUpdateParams"] + + +class SchemaValidationUpdateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + mitigation_action: Optional[Literal["log", "block", "none"]] + """When set, this applies a mitigation action to this operation + + - `log` log request when request does not conform to schema for this operation + - `block` deny access to the site when request does not conform to schema for + this operation + - `none` will skip mitigation for this operation + - `null` indicates that no operation level mitigation is in place, see Zone + Level Schema Validation Settings for mitigation action that will be applied + """ diff --git a/src/cloudflare/types/api_gateway/operations/schema_validation_update_response.py b/src/cloudflare/types/api_gateway/operations/schema_validation_update_response.py new file mode 100644 index 00000000000..ab2d8ffd967 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operations/schema_validation_update_response.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__ = ["SchemaValidationUpdateResponse"] + + +class SchemaValidationUpdateResponse(BaseModel): + mitigation_action: Optional[Literal["log", "block", "none"]] = None + """When set, this applies a mitigation action to this operation + + - `log` log request when request does not conform to schema for this operation + - `block` deny access to the site when request does not conform to schema for + this operation + - `none` will skip mitigation for this operation + - `null` indicates that no operation level mitigation is in place, see Zone + Level Schema Validation Settings for mitigation action that will be applied + """ diff --git a/src/cloudflare/types/api_gateway/operations/settings_multiple_request.py b/src/cloudflare/types/api_gateway/operations/settings_multiple_request.py new file mode 100644 index 00000000000..b55c1a48c87 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operations/settings_multiple_request.py @@ -0,0 +1,24 @@ +# 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__ = ["SettingsMultipleRequest", "SettingsMultipleRequestItem"] + + +class SettingsMultipleRequestItem(BaseModel): + mitigation_action: Optional[Literal["log", "block", "none"]] = None + """When set, this applies a mitigation action to this operation + + - `log` log request when request does not conform to schema for this operation + - `block` deny access to the site when request does not conform to schema for + this operation + - `none` will skip mitigation for this operation + - `null` indicates that no operation level mitigation is in place, see Zone + Level Schema Validation Settings for mitigation action that will be applied + """ + + +SettingsMultipleRequest = Dict[str, SettingsMultipleRequestItem] diff --git a/src/cloudflare/types/api_gateway/operations/settings_multiple_request_param.py b/src/cloudflare/types/api_gateway/operations/settings_multiple_request_param.py new file mode 100644 index 00000000000..ec180487534 --- /dev/null +++ b/src/cloudflare/types/api_gateway/operations/settings_multiple_request_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 Dict, Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["SettingsMultipleRequestParam", "SettingsMultipleRequestParamItem"] + + +class SettingsMultipleRequestParamItem(TypedDict, total=False): + mitigation_action: Optional[Literal["log", "block", "none"]] + """When set, this applies a mitigation action to this operation + + - `log` log request when request does not conform to schema for this operation + - `block` deny access to the site when request does not conform to schema for + this operation + - `none` will skip mitigation for this operation + - `null` indicates that no operation level mitigation is in place, see Zone + Level Schema Validation Settings for mitigation action that will be applied + """ + + +SettingsMultipleRequestParam = Dict[str, SettingsMultipleRequestParamItem] diff --git a/src/cloudflare/types/api_gateway/public_schema.py b/src/cloudflare/types/api_gateway/public_schema.py new file mode 100644 index 00000000000..6dabec42f5c --- /dev/null +++ b/src/cloudflare/types/api_gateway/public_schema.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 typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PublicSchema"] + + +class PublicSchema(BaseModel): + created_at: datetime + + kind: Literal["openapi_v3"] + """Kind of schema""" + + name: str + """Name of the schema""" + + schema_id: str + """UUID identifier""" + + source: Optional[str] = None + """Source of the schema""" + + validation_enabled: Optional[bool] = None + """Flag whether schema is enabled for validation.""" diff --git a/src/cloudflare/types/api_gateway/schema_list_params.py b/src/cloudflare/types/api_gateway/schema_list_params.py new file mode 100644 index 00000000000..7bc4f9ac025 --- /dev/null +++ b/src/cloudflare/types/api_gateway/schema_list_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 import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["SchemaListParams"] + + +class SchemaListParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] + """Add feature(s) to the results. + + The feature name that is given here corresponds to the resulting feature object. + Have a look at the top-level object description for more details on the specific + meaning. + """ + + host: List[str] + """Receive schema only for the given host(s).""" diff --git a/src/cloudflare/types/api_gateway/schema_list_response.py b/src/cloudflare/types/api_gateway/schema_list_response.py new file mode 100644 index 00000000000..9b7b5b00ae8 --- /dev/null +++ b/src/cloudflare/types/api_gateway/schema_list_response.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["SchemaListResponse"] + + +class SchemaListResponse(BaseModel): + schemas: Optional[List[object]] = None + + timestamp: Optional[str] = None diff --git a/src/cloudflare/types/api_gateway/schema_upload.py b/src/cloudflare/types/api_gateway/schema_upload.py new file mode 100644 index 00000000000..3df20a038b4 --- /dev/null +++ b/src/cloudflare/types/api_gateway/schema_upload.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 +from .public_schema import PublicSchema + +__all__ = ["SchemaUpload", "UploadDetails", "UploadDetailsWarning"] + + +class UploadDetailsWarning(BaseModel): + code: int + """Code that identifies the event that occurred.""" + + locations: Optional[List[str]] = None + """JSONPath location(s) in the schema where these events were encountered. + + See + [https://goessner.net/articles/JsonPath/](https://goessner.net/articles/JsonPath/) + for JSONPath specification. + """ + + message: Optional[str] = None + """Diagnostic message that describes the event.""" + + +class UploadDetails(BaseModel): + warnings: Optional[List[UploadDetailsWarning]] = None + """Diagnostic warning events that occurred during processing. + + These events are non-critical errors found within the schema. + """ + + +class SchemaUpload(BaseModel): + schema_: PublicSchema = FieldInfo(alias="schema") + + upload_details: Optional[UploadDetails] = None diff --git a/src/cloudflare/types/api_gateway/schema_validation_edit_params.py b/src/cloudflare/types/api_gateway/schema_validation_edit_params.py new file mode 100644 index 00000000000..424471b1283 --- /dev/null +++ b/src/cloudflare/types/api_gateway/schema_validation_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 Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["SchemaValidationEditParams"] + + +class SchemaValidationEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + validation_default_mitigation_action: Optional[Literal["none", "log", "block"]] + """ + The default mitigation action used when there is no mitigation action defined on + the operation Mitigation actions are as follows: + + - `log` - log request when request does not conform to schema + - `block` - deny access to the site when request does not conform to schema + + A special value of of `none` will skip running schema validation entirely for + the request when there is no mitigation action defined on the operation + + `null` will have no effect. + """ + + validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] + """When set, this overrides both zone level and operation level mitigation actions. + + - `none` will skip running schema validation entirely for the request + + To clear any override, use the special value `disable_override` + + `null` will have no effect. + """ diff --git a/src/cloudflare/types/api_gateway/settings/__init__.py b/src/cloudflare/types/api_gateway/settings/__init__.py new file mode 100644 index 00000000000..6bf117b4acd --- /dev/null +++ b/src/cloudflare/types/api_gateway/settings/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .settings import Settings as Settings +from .schema_validation_update_params import SchemaValidationUpdateParams as SchemaValidationUpdateParams diff --git a/src/cloudflare/types/api_gateway/settings/schema_validation_update_params.py b/src/cloudflare/types/api_gateway/settings/schema_validation_update_params.py new file mode 100644 index 00000000000..e7ffb4e6bdd --- /dev/null +++ b/src/cloudflare/types/api_gateway/settings/schema_validation_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 Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["SchemaValidationUpdateParams"] + + +class SchemaValidationUpdateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + validation_default_mitigation_action: Required[Literal["none", "log", "block"]] + """ + The default mitigation action used when there is no mitigation action defined on + the operation + + Mitigation actions are as follows: + + - `log` - log request when request does not conform to schema + - `block` - deny access to the site when request does not conform to schema + + A special value of of `none` will skip running schema validation entirely for + the request when there is no mitigation action defined on the operation + """ + + validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] + """When set, this overrides both zone level and operation level mitigation actions. + + - `none` will skip running schema validation entirely for the request + - `null` indicates that no override is in place + + To clear any override, use the special value `disable_override` or `null` + """ diff --git a/src/cloudflare/types/api_gateway/settings/settings.py b/src/cloudflare/types/api_gateway/settings/settings.py new file mode 100644 index 00000000000..b8d1b00260c --- /dev/null +++ b/src/cloudflare/types/api_gateway/settings/settings.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__ = ["Settings"] + + +class Settings(BaseModel): + validation_default_mitigation_action: Optional[Literal["none", "log", "block"]] = None + """ + The default mitigation action used when there is no mitigation action defined on + the operation + + Mitigation actions are as follows: + + - `log` - log request when request does not conform to schema + - `block` - deny access to the site when request does not conform to schema + + A special value of of `none` will skip running schema validation entirely for + the request when there is no mitigation action defined on the operation + """ + + validation_override_mitigation_action: Optional[Literal["none"]] = None + """When set, this overrides both zone level and operation level mitigation actions. + + - `none` will skip running schema validation entirely for the request + - `null` indicates that no override is in place + """ diff --git a/src/cloudflare/types/api_gateway/user_schema_create_params.py b/src/cloudflare/types/api_gateway/user_schema_create_params.py new file mode 100644 index 00000000000..10d9593240a --- /dev/null +++ b/src/cloudflare/types/api_gateway/user_schema_create_params.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 Literal, Required, TypedDict + +from ..._types import FileTypes + +__all__ = ["UserSchemaCreateParams"] + + +class UserSchemaCreateParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + file: Required[FileTypes] + """Schema file bytes""" + + kind: Required[Literal["openapi_v3"]] + """Kind of schema""" + + name: str + """Name of the schema""" + + validation_enabled: Literal["true", "false"] + """Flag whether schema is enabled for validation.""" diff --git a/src/cloudflare/types/accounts/account_get_response.py b/src/cloudflare/types/api_gateway/user_schema_delete_response.py similarity index 54% rename from src/cloudflare/types/accounts/account_get_response.py rename to src/cloudflare/types/api_gateway/user_schema_delete_response.py index 90ec592d62b..5a901e1de91 100644 --- a/src/cloudflare/types/accounts/account_get_response.py +++ b/src/cloudflare/types/api_gateway/user_schema_delete_response.py @@ -2,6 +2,6 @@ from typing import Union, Optional -__all__ = ["AccountGetResponse"] +__all__ = ["UserSchemaDeleteResponse"] -AccountGetResponse = Union[Optional[str], Optional[object]] +UserSchemaDeleteResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/api_gateway/user_schema_edit_params.py b/src/cloudflare/types/api_gateway/user_schema_edit_params.py new file mode 100644 index 00000000000..99e15349c77 --- /dev/null +++ b/src/cloudflare/types/api_gateway/user_schema_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 Literal, Required, TypedDict + +__all__ = ["UserSchemaEditParams"] + + +class UserSchemaEditParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + validation_enabled: Literal[True] + """Flag whether schema is enabled for validation.""" diff --git a/src/cloudflare/types/api_gateway/user_schema_get_params.py b/src/cloudflare/types/api_gateway/user_schema_get_params.py new file mode 100644 index 00000000000..dbaee3dee47 --- /dev/null +++ b/src/cloudflare/types/api_gateway/user_schema_get_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__ = ["UserSchemaGetParams"] + + +class UserSchemaGetParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + omit_source: bool + """Omit the source-files of schemas and only retrieve their meta-data.""" diff --git a/src/cloudflare/types/api_gateway/user_schema_list_params.py b/src/cloudflare/types/api_gateway/user_schema_list_params.py new file mode 100644 index 00000000000..a46fd077690 --- /dev/null +++ b/src/cloudflare/types/api_gateway/user_schema_list_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 Required, TypedDict + +__all__ = ["UserSchemaListParams"] + + +class UserSchemaListParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + omit_source: bool + """Omit the source-files of schemas and only retrieve their meta-data.""" + + page: object + """Page number of paginated results.""" + + per_page: object + """Maximum number of results per page.""" + + validation_enabled: bool + """Flag whether schema is enabled for validation.""" diff --git a/src/cloudflare/types/api_gateway/user_schemas/__init__.py b/src/cloudflare/types/api_gateway/user_schemas/__init__.py new file mode 100644 index 00000000000..597343a578b --- /dev/null +++ b/src/cloudflare/types/api_gateway/user_schemas/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .operation_list_params import OperationListParams as OperationListParams +from .operation_list_response import OperationListResponse as OperationListResponse diff --git a/src/cloudflare/types/api_gateway/user_schemas/operation_list_params.py b/src/cloudflare/types/api_gateway/user_schemas/operation_list_params.py new file mode 100644 index 00000000000..8e6eaebd97b --- /dev/null +++ b/src/cloudflare/types/api_gateway/user_schemas/operation_list_params.py @@ -0,0 +1,44 @@ +# 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__ = ["OperationListParams"] + + +class OperationListParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + endpoint: str + """Filter results to only include endpoints containing this pattern.""" + + feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] + """Add feature(s) to the results. + + The feature name that is given here corresponds to the resulting feature object. + Have a look at the top-level object description for more details on the specific + meaning. + """ + + host: List[str] + """Filter results to only include the specified hosts.""" + + method: List[str] + """Filter results to only include the specified HTTP methods.""" + + operation_status: Literal["new", "existing"] + """ + Filter results by whether operations exist in API Shield Endpoint Management or + not. `new` will just return operations from the schema that do not exist in API + Shield Endpoint Management. `existing` will just return operations from the + schema that already exist in API Shield Endpoint Management. + """ + + page: object + """Page number of paginated results.""" + + per_page: object + """Maximum number of results per page.""" diff --git a/src/cloudflare/types/api_gateway/user_schemas/operation_list_response.py b/src/cloudflare/types/api_gateway/user_schemas/operation_list_response.py new file mode 100644 index 00000000000..b4ff6af36be --- /dev/null +++ b/src/cloudflare/types/api_gateway/user_schemas/operation_list_response.py @@ -0,0 +1,28 @@ +# 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 ..api_shield import APIShield + +__all__ = ["OperationListResponse", "APIShieldBasicOperation"] + + +class APIShieldBasicOperation(BaseModel): + endpoint: str + """ + The endpoint which can contain path parameter templates in curly braces, each + will be replaced from left to right with {varN}, starting with {var1}, during + insertion. This will further be Cloudflare-normalized upon insertion. See: + https://developers.cloudflare.com/rules/normalization/how-it-works/. + """ + + host: str + """RFC3986-compliant host.""" + + method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"] + """The HTTP method used to access the endpoint.""" + + +OperationListResponse = Union[APIShield, APIShieldBasicOperation] diff --git a/src/cloudflare/types/argo/tiered_caching_edit_response.py b/src/cloudflare/types/argo/tiered_caching_edit_response.py index e86ebbfb070..0e99559b8f5 100644 --- a/src/cloudflare/types/argo/tiered_caching_edit_response.py +++ b/src/cloudflare/types/argo/tiered_caching_edit_response.py @@ -1,7 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel __all__ = ["TieredCachingEditResponse"] -TieredCachingEditResponse = Union[Optional[str], Optional[object]] + +class TieredCachingEditResponse(BaseModel): + id: str + """The identifier of the caching setting""" + + editable: bool + """Whether the setting is editable""" + + modified_on: datetime + """The time when the setting was last modified""" + + value: Literal["on", "off"] + """The status of the feature being on / off""" diff --git a/src/cloudflare/types/argo/tiered_caching_get_response.py b/src/cloudflare/types/argo/tiered_caching_get_response.py index b50be22c227..72f04aac880 100644 --- a/src/cloudflare/types/argo/tiered_caching_get_response.py +++ b/src/cloudflare/types/argo/tiered_caching_get_response.py @@ -1,7 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel __all__ = ["TieredCachingGetResponse"] -TieredCachingGetResponse = Union[Optional[str], Optional[object]] + +class TieredCachingGetResponse(BaseModel): + id: str + """The identifier of the caching setting""" + + editable: bool + """Whether the setting is editable""" + + modified_on: datetime + """The time when the setting was last modified""" + + value: Literal["on", "off"] + """The status of the feature being on / off""" diff --git a/src/cloudflare/types/cache/cache_purge_params.py b/src/cloudflare/types/cache/cache_purge_params.py index 5eb2fbb56c7..53155b6f63a 100644 --- a/src/cloudflare/types/cache/cache_purge_params.py +++ b/src/cloudflare/types/cache/cache_purge_params.py @@ -2,57 +2,92 @@ from __future__ import annotations -from typing import List, Union +from typing import List, Union, Iterable from typing_extensions import Required, TypedDict __all__ = [ "CachePurgeParams", - "CachePurgeTags", - "CachePurgeHosts", - "CachePurgePrefixes", + "CachePurgeFlexPurgeByTags", + "CachePurgeFlexPurgeByHostnames", + "CachePurgeFlexPurgeByPrefixes", "CachePurgeEverything", - "CachePurgeFiles", - "CachePurgeFilesFile", - "CachePurgeFilesFileCachePurgeURLAndHeaders", + "CachePurgeSingleFile", + "CachePurgeSingleFileWithURLAndHeaders", + "CachePurgeSingleFileWithURLAndHeadersFile", ] -class CachePurgeTags(TypedDict, total=False): +class CachePurgeFlexPurgeByTags(TypedDict, total=False): zone_id: Required[str] tags: List[str] + """ + For more information on cache tags and purging by tags, please refer to + [purge by cache-tags documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-tags/#purge-cache-by-cache-tags-enterprise-only). + """ -class CachePurgeHosts(TypedDict, total=False): +class CachePurgeFlexPurgeByHostnames(TypedDict, total=False): zone_id: Required[str] hosts: List[str] + """ + For more information purging by hostnames, please refer to + [purge by hostname documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-hostname/). + """ -class CachePurgePrefixes(TypedDict, total=False): +class CachePurgeFlexPurgeByPrefixes(TypedDict, total=False): zone_id: Required[str] prefixes: List[str] + """ + For more information on purging by prefixes, please refer to + [purge by prefix documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge_by_prefix/). + """ class CachePurgeEverything(TypedDict, total=False): zone_id: Required[str] purge_everything: bool + """ + For more information, please refer to + [purge everything documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-everything/). + """ -class CachePurgeFiles(TypedDict, total=False): +class CachePurgeSingleFile(TypedDict, total=False): zone_id: Required[str] - files: List[CachePurgeFilesFile] + files: List[str] + """ + For more information on purging files, please refer to + [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). + """ -class CachePurgeFilesFileCachePurgeURLAndHeaders(TypedDict, total=False): +class CachePurgeSingleFileWithURLAndHeaders(TypedDict, total=False): + zone_id: Required[str] + + files: Iterable[CachePurgeSingleFileWithURLAndHeadersFile] + """ + For more information on purging files with URL and headers, please refer to + [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). + """ + + +class CachePurgeSingleFileWithURLAndHeadersFile(TypedDict, total=False): headers: object url: str -CachePurgeFilesFile = Union[str, CachePurgeFilesFileCachePurgeURLAndHeaders] - -CachePurgeParams = Union[CachePurgeTags, CachePurgeHosts, CachePurgePrefixes, CachePurgeEverything, CachePurgeFiles] +CachePurgeParams = Union[ + CachePurgeFlexPurgeByTags, + CachePurgeFlexPurgeByHostnames, + CachePurgeFlexPurgeByPrefixes, + CachePurgeEverything, + CachePurgeSingleFile, + CachePurgeSingleFileWithURLAndHeaders, +] diff --git a/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py b/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py index 5163ec1c632..3ccc2711f88 100644 --- a/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py +++ b/src/cloudflare/types/cache/smart_tiered_cache_delete_response.py @@ -1,7 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel __all__ = ["SmartTieredCacheDeleteResponse"] -SmartTieredCacheDeleteResponse = Union[Optional[str], Optional[object]] + +class SmartTieredCacheDeleteResponse(BaseModel): + id: str + """The identifier of the caching setting""" + + editable: bool + """Whether the setting is editable""" + + modified_on: datetime + """The time when the setting was last modified""" + + value: Literal["on", "off"] + """The status of the feature being on / off""" diff --git a/src/cloudflare/types/cache/smart_tiered_cache_edit_params.py b/src/cloudflare/types/cache/smart_tiered_cache_edit_params.py index 5ab8be3dd6b..557f0df09fe 100644 --- a/src/cloudflare/types/cache/smart_tiered_cache_edit_params.py +++ b/src/cloudflare/types/cache/smart_tiered_cache_edit_params.py @@ -12,4 +12,4 @@ class SmartTieredCacheEditParams(TypedDict, total=False): """Identifier""" value: Required[Literal["on", "off"]] - """Enables Tiered Cache.""" + """Enable or disable the Smart Tiered Cache""" diff --git a/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py b/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py index 904f1c78e2f..8e871b0599c 100644 --- a/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py +++ b/src/cloudflare/types/cache/smart_tiered_cache_edit_response.py @@ -1,7 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel __all__ = ["SmartTieredCacheEditResponse"] -SmartTieredCacheEditResponse = Union[Optional[str], Optional[object]] + +class SmartTieredCacheEditResponse(BaseModel): + id: str + """The identifier of the caching setting""" + + editable: bool + """Whether the setting is editable""" + + modified_on: datetime + """The time when the setting was last modified""" + + value: Literal["on", "off"] + """The status of the feature being on / off""" diff --git a/src/cloudflare/types/cache/smart_tiered_cache_get_response.py b/src/cloudflare/types/cache/smart_tiered_cache_get_response.py index d174244f78d..787aa0d5d59 100644 --- a/src/cloudflare/types/cache/smart_tiered_cache_get_response.py +++ b/src/cloudflare/types/cache/smart_tiered_cache_get_response.py @@ -1,7 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel __all__ = ["SmartTieredCacheGetResponse"] -SmartTieredCacheGetResponse = Union[Optional[str], Optional[object]] + +class SmartTieredCacheGetResponse(BaseModel): + id: str + """The identifier of the caching setting""" + + editable: bool + """Whether the setting is editable""" + + modified_on: datetime + """The time when the setting was last modified""" + + value: Literal["on", "off"] + """The status of the feature being on / off""" diff --git a/src/cloudflare/types/calls/__init__.py b/src/cloudflare/types/calls/__init__.py index b3889df1cbc..df3d07db98d 100644 --- a/src/cloudflare/types/calls/__init__.py +++ b/src/cloudflare/types/calls/__init__.py @@ -4,5 +4,6 @@ from .calls_app import CallsApp as CallsApp from .call_create_params import CallCreateParams as CallCreateParams +from .call_list_response import CallListResponse as CallListResponse from .call_update_params import CallUpdateParams as CallUpdateParams from .calls_app_with_secret import CallsAppWithSecret as CallsAppWithSecret diff --git a/src/cloudflare/types/kv/namespaces/value_get_response.py b/src/cloudflare/types/calls/call_list_response.py similarity index 62% rename from src/cloudflare/types/kv/namespaces/value_get_response.py rename to src/cloudflare/types/calls/call_list_response.py index 81657f0d82b..ff6eaf3e99f 100644 --- a/src/cloudflare/types/kv/namespaces/value_get_response.py +++ b/src/cloudflare/types/calls/call_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -__all__ = ["ValueGetResponse"] +__all__ = ["CallListResponse"] -ValueGetResponse = str +CallListResponse = str diff --git a/src/cloudflare/types/calls/calls_app_with_secret.py b/src/cloudflare/types/calls/calls_app_with_secret.py index 820a8080f27..41adc52c1f5 100644 --- a/src/cloudflare/types/calls/calls_app_with_secret.py +++ b/src/cloudflare/types/calls/calls_app_with_secret.py @@ -19,7 +19,7 @@ class CallsAppWithSecret(BaseModel): """A short description of Calls app, not shown to end users.""" secret: Optional[str] = None - """Bearer token to use the Calls API.""" + """Bearer token""" uid: Optional[str] = None """A Cloudflare-generated unique identifier for a item.""" diff --git a/src/cloudflare/types/calls/turn/__init__.py b/src/cloudflare/types/calls/turn/__init__.py new file mode 100644 index 00000000000..4bb96b15b72 --- /dev/null +++ b/src/cloudflare/types/calls/turn/__init__.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .key_get_response import KeyGetResponse as KeyGetResponse +from .key_create_params import KeyCreateParams as KeyCreateParams +from .key_list_response import KeyListResponse as KeyListResponse +from .key_update_params import KeyUpdateParams as KeyUpdateParams +from .key_create_response import KeyCreateResponse as KeyCreateResponse +from .key_delete_response import KeyDeleteResponse as KeyDeleteResponse +from .key_update_response import KeyUpdateResponse as KeyUpdateResponse diff --git a/src/cloudflare/types/calls/turn/key_create_params.py b/src/cloudflare/types/calls/turn/key_create_params.py new file mode 100644 index 00000000000..7bf69400dc0 --- /dev/null +++ b/src/cloudflare/types/calls/turn/key_create_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__ = ["KeyCreateParams"] + + +class KeyCreateParams(TypedDict, total=False): + account_id: Required[str] + """The account identifier tag.""" + + name: str + """A short description of a TURN key, not shown to end users.""" diff --git a/src/cloudflare/types/calls/turn/key_create_response.py b/src/cloudflare/types/calls/turn/key_create_response.py new file mode 100644 index 00000000000..fb228b86b86 --- /dev/null +++ b/src/cloudflare/types/calls/turn/key_create_response.py @@ -0,0 +1,25 @@ +# 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__ = ["KeyCreateResponse"] + + +class KeyCreateResponse(BaseModel): + created: Optional[datetime] = None + """The date and time the item was created.""" + + key: Optional[str] = None + """Bearer token""" + + modified: Optional[datetime] = None + """The date and time the item was last modified.""" + + name: Optional[str] = None + """A short description of a TURN key, not shown to end users.""" + + uid: Optional[str] = None + """A Cloudflare-generated unique identifier for a item.""" diff --git a/src/cloudflare/types/calls/turn/key_delete_response.py b/src/cloudflare/types/calls/turn/key_delete_response.py new file mode 100644 index 00000000000..567f4d5cd8f --- /dev/null +++ b/src/cloudflare/types/calls/turn/key_delete_response.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["KeyDeleteResponse"] + +KeyDeleteResponse = str diff --git a/src/cloudflare/types/calls/turn/key_get_response.py b/src/cloudflare/types/calls/turn/key_get_response.py new file mode 100644 index 00000000000..71d24bb41c9 --- /dev/null +++ b/src/cloudflare/types/calls/turn/key_get_response.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["KeyGetResponse"] + +KeyGetResponse = str diff --git a/src/cloudflare/types/calls/turn/key_list_response.py b/src/cloudflare/types/calls/turn/key_list_response.py new file mode 100644 index 00000000000..0361bf29dc9 --- /dev/null +++ b/src/cloudflare/types/calls/turn/key_list_response.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["KeyListResponse"] + +KeyListResponse = str diff --git a/src/cloudflare/types/calls/turn/key_update_params.py b/src/cloudflare/types/calls/turn/key_update_params.py new file mode 100644 index 00000000000..0895691ce90 --- /dev/null +++ b/src/cloudflare/types/calls/turn/key_update_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__ = ["KeyUpdateParams"] + + +class KeyUpdateParams(TypedDict, total=False): + account_id: Required[str] + """The account identifier tag.""" + + name: str + """A short description of a TURN key, not shown to end users.""" diff --git a/src/cloudflare/types/calls/turn/key_update_response.py b/src/cloudflare/types/calls/turn/key_update_response.py new file mode 100644 index 00000000000..77ea5be7481 --- /dev/null +++ b/src/cloudflare/types/calls/turn/key_update_response.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +__all__ = ["KeyUpdateResponse"] + +KeyUpdateResponse = str diff --git a/src/cloudflare/types/d1/__init__.py b/src/cloudflare/types/d1/__init__.py index 2c77c7a96e5..fe272f9209e 100644 --- a/src/cloudflare/types/d1/__init__.py +++ b/src/cloudflare/types/d1/__init__.py @@ -4,8 +4,10 @@ from .d1 import D1 as D1 from .query_result import QueryResult as QueryResult +from .database_raw_params import DatabaseRawParams as DatabaseRawParams from .database_list_params import DatabaseListParams as DatabaseListParams from .database_query_params import DatabaseQueryParams as DatabaseQueryParams +from .database_raw_response import DatabaseRawResponse as DatabaseRawResponse from .database_create_params import DatabaseCreateParams as DatabaseCreateParams from .database_list_response import DatabaseListResponse as DatabaseListResponse from .database_query_response import DatabaseQueryResponse as DatabaseQueryResponse diff --git a/src/cloudflare/types/d1/database_query_params.py b/src/cloudflare/types/d1/database_query_params.py index c76047eb12b..5c33fb076cb 100644 --- a/src/cloudflare/types/d1/database_query_params.py +++ b/src/cloudflare/types/d1/database_query_params.py @@ -9,7 +9,7 @@ class DatabaseQueryParams(TypedDict, total=False): - account_identifier: Required[str] + account_id: Required[str] """Account identifier tag.""" sql: Required[str] diff --git a/src/cloudflare/types/d1/database_raw_params.py b/src/cloudflare/types/d1/database_raw_params.py new file mode 100644 index 00000000000..9c056647b21 --- /dev/null +++ b/src/cloudflare/types/d1/database_raw_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 import List +from typing_extensions import Required, TypedDict + +__all__ = ["DatabaseRawParams"] + + +class DatabaseRawParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + sql: Required[str] + + params: List[str] diff --git a/src/cloudflare/types/d1/database_raw_response.py b/src/cloudflare/types/d1/database_raw_response.py new file mode 100644 index 00000000000..f59973dba74 --- /dev/null +++ b/src/cloudflare/types/d1/database_raw_response.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 ..._models import BaseModel + +__all__ = [ + "DatabaseRawResponse", + "DatabaseRawResponseItem", + "DatabaseRawResponseItemMeta", + "DatabaseRawResponseItemResults", +] + + +class DatabaseRawResponseItemMeta(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 DatabaseRawResponseItemResults(BaseModel): + columns: Optional[List[str]] = None + + rows: Optional[List[List[Union[float, str, object]]]] = None + + +class DatabaseRawResponseItem(BaseModel): + meta: Optional[DatabaseRawResponseItemMeta] = None + + results: Optional[DatabaseRawResponseItemResults] = None + + success: Optional[bool] = None + + +DatabaseRawResponse = List[DatabaseRawResponseItem] diff --git a/src/cloudflare/types/dns/__init__.py b/src/cloudflare/types/dns/__init__.py index 5966582d8bf..3b3aa6dfb0b 100644 --- a/src/cloudflare/types/dns/__init__.py +++ b/src/cloudflare/types/dns/__init__.py @@ -12,12 +12,14 @@ from .ttl_param import TTLParam as TTLParam from .caa_record import CAARecord as CAARecord from .loc_record import LOCRecord as LOCRecord +from .nameserver import Nameserver as Nameserver 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 .dns_setting import DNSSetting as DNSSetting from .record_tags import RecordTags as RecordTags from .svcb_record import SVCBRecord as SVCBRecord from .tlsa_record import TLSARecord as TLSARecord @@ -30,20 +32,25 @@ from .dnskey_record import DNSKEYRecord as DNSKEYRecord from .smimea_record import SMIMEARecord as SMIMEARecord from .record_metadata import RecordMetadata as RecordMetadata +from .nameserver_param import NameserverParam as NameserverParam from .attack_mitigation import AttackMitigation as AttackMitigation +from .dns_setting_param import DNSSettingParam as DNSSettingParam 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 .setting_edit_params import SettingEditParams as SettingEditParams 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_import_params import RecordImportParams as RecordImportParams from .record_scan_response import RecordScanResponse as RecordScanResponse from .record_update_params import RecordUpdateParams as RecordUpdateParams +from .setting_get_response import SettingGetResponse as SettingGetResponse from .record_process_timing import RecordProcessTiming as RecordProcessTiming +from .setting_edit_response import SettingEditResponse as SettingEditResponse from .firewall_create_params import FirewallCreateParams as FirewallCreateParams from .record_delete_response import RecordDeleteResponse as RecordDeleteResponse from .record_export_response import RecordExportResponse as RecordExportResponse diff --git a/src/cloudflare/types/dns/dns_setting.py b/src/cloudflare/types/dns/dns_setting.py new file mode 100644 index 00000000000..c96b14afb67 --- /dev/null +++ b/src/cloudflare/types/dns/dns_setting.py @@ -0,0 +1,76 @@ +# 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 .nameserver import Nameserver + +__all__ = ["DNSSetting", "SOA"] + + +class SOA(BaseModel): + expire: float + """ + Time in seconds of being unable to query the primary server after which + secondary servers should stop serving the zone. + """ + + min_ttl: float + """The time to live (TTL) for negative caching of records within the zone.""" + + mname: str + """The primary nameserver, which may be used for outbound zone transfers.""" + + refresh: float + """ + Time in seconds after which secondary servers should re-check the SOA record to + see if the zone has been updated. + """ + + retry: float + """ + Time in seconds after which secondary servers should retry queries after the + primary server was unresponsive. + """ + + rname: str + """ + The email address of the zone administrator, with the first label representing + the local part of the email address. + """ + + ttl: float + """The time to live (TTL) of the SOA record itself.""" + + +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. + """ + + ns_ttl: Optional[float] = None + """The time to live (TTL) of the zone's nameserver (NS) records.""" + + secondary_overrides: Optional[bool] = None + """ + Allows a Secondary DNS zone to use (proxied) override records and CNAME + flattening at the zone apex. + """ + + soa: Optional[SOA] = None + """Components of the zone's SOA record.""" + + zone_mode: Optional[Literal["standard", "cdn_only", "dns_only"]] = None + """Whether the zone mode is a regular or CDN/DNS only zone.""" diff --git a/src/cloudflare/types/dns/dns_setting_param.py b/src/cloudflare/types/dns/dns_setting_param.py new file mode 100644 index 00000000000..127be3c6a83 --- /dev/null +++ b/src/cloudflare/types/dns/dns_setting_param.py @@ -0,0 +1,76 @@ +# 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 .nameserver_param import NameserverParam + +__all__ = ["DNSSettingParam", "SOA"] + + +class SOA(TypedDict, total=False): + expire: Required[float] + """ + Time in seconds of being unable to query the primary server after which + secondary servers should stop serving the zone. + """ + + min_ttl: Required[float] + """The time to live (TTL) for negative caching of records within the zone.""" + + mname: Required[str] + """The primary nameserver, which may be used for outbound zone transfers.""" + + refresh: Required[float] + """ + Time in seconds after which secondary servers should re-check the SOA record to + see if the zone has been updated. + """ + + retry: Required[float] + """ + Time in seconds after which secondary servers should retry queries after the + primary server was unresponsive. + """ + + rname: Required[str] + """ + The email address of the zone administrator, with the first label representing + the local part of the email address. + """ + + ttl: Required[float] + """The time to live (TTL) of the SOA record itself.""" + + +class DNSSettingParam(TypedDict, total=False): + foundation_dns: bool + """Whether to enable Foundation DNS Advanced Nameservers on the zone.""" + + multi_provider: bool + """ + 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. + """ + + ns_ttl: float + """The time to live (TTL) of the zone's nameserver (NS) records.""" + + secondary_overrides: bool + """ + Allows a Secondary DNS zone to use (proxied) override records and CNAME + flattening at the zone apex. + """ + + soa: SOA + """Components of the zone's SOA record.""" + + zone_mode: Literal["standard", "cdn_only", "dns_only"] + """Whether the zone mode is a regular or CDN/DNS only zone.""" diff --git a/src/cloudflare/types/zones/nameserver.py b/src/cloudflare/types/dns/nameserver.py similarity index 100% rename from src/cloudflare/types/zones/nameserver.py rename to src/cloudflare/types/dns/nameserver.py diff --git a/src/cloudflare/types/zones/nameserver_param.py b/src/cloudflare/types/dns/nameserver_param.py similarity index 100% rename from src/cloudflare/types/zones/nameserver_param.py rename to src/cloudflare/types/dns/nameserver_param.py diff --git a/src/cloudflare/types/dns/setting_edit_params.py b/src/cloudflare/types/dns/setting_edit_params.py new file mode 100644 index 00000000000..1ac1ba3eeae --- /dev/null +++ b/src/cloudflare/types/dns/setting_edit_params.py @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from .dns_setting_param import DNSSettingParam + +__all__ = ["SettingEditParams"] + + +class SettingEditParams(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.""" + + zone_defaults: DNSSettingParam diff --git a/src/cloudflare/types/dns/setting_edit_response.py b/src/cloudflare/types/dns/setting_edit_response.py new file mode 100644 index 00000000000..87a73a5356f --- /dev/null +++ b/src/cloudflare/types/dns/setting_edit_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .dns_setting import DNSSetting + +__all__ = ["SettingEditResponse"] + + +class SettingEditResponse(BaseModel): + zone_defaults: Optional[DNSSetting] = None diff --git a/src/cloudflare/types/dns/setting_get_response.py b/src/cloudflare/types/dns/setting_get_response.py new file mode 100644 index 00000000000..42c33600842 --- /dev/null +++ b/src/cloudflare/types/dns/setting_get_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .dns_setting import DNSSetting + +__all__ = ["SettingGetResponse"] + + +class SettingGetResponse(BaseModel): + zone_defaults: Optional[DNSSetting] = None diff --git a/src/cloudflare/types/firewall/__init__.py b/src/cloudflare/types/firewall/__init__.py index 3c81f93f594..b93cee390ef 100644 --- a/src/cloudflare/types/firewall/__init__.py +++ b/src/cloudflare/types/firewall/__init__.py @@ -2,8 +2,8 @@ from __future__ import annotations +from .product import Product as Product 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 diff --git a/src/cloudflare/types/firewall/firewall_rule.py b/src/cloudflare/types/firewall/firewall_rule.py index 8c3a20fffad..179de38e86d 100644 --- a/src/cloudflare/types/firewall/firewall_rule.py +++ b/src/cloudflare/types/firewall/firewall_rule.py @@ -2,7 +2,7 @@ from typing import List, Union, Optional -from .products import Products +from .product import Product from ..._models import BaseModel from .deleted_filter import DeletedFilter from ..rate_limits.action import Action @@ -39,7 +39,7 @@ class FirewallRule(BaseModel): processed before rules without a priority. """ - products: Optional[List[Products]] = None + products: Optional[List[Product]] = None ref: Optional[str] = None """A short reference tag. Allows you to select related firewall rules.""" diff --git a/src/cloudflare/types/firewall/products.py b/src/cloudflare/types/firewall/product.py similarity index 51% rename from src/cloudflare/types/firewall/products.py rename to src/cloudflare/types/firewall/product.py index 0dc537616f5..5a004e3217c 100644 --- a/src/cloudflare/types/firewall/products.py +++ b/src/cloudflare/types/firewall/product.py @@ -2,6 +2,6 @@ from typing_extensions import Literal -__all__ = ["Products"] +__all__ = ["Product"] -Products = Literal["zoneLockdown", "uaBlock", "bic", "hot", "securityLevel", "rateLimit", "waf"] +Product = Literal["zoneLockdown", "uaBlock", "bic", "hot", "securityLevel", "rateLimit", "waf"] diff --git a/src/cloudflare/types/healthchecks/http_configuration.py b/src/cloudflare/types/healthchecks/http_configuration.py index e7816f99ec0..b000623d5f9 100644 --- a/src/cloudflare/types/healthchecks/http_configuration.py +++ b/src/cloudflare/types/healthchecks/http_configuration.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from typing_extensions import Literal from ..._models import BaseModel @@ -28,7 +28,7 @@ class HTTPConfiguration(BaseModel): follow_redirects: Optional[bool] = None """Follow redirects if the origin returns a 3xx status code.""" - header: Optional[object] = None + header: Optional[Dict[str, List[str]]] = 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 diff --git a/src/cloudflare/types/healthchecks/http_configuration_param.py b/src/cloudflare/types/healthchecks/http_configuration_param.py index 1b97f2f53c5..f8f0bc4ac32 100644 --- a/src/cloudflare/types/healthchecks/http_configuration_param.py +++ b/src/cloudflare/types/healthchecks/http_configuration_param.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Optional +from typing import Dict, List, Optional from typing_extensions import Literal, TypedDict __all__ = ["HTTPConfigurationParam"] @@ -28,7 +28,7 @@ class HTTPConfigurationParam(TypedDict, total=False): follow_redirects: bool """Follow redirects if the origin returns a 3xx status code.""" - header: Optional[object] + header: Optional[Dict[str, List[str]]] """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 diff --git a/src/cloudflare/types/iam/__init__.py b/src/cloudflare/types/iam/__init__.py new file mode 100644 index 00000000000..5982e2443a2 --- /dev/null +++ b/src/cloudflare/types/iam/__init__.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .resource_group_list_params import ResourceGroupListParams as ResourceGroupListParams +from .resource_group_get_response import ResourceGroupGetResponse as ResourceGroupGetResponse +from .permission_group_list_params import PermissionGroupListParams as PermissionGroupListParams +from .resource_group_create_params import ResourceGroupCreateParams as ResourceGroupCreateParams +from .resource_group_update_params import ResourceGroupUpdateParams as ResourceGroupUpdateParams +from .permission_group_get_response import PermissionGroupGetResponse as PermissionGroupGetResponse +from .resource_group_create_response import ResourceGroupCreateResponse as ResourceGroupCreateResponse +from .resource_group_delete_response import ResourceGroupDeleteResponse as ResourceGroupDeleteResponse +from .resource_group_update_response import ResourceGroupUpdateResponse as ResourceGroupUpdateResponse diff --git a/src/cloudflare/types/iam/permission_group_get_response.py b/src/cloudflare/types/iam/permission_group_get_response.py new file mode 100644 index 00000000000..bfafb28bc92 --- /dev/null +++ b/src/cloudflare/types/iam/permission_group_get_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__ = ["PermissionGroupGetResponse"] + + +class PermissionGroupGetResponse(BaseModel): + id: str + """Identifier of the group.""" + + meta: Optional[object] = None + """Attributes associated to the permission group.""" + + name: Optional[str] = None + """Name of the group.""" diff --git a/src/cloudflare/types/iam/permission_group_list_params.py b/src/cloudflare/types/iam/permission_group_list_params.py new file mode 100644 index 00000000000..04f58ce75ce --- /dev/null +++ b/src/cloudflare/types/iam/permission_group_list_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["PermissionGroupListParams"] + + +class PermissionGroupListParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + id: str + """ID of the permission group to be fetched.""" + + label: str + """Label of the permission group to be fetched.""" + + name: str + """Name of the permission group to be fetched.""" + + page: float + """Page number of paginated results.""" + + per_page: float + """Maximum number of results per page.""" diff --git a/src/cloudflare/types/iam/resource_group_create_params.py b/src/cloudflare/types/iam/resource_group_create_params.py new file mode 100644 index 00000000000..7f583c5f87c --- /dev/null +++ b/src/cloudflare/types/iam/resource_group_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 import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["ResourceGroupCreateParams", "Scope", "ScopeObject"] + + +class ResourceGroupCreateParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + scope: Required[Scope] + """A scope is a combination of scope objects which provides additional context.""" + + meta: object + """Attributes associated to the resource group.""" + + +class ScopeObject(TypedDict, total=False): + key: Required[str] + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class Scope(TypedDict, total=False): + key: Required[str] + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: Required[Iterable[ScopeObject]] + """A list of scope objects for additional context. + + The number of Scope objects should not be zero. + """ diff --git a/src/cloudflare/types/iam/resource_group_create_response.py b/src/cloudflare/types/iam/resource_group_create_response.py new file mode 100644 index 00000000000..a6c3b5dc1b0 --- /dev/null +++ b/src/cloudflare/types/iam/resource_group_create_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ResourceGroupCreateResponse", "Scope", "ScopeObject"] + + +class ScopeObject(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class Scope(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: List[ScopeObject] + """A list of scope objects for additional context. + + The number of Scope objects should not be zero. + """ + + +class ResourceGroupCreateResponse(BaseModel): + id: Optional[str] = None + """Identifier of the group.""" + + meta: Optional[object] = None + """Attributes associated to the resource group.""" + + scope: Optional[Scope] = None + """A scope is a combination of scope objects which provides additional context.""" diff --git a/src/cloudflare/types/iam/resource_group_delete_response.py b/src/cloudflare/types/iam/resource_group_delete_response.py new file mode 100644 index 00000000000..604eafbe8f0 --- /dev/null +++ b/src/cloudflare/types/iam/resource_group_delete_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + + +from ..._models import BaseModel + +__all__ = ["ResourceGroupDeleteResponse"] + + +class ResourceGroupDeleteResponse(BaseModel): + id: str + """Identifier""" diff --git a/src/cloudflare/types/iam/resource_group_get_response.py b/src/cloudflare/types/iam/resource_group_get_response.py new file mode 100644 index 00000000000..26cc4314edc --- /dev/null +++ b/src/cloudflare/types/iam/resource_group_get_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ResourceGroupGetResponse", "Scope", "ScopeObject"] + + +class ScopeObject(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class Scope(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: List[ScopeObject] + """A list of scope objects for additional context.""" + + +class ResourceGroupGetResponse(BaseModel): + id: str + """Identifier of the group.""" + + scope: List[Scope] + """The scope associated to the resource group""" + + meta: Optional[object] = None + """Attributes associated to the resource group.""" + + name: Optional[str] = None + """Name of the resource group.""" diff --git a/src/cloudflare/types/iam/resource_group_list_params.py b/src/cloudflare/types/iam/resource_group_list_params.py new file mode 100644 index 00000000000..f6153181a2f --- /dev/null +++ b/src/cloudflare/types/iam/resource_group_list_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 Required, TypedDict + +__all__ = ["ResourceGroupListParams"] + + +class ResourceGroupListParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + id: str + """ID of the resource group to be fetched.""" + + name: str + """Name of the resource group to be fetched.""" + + page: float + """Page number of paginated results.""" + + per_page: float + """Maximum number of results per page.""" diff --git a/src/cloudflare/types/iam/resource_group_update_params.py b/src/cloudflare/types/iam/resource_group_update_params.py new file mode 100644 index 00000000000..eb50831f7be --- /dev/null +++ b/src/cloudflare/types/iam/resource_group_update_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 import Iterable +from typing_extensions import Required, TypedDict + +__all__ = ["ResourceGroupUpdateParams", "Scope", "ScopeObject"] + + +class ResourceGroupUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier tag.""" + + scope: Required[Scope] + """A scope is a combination of scope objects which provides additional context.""" + + meta: object + """Attributes associated to the resource group.""" + + +class ScopeObject(TypedDict, total=False): + key: Required[str] + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class Scope(TypedDict, total=False): + key: Required[str] + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: Required[Iterable[ScopeObject]] + """A list of scope objects for additional context. + + The number of Scope objects should not be zero. + """ diff --git a/src/cloudflare/types/iam/resource_group_update_response.py b/src/cloudflare/types/iam/resource_group_update_response.py new file mode 100644 index 00000000000..8aa70682f42 --- /dev/null +++ b/src/cloudflare/types/iam/resource_group_update_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["ResourceGroupUpdateResponse", "Scope", "ScopeObject"] + + +class ScopeObject(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class Scope(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: List[ScopeObject] + """A list of scope objects for additional context.""" + + +class ResourceGroupUpdateResponse(BaseModel): + id: str + """Identifier of the group.""" + + scope: List[Scope] + """The scope associated to the resource group""" + + meta: Optional[object] = None + """Attributes associated to the resource group.""" + + name: Optional[str] = None + """Name of the resource group.""" diff --git a/src/cloudflare/types/intel/indicator_feed_get_response.py b/src/cloudflare/types/intel/indicator_feed_get_response.py index 1fd0e75e82b..2ba6e9a1cfa 100644 --- a/src/cloudflare/types/intel/indicator_feed_get_response.py +++ b/src/cloudflare/types/intel/indicator_feed_get_response.py @@ -19,6 +19,12 @@ class IndicatorFeedGetResponse(BaseModel): description: Optional[str] = None """The description of the example test""" + is_attributable: Optional[bool] = None + """Whether the indicator feed can be attributed to a provider""" + + is_public: Optional[bool] = None + """Whether the indicator feed is exposed to customers""" + latest_upload_status: Optional[ Literal["Mirroring", "Unifying", "Loading", "Provisioning", "Complete", "Error"] ] = None @@ -29,3 +35,9 @@ class IndicatorFeedGetResponse(BaseModel): name: Optional[str] = None """The name of the indicator feed""" + + provider_id: Optional[str] = None + """The unique identifier for the provider""" + + provider_name: Optional[str] = None + """The provider of the indicator feed""" diff --git a/src/cloudflare/types/intel/indicator_feed_update_params.py b/src/cloudflare/types/intel/indicator_feed_update_params.py index b7af16167f6..0d1eeb4f5da 100644 --- a/src/cloudflare/types/intel/indicator_feed_update_params.py +++ b/src/cloudflare/types/intel/indicator_feed_update_params.py @@ -11,7 +11,7 @@ class IndicatorFeedUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - feed_description: str + description: str """The new description of the feed""" is_attributable: bool @@ -19,3 +19,6 @@ class IndicatorFeedUpdateParams(TypedDict, total=False): is_public: bool """The new is_public value of the feed""" + + name: str + """The new name of the feed""" diff --git a/src/cloudflare/types/kv/namespace_delete_response.py b/src/cloudflare/types/kv/namespace_delete_response.py index 9e59782ae79..eb6f28e4253 100644 --- a/src/cloudflare/types/kv/namespace_delete_response.py +++ b/src/cloudflare/types/kv/namespace_delete_response.py @@ -1,7 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union + + +from ..._models import BaseModel __all__ = ["NamespaceDeleteResponse"] -NamespaceDeleteResponse = Union[str, object] + +class NamespaceDeleteResponse(BaseModel): + pass diff --git a/src/cloudflare/types/kv/namespace_update_response.py b/src/cloudflare/types/kv/namespace_update_response.py index fbd61fb15c8..b8f763fc2e9 100644 --- a/src/cloudflare/types/kv/namespace_update_response.py +++ b/src/cloudflare/types/kv/namespace_update_response.py @@ -1,7 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union + + +from ..._models import BaseModel __all__ = ["NamespaceUpdateResponse"] -NamespaceUpdateResponse = Union[str, object] + +class NamespaceUpdateResponse(BaseModel): + pass diff --git a/src/cloudflare/types/kv/namespaces/__init__.py b/src/cloudflare/types/kv/namespaces/__init__.py index e7c21904155..69632f0965e 100644 --- a/src/cloudflare/types/kv/namespaces/__init__.py +++ b/src/cloudflare/types/kv/namespaces/__init__.py @@ -5,9 +5,9 @@ from .key import Key as Key from .key_list_params import KeyListParams as KeyListParams from .bulk_update_params import BulkUpdateParams as BulkUpdateParams -from .value_get_response import ValueGetResponse as ValueGetResponse from .value_update_params import ValueUpdateParams as ValueUpdateParams from .bulk_delete_response import BulkDeleteResponse as BulkDeleteResponse from .bulk_update_response import BulkUpdateResponse as BulkUpdateResponse +from .metadata_get_response import MetadataGetResponse as MetadataGetResponse from .value_delete_response import ValueDeleteResponse as ValueDeleteResponse from .value_update_response import ValueUpdateResponse as ValueUpdateResponse diff --git a/src/cloudflare/types/kv/namespaces/bulk_delete_response.py b/src/cloudflare/types/kv/namespaces/bulk_delete_response.py index 56c602c8530..4ae88607764 100644 --- a/src/cloudflare/types/kv/namespaces/bulk_delete_response.py +++ b/src/cloudflare/types/kv/namespaces/bulk_delete_response.py @@ -1,7 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union + + +from ...._models import BaseModel __all__ = ["BulkDeleteResponse"] -BulkDeleteResponse = Union[str, object] + +class BulkDeleteResponse(BaseModel): + pass diff --git a/src/cloudflare/types/kv/namespaces/bulk_update_params.py b/src/cloudflare/types/kv/namespaces/bulk_update_params.py index c78d5da68ad..6cb8d8702c8 100644 --- a/src/cloudflare/types/kv/namespaces/bulk_update_params.py +++ b/src/cloudflare/types/kv/namespaces/bulk_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable +from typing import Dict, Iterable from typing_extensions import Required, TypedDict __all__ = ["BulkUpdateParams", "Body"] @@ -42,7 +42,7 @@ class Body(TypedDict, total=False): valid. """ - metadata: object + metadata: Dict[str, object] """Arbitrary JSON that is associated with a key.""" value: str diff --git a/src/cloudflare/types/kv/namespaces/bulk_update_response.py b/src/cloudflare/types/kv/namespaces/bulk_update_response.py index 7a1f035d954..55544c65e54 100644 --- a/src/cloudflare/types/kv/namespaces/bulk_update_response.py +++ b/src/cloudflare/types/kv/namespaces/bulk_update_response.py @@ -1,7 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union + + +from ...._models import BaseModel __all__ = ["BulkUpdateResponse"] -BulkUpdateResponse = Union[str, object] + +class BulkUpdateResponse(BaseModel): + pass diff --git a/src/cloudflare/types/kv/namespaces/key.py b/src/cloudflare/types/kv/namespaces/key.py index 604b5d06192..5b48057e954 100644 --- a/src/cloudflare/types/kv/namespaces/key.py +++ b/src/cloudflare/types/kv/namespaces/key.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from ...._models import BaseModel @@ -21,5 +21,5 @@ class Key(BaseModel): will expire. This property is omitted for keys that will not expire. """ - metadata: Optional[object] = None + metadata: Optional[Dict[str, object]] = None """Arbitrary JSON that is associated with a key.""" diff --git a/src/cloudflare/types/kv/namespaces/metadata_get_response.py b/src/cloudflare/types/kv/namespaces/metadata_get_response.py new file mode 100644 index 00000000000..6b0475335e2 --- /dev/null +++ b/src/cloudflare/types/kv/namespaces/metadata_get_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict + +__all__ = ["MetadataGetResponse"] + +MetadataGetResponse = Dict[str, object] diff --git a/src/cloudflare/types/kv/namespaces/value_delete_response.py b/src/cloudflare/types/kv/namespaces/value_delete_response.py index 7c3d2c3fb80..224a80852b0 100644 --- a/src/cloudflare/types/kv/namespaces/value_delete_response.py +++ b/src/cloudflare/types/kv/namespaces/value_delete_response.py @@ -1,7 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union + + +from ...._models import BaseModel __all__ = ["ValueDeleteResponse"] -ValueDeleteResponse = Union[str, object] + +class ValueDeleteResponse(BaseModel): + pass diff --git a/src/cloudflare/types/kv/namespaces/value_update_response.py b/src/cloudflare/types/kv/namespaces/value_update_response.py index 30f088b4fd9..40ffa943af8 100644 --- a/src/cloudflare/types/kv/namespaces/value_update_response.py +++ b/src/cloudflare/types/kv/namespaces/value_update_response.py @@ -1,7 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union + + +from ...._models import BaseModel __all__ = ["ValueUpdateResponse"] -ValueUpdateResponse = Union[str, object] + +class ValueUpdateResponse(BaseModel): + pass diff --git a/src/cloudflare/types/logs/control/__init__.py b/src/cloudflare/types/logs/control/__init__.py index f8ee8b14b1c..bab336a2b0d 100644 --- a/src/cloudflare/types/logs/control/__init__.py +++ b/src/cloudflare/types/logs/control/__init__.py @@ -1,3 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .retention_get_response import RetentionGetResponse as RetentionGetResponse +from .retention_create_params import RetentionCreateParams as RetentionCreateParams +from .retention_create_response import RetentionCreateResponse as RetentionCreateResponse diff --git a/src/cloudflare/types/logs/control/retention/__init__.py b/src/cloudflare/types/logs/control/retention/__init__.py deleted file mode 100644 index 5ee01ff7c47..00000000000 --- a/src/cloudflare/types/logs/control/retention/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .flag_get_response import FlagGetResponse as FlagGetResponse -from .flag_create_params import FlagCreateParams as FlagCreateParams -from .flag_create_response import FlagCreateResponse as FlagCreateResponse diff --git a/src/cloudflare/types/logs/control/retention/flag_create_params.py b/src/cloudflare/types/logs/control/retention_create_params.py similarity index 73% rename from src/cloudflare/types/logs/control/retention/flag_create_params.py rename to src/cloudflare/types/logs/control/retention_create_params.py index 0dfbf8885db..d022c669bc2 100644 --- a/src/cloudflare/types/logs/control/retention/flag_create_params.py +++ b/src/cloudflare/types/logs/control/retention_create_params.py @@ -4,9 +4,9 @@ from typing_extensions import Required, TypedDict -__all__ = ["FlagCreateParams"] +__all__ = ["RetentionCreateParams"] -class FlagCreateParams(TypedDict, total=False): +class RetentionCreateParams(TypedDict, total=False): flag: Required[bool] """The log retention flag for Logpull API.""" diff --git a/src/cloudflare/types/logs/control/retention/flag_get_response.py b/src/cloudflare/types/logs/control/retention_create_response.py similarity index 56% rename from src/cloudflare/types/logs/control/retention/flag_get_response.py rename to src/cloudflare/types/logs/control/retention_create_response.py index 6b7291bd7da..1c2d420bb34 100644 --- a/src/cloudflare/types/logs/control/retention/flag_get_response.py +++ b/src/cloudflare/types/logs/control/retention_create_response.py @@ -2,10 +2,10 @@ from typing import Optional -from ....._models import BaseModel +from ...._models import BaseModel -__all__ = ["FlagGetResponse"] +__all__ = ["RetentionCreateResponse"] -class FlagGetResponse(BaseModel): +class RetentionCreateResponse(BaseModel): flag: Optional[bool] = None diff --git a/src/cloudflare/types/logs/control/retention/flag_create_response.py b/src/cloudflare/types/logs/control/retention_get_response.py similarity index 58% rename from src/cloudflare/types/logs/control/retention/flag_create_response.py rename to src/cloudflare/types/logs/control/retention_get_response.py index a96a4fa2b8d..3d2d09e5461 100644 --- a/src/cloudflare/types/logs/control/retention/flag_create_response.py +++ b/src/cloudflare/types/logs/control/retention_get_response.py @@ -2,10 +2,10 @@ from typing import Optional -from ....._models import BaseModel +from ...._models import BaseModel -__all__ = ["FlagCreateResponse"] +__all__ = ["RetentionGetResponse"] -class FlagCreateResponse(BaseModel): +class RetentionGetResponse(BaseModel): flag: Optional[bool] = None diff --git a/src/cloudflare/types/magic_transit/__init__.py b/src/cloudflare/types/magic_transit/__init__.py index 98e253df212..ad2327c5724 100644 --- a/src/cloudflare/types/magic_transit/__init__.py +++ b/src/cloudflare/types/magic_transit/__init__.py @@ -8,25 +8,38 @@ from .health_check import HealthCheck as HealthCheck from .psk_metadata import PSKMetadata as PSKMetadata from .site_location import SiteLocation as SiteLocation +from .site_edit_params import SiteEditParams as SiteEditParams from .site_list_params import SiteListParams as SiteListParams +from .app_create_params import AppCreateParams as AppCreateParams +from .app_list_response import AppListResponse as AppListResponse +from .app_update_params import AppUpdateParams as AppUpdateParams 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_get_response import RouteGetResponse as RouteGetResponse from .site_create_params import SiteCreateParams as SiteCreateParams from .site_update_params import SiteUpdateParams as SiteUpdateParams +from .app_create_response import AppCreateResponse as AppCreateResponse +from .app_delete_response import AppDeleteResponse as AppDeleteResponse +from .app_update_response import AppUpdateResponse as AppUpdateResponse from .route_create_params import RouteCreateParams as RouteCreateParams from .route_list_response import RouteListResponse as RouteListResponse from .route_update_params import RouteUpdateParams as RouteUpdateParams from .site_location_param import SiteLocationParam as SiteLocationParam from .route_empty_response import RouteEmptyResponse as RouteEmptyResponse +from .connector_edit_params import ConnectorEditParams as ConnectorEditParams 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 .connector_get_response import ConnectorGetResponse as ConnectorGetResponse +from .connector_edit_response import ConnectorEditResponse as ConnectorEditResponse +from .connector_list_response import ConnectorListResponse as ConnectorListResponse +from .connector_update_params import ConnectorUpdateParams as ConnectorUpdateParams from .gre_tunnel_get_response import GRETunnelGetResponse as GRETunnelGetResponse from .gre_tunnel_create_params import GRETunnelCreateParams as GRETunnelCreateParams from .gre_tunnel_list_response import GRETunnelListResponse as GRETunnelListResponse from .gre_tunnel_update_params import GRETunnelUpdateParams as GRETunnelUpdateParams +from .connector_update_response import ConnectorUpdateResponse as ConnectorUpdateResponse from .ipsec_tunnel_get_response import IPSECTunnelGetResponse as IPSECTunnelGetResponse from .gre_tunnel_create_response import GRETunnelCreateResponse as GRETunnelCreateResponse from .gre_tunnel_delete_response import GRETunnelDeleteResponse as GRETunnelDeleteResponse diff --git a/src/cloudflare/types/magic_transit/app_create_params.py b/src/cloudflare/types/magic_transit/app_create_params.py new file mode 100644 index 00000000000..663405d69c1 --- /dev/null +++ b/src/cloudflare/types/magic_transit/app_create_params.py @@ -0,0 +1,25 @@ +# 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__ = ["AppCreateParams", "Hostnames", "Subnets"] + + +class Hostnames(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] + + +class Subnets(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] + + +AppCreateParams = Union[Hostnames, Subnets] diff --git a/src/cloudflare/types/magic_transit/app_create_response.py b/src/cloudflare/types/magic_transit/app_create_response.py new file mode 100644 index 00000000000..109887e4753 --- /dev/null +++ b/src/cloudflare/types/magic_transit/app_create_response.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["AppCreateResponse"] + + +class AppCreateResponse(BaseModel): + account_app_id: str + """Magic account app ID.""" + + hostnames: Optional[List[str]] = None + """FQDNs to associate with traffic decisions.""" + + ip_subnets: Optional[List[str]] = None + """CIDRs to associate with traffic decisions.""" + + name: Optional[str] = None + """Display name for the app.""" + + type: Optional[str] = None + """Category of the app.""" diff --git a/src/cloudflare/types/magic_transit/app_delete_response.py b/src/cloudflare/types/magic_transit/app_delete_response.py new file mode 100644 index 00000000000..0eafc15562c --- /dev/null +++ b/src/cloudflare/types/magic_transit/app_delete_response.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["AppDeleteResponse"] + + +class AppDeleteResponse(BaseModel): + account_app_id: str + """Magic account app ID.""" + + hostnames: Optional[List[str]] = None + """FQDNs to associate with traffic decisions.""" + + ip_subnets: Optional[List[str]] = None + """CIDRs to associate with traffic decisions.""" + + name: Optional[str] = None + """Display name for the app.""" + + type: Optional[str] = None + """Category of the app.""" diff --git a/src/cloudflare/types/magic_transit/app_list_response.py b/src/cloudflare/types/magic_transit/app_list_response.py new file mode 100644 index 00000000000..a7ef5d8cbd3 --- /dev/null +++ b/src/cloudflare/types/magic_transit/app_list_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional + +from ..._models import BaseModel + +__all__ = ["AppListResponse", "MagicAccountApp", "MagicManagedApp"] + + +class MagicAccountApp(BaseModel): + account_app_id: str + """Magic account app ID.""" + + hostnames: Optional[List[str]] = None + """FQDNs to associate with traffic decisions.""" + + ip_subnets: Optional[List[str]] = None + """CIDRs to associate with traffic decisions.""" + + name: Optional[str] = None + """Display name for the app.""" + + type: Optional[str] = None + """Category of the app.""" + + +class MagicManagedApp(BaseModel): + managed_app_id: str + """Managed app ID.""" + + hostnames: Optional[List[str]] = None + """FQDNs to associate with traffic decisions.""" + + ip_subnets: Optional[List[str]] = None + """CIDRs to associate with traffic decisions.""" + + name: Optional[str] = None + """Display name for the app.""" + + type: Optional[str] = None + """Category of the app.""" + + +AppListResponse = Union[MagicAccountApp, MagicManagedApp] diff --git a/src/cloudflare/types/magic_transit/app_update_params.py b/src/cloudflare/types/magic_transit/app_update_params.py new file mode 100644 index 00000000000..4aa43a96678 --- /dev/null +++ b/src/cloudflare/types/magic_transit/app_update_params.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 Union +from typing_extensions import Required, TypedDict + +__all__ = ["AppUpdateParams", "UpdateAppName", "UpdateAppType", "UpdateAppHostnames", "UpdateAppSubnets"] + + +class UpdateAppName(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] + + +class UpdateAppType(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] + + +class UpdateAppHostnames(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] + + +class UpdateAppSubnets(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + body: Required[object] + + +AppUpdateParams = Union[UpdateAppName, UpdateAppType, UpdateAppHostnames, UpdateAppSubnets] diff --git a/src/cloudflare/types/magic_transit/app_update_response.py b/src/cloudflare/types/magic_transit/app_update_response.py new file mode 100644 index 00000000000..fb98877f021 --- /dev/null +++ b/src/cloudflare/types/magic_transit/app_update_response.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from ..._models import BaseModel + +__all__ = ["AppUpdateResponse"] + + +class AppUpdateResponse(BaseModel): + account_app_id: str + """Magic account app ID.""" + + hostnames: Optional[List[str]] = None + """FQDNs to associate with traffic decisions.""" + + ip_subnets: Optional[List[str]] = None + """CIDRs to associate with traffic decisions.""" + + name: Optional[str] = None + """Display name for the app.""" + + type: Optional[str] = None + """Category of the app.""" diff --git a/src/cloudflare/types/magic_transit/connector_edit_params.py b/src/cloudflare/types/magic_transit/connector_edit_params.py new file mode 100644 index 00000000000..da638c4e8a3 --- /dev/null +++ b/src/cloudflare/types/magic_transit/connector_edit_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ConnectorEditParams"] + + +class ConnectorEditParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier""" + + activated: bool + + interrupt_window_duration_hours: float + + interrupt_window_hour_of_day: float + + notes: str + + timezone: str diff --git a/src/cloudflare/types/magic_transit/connector_edit_response.py b/src/cloudflare/types/magic_transit/connector_edit_response.py new file mode 100644 index 00000000000..47d29cef4a4 --- /dev/null +++ b/src/cloudflare/types/magic_transit/connector_edit_response.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["ConnectorEditResponse", "Device"] + + +class Device(BaseModel): + id: str + + serial_number: Optional[str] = None + + +class ConnectorEditResponse(BaseModel): + id: str + + activated: bool + + interrupt_window_duration_hours: float + + interrupt_window_hour_of_day: float + + last_updated: str + + notes: str + + timezone: str + + device: Optional[Device] = None + + last_heartbeat: Optional[str] = None + + last_seen_version: Optional[str] = None diff --git a/src/cloudflare/types/magic_transit/connector_get_response.py b/src/cloudflare/types/magic_transit/connector_get_response.py new file mode 100644 index 00000000000..6b36ed76687 --- /dev/null +++ b/src/cloudflare/types/magic_transit/connector_get_response.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["ConnectorGetResponse", "Device"] + + +class Device(BaseModel): + id: str + + serial_number: Optional[str] = None + + +class ConnectorGetResponse(BaseModel): + id: str + + activated: bool + + interrupt_window_duration_hours: float + + interrupt_window_hour_of_day: float + + last_updated: str + + notes: str + + timezone: str + + device: Optional[Device] = None + + last_heartbeat: Optional[str] = None + + last_seen_version: Optional[str] = None diff --git a/src/cloudflare/types/magic_transit/connector_list_response.py b/src/cloudflare/types/magic_transit/connector_list_response.py new file mode 100644 index 00000000000..abad515443c --- /dev/null +++ b/src/cloudflare/types/magic_transit/connector_list_response.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["ConnectorListResponse", "Device"] + + +class Device(BaseModel): + id: str + + serial_number: Optional[str] = None + + +class ConnectorListResponse(BaseModel): + id: str + + activated: bool + + interrupt_window_duration_hours: float + + interrupt_window_hour_of_day: float + + last_updated: str + + notes: str + + timezone: str + + device: Optional[Device] = None + + last_heartbeat: Optional[str] = None + + last_seen_version: Optional[str] = None diff --git a/src/cloudflare/types/magic_transit/connector_update_params.py b/src/cloudflare/types/magic_transit/connector_update_params.py new file mode 100644 index 00000000000..bce1d58116e --- /dev/null +++ b/src/cloudflare/types/magic_transit/connector_update_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["ConnectorUpdateParams"] + + +class ConnectorUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Account identifier""" + + activated: bool + + interrupt_window_duration_hours: float + + interrupt_window_hour_of_day: float + + notes: str + + timezone: str diff --git a/src/cloudflare/types/magic_transit/connector_update_response.py b/src/cloudflare/types/magic_transit/connector_update_response.py new file mode 100644 index 00000000000..80f6a6a5198 --- /dev/null +++ b/src/cloudflare/types/magic_transit/connector_update_response.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["ConnectorUpdateResponse", "Device"] + + +class Device(BaseModel): + id: str + + serial_number: Optional[str] = None + + +class ConnectorUpdateResponse(BaseModel): + id: str + + activated: bool + + interrupt_window_duration_hours: float + + interrupt_window_hour_of_day: float + + last_updated: str + + notes: str + + timezone: str + + device: Optional[Device] = None + + last_heartbeat: Optional[str] = None + + last_seen_version: Optional[str] = None diff --git a/src/cloudflare/types/magic_transit/site.py b/src/cloudflare/types/magic_transit/site.py index 41ffe01ee98..e011ab21bbf 100644 --- a/src/cloudflare/types/magic_transit/site.py +++ b/src/cloudflare/types/magic_transit/site.py @@ -13,7 +13,7 @@ class Site(BaseModel): """Identifier""" connector_id: Optional[str] = None - """Magic WAN Connector identifier tag.""" + """Magic Connector identifier tag.""" description: Optional[str] = None @@ -31,4 +31,4 @@ class Site(BaseModel): """The name of the site.""" secondary_connector_id: Optional[str] = None - """Magic WAN Connector identifier tag. Used when high availability mode is on.""" + """Magic 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 410981caead..70a64bc5406 100644 --- a/src/cloudflare/types/magic_transit/site_create_params.py +++ b/src/cloudflare/types/magic_transit/site_create_params.py @@ -17,7 +17,7 @@ class SiteCreateParams(TypedDict, total=False): """The name of the site.""" connector_id: str - """Magic WAN Connector identifier tag.""" + """Magic Connector identifier tag.""" description: str @@ -32,4 +32,4 @@ class SiteCreateParams(TypedDict, total=False): """Location of site in latitude and longitude.""" secondary_connector_id: str - """Magic WAN Connector identifier tag. Used when high availability mode is on.""" + """Magic Connector identifier tag. Used when high availability mode is on.""" diff --git a/src/cloudflare/types/magic_transit/site_edit_params.py b/src/cloudflare/types/magic_transit/site_edit_params.py new file mode 100644 index 00000000000..eef65820c0b --- /dev/null +++ b/src/cloudflare/types/magic_transit/site_edit_params.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 Required, TypedDict + +from .site_location_param import SiteLocationParam + +__all__ = ["SiteEditParams"] + + +class SiteEditParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + connector_id: str + """Magic Connector identifier tag.""" + + description: str + + location: SiteLocationParam + """Location of site in latitude and longitude.""" + + name: str + """The name of the site.""" + + secondary_connector_id: str + """Magic Connector identifier tag. Used when high availability mode is on.""" diff --git a/src/cloudflare/types/magic_transit/site_update_params.py b/src/cloudflare/types/magic_transit/site_update_params.py index 1843cba18ff..4568612636c 100644 --- a/src/cloudflare/types/magic_transit/site_update_params.py +++ b/src/cloudflare/types/magic_transit/site_update_params.py @@ -14,7 +14,7 @@ class SiteUpdateParams(TypedDict, total=False): """Identifier""" connector_id: str - """Magic WAN Connector identifier tag.""" + """Magic Connector identifier tag.""" description: str @@ -25,4 +25,4 @@ class SiteUpdateParams(TypedDict, total=False): """The name of the site.""" secondary_connector_id: str - """Magic WAN Connector identifier tag. Used when high availability mode is on.""" + """Magic Connector identifier tag. Used when high availability mode is on.""" diff --git a/src/cloudflare/types/magic_transit/sites/__init__.py b/src/cloudflare/types/magic_transit/sites/__init__.py index 5f61827b3cb..38f592bb4e6 100644 --- a/src/cloudflare/types/magic_transit/sites/__init__.py +++ b/src/cloudflare/types/magic_transit/sites/__init__.py @@ -12,6 +12,9 @@ from .dhcp_server import DHCPServer as DHCPServer from .subnet_param import SubnetParam as SubnetParam from .routed_subnet import RoutedSubnet as RoutedSubnet +from .acl_edit_params import ACLEditParams as ACLEditParams +from .lan_edit_params import LANEditParams as LANEditParams +from .wan_edit_params import WANEditParams as WANEditParams from .allowed_protocol import AllowedProtocol as AllowedProtocol from .dhcp_relay_param import DHCPRelayParam as DHCPRelayParam from .acl_configuration import ACLConfiguration as ACLConfiguration diff --git a/src/cloudflare/types/magic_transit/sites/acl.py b/src/cloudflare/types/magic_transit/sites/acl.py index 01bcf9e4b55..5565fc0f5c9 100644 --- a/src/cloudflare/types/magic_transit/sites/acl.py +++ b/src/cloudflare/types/magic_transit/sites/acl.py @@ -20,8 +20,8 @@ class ACL(BaseModel): """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. + "true", the policy will forward traffic locally on the Magic Connector. If not + included in request, will default to false. """ lan_1: Optional[ACLConfiguration] = None 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 67a21900fa4..48b2d5f517b 100644 --- a/src/cloudflare/types/magic_transit/sites/acl_create_params.py +++ b/src/cloudflare/types/magic_transit/sites/acl_create_params.py @@ -29,8 +29,8 @@ class ACLCreateParams(TypedDict, total=False): """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. + "true", the policy will forward traffic locally on the Magic Connector. If not + included in request, will default to false. """ protocols: List[AllowedProtocol] diff --git a/src/cloudflare/types/magic_transit/sites/acl_edit_params.py b/src/cloudflare/types/magic_transit/sites/acl_edit_params.py new file mode 100644 index 00000000000..8a6c7b0f5c6 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/acl_edit_params.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 + +from .allowed_protocol import AllowedProtocol +from .acl_configuration_param import ACLConfigurationParam + +__all__ = ["ACLEditParams"] + + +class ACLEditParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + site_id: Required[str] + """Identifier""" + + description: str + """Description for the ACL.""" + + 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 Connector. If not + included in request, will default to false. + """ + + lan_1: ACLConfigurationParam + + lan_2: ACLConfigurationParam + + name: str + """The name of the ACL.""" + + protocols: List[AllowedProtocol] 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 72165d3c2a2..5abc70c2329 100644 --- a/src/cloudflare/types/magic_transit/sites/acl_update_params.py +++ b/src/cloudflare/types/magic_transit/sites/acl_update_params.py @@ -25,8 +25,8 @@ class ACLUpdateParams(TypedDict, total=False): """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. + "true", the policy will forward traffic locally on the Magic Connector. If not + included in request, will default to false. """ lan_1: ACLConfigurationParam diff --git a/src/cloudflare/types/magic_transit/sites/lan_edit_params.py b/src/cloudflare/types/magic_transit/sites/lan_edit_params.py new file mode 100644 index 00000000000..ca11b71b860 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/lan_edit_params.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 Iterable +from typing_extensions import Required, TypedDict + +from .nat_param import NatParam +from .routed_subnet_param import RoutedSubnetParam +from .lan_static_addressing_param import LANStaticAddressingParam + +__all__ = ["LANEditParams"] + + +class LANEditParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + site_id: Required[str] + """Identifier""" + + name: str + + nat: NatParam + + physport: int + + routed_subnets: Iterable[RoutedSubnetParam] + + 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, + static_address is required along with secondary and virtual address. + """ + + vlan_tag: int + """VLAN port number.""" diff --git a/src/cloudflare/types/magic_transit/sites/wan_edit_params.py b/src/cloudflare/types/magic_transit/sites/wan_edit_params.py new file mode 100644 index 00000000000..fdd941a07b4 --- /dev/null +++ b/src/cloudflare/types/magic_transit/sites/wan_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 .wan_static_addressing_param import WANStaticAddressingParam + +__all__ = ["WANEditParams"] + + +class WANEditParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + site_id: Required[str] + """Identifier""" + + name: str + + physport: int + + priority: int + + static_addressing: WANStaticAddressingParam + """(optional) if omitted, use DHCP. + + Submit secondary_address when site is in high availability mode. + """ + + vlan_tag: int + """VLAN port number.""" diff --git a/src/cloudflare/types/memberships/membership.py b/src/cloudflare/types/memberships/membership.py index a820bdcb233..a7fb6720539 100644 --- a/src/cloudflare/types/memberships/membership.py +++ b/src/cloudflare/types/memberships/membership.py @@ -49,9 +49,6 @@ class Membership(BaseModel): 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.""" diff --git a/src/cloudflare/types/memberships/membership_get_response.py b/src/cloudflare/types/memberships/membership_get_response.py index 58aa5f5943b..d828d038709 100644 --- a/src/cloudflare/types/memberships/membership_get_response.py +++ b/src/cloudflare/types/memberships/membership_get_response.py @@ -1,7 +1,128 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import List, Optional +from typing_extensions import Literal -__all__ = ["MembershipGetResponse"] +from ..._models import BaseModel +from ..accounts.account import Account +from ..shared.permission_grant import PermissionGrant -MembershipGetResponse = Union[Optional[str], Optional[object]] +__all__ = [ + "MembershipGetResponse", + "Permissions", + "Policy", + "PolicyPermissionGroup", + "PolicyResourceGroup", + "PolicyResourceGroupScope", + "PolicyResourceGroupScopeObject", +] + + +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 PolicyPermissionGroup(BaseModel): + id: str + """Identifier of the group.""" + + meta: Optional[object] = None + """Attributes associated to the permission group.""" + + name: Optional[str] = None + """Name of the group.""" + + +class PolicyResourceGroupScopeObject(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class PolicyResourceGroupScope(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: List[PolicyResourceGroupScopeObject] + """A list of scope objects for additional context.""" + + +class PolicyResourceGroup(BaseModel): + id: str + """Identifier of the group.""" + + scope: List[PolicyResourceGroupScope] + """The scope associated to the resource group""" + + meta: Optional[object] = None + """Attributes associated to the resource group.""" + + name: Optional[str] = None + """Name of the resource group.""" + + +class Policy(BaseModel): + id: Optional[str] = None + """Policy identifier.""" + + access: Optional[Literal["allow", "deny"]] = None + """Allow or deny operations against the resources.""" + + permission_groups: Optional[List[PolicyPermissionGroup]] = None + """A set of permission groups that are specified to the policy.""" + + resource_groups: Optional[List[PolicyResourceGroup]] = None + """A list of resource groups that the policy applies to.""" + + +class MembershipGetResponse(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. + """ + + permissions: Optional[Permissions] = None + """All access permissions for the user at the account.""" + + policies: Optional[List[Policy]] = None + """Access policy for the membership""" + + 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_update_response.py b/src/cloudflare/types/memberships/membership_update_response.py index adcc658f350..ee118776d7c 100644 --- a/src/cloudflare/types/memberships/membership_update_response.py +++ b/src/cloudflare/types/memberships/membership_update_response.py @@ -1,7 +1,128 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import List, Optional +from typing_extensions import Literal -__all__ = ["MembershipUpdateResponse"] +from ..._models import BaseModel +from ..accounts.account import Account +from ..shared.permission_grant import PermissionGrant -MembershipUpdateResponse = Union[Optional[str], Optional[object]] +__all__ = [ + "MembershipUpdateResponse", + "Permissions", + "Policy", + "PolicyPermissionGroup", + "PolicyResourceGroup", + "PolicyResourceGroupScope", + "PolicyResourceGroupScopeObject", +] + + +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 PolicyPermissionGroup(BaseModel): + id: str + """Identifier of the group.""" + + meta: Optional[object] = None + """Attributes associated to the permission group.""" + + name: Optional[str] = None + """Name of the group.""" + + +class PolicyResourceGroupScopeObject(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Zone ID + etc.) + """ + + +class PolicyResourceGroupScope(BaseModel): + key: str + """ + This is a combination of pre-defined resource name and identifier (like Account + ID etc.) + """ + + objects: List[PolicyResourceGroupScopeObject] + """A list of scope objects for additional context.""" + + +class PolicyResourceGroup(BaseModel): + id: str + """Identifier of the group.""" + + scope: List[PolicyResourceGroupScope] + """The scope associated to the resource group""" + + meta: Optional[object] = None + """Attributes associated to the resource group.""" + + name: Optional[str] = None + """Name of the resource group.""" + + +class Policy(BaseModel): + id: Optional[str] = None + """Policy identifier.""" + + access: Optional[Literal["allow", "deny"]] = None + """Allow or deny operations against the resources.""" + + permission_groups: Optional[List[PolicyPermissionGroup]] = None + """A set of permission groups that are specified to the policy.""" + + resource_groups: Optional[List[PolicyResourceGroup]] = None + """A list of resource groups that the policy applies to.""" + + +class MembershipUpdateResponse(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. + """ + + permissions: Optional[Permissions] = None + """All access permissions for the user at the account.""" + + policies: Optional[List[Policy]] = None + """Access policy for the membership""" + + 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/page_shield/__init__.py b/src/cloudflare/types/page_shield/__init__.py index 6f07ca60629..a115366d760 100644 --- a/src/cloudflare/types/page_shield/__init__.py +++ b/src/cloudflare/types/page_shield/__init__.py @@ -6,10 +6,17 @@ from .script import Script as Script from .setting import Setting as Setting from .connection import Connection as Connection +from .cookie_list_params import CookieListParams as CookieListParams from .script_list_params import ScriptListParams as ScriptListParams +from .cookie_get_response import CookieGetResponse as CookieGetResponse +from .policy_get_response import PolicyGetResponse as PolicyGetResponse from .script_get_response import ScriptGetResponse as ScriptGetResponse +from .cookie_list_response import CookieListResponse as CookieListResponse from .policy_create_params import PolicyCreateParams as PolicyCreateParams +from .policy_list_response import PolicyListResponse as PolicyListResponse from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .connection_list_params import ConnectionListParams as ConnectionListParams +from .policy_create_response import PolicyCreateResponse as PolicyCreateResponse +from .policy_update_response import PolicyUpdateResponse as PolicyUpdateResponse 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 index e89e575b52a..252091a2c85 100644 --- a/src/cloudflare/types/page_shield/connection.py +++ b/src/cloudflare/types/page_shield/connection.py @@ -1,6 +1,7 @@ # 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 @@ -8,22 +9,29 @@ class Connection(BaseModel): - id: Optional[str] = None + id: str + """Identifier""" - added_at: Optional[str] = None + added_at: datetime + + first_seen_at: datetime + + host: str + + last_seen_at: datetime + + url: str + + url_contains_cdn_cgi_path: bool domain_reported_malicious: Optional[bool] = None first_page_url: Optional[str] = None - first_seen_at: Optional[str] = None - - host: Optional[str] = None + malicious_domain_categories: Optional[List[str]] = None - last_seen_at: Optional[str] = None + malicious_url_categories: Optional[List[str]] = None page_urls: Optional[List[str]] = None - url: Optional[str] = None - - url_contains_cdn_cgi_path: Optional[bool] = None + url_reported_malicious: Optional[bool] = None diff --git a/src/cloudflare/types/page_shield/cookie_get_response.py b/src/cloudflare/types/page_shield/cookie_get_response.py new file mode 100644 index 00000000000..45735f30051 --- /dev/null +++ b/src/cloudflare/types/page_shield/cookie_get_response.py @@ -0,0 +1,40 @@ +# 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__ = ["CookieGetResponse"] + + +class CookieGetResponse(BaseModel): + id: str + """Identifier""" + + first_seen_at: datetime + + host: str + + last_seen_at: datetime + + name: str + + type: Literal["first_party", "unknown"] + + domain_attribute: Optional[str] = None + + expires_attribute: Optional[datetime] = None + + http_only_attribute: Optional[bool] = None + + max_age_attribute: Optional[int] = None + + page_urls: Optional[List[str]] = None + + path_attribute: Optional[str] = None + + same_site_attribute: Optional[Literal["lax", "strict", "none"]] = None + + secure_attribute: Optional[bool] = None diff --git a/src/cloudflare/types/page_shield/cookie_list_params.py b/src/cloudflare/types/page_shield/cookie_list_params.py new file mode 100644 index 00000000000..3daf5bdee9c --- /dev/null +++ b/src/cloudflare/types/page_shield/cookie_list_params.py @@ -0,0 +1,75 @@ +# 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__ = ["CookieListParams"] + + +class CookieListParams(TypedDict, total=False): + zone_id: Required[str] + """Identifier""" + + direction: Literal["asc", "desc"] + """The direction used to sort returned cookies.'""" + + domain: str + """Filters the returned cookies that match the specified domain attribute""" + + export: Literal["csv"] + """Export the list of cookies as a file. + + Cannot be used with per_page or page options. + """ + + hosts: str + """ + Includes cookies that match one or more URL-encoded hostnames separated by + commas. + + Wildcards are supported at the start and end of each hostname to support starts + with, ends with and contains. If no wildcards are used, results will be filtered + by exact match + """ + + http_only: bool + """Filters the returned cookies that are set with HttpOnly""" + + name: str + """ + Filters the returned cookies that match the specified name. Wildcards are + supported at the start and end to support starts with, ends with and contains. + e.g. session\\** + """ + + order_by: Literal["first_seen_at", "last_seen_at"] + """The field used to sort returned cookies.""" + + page: str + """The current page number of the paginated results.""" + + page_url: str + """ + Includes connections that match one or more page URLs (separated by commas) + where they were last seen + + Wildcards are supported at the start and end of each page URL to support starts + with, ends with and contains. If no wildcards are used, results will be filtered + by exact match + """ + + path: str + """Filters the returned cookies that match the specified path attribute""" + + per_page: float + """The number of results per page.""" + + same_site: Literal["lax", "strict", "none"] + """Filters the returned cookies that match the specified same_site attribute""" + + secure: bool + """Filters the returned cookies that are set with Secure""" + + type: Literal["first_party", "unknown"] + """Filters the returned cookies that match the specified type attribute""" diff --git a/src/cloudflare/types/page_shield/cookie_list_response.py b/src/cloudflare/types/page_shield/cookie_list_response.py new file mode 100644 index 00000000000..144fd84b510 --- /dev/null +++ b/src/cloudflare/types/page_shield/cookie_list_response.py @@ -0,0 +1,40 @@ +# 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__ = ["CookieListResponse"] + + +class CookieListResponse(BaseModel): + id: str + """Identifier""" + + first_seen_at: datetime + + host: str + + last_seen_at: datetime + + name: str + + type: Literal["first_party", "unknown"] + + domain_attribute: Optional[str] = None + + expires_attribute: Optional[datetime] = None + + http_only_attribute: Optional[bool] = None + + max_age_attribute: Optional[int] = None + + page_urls: Optional[List[str]] = None + + path_attribute: Optional[str] = None + + same_site_attribute: Optional[Literal["lax", "strict", "none"]] = None + + secure_attribute: Optional[bool] = None diff --git a/src/cloudflare/types/page_shield/page_shield_update_response.py b/src/cloudflare/types/page_shield/page_shield_update_response.py index d0410913b2d..ad2852df732 100644 --- a/src/cloudflare/types/page_shield/page_shield_update_response.py +++ b/src/cloudflare/types/page_shield/page_shield_update_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional + from ..._models import BaseModel @@ -8,17 +8,17 @@ class PageShieldUpdateResponse(BaseModel): - enabled: Optional[bool] = None + enabled: bool """When true, indicates that Page Shield is enabled.""" - updated_at: Optional[str] = None + updated_at: str """The timestamp of when Page Shield was last updated.""" - use_cloudflare_reporting_endpoint: Optional[bool] = None + use_cloudflare_reporting_endpoint: bool """ 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 + use_connection_url_path: bool """When true, the paths associated with connections URLs will also be analyzed.""" diff --git a/src/cloudflare/types/page_shield/policy.py b/src/cloudflare/types/page_shield/policy.py index 3f838d934c7..e2c5e6b02a5 100644 --- a/src/cloudflare/types/page_shield/policy.py +++ b/src/cloudflare/types/page_shield/policy.py @@ -1,6 +1,5 @@ # 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 @@ -9,23 +8,20 @@ class Policy(BaseModel): - id: Optional[str] = None - """The ID of the policy""" - - action: Optional[Literal["allow", "log"]] = None + action: Literal["allow", "log"] """The action to take if the expression matches""" - description: Optional[str] = None + description: str """A description for the policy""" - enabled: Optional[bool] = None + enabled: bool """Whether the policy is enabled""" - expression: Optional[str] = None + expression: str """ The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax """ - value: Optional[str] = None + value: str """The policy which will be applied""" diff --git a/src/cloudflare/types/page_shield/policy_create_params.py b/src/cloudflare/types/page_shield/policy_create_params.py index 724923121d7..6578a38230b 100644 --- a/src/cloudflare/types/page_shield/policy_create_params.py +++ b/src/cloudflare/types/page_shield/policy_create_params.py @@ -11,20 +11,20 @@ class PolicyCreateParams(TypedDict, total=False): zone_id: Required[str] """Identifier""" - action: Literal["allow", "log"] + action: Required[Literal["allow", "log"]] """The action to take if the expression matches""" - description: str + description: Required[str] """A description for the policy""" - enabled: bool + enabled: Required[bool] """Whether the policy is enabled""" - expression: str + expression: Required[str] """ The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax """ - value: str + value: Required[str] """The policy which will be applied""" diff --git a/src/cloudflare/types/page_shield/policy_create_response.py b/src/cloudflare/types/page_shield/policy_create_response.py new file mode 100644 index 00000000000..483d2835764 --- /dev/null +++ b/src/cloudflare/types/page_shield/policy_create_response.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PolicyCreateResponse"] + + +class PolicyCreateResponse(BaseModel): + id: str + """Identifier""" + + 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/policy_get_response.py b/src/cloudflare/types/page_shield/policy_get_response.py new file mode 100644 index 00000000000..3b28c295122 --- /dev/null +++ b/src/cloudflare/types/page_shield/policy_get_response.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PolicyGetResponse"] + + +class PolicyGetResponse(BaseModel): + id: str + """Identifier""" + + 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/policy_list_response.py b/src/cloudflare/types/page_shield/policy_list_response.py new file mode 100644 index 00000000000..5ce2180de2f --- /dev/null +++ b/src/cloudflare/types/page_shield/policy_list_response.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PolicyListResponse"] + + +class PolicyListResponse(BaseModel): + id: str + """Identifier""" + + 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/policy_update_response.py b/src/cloudflare/types/page_shield/policy_update_response.py new file mode 100644 index 00000000000..dcc40a8c6cb --- /dev/null +++ b/src/cloudflare/types/page_shield/policy_update_response.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PolicyUpdateResponse"] + + +class PolicyUpdateResponse(BaseModel): + id: str + """Identifier""" + + 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 index 60d4a295f50..2db2c549968 100644 --- a/src/cloudflare/types/page_shield/script.py +++ b/src/cloudflare/types/page_shield/script.py @@ -1,6 +1,7 @@ # 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 @@ -8,32 +9,44 @@ class Script(BaseModel): - id: Optional[str] = None + id: str + """Identifier""" - added_at: Optional[str] = None + added_at: datetime - dataflow_score: Optional[float] = None + first_seen_at: datetime + + host: str + + last_seen_at: datetime + + url: str + + url_contains_cdn_cgi_path: bool + + dataflow_score: Optional[int] = None + """The dataflow score of the JavaScript content.""" domain_reported_malicious: Optional[bool] = None fetched_at: Optional[str] = None + """The timestamp of when the script was last fetched.""" first_page_url: Optional[str] = None - first_seen_at: Optional[str] = None - hash: Optional[str] = None + """The computed hash of the analyzed script.""" - host: Optional[str] = None + js_integrity_score: Optional[int] = None + """The integrity score of the JavaScript content.""" - js_integrity_score: Optional[float] = None + malicious_domain_categories: Optional[List[str]] = None - last_seen_at: Optional[str] = None + malicious_url_categories: Optional[List[str]] = None - obfuscation_score: Optional[float] = None + obfuscation_score: Optional[int] = None + """The obfuscation score of the JavaScript content.""" page_urls: Optional[List[str]] = None - url: Optional[str] = None - - url_contains_cdn_cgi_path: Optional[bool] = None + url_reported_malicious: Optional[bool] = None diff --git a/src/cloudflare/types/page_shield/script_get_response.py b/src/cloudflare/types/page_shield/script_get_response.py index 171d5e24c6b..56d60bc2164 100644 --- a/src/cloudflare/types/page_shield/script_get_response.py +++ b/src/cloudflare/types/page_shield/script_get_response.py @@ -1,6 +1,7 @@ # 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 @@ -25,34 +26,46 @@ class Version(BaseModel): class ScriptGetResponse(BaseModel): - id: Optional[str] = None + id: str + """Identifier""" - added_at: Optional[str] = None + added_at: datetime - dataflow_score: Optional[float] = None + first_seen_at: datetime + + host: str + + last_seen_at: datetime + + url: str + + url_contains_cdn_cgi_path: bool + + dataflow_score: Optional[int] = None + """The dataflow score of the JavaScript content.""" domain_reported_malicious: Optional[bool] = None fetched_at: Optional[str] = None + """The timestamp of when the script was last fetched.""" first_page_url: Optional[str] = None - first_seen_at: Optional[str] = None - hash: Optional[str] = None + """The computed hash of the analyzed script.""" - host: Optional[str] = None + js_integrity_score: Optional[int] = None + """The integrity score of the JavaScript content.""" - js_integrity_score: Optional[float] = None + malicious_domain_categories: Optional[List[str]] = None - last_seen_at: Optional[str] = None + malicious_url_categories: Optional[List[str]] = None - obfuscation_score: Optional[float] = None + obfuscation_score: Optional[int] = None + """The obfuscation score of the JavaScript content.""" page_urls: Optional[List[str]] = None - url: Optional[str] = None - - url_contains_cdn_cgi_path: Optional[bool] = None + url_reported_malicious: Optional[bool] = None versions: Optional[List[Version]] = None diff --git a/src/cloudflare/types/page_shield/setting.py b/src/cloudflare/types/page_shield/setting.py index fee7e5dc567..46e4fd6da65 100644 --- a/src/cloudflare/types/page_shield/setting.py +++ b/src/cloudflare/types/page_shield/setting.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional + from ..._models import BaseModel @@ -8,17 +8,17 @@ class Setting(BaseModel): - enabled: Optional[bool] = None + enabled: bool """When true, indicates that Page Shield is enabled.""" - updated_at: Optional[str] = None + updated_at: str """The timestamp of when Page Shield was last updated.""" - use_cloudflare_reporting_endpoint: Optional[bool] = None + use_cloudflare_reporting_endpoint: bool """ 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 + use_connection_url_path: bool """When true, the paths associated with connections URLs will also be analyzed.""" diff --git a/src/cloudflare/types/pages/project.py b/src/cloudflare/types/pages/project.py index b4bd6af5396..d3e0210408f 100644 --- a/src/cloudflare/types/pages/project.py +++ b/src/cloudflare/types/pages/project.py @@ -201,6 +201,9 @@ class DeploymentConfigsPreviewQueueProducers(BaseModel): class DeploymentConfigsPreviewR2BucketsR2Binding(BaseModel): + jurisdiction: Optional[str] = None + """Jurisdiction of the R2 bucket.""" + name: Optional[str] = None """Name of the R2 bucket.""" @@ -398,6 +401,9 @@ class DeploymentConfigsProductionQueueProducers(BaseModel): class DeploymentConfigsProductionR2BucketsR2Binding(BaseModel): + jurisdiction: Optional[str] = None + """Jurisdiction of the R2 bucket.""" + name: Optional[str] = None """Name of the R2 bucket.""" diff --git a/src/cloudflare/types/pages/project_create_params.py b/src/cloudflare/types/pages/project_create_params.py index 8951be5327a..8c524d05ead 100644 --- a/src/cloudflare/types/pages/project_create_params.py +++ b/src/cloudflare/types/pages/project_create_params.py @@ -218,6 +218,9 @@ class DeploymentConfigsPreviewQueueProducers(TypedDict, total=False): class DeploymentConfigsPreviewR2BucketsR2Binding(TypedDict, total=False): + jurisdiction: Optional[str] + """Jurisdiction of the R2 bucket.""" + name: str """Name of the R2 bucket.""" @@ -410,6 +413,9 @@ class DeploymentConfigsProductionQueueProducers(TypedDict, total=False): class DeploymentConfigsProductionR2BucketsR2Binding(TypedDict, total=False): + jurisdiction: Optional[str] + """Jurisdiction of the R2 bucket.""" + name: str """Name of the R2 bucket.""" diff --git a/src/cloudflare/types/r2/__init__.py b/src/cloudflare/types/r2/__init__.py index 9227a53be92..a4a10ec7a7c 100644 --- a/src/cloudflare/types/r2/__init__.py +++ b/src/cloudflare/types/r2/__init__.py @@ -9,3 +9,5 @@ from .sippy_update_params import SippyUpdateParams as SippyUpdateParams from .bucket_create_params import BucketCreateParams as BucketCreateParams from .sippy_delete_response import SippyDeleteResponse as SippyDeleteResponse +from .temporary_credential_create_params import TemporaryCredentialCreateParams as TemporaryCredentialCreateParams +from .temporary_credential_create_response import TemporaryCredentialCreateResponse as TemporaryCredentialCreateResponse diff --git a/src/cloudflare/types/r2/bucket.py b/src/cloudflare/types/r2/bucket.py index d473140b23d..aa601305f38 100644 --- a/src/cloudflare/types/r2/bucket.py +++ b/src/cloudflare/types/r2/bucket.py @@ -17,3 +17,6 @@ class Bucket(BaseModel): name: Optional[str] = None """Name of the bucket""" + + storage_class: Optional[Literal["Standard", "InfrequentAccess"]] = None + """Storage class for newly uploaded objects, unless specified otherwise.""" diff --git a/src/cloudflare/types/r2/bucket_create_params.py b/src/cloudflare/types/r2/bucket_create_params.py index 9809fb9a07d..ad5ad8a75b3 100644 --- a/src/cloudflare/types/r2/bucket_create_params.py +++ b/src/cloudflare/types/r2/bucket_create_params.py @@ -18,3 +18,6 @@ class BucketCreateParams(TypedDict, total=False): location_hint: Annotated[Literal["apac", "eeur", "enam", "weur", "wnam"], PropertyInfo(alias="locationHint")] """Location of the bucket""" + + storage_class: Annotated[Literal["Standard", "InfrequentAccess"], PropertyInfo(alias="storageClass")] + """Storage class for newly uploaded objects, unless specified otherwise.""" diff --git a/src/cloudflare/types/r2/temporary_credential_create_params.py b/src/cloudflare/types/r2/temporary_credential_create_params.py new file mode 100644 index 00000000000..c79dcc8e5f6 --- /dev/null +++ b/src/cloudflare/types/r2/temporary_credential_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 List +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["TemporaryCredentialCreateParams"] + + +class TemporaryCredentialCreateParams(TypedDict, total=False): + account_id: Required[str] + """Account ID""" + + bucket: Required[str] + """Name of the GCS bucket""" + + parent_access_key_id: Required[Annotated[str, PropertyInfo(alias="parentAccessKeyId")]] + """The parent access key id to use for signing""" + + permission: Required[Literal["admin-read-write", "admin-read-only", "object-read-write", "object-read-only"]] + """Permissions allowed on the credentials""" + + ttl_seconds: Required[Annotated[float, PropertyInfo(alias="ttlSeconds")]] + """How long the credentials will live for in seconds""" + + objects: List[str] + """Optional object paths to scope the credentials to""" + + prefixes: List[str] + """Optional prefix paths to scope the credentials to""" diff --git a/src/cloudflare/types/r2/temporary_credential_create_response.py b/src/cloudflare/types/r2/temporary_credential_create_response.py new file mode 100644 index 00000000000..3a1838f74fc --- /dev/null +++ b/src/cloudflare/types/r2/temporary_credential_create_response.py @@ -0,0 +1,20 @@ +# 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__ = ["TemporaryCredentialCreateResponse"] + + +class TemporaryCredentialCreateResponse(BaseModel): + access_key_id: Optional[str] = FieldInfo(alias="accessKeyId", default=None) + """ID for new access key""" + + secret_access_key: Optional[str] = FieldInfo(alias="secretAccessKey", default=None) + """Secret access key""" + + session_token: Optional[str] = FieldInfo(alias="sessionToken", default=None) + """Security token""" diff --git a/src/cloudflare/types/radar/__init__.py b/src/cloudflare/types/radar/__init__.py index cacf1e11ece..cab083c87f6 100644 --- a/src/cloudflare/types/radar/__init__.py +++ b/src/cloudflare/types/radar/__init__.py @@ -14,10 +14,12 @@ from .search_global_params import SearchGlobalParams as SearchGlobalParams from .bgp_timeseries_params import BGPTimeseriesParams as BGPTimeseriesParams from .dataset_list_response import DatasetListResponse as DatasetListResponse +from .http_timeseries_params import HTTPTimeseriesParams as HTTPTimeseriesParams from .search_global_response import SearchGlobalResponse as SearchGlobalResponse from .as112_timeseries_params import AS112TimeseriesParams as AS112TimeseriesParams from .bgp_timeseries_response import BGPTimeseriesResponse as BGPTimeseriesResponse from .dataset_download_params import DatasetDownloadParams as DatasetDownloadParams +from .http_timeseries_response import HTTPTimeseriesResponse as HTTPTimeseriesResponse from .as112_timeseries_response import AS112TimeseriesResponse as AS112TimeseriesResponse from .dataset_download_response import DatasetDownloadResponse as DatasetDownloadResponse from .netflow_timeseries_params import NetflowTimeseriesParams as NetflowTimeseriesParams diff --git a/src/cloudflare/types/radar/bgp/__init__.py b/src/cloudflare/types/radar/bgp/__init__.py index d1bc53367b3..fdbf378f666 100644 --- a/src/cloudflare/types/radar/bgp/__init__.py +++ b/src/cloudflare/types/radar/bgp/__init__.py @@ -2,13 +2,15 @@ from __future__ import annotations +from .route_ases_params import RouteAsesParams as RouteAsesParams from .route_moas_params import RouteMoasParams as RouteMoasParams from .route_stats_params import RouteStatsParams as RouteStatsParams +from .route_ases_response import RouteAsesResponse as RouteAsesResponse 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 .ip_timeseries_params import IPTimeseriesParams as IPTimeseriesParams 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 .route_timeseries_params import RouteTimeseriesParams as RouteTimeseriesParams -from .route_timeseries_response import RouteTimeseriesResponse as RouteTimeseriesResponse +from .ip_timeseries_response import IPTimeseriesResponse as IPTimeseriesResponse diff --git a/src/cloudflare/types/radar/bgp/hijacks/event_list_params.py b/src/cloudflare/types/radar/bgp/hijacks/event_list_params.py index 8bceb23cf4f..d4508e86b11 100644 --- a/src/cloudflare/types/radar/bgp/hijacks/event_list_params.py +++ b/src/cloudflare/types/radar/bgp/hijacks/event_list_params.py @@ -71,7 +71,7 @@ class EventListParams(TypedDict, total=False): """Number of entries per page""" prefix: str - """The prefix hijacked during a BGP hijack event""" + """Network prefix, IPv4 or IPv6.""" sort_by: Annotated[Literal["ID", "TIME", "CONFIDENCE"], PropertyInfo(alias="sortBy")] """Sort events by field""" diff --git a/src/cloudflare/types/radar/bgp/route_timeseries_params.py b/src/cloudflare/types/radar/bgp/ip_timeseries_params.py similarity index 80% rename from src/cloudflare/types/radar/bgp/route_timeseries_params.py rename to src/cloudflare/types/radar/bgp/ip_timeseries_params.py index 55d51e97031..64d069dcb49 100644 --- a/src/cloudflare/types/radar/bgp/route_timeseries_params.py +++ b/src/cloudflare/types/radar/bgp/ip_timeseries_params.py @@ -2,18 +2,18 @@ from __future__ import annotations -from typing import Union +from typing import List, Union from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict from ...._utils import PropertyInfo -__all__ = ["RouteTimeseriesParams"] +__all__ = ["IPTimeseriesParams"] -class RouteTimeseriesParams(TypedDict, total=False): - asn: int - """Single ASN as integer.""" +class IPTimeseriesParams(TypedDict, total=False): + asn: str + """Comma separated list of ASNs.""" date_end: Annotated[Union[str, datetime], PropertyInfo(alias="dateEnd", format="iso8601")] """End of the date range (inclusive).""" @@ -53,4 +53,7 @@ class RouteTimeseriesParams(TypedDict, total=False): """Include data delay meta information""" location: str - """Location Alpha2 code.""" + """Comma separated list of locations.""" + + name: List[str] + """Array of names that will be used to name the series in responses.""" diff --git a/src/cloudflare/types/radar/bgp/route_timeseries_response.py b/src/cloudflare/types/radar/bgp/ip_timeseries_response.py similarity index 66% rename from src/cloudflare/types/radar/bgp/route_timeseries_response.py rename to src/cloudflare/types/radar/bgp/ip_timeseries_response.py index fa7506de2c5..aeff238cfe0 100644 --- a/src/cloudflare/types/radar/bgp/route_timeseries_response.py +++ b/src/cloudflare/types/radar/bgp/ip_timeseries_response.py @@ -7,7 +7,7 @@ from ...._models import BaseModel -__all__ = ["RouteTimeseriesResponse", "Meta", "MetaDateRange", "SerieIPV4_24s", "SerieIPV6_48s"] +__all__ = ["IPTimeseriesResponse", "Meta", "MetaDateRange", "Serie174", "SerieCn"] class MetaDateRange(BaseModel): @@ -22,21 +22,25 @@ class Meta(BaseModel): date_range: List[MetaDateRange] = FieldInfo(alias="dateRange") -class SerieIPV4_24s(BaseModel): +class Serie174(BaseModel): + ipv4: List[str] + + ipv6: List[str] + timestamps: List[datetime] - values: List[int] +class SerieCn(BaseModel): + ipv4: List[str] -class SerieIPV6_48s(BaseModel): - timestamps: List[datetime] + ipv6: List[str] - values: List[int] + timestamps: List[datetime] -class RouteTimeseriesResponse(BaseModel): +class IPTimeseriesResponse(BaseModel): meta: Meta - serie_ipv4_24s: SerieIPV4_24s + serie_174: Serie174 - serie_ipv6_48s: SerieIPV6_48s + serie_cn: SerieCn diff --git a/src/cloudflare/types/radar/bgp/route_ases_params.py b/src/cloudflare/types/radar/bgp/route_ases_params.py new file mode 100644 index 00000000000..734a74168f0 --- /dev/null +++ b/src/cloudflare/types/radar/bgp/route_ases_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["RouteAsesParams"] + + +class RouteAsesParams(TypedDict, total=False): + format: Literal["JSON", "CSV"] + """Format results are returned in.""" + + limit: int + """Limit the number of objects in the response.""" + + location: str + """Location Alpha2 code.""" + + sort_by: Annotated[ + Literal["cone", "pfxs", "ipv4", "ipv6", "rpki_valid", "rpki_invalid", "rpki_unknown"], + PropertyInfo(alias="sortBy"), + ] + """Return order results by given type""" + + sort_order: Annotated[Literal["asc", "desc"], PropertyInfo(alias="sortOrder")] + """Sort by value ascending or descending""" diff --git a/src/cloudflare/types/radar/bgp/route_ases_response.py b/src/cloudflare/types/radar/bgp/route_ases_response.py new file mode 100644 index 00000000000..56e851baf3d --- /dev/null +++ b/src/cloudflare/types/radar/bgp/route_ases_response.py @@ -0,0 +1,57 @@ +# 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__ = ["RouteAsesResponse", "ASN", "Meta"] + + +class ASN(BaseModel): + asn: int + + cone_size: int = FieldInfo(alias="coneSize") + """AS's customer cone size""" + + country: str + """2-letter country code for the AS's registration country""" + + ipv4_count: int = FieldInfo(alias="ipv4Count") + """number of IPv4 addresses originated by the AS""" + + ipv6_count: str = FieldInfo(alias="ipv6Count") + """number of IPv6 addresses originated by the AS""" + + name: str + """name of the AS""" + + pfxs_count: int = FieldInfo(alias="pfxsCount") + """number of total IP prefixes originated by the AS""" + + rpki_invalid: int = FieldInfo(alias="rpkiInvalid") + """number of RPKI invalid prefixes originated by the AS""" + + rpki_unknown: int = FieldInfo(alias="rpkiUnknown") + """number of RPKI unknown prefixes originated by the AS""" + + rpki_valid: int = FieldInfo(alias="rpkiValid") + """number of RPKI valid prefixes originated by the AS""" + + +class Meta(BaseModel): + data_time: str = FieldInfo(alias="dataTime") + """the timestamp of when the data is generated""" + + query_time: str = FieldInfo(alias="queryTime") + """the timestamp of the query""" + + total_peers: int = FieldInfo(alias="totalPeers") + """total number of route collector peers used to generate this data""" + + +class RouteAsesResponse(BaseModel): + asns: List[ASN] + + meta: Meta diff --git a/src/cloudflare/types/radar/bgp/route_moas_params.py b/src/cloudflare/types/radar/bgp/route_moas_params.py index f4aff772fa5..8bf9d86d6c6 100644 --- a/src/cloudflare/types/radar/bgp/route_moas_params.py +++ b/src/cloudflare/types/radar/bgp/route_moas_params.py @@ -18,4 +18,4 @@ class RouteMoasParams(TypedDict, total=False): """Lookup MOASes originated by the given ASN""" prefix: str - """Lookup MOASes by prefix""" + """Network prefix, IPv4 or IPv6.""" diff --git a/src/cloudflare/types/radar/bgp/route_pfx2as_params.py b/src/cloudflare/types/radar/bgp/route_pfx2as_params.py index c3f84837f6d..caa3a87e8b0 100644 --- a/src/cloudflare/types/radar/bgp/route_pfx2as_params.py +++ b/src/cloudflare/types/radar/bgp/route_pfx2as_params.py @@ -23,7 +23,7 @@ class RoutePfx2asParams(TypedDict, total=False): """Lookup prefixes originated by the given ASN""" prefix: str - """Lookup origin ASNs of the given prefix""" + """Network prefix, IPv4 or IPv6.""" rpki_status: Annotated[Literal["VALID", "INVALID", "UNKNOWN"], PropertyInfo(alias="rpkiStatus")] """Return only results with matching rpki status: valid, invalid or unknown""" diff --git a/src/cloudflare/types/radar/bgp/top/ase_get_params.py b/src/cloudflare/types/radar/bgp/top/ase_get_params.py index c6d396e84ee..f24fe9c65e8 100644 --- a/src/cloudflare/types/radar/bgp/top/ase_get_params.py +++ b/src/cloudflare/types/radar/bgp/top/ase_get_params.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import List, Union +from typing import List, Union, Iterable from datetime import datetime -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from ....._utils import PropertyInfo -__all__ = ["AseGetParams"] +__all__ = ["AseGetParams", "Prefix"] class AseGetParams(TypedDict, total=False): @@ -62,8 +62,17 @@ class AseGetParams(TypedDict, total=False): name: List[str] """Array of names that will be used to name the series in responses.""" - prefix: List[str] + prefix: Iterable[Prefix] """Array of BGP network prefixes.""" update_type: Annotated[List[Literal["ANNOUNCEMENT", "WITHDRAWAL"]], PropertyInfo(alias="updateType")] """Array of BGP update types.""" + + +class Prefix(TypedDict, total=False): + location: Required[str] + + name: Required[str] + + type: str + """Network prefix, IPv4 or IPv6.""" diff --git a/src/cloudflare/types/radar/bgp_timeseries_params.py b/src/cloudflare/types/radar/bgp_timeseries_params.py index 084c0cf5a5a..53697dd7bf2 100644 --- a/src/cloudflare/types/radar/bgp_timeseries_params.py +++ b/src/cloudflare/types/radar/bgp_timeseries_params.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import List, Union +from typing import List, Union, Iterable from datetime import datetime -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from ..._utils import PropertyInfo -__all__ = ["BGPTimeseriesParams"] +__all__ = ["BGPTimeseriesParams", "Prefix"] class BGPTimeseriesParams(TypedDict, total=False): @@ -66,8 +66,17 @@ class BGPTimeseriesParams(TypedDict, total=False): name: List[str] """Array of names that will be used to name the series in responses.""" - prefix: List[str] + prefix: Iterable[Prefix] """Array of BGP network prefixes.""" update_type: Annotated[List[Literal["ANNOUNCEMENT", "WITHDRAWAL"]], PropertyInfo(alias="updateType")] """Array of BGP update types.""" + + +class Prefix(TypedDict, total=False): + location: Required[str] + + name: Required[str] + + type: str + """Network prefix, IPv4 or IPv6.""" diff --git a/src/cloudflare/types/radar/http/ase_get_params.py b/src/cloudflare/types/radar/http/ase_get_params.py index 3d3336e3f44..866834c70d7 100644 --- a/src/cloudflare/types/radar/http/ase_get_params.py +++ b/src/cloudflare/types/radar/http/ase_get_params.py @@ -26,6 +26,9 @@ class AseGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/ases/__init__.py b/src/cloudflare/types/radar/http/ases/__init__.py index f91ee63822a..c527d55fdc2 100644 --- a/src/cloudflare/types/radar/http/ases/__init__.py +++ b/src/cloudflare/types/radar/http/ases/__init__.py @@ -15,4 +15,6 @@ from .http_method_get_response import HTTPMethodGetResponse as HTTPMethodGetResponse from .http_protocol_get_params import HTTPProtocolGetParams as HTTPProtocolGetParams from .tls_version_get_response import TLSVersionGetResponse as TLSVersionGetResponse +from .browser_family_get_params import BrowserFamilyGetParams as BrowserFamilyGetParams from .http_protocol_get_response import HTTPProtocolGetResponse as HTTPProtocolGetResponse +from .browser_family_get_response import BrowserFamilyGetResponse as BrowserFamilyGetResponse diff --git a/src/cloudflare/types/radar/http/ases/bot_class_get_params.py b/src/cloudflare/types/radar/http/ases/bot_class_get_params.py index aeac71c8dc0..cd99955cee5 100644 --- a/src/cloudflare/types/radar/http/ases/bot_class_get_params.py +++ b/src/cloudflare/types/radar/http/ases/bot_class_get_params.py @@ -19,6 +19,9 @@ class BotClassGetParams(TypedDict, total=False): AS3356. """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/ases/browser_family_get_params.py b/src/cloudflare/types/radar/http/ases/browser_family_get_params.py new file mode 100644 index 00000000000..e4869f37c27 --- /dev/null +++ b/src/cloudflare/types/radar/http/ases/browser_family_get_params.py @@ -0,0 +1,104 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ....._utils import PropertyInfo + +__all__ = ["BrowserFamilyGetParams"] + + +class BrowserFamilyGetParams(TypedDict, total=False): + asn: List[str] + """Array of comma separated list of ASNs, start with `-` to exclude from results. + + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + """ + + bot_class: Annotated[List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]], PropertyInfo(alias="botClass")] + """Filter for bot class. + + Refer to + [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + """ + + continent: List[str] + """Array of comma separated list of continents (alpha-2 continent codes). + + Start with `-` to exclude from results. For example, `-EU,NA` excludes results + from Europe, but includes results from North America. + """ + + date_end: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateEnd", format="iso8601")] + """End of the date range (inclusive).""" + + date_range: Annotated[ + List[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + ], + PropertyInfo(alias="dateRange"), + ] + """ + For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + """ + + date_start: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateStart", format="iso8601")] + """Array of datetimes to filter the start of a series.""" + + device_type: Annotated[List[Literal["DESKTOP", "MOBILE", "OTHER"]], PropertyInfo(alias="deviceType")] + """Filter for device type.""" + + format: Literal["JSON", "CSV"] + """Format results are returned in.""" + + http_protocol: Annotated[List[Literal["HTTP", "HTTPS"]], PropertyInfo(alias="httpProtocol")] + """Filter for http protocol.""" + + http_version: Annotated[List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]], PropertyInfo(alias="httpVersion")] + """Filter for http version.""" + + ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")] + """Filter for ip version.""" + + limit: int + """Limit the number of objects in the response.""" + + location: List[str] + """Array of comma separated list of locations (alpha-2 country codes). + + Start with `-` to exclude from results. For example, `-US,PT` excludes results + from the US, but includes results from PT. + """ + + name: List[str] + """Array of names that will be used to name the series in responses.""" + + os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]] + """Filter for os name.""" + + tls_version: Annotated[ + List[Literal["TLSv1_0", "TLSv1_1", "TLSv1_2", "TLSv1_3", "TLSvQUIC"]], PropertyInfo(alias="tlsVersion") + ] + """Filter for tls version.""" diff --git a/src/cloudflare/types/radar/http/ases/browser_family_get_response.py b/src/cloudflare/types/radar/http/ases/browser_family_get_response.py new file mode 100644 index 00000000000..e7bd3b48901 --- /dev/null +++ b/src/cloudflare/types/radar/http/ases/browser_family_get_response.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 pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = [ + "BrowserFamilyGetResponse", + "Meta", + "MetaDateRange", + "MetaConfidenceInfo", + "MetaConfidenceInfoAnnotation", + "Top0", +] + + +class MetaDateRange(BaseModel): + end_time: datetime = FieldInfo(alias="endTime") + """Adjusted end of date range.""" + + start_time: datetime = FieldInfo(alias="startTime") + """Adjusted start of date range.""" + + +class MetaConfidenceInfoAnnotation(BaseModel): + data_source: str = FieldInfo(alias="dataSource") + + description: str + + event_type: str = FieldInfo(alias="eventType") + + is_instantaneous: object = FieldInfo(alias="isInstantaneous") + + end_time: Optional[datetime] = FieldInfo(alias="endTime", default=None) + + linked_url: Optional[str] = FieldInfo(alias="linkedUrl", default=None) + + start_time: Optional[datetime] = FieldInfo(alias="startTime", default=None) + + +class MetaConfidenceInfo(BaseModel): + annotations: Optional[List[MetaConfidenceInfoAnnotation]] = None + + level: Optional[int] = None + + +class Meta(BaseModel): + date_range: List[MetaDateRange] = FieldInfo(alias="dateRange") + + last_updated: str = FieldInfo(alias="lastUpdated") + + confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) + + +class Top0(BaseModel): + client_asn: int = FieldInfo(alias="clientASN") + + client_as_name: str = FieldInfo(alias="clientASName") + + value: str + + +class BrowserFamilyGetResponse(BaseModel): + meta: Meta + + top_0: List[Top0] diff --git a/src/cloudflare/types/radar/http/ases/device_type_get_params.py b/src/cloudflare/types/radar/http/ases/device_type_get_params.py index afc057a5def..4e8a4f6eef2 100644 --- a/src/cloudflare/types/radar/http/ases/device_type_get_params.py +++ b/src/cloudflare/types/radar/http/ases/device_type_get_params.py @@ -26,6 +26,9 @@ class DeviceTypeGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/ases/http_method_get_params.py b/src/cloudflare/types/radar/http/ases/http_method_get_params.py index 11533af139e..d32a5407d1f 100644 --- a/src/cloudflare/types/radar/http/ases/http_method_get_params.py +++ b/src/cloudflare/types/radar/http/ases/http_method_get_params.py @@ -26,6 +26,9 @@ class HTTPMethodGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/ases/http_protocol_get_params.py b/src/cloudflare/types/radar/http/ases/http_protocol_get_params.py index 299452c2e2a..6286b675db5 100644 --- a/src/cloudflare/types/radar/http/ases/http_protocol_get_params.py +++ b/src/cloudflare/types/radar/http/ases/http_protocol_get_params.py @@ -26,6 +26,9 @@ class HTTPProtocolGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/ases/ip_version_get_params.py b/src/cloudflare/types/radar/http/ases/ip_version_get_params.py index 57b133433b6..c39d2467c67 100644 --- a/src/cloudflare/types/radar/http/ases/ip_version_get_params.py +++ b/src/cloudflare/types/radar/http/ases/ip_version_get_params.py @@ -26,6 +26,9 @@ class IPVersionGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/ases/os_get_params.py b/src/cloudflare/types/radar/http/ases/os_get_params.py index 4e61e3dec2c..300ebd78db8 100644 --- a/src/cloudflare/types/radar/http/ases/os_get_params.py +++ b/src/cloudflare/types/radar/http/ases/os_get_params.py @@ -26,6 +26,9 @@ class OSGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/ases/tls_version_get_params.py b/src/cloudflare/types/radar/http/ases/tls_version_get_params.py index 1dcba2abdec..f5bb8d7ce65 100644 --- a/src/cloudflare/types/radar/http/ases/tls_version_get_params.py +++ b/src/cloudflare/types/radar/http/ases/tls_version_get_params.py @@ -26,6 +26,9 @@ class TLSVersionGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/location_get_params.py b/src/cloudflare/types/radar/http/location_get_params.py index 14074793bb4..7f57f7d7d12 100644 --- a/src/cloudflare/types/radar/http/location_get_params.py +++ b/src/cloudflare/types/radar/http/location_get_params.py @@ -26,6 +26,9 @@ class LocationGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/locations/__init__.py b/src/cloudflare/types/radar/http/locations/__init__.py index f91ee63822a..c527d55fdc2 100644 --- a/src/cloudflare/types/radar/http/locations/__init__.py +++ b/src/cloudflare/types/radar/http/locations/__init__.py @@ -15,4 +15,6 @@ from .http_method_get_response import HTTPMethodGetResponse as HTTPMethodGetResponse from .http_protocol_get_params import HTTPProtocolGetParams as HTTPProtocolGetParams from .tls_version_get_response import TLSVersionGetResponse as TLSVersionGetResponse +from .browser_family_get_params import BrowserFamilyGetParams as BrowserFamilyGetParams from .http_protocol_get_response import HTTPProtocolGetResponse as HTTPProtocolGetResponse +from .browser_family_get_response import BrowserFamilyGetResponse as BrowserFamilyGetResponse diff --git a/src/cloudflare/types/radar/http/locations/bot_class_get_params.py b/src/cloudflare/types/radar/http/locations/bot_class_get_params.py index aeac71c8dc0..cd99955cee5 100644 --- a/src/cloudflare/types/radar/http/locations/bot_class_get_params.py +++ b/src/cloudflare/types/radar/http/locations/bot_class_get_params.py @@ -19,6 +19,9 @@ class BotClassGetParams(TypedDict, total=False): AS3356. """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/locations/browser_family_get_params.py b/src/cloudflare/types/radar/http/locations/browser_family_get_params.py new file mode 100644 index 00000000000..e4869f37c27 --- /dev/null +++ b/src/cloudflare/types/radar/http/locations/browser_family_get_params.py @@ -0,0 +1,104 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ....._utils import PropertyInfo + +__all__ = ["BrowserFamilyGetParams"] + + +class BrowserFamilyGetParams(TypedDict, total=False): + asn: List[str] + """Array of comma separated list of ASNs, start with `-` to exclude from results. + + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + """ + + bot_class: Annotated[List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]], PropertyInfo(alias="botClass")] + """Filter for bot class. + + Refer to + [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + """ + + continent: List[str] + """Array of comma separated list of continents (alpha-2 continent codes). + + Start with `-` to exclude from results. For example, `-EU,NA` excludes results + from Europe, but includes results from North America. + """ + + date_end: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateEnd", format="iso8601")] + """End of the date range (inclusive).""" + + date_range: Annotated[ + List[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + ], + PropertyInfo(alias="dateRange"), + ] + """ + For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + """ + + date_start: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateStart", format="iso8601")] + """Array of datetimes to filter the start of a series.""" + + device_type: Annotated[List[Literal["DESKTOP", "MOBILE", "OTHER"]], PropertyInfo(alias="deviceType")] + """Filter for device type.""" + + format: Literal["JSON", "CSV"] + """Format results are returned in.""" + + http_protocol: Annotated[List[Literal["HTTP", "HTTPS"]], PropertyInfo(alias="httpProtocol")] + """Filter for http protocol.""" + + http_version: Annotated[List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]], PropertyInfo(alias="httpVersion")] + """Filter for http version.""" + + ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")] + """Filter for ip version.""" + + limit: int + """Limit the number of objects in the response.""" + + location: List[str] + """Array of comma separated list of locations (alpha-2 country codes). + + Start with `-` to exclude from results. For example, `-US,PT` excludes results + from the US, but includes results from PT. + """ + + name: List[str] + """Array of names that will be used to name the series in responses.""" + + os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]] + """Filter for os name.""" + + tls_version: Annotated[ + List[Literal["TLSv1_0", "TLSv1_1", "TLSv1_2", "TLSv1_3", "TLSvQUIC"]], PropertyInfo(alias="tlsVersion") + ] + """Filter for tls version.""" diff --git a/src/cloudflare/types/radar/http/locations/browser_family_get_response.py b/src/cloudflare/types/radar/http/locations/browser_family_get_response.py new file mode 100644 index 00000000000..faa107c1193 --- /dev/null +++ b/src/cloudflare/types/radar/http/locations/browser_family_get_response.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 pydantic import Field as FieldInfo + +from ....._models import BaseModel + +__all__ = [ + "BrowserFamilyGetResponse", + "Meta", + "MetaDateRange", + "MetaConfidenceInfo", + "MetaConfidenceInfoAnnotation", + "Top0", +] + + +class MetaDateRange(BaseModel): + end_time: datetime = FieldInfo(alias="endTime") + """Adjusted end of date range.""" + + start_time: datetime = FieldInfo(alias="startTime") + """Adjusted start of date range.""" + + +class MetaConfidenceInfoAnnotation(BaseModel): + data_source: str = FieldInfo(alias="dataSource") + + description: str + + event_type: str = FieldInfo(alias="eventType") + + is_instantaneous: object = FieldInfo(alias="isInstantaneous") + + end_time: Optional[datetime] = FieldInfo(alias="endTime", default=None) + + linked_url: Optional[str] = FieldInfo(alias="linkedUrl", default=None) + + start_time: Optional[datetime] = FieldInfo(alias="startTime", default=None) + + +class MetaConfidenceInfo(BaseModel): + annotations: Optional[List[MetaConfidenceInfoAnnotation]] = None + + level: Optional[int] = None + + +class Meta(BaseModel): + date_range: List[MetaDateRange] = FieldInfo(alias="dateRange") + + last_updated: str = FieldInfo(alias="lastUpdated") + + confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) + + +class Top0(BaseModel): + client_country_alpha2: str = FieldInfo(alias="clientCountryAlpha2") + + client_country_name: str = FieldInfo(alias="clientCountryName") + + value: str + + +class BrowserFamilyGetResponse(BaseModel): + meta: Meta + + top_0: List[Top0] diff --git a/src/cloudflare/types/radar/http/locations/device_type_get_params.py b/src/cloudflare/types/radar/http/locations/device_type_get_params.py index afc057a5def..4e8a4f6eef2 100644 --- a/src/cloudflare/types/radar/http/locations/device_type_get_params.py +++ b/src/cloudflare/types/radar/http/locations/device_type_get_params.py @@ -26,6 +26,9 @@ class DeviceTypeGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/locations/http_method_get_params.py b/src/cloudflare/types/radar/http/locations/http_method_get_params.py index 11533af139e..d32a5407d1f 100644 --- a/src/cloudflare/types/radar/http/locations/http_method_get_params.py +++ b/src/cloudflare/types/radar/http/locations/http_method_get_params.py @@ -26,6 +26,9 @@ class HTTPMethodGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/locations/http_protocol_get_params.py b/src/cloudflare/types/radar/http/locations/http_protocol_get_params.py index 299452c2e2a..6286b675db5 100644 --- a/src/cloudflare/types/radar/http/locations/http_protocol_get_params.py +++ b/src/cloudflare/types/radar/http/locations/http_protocol_get_params.py @@ -26,6 +26,9 @@ class HTTPProtocolGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/locations/ip_version_get_params.py b/src/cloudflare/types/radar/http/locations/ip_version_get_params.py index 57b133433b6..c39d2467c67 100644 --- a/src/cloudflare/types/radar/http/locations/ip_version_get_params.py +++ b/src/cloudflare/types/radar/http/locations/ip_version_get_params.py @@ -26,6 +26,9 @@ class IPVersionGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/locations/os_get_params.py b/src/cloudflare/types/radar/http/locations/os_get_params.py index 4e61e3dec2c..300ebd78db8 100644 --- a/src/cloudflare/types/radar/http/locations/os_get_params.py +++ b/src/cloudflare/types/radar/http/locations/os_get_params.py @@ -26,6 +26,9 @@ class OSGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/locations/tls_version_get_params.py b/src/cloudflare/types/radar/http/locations/tls_version_get_params.py index 1dcba2abdec..f5bb8d7ce65 100644 --- a/src/cloudflare/types/radar/http/locations/tls_version_get_params.py +++ b/src/cloudflare/types/radar/http/locations/tls_version_get_params.py @@ -26,6 +26,9 @@ class TLSVersionGetParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/top_browser_families_params.py b/src/cloudflare/types/radar/http/top_browser_families_params.py index 36992c88360..53bf111abab 100644 --- a/src/cloudflare/types/radar/http/top_browser_families_params.py +++ b/src/cloudflare/types/radar/http/top_browser_families_params.py @@ -26,6 +26,9 @@ class TopBrowserFamiliesParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http/top_browsers_params.py b/src/cloudflare/types/radar/http/top_browsers_params.py index 189c2149d62..1454f2d68e7 100644 --- a/src/cloudflare/types/radar/http/top_browsers_params.py +++ b/src/cloudflare/types/radar/http/top_browsers_params.py @@ -26,6 +26,9 @@ class TopBrowsersParams(TypedDict, total=False): [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). """ + browser_family: Annotated[List[Literal["CHROME", "EDGE", "FIREFOX", "SAFARI"]], PropertyInfo(alias="browserFamily")] + """Filter for browser family.""" + continent: List[str] """Array of comma separated list of continents (alpha-2 continent codes). diff --git a/src/cloudflare/types/radar/http_timeseries_params.py b/src/cloudflare/types/radar/http_timeseries_params.py new file mode 100644 index 00000000000..a11c86f05f2 --- /dev/null +++ b/src/cloudflare/types/radar/http_timeseries_params.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["HTTPTimeseriesParams"] + + +class HTTPTimeseriesParams(TypedDict, total=False): + agg_interval: Annotated[Literal["15m", "1h", "1d", "1w"], PropertyInfo(alias="aggInterval")] + """ + Aggregation interval results should be returned in (for example, in 15 minutes + or 1 hour intervals). Refer to + [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + """ + + asn: List[str] + """Array of comma separated list of ASNs, start with `-` to exclude from results. + + For example, `-174, 3356` excludes results from AS174, but includes results from + AS3356. + """ + + continent: List[str] + """Array of comma separated list of continents (alpha-2 continent codes). + + Start with `-` to exclude from results. For example, `-EU,NA` excludes results + from Europe, but includes results from North America. + """ + + date_end: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateEnd", format="iso8601")] + """End of the date range (inclusive).""" + + date_range: Annotated[ + List[ + Literal[ + "1d", + "2d", + "7d", + "14d", + "28d", + "12w", + "24w", + "52w", + "1dControl", + "2dControl", + "7dControl", + "14dControl", + "28dControl", + "12wControl", + "24wControl", + ] + ], + PropertyInfo(alias="dateRange"), + ] + """ + For example, use `7d` and `7dControl` to compare this week with the previous + week. Use this parameter or set specific start and end dates (`dateStart` and + `dateEnd` parameters). + """ + + date_start: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateStart", format="iso8601")] + """Array of datetimes to filter the start of a series.""" + + format: Literal["JSON", "CSV"] + """Format results are returned in.""" + + location: List[str] + """Array of comma separated list of locations (alpha-2 country codes). + + Start with `-` to exclude from results. For example, `-US,PT` excludes results + from the US, but includes results from PT. + """ + + name: List[str] + """Array of names that will be used to name the series in responses.""" diff --git a/src/cloudflare/types/radar/http_timeseries_response.py b/src/cloudflare/types/radar/http_timeseries_response.py new file mode 100644 index 00000000000..00d0b8dada4 --- /dev/null +++ b/src/cloudflare/types/radar/http_timeseries_response.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 pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "HTTPTimeseriesResponse", + "Meta", + "MetaDateRange", + "MetaConfidenceInfo", + "MetaConfidenceInfoAnnotation", + "Serie0", +] + + +class MetaDateRange(BaseModel): + end_time: datetime = FieldInfo(alias="endTime") + """Adjusted end of date range.""" + + start_time: datetime = FieldInfo(alias="startTime") + """Adjusted start of date range.""" + + +class MetaConfidenceInfoAnnotation(BaseModel): + data_source: str = FieldInfo(alias="dataSource") + + description: str + + event_type: str = FieldInfo(alias="eventType") + + is_instantaneous: object = FieldInfo(alias="isInstantaneous") + + end_time: Optional[datetime] = FieldInfo(alias="endTime", default=None) + + linked_url: Optional[str] = FieldInfo(alias="linkedUrl", default=None) + + start_time: Optional[datetime] = FieldInfo(alias="startTime", default=None) + + +class MetaConfidenceInfo(BaseModel): + annotations: Optional[List[MetaConfidenceInfoAnnotation]] = None + + level: Optional[int] = None + + +class Meta(BaseModel): + agg_interval: str = FieldInfo(alias="aggInterval") + + date_range: List[MetaDateRange] = FieldInfo(alias="dateRange") + + last_updated: datetime = FieldInfo(alias="lastUpdated") + + confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None) + + +class Serie0(BaseModel): + timestamps: List[datetime] + + values: List[str] + + +class HTTPTimeseriesResponse(BaseModel): + meta: Meta + + serie_0: Serie0 diff --git a/src/cloudflare/types/rulesets/__init__.py b/src/cloudflare/types/rulesets/__init__.py index d5b6a67cb87..8b6885eb3fd 100644 --- a/src/cloudflare/types/rulesets/__init__.py +++ b/src/cloudflare/types/rulesets/__init__.py @@ -5,7 +5,6 @@ from .kind import Kind as Kind from .phase import Phase as Phase 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 @@ -40,8 +39,10 @@ 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_list_response import RulesetListResponse as RulesetListResponse from .ruleset_update_params import RulesetUpdateParams as RulesetUpdateParams from .set_config_rule_param import SetConfigRuleParam as SetConfigRuleParam +from .version_list_response import VersionListResponse as VersionListResponse 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 diff --git a/src/cloudflare/types/rulesets/phase_get_response.py b/src/cloudflare/types/rulesets/phase_get_response.py index 659dae75d71..d88c9679596 100644 --- a/src/cloudflare/types/rulesets/phase_get_response.py +++ b/src/cloudflare/types/rulesets/phase_get_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from .kind import Kind from .phase import Phase +from .logging import Logging +from ..._utils import PropertyInfo from .log_rule import LogRule from ..._models import BaseModel from .skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "PhaseGetResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/phase_update_params.py b/src/cloudflare/types/rulesets/phase_update_params.py index fbee22cf279..972c5295f31 100644 --- a/src/cloudflare/types/rulesets/phase_update_params.py +++ b/src/cloudflare/types/rulesets/phase_update_params.py @@ -3,10 +3,9 @@ from __future__ import annotations from typing import Union, Iterable -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict -from .kind import Kind -from .phase import Phase +from .logging_param import LoggingParam from .log_rule_param import LogRuleParam from .skip_rule_param import SkipRuleParam from .block_rule_param import BlockRuleParam @@ -23,7 +22,17 @@ from .managed_challenge_rule_param import ManagedChallengeRuleParam from .set_cache_settings_rule_param import SetCacheSettingsRuleParam -__all__ = ["PhaseUpdateParams", "Rule"] +__all__ = [ + "PhaseUpdateParams", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] class PhaseUpdateParams(TypedDict, total=False): @@ -39,14 +48,112 @@ class PhaseUpdateParams(TypedDict, total=False): description: str """An informative description of the ruleset.""" - kind: Kind - """The kind of the ruleset.""" - name: str """The human-readable name of the ruleset.""" - phase: Phase - """The phase of the ruleset.""" + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): + cookie_fields: Iterable[RuleRulesetsLogCustomFieldRuleActionParametersCookieField] + """The cookie fields to log.""" + + request_fields: Iterable[RuleRulesetsLogCustomFieldRuleActionParametersRequestField] + """The request fields to log.""" + + response_fields: Iterable[RuleRulesetsLogCustomFieldRuleActionParametersResponseField] + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["log_custom_field"] + """The action to perform when the rule matches.""" + + action_parameters: RuleRulesetsLogCustomFieldRuleActionParameters + """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 RuleRulesetsDDoSDynamicRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["ddos_dynamic"] + """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 RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["force_connection_close"] + """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).""" Rule = Union[ @@ -65,4 +172,7 @@ class PhaseUpdateParams(TypedDict, total=False): SetConfigRuleParam, SkipRuleParam, SetCacheSettingsRuleParam, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/phase_update_response.py b/src/cloudflare/types/rulesets/phase_update_response.py index 8d5b1b28eac..3e00524ec11 100644 --- a/src/cloudflare/types/rulesets/phase_update_response.py +++ b/src/cloudflare/types/rulesets/phase_update_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from .kind import Kind from .phase import Phase +from .logging import Logging +from ..._utils import PropertyInfo from .log_rule import LogRule from ..._models import BaseModel from .skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "PhaseUpdateResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/phases/__init__.py b/src/cloudflare/types/rulesets/phases/__init__.py index 398f2bd04ad..5a719b3e523 100644 --- a/src/cloudflare/types/rulesets/phases/__init__.py +++ b/src/cloudflare/types/rulesets/phases/__init__.py @@ -3,3 +3,4 @@ from __future__ import annotations from .version_get_response import VersionGetResponse as VersionGetResponse +from .version_list_response import VersionListResponse as VersionListResponse diff --git a/src/cloudflare/types/rulesets/phases/version_get_response.py b/src/cloudflare/types/rulesets/phases/version_get_response.py index e4a7e29890b..3c7d7b05653 100644 --- a/src/cloudflare/types/rulesets/phases/version_get_response.py +++ b/src/cloudflare/types/rulesets/phases/version_get_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from ..kind import Kind from ..phase import Phase +from ..logging import Logging +from ...._utils import PropertyInfo from ..log_rule import LogRule from ...._models import BaseModel from ..skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "VersionGetResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/phases/version_list_response.py b/src/cloudflare/types/rulesets/phases/version_list_response.py new file mode 100644 index 00000000000..921e1de8c40 --- /dev/null +++ b/src/cloudflare/types/rulesets/phases/version_list_response.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 ..kind import Kind +from ..phase import Phase +from ...._models import BaseModel + +__all__ = ["VersionListResponse"] + + +class VersionListResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Kind + """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: Phase + """The phase of 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_create_params.py b/src/cloudflare/types/rulesets/rule_create_params.py index 84c2f09d8b5..f027d1e1dc5 100644 --- a/src/cloudflare/types/rulesets/rule_create_params.py +++ b/src/cloudflare/types/rulesets/rule_create_params.py @@ -71,6 +71,13 @@ "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL", "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange", "SetCacheSettingsRuleActionParametersServeStale", + "RulesetsLogCustomFieldRule", + "RulesetsLogCustomFieldRuleActionParameters", + "RulesetsLogCustomFieldRuleActionParametersCookieField", + "RulesetsLogCustomFieldRuleActionParametersRequestField", + "RulesetsLogCustomFieldRuleActionParametersResponseField", + "RulesetsDDoSDynamicRule", + "RulesetsForceConnectionCloseRule", ] @@ -741,15 +748,21 @@ class SetConfigRuleActionParameters(TypedDict, total=False): bic: bool """Turn on or off Browser Integrity Check.""" - disable_apps: bool + disable_apps: Literal[True] """Turn off all active Cloudflare Apps.""" - disable_zaraz: bool + disable_rum: Literal[True] + """Turn off Real User Monitoring (RUM).""" + + disable_zaraz: Literal[True] """Turn off Zaraz.""" email_obfuscation: bool """Turn on or off Email Obfuscation.""" + fonts: bool + """Turn on or off Cloudflare Fonts.""" + hotlink_protection: bool """Turn on or off the Hotlink Protection.""" @@ -1136,6 +1149,128 @@ class SetCacheSettingsRuleActionParameters(TypedDict, total=False): """ +class RulesetsLogCustomFieldRule(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["log_custom_field"] + """The action to perform when the rule matches.""" + + action_parameters: RulesetsLogCustomFieldRuleActionParameters + """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 RulesetsLogCustomFieldRuleActionParametersCookieField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RulesetsLogCustomFieldRuleActionParametersRequestField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RulesetsLogCustomFieldRuleActionParametersResponseField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): + cookie_fields: Iterable[RulesetsLogCustomFieldRuleActionParametersCookieField] + """The cookie fields to log.""" + + request_fields: Iterable[RulesetsLogCustomFieldRuleActionParametersRequestField] + """The request fields to log.""" + + response_fields: Iterable[RulesetsLogCustomFieldRuleActionParametersResponseField] + """The response fields to log.""" + + +class RulesetsDDoSDynamicRule(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["ddos_dynamic"] + """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 RulesetsForceConnectionCloseRule(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["force_connection_close"] + """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).""" + + RuleCreateParams = Union[ BlockRule, ChallengeRule, @@ -1152,4 +1287,7 @@ class SetCacheSettingsRuleActionParameters(TypedDict, total=False): SetConfigRule, SkipRule, SetCacheSettingsRule, + RulesetsLogCustomFieldRule, + RulesetsDDoSDynamicRule, + RulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/rule_create_response.py b/src/cloudflare/types/rulesets/rule_create_response.py index 7fdfe28ad63..04e3457f902 100644 --- a/src/cloudflare/types/rulesets/rule_create_response.py +++ b/src/cloudflare/types/rulesets/rule_create_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from .kind import Kind from .phase import Phase +from .logging import Logging +from ..._utils import PropertyInfo from .log_rule import LogRule from ..._models import BaseModel from .skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "RuleCreateResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/rule_delete_response.py b/src/cloudflare/types/rulesets/rule_delete_response.py index a199b17fd00..25d801cd5aa 100644 --- a/src/cloudflare/types/rulesets/rule_delete_response.py +++ b/src/cloudflare/types/rulesets/rule_delete_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from .kind import Kind from .phase import Phase +from .logging import Logging +from ..._utils import PropertyInfo from .log_rule import LogRule from ..._models import BaseModel from .skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "RuleDeleteResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/rule_edit_params.py b/src/cloudflare/types/rulesets/rule_edit_params.py index 63f8b2a0b50..8382c7d8687 100644 --- a/src/cloudflare/types/rulesets/rule_edit_params.py +++ b/src/cloudflare/types/rulesets/rule_edit_params.py @@ -71,6 +71,13 @@ "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTL", "SetCacheSettingsRuleActionParametersEdgeTTLStatusCodeTTLStatusCodeRange", "SetCacheSettingsRuleActionParametersServeStale", + "RulesetsLogCustomFieldRule", + "RulesetsLogCustomFieldRuleActionParameters", + "RulesetsLogCustomFieldRuleActionParametersCookieField", + "RulesetsLogCustomFieldRuleActionParametersRequestField", + "RulesetsLogCustomFieldRuleActionParametersResponseField", + "RulesetsDDoSDynamicRule", + "RulesetsForceConnectionCloseRule", ] @@ -780,15 +787,21 @@ class SetConfigRuleActionParameters(TypedDict, total=False): bic: bool """Turn on or off Browser Integrity Check.""" - disable_apps: bool + disable_apps: Literal[True] """Turn off all active Cloudflare Apps.""" - disable_zaraz: bool + disable_rum: Literal[True] + """Turn off Real User Monitoring (RUM).""" + + disable_zaraz: Literal[True] """Turn off Zaraz.""" email_obfuscation: bool """Turn on or off Email Obfuscation.""" + fonts: bool + """Turn on or off Cloudflare Fonts.""" + hotlink_protection: bool """Turn on or off the Hotlink Protection.""" @@ -1181,6 +1194,137 @@ class SetCacheSettingsRuleActionParameters(TypedDict, total=False): """ +class RulesetsLogCustomFieldRule(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["log_custom_field"] + """The action to perform when the rule matches.""" + + action_parameters: RulesetsLogCustomFieldRuleActionParameters + """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 RulesetsLogCustomFieldRuleActionParametersCookieField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RulesetsLogCustomFieldRuleActionParametersRequestField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RulesetsLogCustomFieldRuleActionParametersResponseField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): + cookie_fields: Iterable[RulesetsLogCustomFieldRuleActionParametersCookieField] + """The cookie fields to log.""" + + request_fields: Iterable[RulesetsLogCustomFieldRuleActionParametersRequestField] + """The request fields to log.""" + + response_fields: Iterable[RulesetsLogCustomFieldRuleActionParametersResponseField] + """The response fields to log.""" + + +class RulesetsDDoSDynamicRule(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["ddos_dynamic"] + """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 RulesetsForceConnectionCloseRule(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["force_connection_close"] + """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).""" + + RuleEditParams = Union[ BlockRule, ChallengeRule, @@ -1197,4 +1341,7 @@ class SetCacheSettingsRuleActionParameters(TypedDict, total=False): SetConfigRule, SkipRule, SetCacheSettingsRule, + RulesetsLogCustomFieldRule, + RulesetsDDoSDynamicRule, + RulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/rule_edit_response.py b/src/cloudflare/types/rulesets/rule_edit_response.py index 38c4717f2f6..47dd4534324 100644 --- a/src/cloudflare/types/rulesets/rule_edit_response.py +++ b/src/cloudflare/types/rulesets/rule_edit_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from .kind import Kind from .phase import Phase +from .logging import Logging +from ..._utils import PropertyInfo from .log_rule import LogRule from ..._models import BaseModel from .skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "RuleEditResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/ruleset_create_params.py b/src/cloudflare/types/rulesets/ruleset_create_params.py index db2759e933f..4e372271bef 100644 --- a/src/cloudflare/types/rulesets/ruleset_create_params.py +++ b/src/cloudflare/types/rulesets/ruleset_create_params.py @@ -3,10 +3,11 @@ from __future__ import annotations from typing import Union, Iterable -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict from .kind import Kind from .phase import Phase +from .logging_param import LoggingParam from .log_rule_param import LogRuleParam from .skip_rule_param import SkipRuleParam from .block_rule_param import BlockRuleParam @@ -23,7 +24,17 @@ from .managed_challenge_rule_param import ManagedChallengeRuleParam from .set_cache_settings_rule_param import SetCacheSettingsRuleParam -__all__ = ["RulesetCreateParams", "Rule"] +__all__ = [ + "RulesetCreateParams", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] class RulesetCreateParams(TypedDict, total=False): @@ -49,6 +60,110 @@ class RulesetCreateParams(TypedDict, total=False): """An informative description of the ruleset.""" +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): + cookie_fields: Iterable[RuleRulesetsLogCustomFieldRuleActionParametersCookieField] + """The cookie fields to log.""" + + request_fields: Iterable[RuleRulesetsLogCustomFieldRuleActionParametersRequestField] + """The request fields to log.""" + + response_fields: Iterable[RuleRulesetsLogCustomFieldRuleActionParametersResponseField] + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["log_custom_field"] + """The action to perform when the rule matches.""" + + action_parameters: RuleRulesetsLogCustomFieldRuleActionParameters + """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 RuleRulesetsDDoSDynamicRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["ddos_dynamic"] + """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 RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["force_connection_close"] + """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).""" + + Rule = Union[ BlockRuleParam, ChallengeRuleParam, @@ -65,4 +180,7 @@ class RulesetCreateParams(TypedDict, total=False): SetConfigRuleParam, SkipRuleParam, SetCacheSettingsRuleParam, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/ruleset_create_response.py b/src/cloudflare/types/rulesets/ruleset_create_response.py index c14817bae8e..bfeacd5afd4 100644 --- a/src/cloudflare/types/rulesets/ruleset_create_response.py +++ b/src/cloudflare/types/rulesets/ruleset_create_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from .kind import Kind from .phase import Phase +from .logging import Logging +from ..._utils import PropertyInfo from .log_rule import LogRule from ..._models import BaseModel from .skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "RulesetCreateResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/ruleset_get_response.py b/src/cloudflare/types/rulesets/ruleset_get_response.py index 99506e58175..328ba42b25a 100644 --- a/src/cloudflare/types/rulesets/ruleset_get_response.py +++ b/src/cloudflare/types/rulesets/ruleset_get_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from .kind import Kind from .phase import Phase +from .logging import Logging +from ..._utils import PropertyInfo from .log_rule import LogRule from ..._models import BaseModel from .skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "RulesetGetResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/ruleset.py b/src/cloudflare/types/rulesets/ruleset_list_response.py similarity index 81% rename from src/cloudflare/types/rulesets/ruleset.py rename to src/cloudflare/types/rulesets/ruleset_list_response.py index a570fcc344d..582742290a7 100644 --- a/src/cloudflare/types/rulesets/ruleset.py +++ b/src/cloudflare/types/rulesets/ruleset_list_response.py @@ -7,27 +7,27 @@ from .phase import Phase from ..._models import BaseModel -__all__ = ["Ruleset"] +__all__ = ["RulesetListResponse"] -class Ruleset(BaseModel): +class RulesetListResponse(BaseModel): id: str """The unique ID of the ruleset.""" + kind: Kind + """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: Phase + """The phase of the ruleset.""" + version: str """The version of the ruleset.""" description: Optional[str] = None """An informative description of the ruleset.""" - - kind: Optional[Kind] = None - """The kind of the ruleset.""" - - name: Optional[str] = None - """The human-readable name of the ruleset.""" - - phase: Optional[Phase] = None - """The phase of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/ruleset_update_params.py b/src/cloudflare/types/rulesets/ruleset_update_params.py index 4e3b08a7640..e2ff9a9fcb8 100644 --- a/src/cloudflare/types/rulesets/ruleset_update_params.py +++ b/src/cloudflare/types/rulesets/ruleset_update_params.py @@ -3,10 +3,11 @@ from __future__ import annotations from typing import Union, Iterable -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict from .kind import Kind from .phase import Phase +from .logging_param import LoggingParam from .log_rule_param import LogRuleParam from .skip_rule_param import SkipRuleParam from .block_rule_param import BlockRuleParam @@ -23,7 +24,17 @@ from .managed_challenge_rule_param import ManagedChallengeRuleParam from .set_cache_settings_rule_param import SetCacheSettingsRuleParam -__all__ = ["RulesetUpdateParams", "Rule"] +__all__ = [ + "RulesetUpdateParams", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] class RulesetUpdateParams(TypedDict, total=False): @@ -49,6 +60,110 @@ class RulesetUpdateParams(TypedDict, total=False): """The phase of the ruleset.""" +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(TypedDict, total=False): + name: Required[str] + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(TypedDict, total=False): + cookie_fields: Iterable[RuleRulesetsLogCustomFieldRuleActionParametersCookieField] + """The cookie fields to log.""" + + request_fields: Iterable[RuleRulesetsLogCustomFieldRuleActionParametersRequestField] + """The request fields to log.""" + + response_fields: Iterable[RuleRulesetsLogCustomFieldRuleActionParametersResponseField] + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["log_custom_field"] + """The action to perform when the rule matches.""" + + action_parameters: RuleRulesetsLogCustomFieldRuleActionParameters + """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 RuleRulesetsDDoSDynamicRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["ddos_dynamic"] + """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 RuleRulesetsForceConnectionCloseRule(TypedDict, total=False): + id: str + """The unique ID of the rule.""" + + action: Literal["force_connection_close"] + """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).""" + + Rule = Union[ BlockRuleParam, ChallengeRuleParam, @@ -65,4 +180,7 @@ class RulesetUpdateParams(TypedDict, total=False): SetConfigRuleParam, SkipRuleParam, SetCacheSettingsRuleParam, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, ] diff --git a/src/cloudflare/types/rulesets/ruleset_update_response.py b/src/cloudflare/types/rulesets/ruleset_update_response.py index 6cc2c3f102c..9fb84d0d26a 100644 --- a/src/cloudflare/types/rulesets/ruleset_update_response.py +++ b/src/cloudflare/types/rulesets/ruleset_update_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from .kind import Kind from .phase import Phase +from .logging import Logging +from ..._utils import PropertyInfo from .log_rule import LogRule from ..._models import BaseModel from .skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "RulesetUpdateResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/set_config_rule.py b/src/cloudflare/types/rulesets/set_config_rule.py index 8d135f95608..8f09bbe8b99 100644 --- a/src/cloudflare/types/rulesets/set_config_rule.py +++ b/src/cloudflare/types/rulesets/set_config_rule.py @@ -31,15 +31,21 @@ class ActionParameters(BaseModel): bic: Optional[bool] = None """Turn on or off Browser Integrity Check.""" - disable_apps: Optional[bool] = None + disable_apps: Optional[Literal[True]] = None """Turn off all active Cloudflare Apps.""" - disable_zaraz: Optional[bool] = None + disable_rum: Optional[Literal[True]] = None + """Turn off Real User Monitoring (RUM).""" + + disable_zaraz: Optional[Literal[True]] = None """Turn off Zaraz.""" email_obfuscation: Optional[bool] = None """Turn on or off Email Obfuscation.""" + fonts: Optional[bool] = None + """Turn on or off Cloudflare Fonts.""" + hotlink_protection: Optional[bool] = None """Turn on or off the Hotlink Protection.""" diff --git a/src/cloudflare/types/rulesets/set_config_rule_param.py b/src/cloudflare/types/rulesets/set_config_rule_param.py index e90a1670126..09ccc180461 100644 --- a/src/cloudflare/types/rulesets/set_config_rule_param.py +++ b/src/cloudflare/types/rulesets/set_config_rule_param.py @@ -30,15 +30,21 @@ class ActionParameters(TypedDict, total=False): bic: bool """Turn on or off Browser Integrity Check.""" - disable_apps: bool + disable_apps: Literal[True] """Turn off all active Cloudflare Apps.""" - disable_zaraz: bool + disable_rum: Literal[True] + """Turn off Real User Monitoring (RUM).""" + + disable_zaraz: Literal[True] """Turn off Zaraz.""" email_obfuscation: bool """Turn on or off Email Obfuscation.""" + fonts: bool + """Turn on or off Cloudflare Fonts.""" + hotlink_protection: bool """Turn on or off the Hotlink Protection.""" diff --git a/src/cloudflare/types/rulesets/version_get_response.py b/src/cloudflare/types/rulesets/version_get_response.py index cb03724ddeb..abb1cfae6c7 100644 --- a/src/cloudflare/types/rulesets/version_get_response.py +++ b/src/cloudflare/types/rulesets/version_get_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from .kind import Kind from .phase import Phase +from .logging import Logging +from ..._utils import PropertyInfo from .log_rule import LogRule from ..._models import BaseModel from .skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "VersionGetResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/rulesets/version_list_response.py b/src/cloudflare/types/rulesets/version_list_response.py new file mode 100644 index 00000000000..bfc8b80491c --- /dev/null +++ b/src/cloudflare/types/rulesets/version_list_response.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 .kind import Kind +from .phase import Phase +from ..._models import BaseModel + +__all__ = ["VersionListResponse"] + + +class VersionListResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Kind + """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: Phase + """The phase of 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/versions/by_tag_get_response.py b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py index f1aa698a4af..058c549bc29 100644 --- a/src/cloudflare/types/rulesets/versions/by_tag_get_response.py +++ b/src/cloudflare/types/rulesets/versions/by_tag_get_response.py @@ -2,9 +2,12 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal, Annotated from ..kind import Kind from ..phase import Phase +from ..logging import Logging +from ...._utils import PropertyInfo from ..log_rule import LogRule from ...._models import BaseModel from ..skip_rule import SkipRule @@ -22,24 +25,172 @@ 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, +__all__ = [ + "ByTagGetResponse", + "Rule", + "RuleRulesetsLogCustomFieldRule", + "RuleRulesetsLogCustomFieldRuleActionParameters", + "RuleRulesetsLogCustomFieldRuleActionParametersCookieField", + "RuleRulesetsLogCustomFieldRuleActionParametersRequestField", + "RuleRulesetsLogCustomFieldRuleActionParametersResponseField", + "RuleRulesetsDDoSDynamicRule", + "RuleRulesetsForceConnectionCloseRule", +] + + +class RuleRulesetsLogCustomFieldRuleActionParametersCookieField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersRequestField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParametersResponseField(BaseModel): + name: str + """The name of the field.""" + + +class RuleRulesetsLogCustomFieldRuleActionParameters(BaseModel): + cookie_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersCookieField]] = None + """The cookie fields to log.""" + + request_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersRequestField]] = None + """The request fields to log.""" + + response_fields: Optional[List[RuleRulesetsLogCustomFieldRuleActionParametersResponseField]] = None + """The response fields to log.""" + + +class RuleRulesetsLogCustomFieldRule(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_custom_field"]] = None + """The action to perform when the rule matches.""" + + action_parameters: Optional[RuleRulesetsLogCustomFieldRuleActionParameters] = 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).""" + + +class RuleRulesetsDDoSDynamicRule(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["ddos_dynamic"]] = 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).""" + + +class RuleRulesetsForceConnectionCloseRule(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["force_connection_close"]] = 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).""" + + +Rule = Annotated[ + Union[ + BlockRule, + ChallengeRule, + CompressResponseRule, + ExecuteRule, + JSChallengeRule, + LogRule, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RouteRule, + ScoreRule, + ServeErrorRule, + SetConfigRule, + SkipRule, + SetCacheSettingsRule, + RuleRulesetsLogCustomFieldRule, + RuleRulesetsDDoSDynamicRule, + RuleRulesetsForceConnectionCloseRule, + ], + PropertyInfo(discriminator="action"), ] diff --git a/src/cloudflare/types/shared/cloudflare_tunnel.py b/src/cloudflare/types/shared/cloudflare_tunnel.py index 63f80cc424a..9fbc6e6c16a 100644 --- a/src/cloudflare/types/shared/cloudflare_tunnel.py +++ b/src/cloudflare/types/shared/cloudflare_tunnel.py @@ -83,7 +83,7 @@ class CloudflareTunnel(BaseModel): If `false`, the tunnel must be configured locally on the origin machine. """ - status: Optional[str] = None + status: Optional[Literal["inactive", "degraded", "healthy", "down"]] = None """The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is diff --git a/src/cloudflare/types/shared/member.py b/src/cloudflare/types/shared/member.py index 101555dd229..c4282582d50 100644 --- a/src/cloudflare/types/shared/member.py +++ b/src/cloudflare/types/shared/member.py @@ -1,6 +1,7 @@ # 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 .permission_grant import PermissionGrant @@ -68,12 +69,14 @@ class User(BaseModel): class Member(BaseModel): - id: str + id: Optional[str] = None """Membership identifier tag.""" - roles: List[Role] + roles: Optional[List[Role]] = None """Roles assigned to this member.""" - status: object + status: Optional[Literal["accepted", "pending"]] = None + """A member's status in the account.""" - user: User + user: Optional[User] = None + """Details of the user associated to the membership.""" diff --git a/src/cloudflare/types/shared/result.py b/src/cloudflare/types/shared/result.py index 27983e6c0fd..5923de2e012 100644 --- a/src/cloudflare/types/shared/result.py +++ b/src/cloudflare/types/shared/result.py @@ -11,9 +11,9 @@ class UnionMember0(BaseModel): - errors: Optional[object] = None + errors: Optional[List[ResponseInfo]] = None - messages: Optional[List[object]] = None + messages: Optional[List[ResponseInfo]] = None result: Optional[List[AuditLog]] = None @@ -25,8 +25,6 @@ class AaaAPIResponseCommon(BaseModel): messages: List[ResponseInfo] - result: Union[List[object], str, object] - success: Literal[True] """Whether the API call was successful""" diff --git a/src/cloudflare/types/user/__init__.py b/src/cloudflare/types/user/__init__.py index 986ee04d241..fa5f8dd0d13 100644 --- a/src/cloudflare/types/user/__init__.py +++ b/src/cloudflare/types/user/__init__.py @@ -12,24 +12,17 @@ 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_update_params import TokenUpdateParams as TokenUpdateParams -from .invite_edit_response import InviteEditResponse as InviteEditResponse 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 .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 .subscription_edit_response import SubscriptionEditResponse as SubscriptionEditResponse from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams diff --git a/src/cloudflare/types/user/invite_edit_response.py b/src/cloudflare/types/user/invite_edit_response.py deleted file mode 100644 index 646377ca831..00000000000 --- a/src/cloudflare/types/user/invite_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, Optional - -__all__ = ["InviteEditResponse"] - -InviteEditResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/user/invite_get_response.py b/src/cloudflare/types/user/invite_get_response.py deleted file mode 100644 index 27a15f71311..00000000000 --- a/src/cloudflare/types/user/invite_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, Optional - -__all__ = ["InviteGetResponse"] - -InviteGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/user/organization.py b/src/cloudflare/types/user/organization.py index 6c1aa83f02d..3a690386174 100644 --- a/src/cloudflare/types/user/organization.py +++ b/src/cloudflare/types/user/organization.py @@ -23,4 +23,4 @@ class Organization(BaseModel): """List of roles that a user has within an organization.""" status: Optional[Status] = None - """Whether the user is a member of the organization or has an inivitation pending.""" + """Whether the user is a member of the organization or has an invitation pending.""" diff --git a/src/cloudflare/types/user/policy_param.py b/src/cloudflare/types/user/policy_param.py index d9f62820fe7..f6b62435dfe 100644 --- a/src/cloudflare/types/user/policy_param.py +++ b/src/cloudflare/types/user/policy_param.py @@ -9,7 +9,8 @@ class PermissionGroup(TypedDict, total=False): - pass + meta: object + """Attributes associated to the permission group.""" class PolicyParam(TypedDict, total=False): diff --git a/src/cloudflare/types/user/token_get_response.py b/src/cloudflare/types/user/token_get_response.py deleted file mode 100644 index a45eff43263..00000000000 --- a/src/cloudflare/types/user/token_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, Optional - -__all__ = ["TokenGetResponse"] - -TokenGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/user/token_update_response.py b/src/cloudflare/types/user/token_update_response.py deleted file mode 100644 index 4600c9aba02..00000000000 --- a/src/cloudflare/types/user/token_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, Optional - -__all__ = ["TokenUpdateResponse"] - -TokenUpdateResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/user/user_edit_response.py b/src/cloudflare/types/user/user_edit_response.py deleted file mode 100644 index e2077cf822d..00000000000 --- a/src/cloudflare/types/user/user_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, Optional - -__all__ = ["UserEditResponse"] - -UserEditResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/user/user_get_response.py b/src/cloudflare/types/user/user_get_response.py deleted file mode 100644 index 7a0f59652a5..00000000000 --- a/src/cloudflare/types/user/user_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, Optional - -__all__ = ["UserGetResponse"] - -UserGetResponse = Union[Optional[str], Optional[object]] diff --git a/src/cloudflare/types/vectorize/index_insert_params.py b/src/cloudflare/types/vectorize/index_insert_params.py index d5a829f9ee3..5498a47074e 100644 --- a/src/cloudflare/types/vectorize/index_insert_params.py +++ b/src/cloudflare/types/vectorize/index_insert_params.py @@ -4,6 +4,8 @@ from typing_extensions import Required, TypedDict +from ..._types import FileTypes + __all__ = ["IndexInsertParams"] @@ -11,4 +13,5 @@ class IndexInsertParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - body: Required[object] + body: Required[FileTypes] + """ndjson file containing vectors to insert.""" diff --git a/src/cloudflare/types/vectorize/index_upsert_params.py b/src/cloudflare/types/vectorize/index_upsert_params.py index 6b187a77059..f9cd3161b36 100644 --- a/src/cloudflare/types/vectorize/index_upsert_params.py +++ b/src/cloudflare/types/vectorize/index_upsert_params.py @@ -4,6 +4,8 @@ from typing_extensions import Required, TypedDict +from ..._types import FileTypes + __all__ = ["IndexUpsertParams"] @@ -11,4 +13,5 @@ class IndexUpsertParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - body: Required[object] + body: Required[FileTypes] + """ndjson file containing vectors to upsert.""" diff --git a/src/cloudflare/types/warp_connector/warp_connector_create_response.py b/src/cloudflare/types/warp_connector/warp_connector_create_response.py index f76eda94d7c..20c981ffbba 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_create_response.py +++ b/src/cloudflare/types/warp_connector/warp_connector_create_response.py @@ -78,7 +78,7 @@ class TunnelWARPConnectorTunnel(BaseModel): name: Optional[str] = None """A user-friendly name for a tunnel.""" - status: Optional[str] = None + status: Optional[Literal["inactive", "degraded", "healthy", "down"]] = None """The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is diff --git a/src/cloudflare/types/warp_connector/warp_connector_delete_response.py b/src/cloudflare/types/warp_connector/warp_connector_delete_response.py index 22c9fd73ca3..6cbd9848ac0 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_delete_response.py +++ b/src/cloudflare/types/warp_connector/warp_connector_delete_response.py @@ -78,7 +78,7 @@ class TunnelWARPConnectorTunnel(BaseModel): name: Optional[str] = None """A user-friendly name for a tunnel.""" - status: Optional[str] = None + status: Optional[Literal["inactive", "degraded", "healthy", "down"]] = None """The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is diff --git a/src/cloudflare/types/warp_connector/warp_connector_edit_response.py b/src/cloudflare/types/warp_connector/warp_connector_edit_response.py index 19ac4305497..1efce6cc9ab 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_edit_response.py +++ b/src/cloudflare/types/warp_connector/warp_connector_edit_response.py @@ -78,7 +78,7 @@ class TunnelWARPConnectorTunnel(BaseModel): name: Optional[str] = None """A user-friendly name for a tunnel.""" - status: Optional[str] = None + status: Optional[Literal["inactive", "degraded", "healthy", "down"]] = None """The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is diff --git a/src/cloudflare/types/warp_connector/warp_connector_get_response.py b/src/cloudflare/types/warp_connector/warp_connector_get_response.py index aab7e8cfb2c..af11fb6dfbb 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_get_response.py +++ b/src/cloudflare/types/warp_connector/warp_connector_get_response.py @@ -78,7 +78,7 @@ class TunnelWARPConnectorTunnel(BaseModel): name: Optional[str] = None """A user-friendly name for a tunnel.""" - status: Optional[str] = None + status: Optional[Literal["inactive", "degraded", "healthy", "down"]] = None """The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is diff --git a/src/cloudflare/types/warp_connector/warp_connector_list_params.py b/src/cloudflare/types/warp_connector/warp_connector_list_params.py index e58a6e75cc1..e02da6d9bed 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_list_params.py +++ b/src/cloudflare/types/warp_connector/warp_connector_list_params.py @@ -4,7 +4,7 @@ from typing import Union from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from ..._utils import PropertyInfo @@ -40,6 +40,15 @@ class WARPConnectorListParams(TypedDict, total=False): per_page: float """Number of results to display.""" + status: Literal["inactive", "degraded", "healthy", "down"] + """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). + """ + uuid: str """UUID of the tunnel.""" diff --git a/src/cloudflare/types/warp_connector/warp_connector_list_response.py b/src/cloudflare/types/warp_connector/warp_connector_list_response.py index a5b67df48c4..1412e8639ee 100644 --- a/src/cloudflare/types/warp_connector/warp_connector_list_response.py +++ b/src/cloudflare/types/warp_connector/warp_connector_list_response.py @@ -78,7 +78,7 @@ class TunnelWARPConnectorTunnel(BaseModel): name: Optional[str] = None """A user-friendly name for a tunnel.""" - status: Optional[str] = None + status: Optional[Literal["inactive", "degraded", "healthy", "down"]] = None """The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is diff --git a/src/cloudflare/types/workers/ai/__init__.py b/src/cloudflare/types/workers/ai/__init__.py new file mode 100644 index 00000000000..f8ee8b14b1c --- /dev/null +++ b/src/cloudflare/types/workers/ai/__init__.py @@ -0,0 +1,3 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations diff --git a/src/cloudflare/types/workers/ai/models/__init__.py b/src/cloudflare/types/workers/ai/models/__init__.py new file mode 100644 index 00000000000..64ed676cee2 --- /dev/null +++ b/src/cloudflare/types/workers/ai/models/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .schema_get_params import SchemaGetParams as SchemaGetParams diff --git a/src/cloudflare/types/workers/ai/models/schema_get_params.py b/src/cloudflare/types/workers/ai/models/schema_get_params.py new file mode 100644 index 00000000000..92d676194ab --- /dev/null +++ b/src/cloudflare/types/workers/ai/models/schema_get_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__ = ["SchemaGetParams"] + + +class SchemaGetParams(TypedDict, total=False): + account_id: Required[str] + + model: Required[str] + """Model Name""" diff --git a/src/cloudflare/types/workers/ai_run_response.py b/src/cloudflare/types/workers/ai_run_response.py index 5877761e02c..87644ee64f6 100644 --- a/src/cloudflare/types/workers/ai_run_response.py +++ b/src/cloudflare/types/workers/ai_run_response.py @@ -13,7 +13,8 @@ "ImageClassification", "ObjectDetection", "ObjectDetectionBox", - "Response", + "UnionMember7", + "UnionMember7ToolCall", "Translation", "Summarization", "ImageToText", @@ -74,9 +75,17 @@ class ObjectDetection(BaseModel): score: Optional[float] = None -class Response(BaseModel): +class UnionMember7ToolCall(BaseModel): + arguments: Optional[object] = None + + name: Optional[str] = None + + +class UnionMember7(BaseModel): response: Optional[str] = None + tool_calls: Optional[List[UnionMember7ToolCall]] = None + class Translation(BaseModel): translated_text: Optional[str] = None @@ -98,7 +107,7 @@ class ImageToText(BaseModel): SpeechRecognition, List[ImageClassification], List[ObjectDetection], - Response, + UnionMember7, object, Translation, Summarization, diff --git a/src/cloudflare/types/workers/scripts/__init__.py b/src/cloudflare/types/workers/scripts/__init__.py index 233a054aa7a..64f34786b7c 100644 --- a/src/cloudflare/types/workers/scripts/__init__.py +++ b/src/cloudflare/types/workers/scripts/__init__.py @@ -9,6 +9,7 @@ from .tail_get_response import TailGetResponse as TailGetResponse from .tail_create_params import TailCreateParams as TailCreateParams from .setting_edit_params import SettingEditParams as SettingEditParams +from .version_list_params import VersionListParams as VersionListParams from .tail_create_response import TailCreateResponse as TailCreateResponse from .tail_delete_response import TailDeleteResponse as TailDeleteResponse from .version_get_response import VersionGetResponse as VersionGetResponse diff --git a/src/cloudflare/types/workers/scripts/version_list_params.py b/src/cloudflare/types/workers/scripts/version_list_params.py new file mode 100644 index 00000000000..b5c0dd9481e --- /dev/null +++ b/src/cloudflare/types/workers/scripts/version_list_params.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["VersionListParams"] + + +class VersionListParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + deployable: bool + """Only return versions that can be used in a deployment. Ignores pagination.""" + + page: int + """Current page.""" + + per_page: int + """Items per-page.""" diff --git a/src/cloudflare/types/workers/scripts/version_list_response.py b/src/cloudflare/types/workers/scripts/version_list_response.py index fd3de314931..b992e3fab59 100644 --- a/src/cloudflare/types/workers/scripts/version_list_response.py +++ b/src/cloudflare/types/workers/scripts/version_list_response.py @@ -1,19 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from ...._models import BaseModel -__all__ = ["VersionListResponse", "Item"] +__all__ = ["VersionListResponse"] -class Item(BaseModel): +class VersionListResponse(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/zero_trust/__init__.py b/src/cloudflare/types/zero_trust/__init__.py index fe2de93ed13..8981ad5974d 100644 --- a/src/cloudflare/types/zero_trust/__init__.py +++ b/src/cloudflare/types/zero_trust/__init__.py @@ -12,7 +12,7 @@ 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 .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 @@ -32,7 +32,7 @@ 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 .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 diff --git a/src/cloudflare/types/zero_trust/access/__init__.py b/src/cloudflare/types/zero_trust/access/__init__.py index eca299d4f71..16436e0e937 100644 --- a/src/cloudflare/types/zero_trust/access/__init__.py +++ b/src/cloudflare/types/zero_trust/access/__init__.py @@ -4,8 +4,8 @@ from .tag import Tag as Tag from .bookmark import Bookmark as Bookmark +from .decision import Decision as Decision 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 .allowed_idps import AllowedIdPs as AllowedIdPs @@ -28,25 +28,36 @@ 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 .policy_get_response import PolicyGetResponse as PolicyGetResponse from .saml_saas_app_param import SAMLSaaSAppParam as SAMLSaaSAppParam from .self_hosted_domains import SelfHostedDomains as SelfHostedDomains from .tag_delete_response import TagDeleteResponse as TagDeleteResponse from .associated_hostnames import AssociatedHostnames as AssociatedHostnames +from .policy_create_params import PolicyCreateParams as PolicyCreateParams +from .policy_list_response import PolicyListResponse as PolicyListResponse +from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .saas_app_name_format import SaaSAppNameFormat as SaaSAppNameFormat from .group_delete_response import GroupDeleteResponse as GroupDeleteResponse from .saas_app_source_param import SaaSAppSourceParam as SaaSAppSourceParam from .bookmark_create_params import BookmarkCreateParams as BookmarkCreateParams from .bookmark_update_params import BookmarkUpdateParams as BookmarkUpdateParams +from .policy_create_response import PolicyCreateResponse as PolicyCreateResponse +from .policy_delete_response import PolicyDeleteResponse as PolicyDeleteResponse +from .policy_update_response import PolicyUpdateResponse as PolicyUpdateResponse from .saas_app_name_id_format import SaaSAppNameIDFormat as SaaSAppNameIDFormat +from .application_get_response import ApplicationGetResponse as ApplicationGetResponse from .bookmark_delete_response import BookmarkDeleteResponse as BookmarkDeleteResponse from .custom_page_without_html import CustomPageWithoutHTML as CustomPageWithoutHTML from .application_create_params import ApplicationCreateParams as ApplicationCreateParams +from .application_list_response import ApplicationListResponse as ApplicationListResponse 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 .application_create_response import ApplicationCreateResponse as ApplicationCreateResponse from .application_delete_response import ApplicationDeleteResponse as ApplicationDeleteResponse +from .application_update_response import ApplicationUpdateResponse as ApplicationUpdateResponse from .certificate_delete_response import CertificateDeleteResponse as CertificateDeleteResponse from .custom_page_delete_response import CustomPageDeleteResponse as CustomPageDeleteResponse from .service_token_create_params import ServiceTokenCreateParams as ServiceTokenCreateParams diff --git a/src/cloudflare/types/zero_trust/access/application.py b/src/cloudflare/types/zero_trust/access/application.py deleted file mode 100644 index 433fd75e505..00000000000 --- a/src/cloudflare/types/zero_trust/access/application.py +++ /dev/null @@ -1,709 +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 -from .allowed_idps import AllowedIdPs -from .cors_headers import CORSHeaders -from .saml_saas_app import SAMLSaaSApp -from .application_type import ApplicationType -from .self_hosted_domains import SelfHostedDomains - -__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[AllowedIdPs]] = 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[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.""" - - 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[SelfHostedDomains]] = 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[AllowedIdPs]] = 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 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[AllowedIdPs]] = 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[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.""" - - 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[SelfHostedDomains]] = 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[AllowedIdPs]] = 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[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.""" - - 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[SelfHostedDomains]] = 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: ApplicationType - """The application type.""" - - id: Optional[str] = None - """UUID""" - - allowed_idps: Optional[List[AllowedIdPs]] = 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: ApplicationType - """The application type.""" - - id: Optional[str] = None - """UUID""" - - allowed_idps: Optional[List[AllowedIdPs]] = 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: ApplicationType - """The application type.""" - - id: Optional[str] = None - """UUID""" - - allowed_idps: Optional[List[AllowedIdPs]] = 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 d8f91af3899..f09b5e2993c 100644 --- a/src/cloudflare/types/zero_trust/access/application_create_params.py +++ b/src/cloudflare/types/zero_trust/access/application_create_params.py @@ -2,29 +2,111 @@ from __future__ import annotations -from typing import Dict, List, Union +from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypedDict +from .decision import Decision from .allowed_idps import AllowedIdPs from .application_type import ApplicationType +from ..access_rule_param import AccessRuleParam from .cors_headers_param import CORSHeadersParam from .saml_saas_app_param import SAMLSaaSAppParam from .self_hosted_domains import SelfHostedDomains +from .applications.approval_group_param import ApprovalGroupParam __all__ = [ "ApplicationCreateParams", "SelfHostedApplication", + "SelfHostedApplicationPolicy", + "SelfHostedApplicationPolicyAccessAppPolicyLink", + "SelfHostedApplicationPolicyUnionMember2", + "SelfHostedApplicationSCIMConfig", + "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SelfHostedApplicationSCIMConfigMapping", + "SelfHostedApplicationSCIMConfigMappingOperations", "SaaSApplication", + "SaaSApplicationPolicy", + "SaaSApplicationPolicyAccessAppPolicyLink", + "SaaSApplicationPolicyUnionMember2", "SaaSApplicationSaaSApp", "SaaSApplicationSaaSAppAccessOIDCSaaSApp", "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims", "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions", + "SaaSApplicationSCIMConfig", + "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SaaSApplicationSCIMConfigMapping", + "SaaSApplicationSCIMConfigMappingOperations", "BrowserSSHApplication", + "BrowserSSHApplicationPolicy", + "BrowserSSHApplicationPolicyAccessAppPolicyLink", + "BrowserSSHApplicationPolicyUnionMember2", + "BrowserSSHApplicationSCIMConfig", + "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserSSHApplicationSCIMConfigMapping", + "BrowserSSHApplicationSCIMConfigMappingOperations", "BrowserVncApplication", + "BrowserVncApplicationPolicy", + "BrowserVncApplicationPolicyAccessAppPolicyLink", + "BrowserVncApplicationPolicyUnionMember2", + "BrowserVncApplicationSCIMConfig", + "BrowserVncApplicationSCIMConfigAuthentication", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserVncApplicationSCIMConfigMapping", + "BrowserVncApplicationSCIMConfigMappingOperations", "AppLauncherApplication", + "AppLauncherApplicationPolicy", + "AppLauncherApplicationPolicyAccessAppPolicyLink", + "AppLauncherApplicationPolicyUnionMember2", + "AppLauncherApplicationSCIMConfig", + "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "AppLauncherApplicationSCIMConfigMapping", + "AppLauncherApplicationSCIMConfigMappingOperations", "DeviceEnrollmentPermissionsApplication", + "DeviceEnrollmentPermissionsApplicationPolicy", + "DeviceEnrollmentPermissionsApplicationPolicyAccessAppPolicyLink", + "DeviceEnrollmentPermissionsApplicationPolicyUnionMember2", + "DeviceEnrollmentPermissionsApplicationSCIMConfig", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMapping", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations", "BrowserIsolationPermissionsApplication", + "BrowserIsolationPermissionsApplicationPolicy", + "BrowserIsolationPermissionsApplicationPolicyAccessAppPolicyLink", + "BrowserIsolationPermissionsApplicationPolicyUnionMember2", + "BrowserIsolationPermissionsApplicationSCIMConfig", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserIsolationPermissionsApplicationSCIMConfigMapping", + "BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations", "BookmarkApplication", + "BookmarkApplicationSCIMConfig", + "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BookmarkApplicationSCIMConfigMapping", + "BookmarkApplicationSCIMConfigMappingOperations", ] @@ -123,12 +205,25 @@ class SelfHostedApplication(TypedDict, total=False): If disabled, the JWT will scope to the hostname by default """ + policies: List[SelfHostedApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + same_site_cookie_attribute: str """ Sets the SameSite cookie setting, which provides increased security against CSRF attacks. """ + scim_config: SelfHostedApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + self_hosted_domains: List[SelfHostedDomains] """List of domains that Access will secure.""" @@ -152,6 +247,214 @@ class SelfHostedApplication(TypedDict, total=False): """ +class SelfHostedApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + +class SelfHostedApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + name: Required[str] + """The name of the Access policy.""" + + id: str + """The UUID of the policy""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +SelfHostedApplicationPolicy = Union[ + SelfHostedApplicationPolicyAccessAppPolicyLink, str, SelfHostedApplicationPolicyUnionMember2 +] + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SelfHostedApplicationSCIMConfigAuthentication = Union[ + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SelfHostedApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SelfHostedApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: SelfHostedApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SelfHostedApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: SelfHostedApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[SelfHostedApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + class SaaSApplication(TypedDict, total=False): account_id: str """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" @@ -185,8 +488,21 @@ class SaaSApplication(TypedDict, total=False): name: str """The name of the application.""" + policies: List[SaaSApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + saas_app: SaaSApplicationSaaSApp + scim_config: SaaSApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + tags: List[str] """The tags you want assigned to an application. @@ -197,18 +513,96 @@ class SaaSApplication(TypedDict, total=False): """The application type.""" +class SaaSApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + +class SaaSApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + name: Required[str] + """The name of the Access policy.""" + + id: str + """The UUID of the policy""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +SaaSApplicationPolicy = Union[SaaSApplicationPolicyAccessAppPolicyLink, str, SaaSApplicationPolicyUnionMember2] + + class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource(TypedDict, total=False): name: str """The name of the IdP claim.""" + name_by_idp: Dict[str, str] + """A mapping from IdP ID to claim name.""" + class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(TypedDict, total=False): name: str """The name of the claim.""" - name_by_idp: Dict[str, str] - """A mapping from IdP ID to claim name.""" - required: bool """If the claim is required when building an OIDC token.""" @@ -218,7 +612,36 @@ class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(TypedDict, total=False source: SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource +class SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions(TypedDict, total=False): + return_access_token_from_authorization_endpoint: bool + """If an Access Token should be returned from the OIDC Authorization endpoint""" + + return_id_token_from_authorization_endpoint: bool + """If an ID Token should be returned from the OIDC Authorization endpoint""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions(TypedDict, total=False): + lifetime: str + """How long a refresh token will be valid for after creation. + + Valid units are m,h,d. Must be longer than 1m. + """ + + class SaaSApplicationSaaSAppAccessOIDCSaaSApp(TypedDict, total=False): + access_token_lifetime: str + """The lifetime of the OIDC Access Token after creation. + + Valid units are m,h. Must be greater than or equal to 1m and less than or equal + to 24h. + """ + + allow_pkce_without_client_secret: bool + """ + If client secret should be required on the token endpoint when + authorization_code_with_pkce grant is used. + """ + app_launcher_url: str """The URL where this applications tile redirects users""" @@ -236,12 +659,16 @@ class SaaSApplicationSaaSAppAccessOIDCSaaSApp(TypedDict, total=False): custom_claims: SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims - grant_types: List[Literal["authorization_code", "authorization_code_with_pkce"]] + grant_types: List[ + Literal["authorization_code", "authorization_code_with_pkce", "refresh_tokens", "hybrid", "implicit"] + ] """The OIDC flows supported by this application""" group_filter_regex: str """A regex to filter Cloudflare groups returned in ID token and userinfo endpoint""" + hybrid_and_implicit_options: SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions + public_key: str """The Access public certificate that will be used to verify your identity.""" @@ -251,13 +678,144 @@ class SaaSApplicationSaaSAppAccessOIDCSaaSApp(TypedDict, total=False): tokens """ + refresh_token_options: SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions + scopes: List[Literal["openid", "groups", "email", "profile"]] - """Define the user information shared with access""" + """ + Define the user information shared with access, "offline_access" scope will be + automatically enabled if refresh tokens are enabled + """ SaaSApplicationSaaSApp = Union[SAMLSaaSAppParam, SaaSApplicationSaaSAppAccessOIDCSaaSApp] +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(TypedDict, total=False): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SaaSApplicationSCIMConfigAuthentication = Union[ + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SaaSApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SaaSApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: SaaSApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SaaSApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: SaaSApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[SaaSApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + class BrowserSSHApplication(TypedDict, total=False): domain: Required[str] """The primary hostname and path that Access will secure. @@ -353,12 +911,25 @@ class BrowserSSHApplication(TypedDict, total=False): If disabled, the JWT will scope to the hostname by default """ + policies: List[BrowserSSHApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + same_site_cookie_attribute: str """ Sets the SameSite cookie setting, which provides increased security against CSRF attacks. """ + scim_config: BrowserSSHApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + self_hosted_domains: List[SelfHostedDomains] """List of domains that Access will secure.""" @@ -382,42 +953,250 @@ class BrowserSSHApplication(TypedDict, total=False): """ -class BrowserVncApplication(TypedDict, total=False): - domain: Required[str] - """The primary hostname and path that Access will secure. +class BrowserSSHApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" - If the app is visible in the App Launcher dashboard, this is the domain that - will be displayed. + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. """ - type: Required[str] - """The application type.""" - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" +class BrowserSSHApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. - allow_authenticate_via_warp: bool - """ - 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. + A user needs to meet only one of the Include rules. """ - allowed_idps: List[AllowedIdPs] - """The identity providers your users can select when connecting to this - application. + name: Required[str] + """The name of the Access policy.""" - Defaults to all IdPs configured in your account. + id: str + """The UUID of the policy""" + + 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. """ - app_launcher_visible: bool - """Displays the application in the App Launcher.""" + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. - auto_redirect_to_identity: bool + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +BrowserSSHApplicationPolicy = Union[ + BrowserSSHApplicationPolicyAccessAppPolicyLink, str, BrowserSSHApplicationPolicyUnionMember2 +] + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserSSHApplicationSCIMConfigAuthentication = Union[ + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserSSHApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserSSHApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: BrowserSSHApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserSSHApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: BrowserSSHApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[BrowserSSHApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class BrowserVncApplication(TypedDict, total=False): + domain: Required[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: Required[str] + """The application type.""" + + 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.""" + + allow_authenticate_via_warp: bool + """ + 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: List[AllowedIdPs] + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + app_launcher_visible: bool + """Displays the application in the App Launcher.""" + + auto_redirect_to_identity: bool """When set to `true`, users skip the identity provider selection step during login. @@ -477,12 +1256,25 @@ class BrowserVncApplication(TypedDict, total=False): If disabled, the JWT will scope to the hostname by default """ + policies: List[BrowserVncApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + same_site_cookie_attribute: str """ Sets the SameSite cookie setting, which provides increased security against CSRF attacks. """ + scim_config: BrowserVncApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + self_hosted_domains: List[SelfHostedDomains] """List of domains that Access will secure.""" @@ -506,71 +1298,215 @@ class BrowserVncApplication(TypedDict, total=False): """ -class AppLauncherApplication(TypedDict, total=False): - type: Required[ApplicationType] - """The application type.""" +class BrowserVncApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" + precedence: int + """The order of execution for this policy. - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" + Must be unique for each policy within an app. + """ - allowed_idps: List[AllowedIdPs] - """The identity providers your users can select when connecting to this - application. - Defaults to all IdPs configured in your account. +class BrowserVncApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. """ - auto_redirect_to_identity: bool - """When set to `true`, users skip the identity provider selection step during - login. + name: Required[str] + """The name of the Access policy.""" - You must specify only one identity provider in allowed_idps. + id: str + """The UUID of the policy""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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 this application will be valid. + """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. """ -class DeviceEnrollmentPermissionsApplication(TypedDict, total=False): - type: Required[ApplicationType] - """The application type.""" +BrowserVncApplicationPolicy = Union[ + BrowserVncApplicationPolicyAccessAppPolicyLink, str, BrowserVncApplicationPolicyUnionMember2 +] - 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.""" +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" - allowed_idps: List[AllowedIdPs] - """The identity providers your users can select when connecting to this - application. + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" - Defaults to all IdPs configured in your account. + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. """ - auto_redirect_to_identity: bool - """When set to `true`, users skip the identity provider selection step during - login. + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ - You must specify only one identity provider in allowed_idps. + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. """ - session_duration: str - """The amount of time that tokens issued for this application will be valid. + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. + +BrowserVncApplicationSCIMConfigAuthentication = Union[ + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserVncApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserVncApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. """ + operations: BrowserVncApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" -class BrowserIsolationPermissionsApplication(TypedDict, total=False): + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserVncApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: BrowserVncApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[BrowserVncApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class AppLauncherApplication(TypedDict, total=False): type: Required[ApplicationType] """The application type.""" @@ -594,6 +1530,19 @@ class BrowserIsolationPermissionsApplication(TypedDict, total=False): You must specify only one identity provider in allowed_idps. """ + policies: List[AppLauncherApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + + scim_config: AppLauncherApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + session_duration: str """The amount of time that tokens issued for this application will be valid. @@ -602,33 +1551,891 @@ class BrowserIsolationPermissionsApplication(TypedDict, total=False): """ -class BookmarkApplication(TypedDict, total=False): - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" +class AppLauncherApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" + precedence: int + """The order of execution for this policy. - app_launcher_visible: bool - """Displays the application in the App Launcher.""" + Must be unique for each policy within an app. + """ - domain: str - """The URL or domain of the bookmark.""" - logo_url: str - """The image URL for the logo shown in the App Launcher dashboard.""" +class AppLauncherApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" - name: str - """The name of the application.""" + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. - tags: List[str] - """The tags you want assigned to an application. + A user needs to meet only one of the Include rules. + """ - Tags are used to filter applications in the App Launcher dashboard. + name: Required[str] + """The name of the Access policy.""" + + id: str + """The UUID of the policy""" + + 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. """ - type: str - """The application type.""" + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +AppLauncherApplicationPolicy = Union[ + AppLauncherApplicationPolicyAccessAppPolicyLink, str, AppLauncherApplicationPolicyUnionMember2 +] + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +AppLauncherApplicationSCIMConfigAuthentication = Union[ + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class AppLauncherApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class AppLauncherApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: AppLauncherApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class AppLauncherApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: AppLauncherApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[AppLauncherApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class DeviceEnrollmentPermissionsApplication(TypedDict, total=False): + type: Required[ApplicationType] + """The application type.""" + + 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.""" + + allowed_idps: List[AllowedIdPs] + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + auto_redirect_to_identity: bool + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + policies: List[DeviceEnrollmentPermissionsApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + + scim_config: DeviceEnrollmentPermissionsApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + session_duration: str + """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. + """ + + +class DeviceEnrollmentPermissionsApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + +class DeviceEnrollmentPermissionsApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + name: Required[str] + """The name of the Access policy.""" + + id: str + """The UUID of the policy""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +DeviceEnrollmentPermissionsApplicationPolicy = Union[ + DeviceEnrollmentPermissionsApplicationPolicyAccessAppPolicyLink, + str, + DeviceEnrollmentPermissionsApplicationPolicyUnionMember2, +] + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic( + TypedDict, total=False +): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2( + TypedDict, total=False +): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication = Union[ + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class DeviceEnrollmentPermissionsApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[DeviceEnrollmentPermissionsApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class BrowserIsolationPermissionsApplication(TypedDict, total=False): + type: Required[ApplicationType] + """The application type.""" + + 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.""" + + allowed_idps: List[AllowedIdPs] + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + auto_redirect_to_identity: bool + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + policies: List[BrowserIsolationPermissionsApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + + scim_config: BrowserIsolationPermissionsApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + session_duration: str + """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. + """ + + +class BrowserIsolationPermissionsApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + +class BrowserIsolationPermissionsApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + name: Required[str] + """The name of the Access policy.""" + + id: str + """The UUID of the policy""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +BrowserIsolationPermissionsApplicationPolicy = Union[ + BrowserIsolationPermissionsApplicationPolicyAccessAppPolicyLink, + str, + BrowserIsolationPermissionsApplicationPolicyUnionMember2, +] + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic( + TypedDict, total=False +): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2( + TypedDict, total=False +): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthentication = Union[ + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserIsolationPermissionsApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: BrowserIsolationPermissionsApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[BrowserIsolationPermissionsApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class BookmarkApplication(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.""" + + app_launcher_visible: bool + """Displays the application in the App Launcher.""" + + domain: str + """The URL or domain of the bookmark.""" + + logo_url: str + """The image URL for the logo shown in the App Launcher dashboard.""" + + name: str + """The name of the application.""" + + scim_config: BookmarkApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + tags: List[str] + """The tags you want assigned to an application. + + Tags are used to filter applications in the App Launcher dashboard. + """ + + type: str + """The application type.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(TypedDict, total=False): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BookmarkApplicationSCIMConfigAuthentication = Union[ + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BookmarkApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BookmarkApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: BookmarkApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BookmarkApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: BookmarkApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[BookmarkApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ ApplicationCreateParams = Union[ diff --git a/src/cloudflare/types/zero_trust/access/application_create_response.py b/src/cloudflare/types/zero_trust/access/application_create_response.py new file mode 100644 index 00000000000..af4a28bfba5 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/application_create_response.py @@ -0,0 +1,2325 @@ +# 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 pydantic import Field as FieldInfo + +from .decision import Decision +from ...._models import BaseModel +from ..access_rule import AccessRule +from .allowed_idps import AllowedIdPs +from .cors_headers import CORSHeaders +from .saml_saas_app import SAMLSaaSApp +from .application_type import ApplicationType +from .self_hosted_domains import SelfHostedDomains +from .applications.approval_group import ApprovalGroup + +__all__ = [ + "ApplicationCreateResponse", + "SelfHostedApplication", + "SelfHostedApplicationPolicy", + "SelfHostedApplicationSCIMConfig", + "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SelfHostedApplicationSCIMConfigMapping", + "SelfHostedApplicationSCIMConfigMappingOperations", + "SaaSApplication", + "SaaSApplicationPolicy", + "SaaSApplicationSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions", + "SaaSApplicationSCIMConfig", + "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SaaSApplicationSCIMConfigMapping", + "SaaSApplicationSCIMConfigMappingOperations", + "BrowserSSHApplication", + "BrowserSSHApplicationPolicy", + "BrowserSSHApplicationSCIMConfig", + "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserSSHApplicationSCIMConfigMapping", + "BrowserSSHApplicationSCIMConfigMappingOperations", + "BrowserVncApplication", + "BrowserVncApplicationPolicy", + "BrowserVncApplicationSCIMConfig", + "BrowserVncApplicationSCIMConfigAuthentication", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserVncApplicationSCIMConfigMapping", + "BrowserVncApplicationSCIMConfigMappingOperations", + "AppLauncherApplication", + "AppLauncherApplicationPolicy", + "AppLauncherApplicationSCIMConfig", + "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "AppLauncherApplicationSCIMConfigMapping", + "AppLauncherApplicationSCIMConfigMappingOperations", + "DeviceEnrollmentPermissionsApplication", + "DeviceEnrollmentPermissionsApplicationPolicy", + "DeviceEnrollmentPermissionsApplicationSCIMConfig", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMapping", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations", + "BrowserIsolationPermissionsApplication", + "BrowserIsolationPermissionsApplicationPolicy", + "BrowserIsolationPermissionsApplicationSCIMConfig", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserIsolationPermissionsApplicationSCIMConfigMapping", + "BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations", + "BookmarkApplication", + "BookmarkApplicationSCIMConfig", + "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BookmarkApplicationSCIMConfigMapping", + "BookmarkApplicationSCIMConfigMappingOperations", +] + + +class SelfHostedApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SelfHostedApplicationSCIMConfigAuthentication = Union[ + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SelfHostedApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SelfHostedApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[SelfHostedApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SelfHostedApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[SelfHostedApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[SelfHostedApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[SelfHostedApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[SelfHostedApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 SaaSApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource(BaseModel): + name: Optional[str] = None + """The name of the IdP claim.""" + + name_by_idp: Optional[Dict[str, str]] = None + """A mapping from IdP ID to claim name.""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(BaseModel): + name: Optional[str] = None + """The name of the claim.""" + + 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 SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions(BaseModel): + return_access_token_from_authorization_endpoint: Optional[bool] = None + """If an Access Token should be returned from the OIDC Authorization endpoint""" + + return_id_token_from_authorization_endpoint: Optional[bool] = None + """If an ID Token should be returned from the OIDC Authorization endpoint""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions(BaseModel): + lifetime: Optional[str] = None + """How long a refresh token will be valid for after creation. + + Valid units are m,h,d. Must be longer than 1m. + """ + + +class SaaSApplicationSaaSAppAccessOIDCSaaSApp(BaseModel): + access_token_lifetime: Optional[str] = None + """The lifetime of the OIDC Access Token after creation. + + Valid units are m,h. Must be greater than or equal to 1m and less than or equal + to 24h. + """ + + allow_pkce_without_client_secret: Optional[bool] = None + """ + If client secret should be required on the token endpoint when + authorization_code_with_pkce grant is used. + """ + + 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", "refresh_tokens", "hybrid", "implicit"]] + ] = 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""" + + hybrid_and_implicit_options: Optional[SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions] = None + + 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 + """ + + refresh_token_options: Optional[SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions] = None + + scopes: Optional[List[Literal["openid", "groups", "email", "profile"]]] = None + """ + Define the user information shared with access, "offline_access" scope will be + automatically enabled if refresh tokens are enabled + """ + + updated_at: Optional[datetime] = None + + +SaaSApplicationSaaSApp = Union[SAMLSaaSApp, SaaSApplicationSaaSAppAccessOIDCSaaSApp] + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SaaSApplicationSCIMConfigAuthentication = Union[ + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SaaSApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SaaSApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[SaaSApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SaaSApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[SaaSApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[SaaSApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class SaaSApplication(BaseModel): + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[SaaSApplicationPolicy]] = None + + saas_app: Optional[SaaSApplicationSaaSApp] = None + + scim_config: Optional[SaaSApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BrowserSSHApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserSSHApplicationSCIMConfigAuthentication = Union[ + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserSSHApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserSSHApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserSSHApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserSSHApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserSSHApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserSSHApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[BrowserSSHApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[BrowserSSHApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 BrowserVncApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserVncApplicationSCIMConfigAuthentication = Union[ + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserVncApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserVncApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserVncApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserVncApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserVncApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserVncApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[BrowserVncApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[BrowserVncApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 AppLauncherApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +AppLauncherApplicationSCIMConfigAuthentication = Union[ + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class AppLauncherApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class AppLauncherApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[AppLauncherApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class AppLauncherApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[AppLauncherApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[AppLauncherApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class AppLauncherApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[AppLauncherApplicationPolicy]] = None + + scim_config: Optional[AppLauncherApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 DeviceEnrollmentPermissionsApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + BaseModel +): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication = Union[ + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class DeviceEnrollmentPermissionsApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[DeviceEnrollmentPermissionsApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class DeviceEnrollmentPermissionsApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[DeviceEnrollmentPermissionsApplicationPolicy]] = None + + scim_config: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BrowserIsolationPermissionsApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + BaseModel +): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthentication = Union[ + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserIsolationPermissionsApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserIsolationPermissionsApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserIsolationPermissionsApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class BrowserIsolationPermissionsApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[BrowserIsolationPermissionsApplicationPolicy]] = None + + scim_config: Optional[BrowserIsolationPermissionsApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BookmarkApplicationSCIMConfigAuthentication = Union[ + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BookmarkApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BookmarkApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BookmarkApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BookmarkApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BookmarkApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BookmarkApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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.""" + + scim_config: Optional[BookmarkApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 + + +ApplicationCreateResponse = Union[ + SelfHostedApplication, + SaaSApplication, + BrowserSSHApplication, + BrowserVncApplication, + AppLauncherApplication, + DeviceEnrollmentPermissionsApplication, + BrowserIsolationPermissionsApplication, + BookmarkApplication, +] diff --git a/src/cloudflare/types/zero_trust/access/application_get_response.py b/src/cloudflare/types/zero_trust/access/application_get_response.py new file mode 100644 index 00000000000..a633b9174c1 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/application_get_response.py @@ -0,0 +1,2325 @@ +# 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 pydantic import Field as FieldInfo + +from .decision import Decision +from ...._models import BaseModel +from ..access_rule import AccessRule +from .allowed_idps import AllowedIdPs +from .cors_headers import CORSHeaders +from .saml_saas_app import SAMLSaaSApp +from .application_type import ApplicationType +from .self_hosted_domains import SelfHostedDomains +from .applications.approval_group import ApprovalGroup + +__all__ = [ + "ApplicationGetResponse", + "SelfHostedApplication", + "SelfHostedApplicationPolicy", + "SelfHostedApplicationSCIMConfig", + "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SelfHostedApplicationSCIMConfigMapping", + "SelfHostedApplicationSCIMConfigMappingOperations", + "SaaSApplication", + "SaaSApplicationPolicy", + "SaaSApplicationSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions", + "SaaSApplicationSCIMConfig", + "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SaaSApplicationSCIMConfigMapping", + "SaaSApplicationSCIMConfigMappingOperations", + "BrowserSSHApplication", + "BrowserSSHApplicationPolicy", + "BrowserSSHApplicationSCIMConfig", + "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserSSHApplicationSCIMConfigMapping", + "BrowserSSHApplicationSCIMConfigMappingOperations", + "BrowserVncApplication", + "BrowserVncApplicationPolicy", + "BrowserVncApplicationSCIMConfig", + "BrowserVncApplicationSCIMConfigAuthentication", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserVncApplicationSCIMConfigMapping", + "BrowserVncApplicationSCIMConfigMappingOperations", + "AppLauncherApplication", + "AppLauncherApplicationPolicy", + "AppLauncherApplicationSCIMConfig", + "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "AppLauncherApplicationSCIMConfigMapping", + "AppLauncherApplicationSCIMConfigMappingOperations", + "DeviceEnrollmentPermissionsApplication", + "DeviceEnrollmentPermissionsApplicationPolicy", + "DeviceEnrollmentPermissionsApplicationSCIMConfig", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMapping", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations", + "BrowserIsolationPermissionsApplication", + "BrowserIsolationPermissionsApplicationPolicy", + "BrowserIsolationPermissionsApplicationSCIMConfig", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserIsolationPermissionsApplicationSCIMConfigMapping", + "BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations", + "BookmarkApplication", + "BookmarkApplicationSCIMConfig", + "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BookmarkApplicationSCIMConfigMapping", + "BookmarkApplicationSCIMConfigMappingOperations", +] + + +class SelfHostedApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SelfHostedApplicationSCIMConfigAuthentication = Union[ + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SelfHostedApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SelfHostedApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[SelfHostedApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SelfHostedApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[SelfHostedApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[SelfHostedApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[SelfHostedApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[SelfHostedApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 SaaSApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource(BaseModel): + name: Optional[str] = None + """The name of the IdP claim.""" + + name_by_idp: Optional[Dict[str, str]] = None + """A mapping from IdP ID to claim name.""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(BaseModel): + name: Optional[str] = None + """The name of the claim.""" + + 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 SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions(BaseModel): + return_access_token_from_authorization_endpoint: Optional[bool] = None + """If an Access Token should be returned from the OIDC Authorization endpoint""" + + return_id_token_from_authorization_endpoint: Optional[bool] = None + """If an ID Token should be returned from the OIDC Authorization endpoint""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions(BaseModel): + lifetime: Optional[str] = None + """How long a refresh token will be valid for after creation. + + Valid units are m,h,d. Must be longer than 1m. + """ + + +class SaaSApplicationSaaSAppAccessOIDCSaaSApp(BaseModel): + access_token_lifetime: Optional[str] = None + """The lifetime of the OIDC Access Token after creation. + + Valid units are m,h. Must be greater than or equal to 1m and less than or equal + to 24h. + """ + + allow_pkce_without_client_secret: Optional[bool] = None + """ + If client secret should be required on the token endpoint when + authorization_code_with_pkce grant is used. + """ + + 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", "refresh_tokens", "hybrid", "implicit"]] + ] = 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""" + + hybrid_and_implicit_options: Optional[SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions] = None + + 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 + """ + + refresh_token_options: Optional[SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions] = None + + scopes: Optional[List[Literal["openid", "groups", "email", "profile"]]] = None + """ + Define the user information shared with access, "offline_access" scope will be + automatically enabled if refresh tokens are enabled + """ + + updated_at: Optional[datetime] = None + + +SaaSApplicationSaaSApp = Union[SAMLSaaSApp, SaaSApplicationSaaSAppAccessOIDCSaaSApp] + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SaaSApplicationSCIMConfigAuthentication = Union[ + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SaaSApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SaaSApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[SaaSApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SaaSApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[SaaSApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[SaaSApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class SaaSApplication(BaseModel): + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[SaaSApplicationPolicy]] = None + + saas_app: Optional[SaaSApplicationSaaSApp] = None + + scim_config: Optional[SaaSApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BrowserSSHApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserSSHApplicationSCIMConfigAuthentication = Union[ + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserSSHApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserSSHApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserSSHApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserSSHApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserSSHApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserSSHApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[BrowserSSHApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[BrowserSSHApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 BrowserVncApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserVncApplicationSCIMConfigAuthentication = Union[ + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserVncApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserVncApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserVncApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserVncApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserVncApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserVncApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[BrowserVncApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[BrowserVncApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 AppLauncherApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +AppLauncherApplicationSCIMConfigAuthentication = Union[ + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class AppLauncherApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class AppLauncherApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[AppLauncherApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class AppLauncherApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[AppLauncherApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[AppLauncherApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class AppLauncherApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[AppLauncherApplicationPolicy]] = None + + scim_config: Optional[AppLauncherApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 DeviceEnrollmentPermissionsApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + BaseModel +): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication = Union[ + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class DeviceEnrollmentPermissionsApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[DeviceEnrollmentPermissionsApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class DeviceEnrollmentPermissionsApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[DeviceEnrollmentPermissionsApplicationPolicy]] = None + + scim_config: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BrowserIsolationPermissionsApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + BaseModel +): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthentication = Union[ + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserIsolationPermissionsApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserIsolationPermissionsApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserIsolationPermissionsApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class BrowserIsolationPermissionsApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[BrowserIsolationPermissionsApplicationPolicy]] = None + + scim_config: Optional[BrowserIsolationPermissionsApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BookmarkApplicationSCIMConfigAuthentication = Union[ + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BookmarkApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BookmarkApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BookmarkApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BookmarkApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BookmarkApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BookmarkApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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.""" + + scim_config: Optional[BookmarkApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 + + +ApplicationGetResponse = Union[ + SelfHostedApplication, + SaaSApplication, + BrowserSSHApplication, + BrowserVncApplication, + AppLauncherApplication, + DeviceEnrollmentPermissionsApplication, + BrowserIsolationPermissionsApplication, + BookmarkApplication, +] diff --git a/src/cloudflare/types/zero_trust/access/application_list_response.py b/src/cloudflare/types/zero_trust/access/application_list_response.py new file mode 100644 index 00000000000..2b7457c8e75 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/application_list_response.py @@ -0,0 +1,2325 @@ +# 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 pydantic import Field as FieldInfo + +from .decision import Decision +from ...._models import BaseModel +from ..access_rule import AccessRule +from .allowed_idps import AllowedIdPs +from .cors_headers import CORSHeaders +from .saml_saas_app import SAMLSaaSApp +from .application_type import ApplicationType +from .self_hosted_domains import SelfHostedDomains +from .applications.approval_group import ApprovalGroup + +__all__ = [ + "ApplicationListResponse", + "SelfHostedApplication", + "SelfHostedApplicationPolicy", + "SelfHostedApplicationSCIMConfig", + "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SelfHostedApplicationSCIMConfigMapping", + "SelfHostedApplicationSCIMConfigMappingOperations", + "SaaSApplication", + "SaaSApplicationPolicy", + "SaaSApplicationSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions", + "SaaSApplicationSCIMConfig", + "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SaaSApplicationSCIMConfigMapping", + "SaaSApplicationSCIMConfigMappingOperations", + "BrowserSSHApplication", + "BrowserSSHApplicationPolicy", + "BrowserSSHApplicationSCIMConfig", + "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserSSHApplicationSCIMConfigMapping", + "BrowserSSHApplicationSCIMConfigMappingOperations", + "BrowserVncApplication", + "BrowserVncApplicationPolicy", + "BrowserVncApplicationSCIMConfig", + "BrowserVncApplicationSCIMConfigAuthentication", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserVncApplicationSCIMConfigMapping", + "BrowserVncApplicationSCIMConfigMappingOperations", + "AppLauncherApplication", + "AppLauncherApplicationPolicy", + "AppLauncherApplicationSCIMConfig", + "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "AppLauncherApplicationSCIMConfigMapping", + "AppLauncherApplicationSCIMConfigMappingOperations", + "DeviceEnrollmentPermissionsApplication", + "DeviceEnrollmentPermissionsApplicationPolicy", + "DeviceEnrollmentPermissionsApplicationSCIMConfig", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMapping", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations", + "BrowserIsolationPermissionsApplication", + "BrowserIsolationPermissionsApplicationPolicy", + "BrowserIsolationPermissionsApplicationSCIMConfig", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserIsolationPermissionsApplicationSCIMConfigMapping", + "BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations", + "BookmarkApplication", + "BookmarkApplicationSCIMConfig", + "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BookmarkApplicationSCIMConfigMapping", + "BookmarkApplicationSCIMConfigMappingOperations", +] + + +class SelfHostedApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SelfHostedApplicationSCIMConfigAuthentication = Union[ + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SelfHostedApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SelfHostedApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[SelfHostedApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SelfHostedApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[SelfHostedApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[SelfHostedApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[SelfHostedApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[SelfHostedApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 SaaSApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource(BaseModel): + name: Optional[str] = None + """The name of the IdP claim.""" + + name_by_idp: Optional[Dict[str, str]] = None + """A mapping from IdP ID to claim name.""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(BaseModel): + name: Optional[str] = None + """The name of the claim.""" + + 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 SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions(BaseModel): + return_access_token_from_authorization_endpoint: Optional[bool] = None + """If an Access Token should be returned from the OIDC Authorization endpoint""" + + return_id_token_from_authorization_endpoint: Optional[bool] = None + """If an ID Token should be returned from the OIDC Authorization endpoint""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions(BaseModel): + lifetime: Optional[str] = None + """How long a refresh token will be valid for after creation. + + Valid units are m,h,d. Must be longer than 1m. + """ + + +class SaaSApplicationSaaSAppAccessOIDCSaaSApp(BaseModel): + access_token_lifetime: Optional[str] = None + """The lifetime of the OIDC Access Token after creation. + + Valid units are m,h. Must be greater than or equal to 1m and less than or equal + to 24h. + """ + + allow_pkce_without_client_secret: Optional[bool] = None + """ + If client secret should be required on the token endpoint when + authorization_code_with_pkce grant is used. + """ + + 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", "refresh_tokens", "hybrid", "implicit"]] + ] = 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""" + + hybrid_and_implicit_options: Optional[SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions] = None + + 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 + """ + + refresh_token_options: Optional[SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions] = None + + scopes: Optional[List[Literal["openid", "groups", "email", "profile"]]] = None + """ + Define the user information shared with access, "offline_access" scope will be + automatically enabled if refresh tokens are enabled + """ + + updated_at: Optional[datetime] = None + + +SaaSApplicationSaaSApp = Union[SAMLSaaSApp, SaaSApplicationSaaSAppAccessOIDCSaaSApp] + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SaaSApplicationSCIMConfigAuthentication = Union[ + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SaaSApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SaaSApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[SaaSApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SaaSApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[SaaSApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[SaaSApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class SaaSApplication(BaseModel): + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[SaaSApplicationPolicy]] = None + + saas_app: Optional[SaaSApplicationSaaSApp] = None + + scim_config: Optional[SaaSApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BrowserSSHApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserSSHApplicationSCIMConfigAuthentication = Union[ + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserSSHApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserSSHApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserSSHApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserSSHApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserSSHApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserSSHApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[BrowserSSHApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[BrowserSSHApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 BrowserVncApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserVncApplicationSCIMConfigAuthentication = Union[ + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserVncApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserVncApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserVncApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserVncApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserVncApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserVncApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[BrowserVncApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[BrowserVncApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 AppLauncherApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +AppLauncherApplicationSCIMConfigAuthentication = Union[ + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class AppLauncherApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class AppLauncherApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[AppLauncherApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class AppLauncherApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[AppLauncherApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[AppLauncherApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class AppLauncherApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[AppLauncherApplicationPolicy]] = None + + scim_config: Optional[AppLauncherApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 DeviceEnrollmentPermissionsApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + BaseModel +): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication = Union[ + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class DeviceEnrollmentPermissionsApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[DeviceEnrollmentPermissionsApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class DeviceEnrollmentPermissionsApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[DeviceEnrollmentPermissionsApplicationPolicy]] = None + + scim_config: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BrowserIsolationPermissionsApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + BaseModel +): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthentication = Union[ + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserIsolationPermissionsApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserIsolationPermissionsApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserIsolationPermissionsApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class BrowserIsolationPermissionsApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[BrowserIsolationPermissionsApplicationPolicy]] = None + + scim_config: Optional[BrowserIsolationPermissionsApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BookmarkApplicationSCIMConfigAuthentication = Union[ + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BookmarkApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BookmarkApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BookmarkApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BookmarkApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BookmarkApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BookmarkApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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.""" + + scim_config: Optional[BookmarkApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 + + +ApplicationListResponse = Union[ + SelfHostedApplication, + SaaSApplication, + BrowserSSHApplication, + BrowserVncApplication, + AppLauncherApplication, + DeviceEnrollmentPermissionsApplication, + BrowserIsolationPermissionsApplication, + BookmarkApplication, +] 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 53fac9bc0b1..c0da9486d6a 100644 --- a/src/cloudflare/types/zero_trust/access/application_update_params.py +++ b/src/cloudflare/types/zero_trust/access/application_update_params.py @@ -2,29 +2,111 @@ from __future__ import annotations -from typing import Dict, List, Union +from typing import Dict, List, Union, Iterable from typing_extensions import Literal, Required, TypedDict +from .decision import Decision from .allowed_idps import AllowedIdPs from .application_type import ApplicationType +from ..access_rule_param import AccessRuleParam from .cors_headers_param import CORSHeadersParam from .saml_saas_app_param import SAMLSaaSAppParam from .self_hosted_domains import SelfHostedDomains +from .applications.approval_group_param import ApprovalGroupParam __all__ = [ "ApplicationUpdateParams", "SelfHostedApplication", + "SelfHostedApplicationPolicy", + "SelfHostedApplicationPolicyAccessAppPolicyLink", + "SelfHostedApplicationPolicyUnionMember2", + "SelfHostedApplicationSCIMConfig", + "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SelfHostedApplicationSCIMConfigMapping", + "SelfHostedApplicationSCIMConfigMappingOperations", "SaaSApplication", + "SaaSApplicationPolicy", + "SaaSApplicationPolicyAccessAppPolicyLink", + "SaaSApplicationPolicyUnionMember2", "SaaSApplicationSaaSApp", "SaaSApplicationSaaSAppAccessOIDCSaaSApp", "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims", "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions", + "SaaSApplicationSCIMConfig", + "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SaaSApplicationSCIMConfigMapping", + "SaaSApplicationSCIMConfigMappingOperations", "BrowserSSHApplication", + "BrowserSSHApplicationPolicy", + "BrowserSSHApplicationPolicyAccessAppPolicyLink", + "BrowserSSHApplicationPolicyUnionMember2", + "BrowserSSHApplicationSCIMConfig", + "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserSSHApplicationSCIMConfigMapping", + "BrowserSSHApplicationSCIMConfigMappingOperations", "BrowserVncApplication", + "BrowserVncApplicationPolicy", + "BrowserVncApplicationPolicyAccessAppPolicyLink", + "BrowserVncApplicationPolicyUnionMember2", + "BrowserVncApplicationSCIMConfig", + "BrowserVncApplicationSCIMConfigAuthentication", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserVncApplicationSCIMConfigMapping", + "BrowserVncApplicationSCIMConfigMappingOperations", "AppLauncherApplication", + "AppLauncherApplicationPolicy", + "AppLauncherApplicationPolicyAccessAppPolicyLink", + "AppLauncherApplicationPolicyUnionMember2", + "AppLauncherApplicationSCIMConfig", + "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "AppLauncherApplicationSCIMConfigMapping", + "AppLauncherApplicationSCIMConfigMappingOperations", "DeviceEnrollmentPermissionsApplication", + "DeviceEnrollmentPermissionsApplicationPolicy", + "DeviceEnrollmentPermissionsApplicationPolicyAccessAppPolicyLink", + "DeviceEnrollmentPermissionsApplicationPolicyUnionMember2", + "DeviceEnrollmentPermissionsApplicationSCIMConfig", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMapping", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations", "BrowserIsolationPermissionsApplication", + "BrowserIsolationPermissionsApplicationPolicy", + "BrowserIsolationPermissionsApplicationPolicyAccessAppPolicyLink", + "BrowserIsolationPermissionsApplicationPolicyUnionMember2", + "BrowserIsolationPermissionsApplicationSCIMConfig", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserIsolationPermissionsApplicationSCIMConfigMapping", + "BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations", "BookmarkApplication", + "BookmarkApplicationSCIMConfig", + "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BookmarkApplicationSCIMConfigMapping", + "BookmarkApplicationSCIMConfigMappingOperations", ] @@ -123,12 +205,25 @@ class SelfHostedApplication(TypedDict, total=False): If disabled, the JWT will scope to the hostname by default """ + policies: List[SelfHostedApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + same_site_cookie_attribute: str """ Sets the SameSite cookie setting, which provides increased security against CSRF attacks. """ + scim_config: SelfHostedApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + self_hosted_domains: List[SelfHostedDomains] """List of domains that Access will secure.""" @@ -152,6 +247,214 @@ class SelfHostedApplication(TypedDict, total=False): """ +class SelfHostedApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + +class SelfHostedApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + name: Required[str] + """The name of the Access policy.""" + + id: str + """The UUID of the policy""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +SelfHostedApplicationPolicy = Union[ + SelfHostedApplicationPolicyAccessAppPolicyLink, str, SelfHostedApplicationPolicyUnionMember2 +] + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SelfHostedApplicationSCIMConfigAuthentication = Union[ + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SelfHostedApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SelfHostedApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: SelfHostedApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SelfHostedApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: SelfHostedApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[SelfHostedApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + class SaaSApplication(TypedDict, total=False): account_id: str """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" @@ -185,8 +488,21 @@ class SaaSApplication(TypedDict, total=False): name: str """The name of the application.""" + policies: List[SaaSApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + saas_app: SaaSApplicationSaaSApp + scim_config: SaaSApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + tags: List[str] """The tags you want assigned to an application. @@ -197,18 +513,96 @@ class SaaSApplication(TypedDict, total=False): """The application type.""" +class SaaSApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + +class SaaSApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + name: Required[str] + """The name of the Access policy.""" + + id: str + """The UUID of the policy""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +SaaSApplicationPolicy = Union[SaaSApplicationPolicyAccessAppPolicyLink, str, SaaSApplicationPolicyUnionMember2] + + class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource(TypedDict, total=False): name: str """The name of the IdP claim.""" + name_by_idp: Dict[str, str] + """A mapping from IdP ID to claim name.""" + class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(TypedDict, total=False): name: str """The name of the claim.""" - name_by_idp: Dict[str, str] - """A mapping from IdP ID to claim name.""" - required: bool """If the claim is required when building an OIDC token.""" @@ -218,7 +612,36 @@ class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(TypedDict, total=False source: SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource +class SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions(TypedDict, total=False): + return_access_token_from_authorization_endpoint: bool + """If an Access Token should be returned from the OIDC Authorization endpoint""" + + return_id_token_from_authorization_endpoint: bool + """If an ID Token should be returned from the OIDC Authorization endpoint""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions(TypedDict, total=False): + lifetime: str + """How long a refresh token will be valid for after creation. + + Valid units are m,h,d. Must be longer than 1m. + """ + + class SaaSApplicationSaaSAppAccessOIDCSaaSApp(TypedDict, total=False): + access_token_lifetime: str + """The lifetime of the OIDC Access Token after creation. + + Valid units are m,h. Must be greater than or equal to 1m and less than or equal + to 24h. + """ + + allow_pkce_without_client_secret: bool + """ + If client secret should be required on the token endpoint when + authorization_code_with_pkce grant is used. + """ + app_launcher_url: str """The URL where this applications tile redirects users""" @@ -236,12 +659,16 @@ class SaaSApplicationSaaSAppAccessOIDCSaaSApp(TypedDict, total=False): custom_claims: SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims - grant_types: List[Literal["authorization_code", "authorization_code_with_pkce"]] + grant_types: List[ + Literal["authorization_code", "authorization_code_with_pkce", "refresh_tokens", "hybrid", "implicit"] + ] """The OIDC flows supported by this application""" group_filter_regex: str """A regex to filter Cloudflare groups returned in ID token and userinfo endpoint""" + hybrid_and_implicit_options: SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions + public_key: str """The Access public certificate that will be used to verify your identity.""" @@ -251,13 +678,144 @@ class SaaSApplicationSaaSAppAccessOIDCSaaSApp(TypedDict, total=False): tokens """ + refresh_token_options: SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions + scopes: List[Literal["openid", "groups", "email", "profile"]] - """Define the user information shared with access""" + """ + Define the user information shared with access, "offline_access" scope will be + automatically enabled if refresh tokens are enabled + """ SaaSApplicationSaaSApp = Union[SAMLSaaSAppParam, SaaSApplicationSaaSAppAccessOIDCSaaSApp] +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(TypedDict, total=False): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SaaSApplicationSCIMConfigAuthentication = Union[ + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SaaSApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SaaSApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: SaaSApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SaaSApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: SaaSApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[SaaSApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + class BrowserSSHApplication(TypedDict, total=False): domain: Required[str] """The primary hostname and path that Access will secure. @@ -353,12 +911,25 @@ class BrowserSSHApplication(TypedDict, total=False): If disabled, the JWT will scope to the hostname by default """ + policies: List[BrowserSSHApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + same_site_cookie_attribute: str """ Sets the SameSite cookie setting, which provides increased security against CSRF attacks. """ + scim_config: BrowserSSHApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + self_hosted_domains: List[SelfHostedDomains] """List of domains that Access will secure.""" @@ -382,42 +953,250 @@ class BrowserSSHApplication(TypedDict, total=False): """ -class BrowserVncApplication(TypedDict, total=False): - domain: Required[str] - """The primary hostname and path that Access will secure. +class BrowserSSHApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" - If the app is visible in the App Launcher dashboard, this is the domain that - will be displayed. + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. """ - type: Required[str] - """The application type.""" - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" +class BrowserSSHApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. - allow_authenticate_via_warp: bool - """ - 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. + A user needs to meet only one of the Include rules. """ - allowed_idps: List[AllowedIdPs] - """The identity providers your users can select when connecting to this - application. + name: Required[str] + """The name of the Access policy.""" - Defaults to all IdPs configured in your account. + id: str + """The UUID of the policy""" + + 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. """ - app_launcher_visible: bool - """Displays the application in the App Launcher.""" + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. - auto_redirect_to_identity: bool + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +BrowserSSHApplicationPolicy = Union[ + BrowserSSHApplicationPolicyAccessAppPolicyLink, str, BrowserSSHApplicationPolicyUnionMember2 +] + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserSSHApplicationSCIMConfigAuthentication = Union[ + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserSSHApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserSSHApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: BrowserSSHApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserSSHApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: BrowserSSHApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[BrowserSSHApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class BrowserVncApplication(TypedDict, total=False): + domain: Required[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: Required[str] + """The application type.""" + + 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.""" + + allow_authenticate_via_warp: bool + """ + 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: List[AllowedIdPs] + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + app_launcher_visible: bool + """Displays the application in the App Launcher.""" + + auto_redirect_to_identity: bool """When set to `true`, users skip the identity provider selection step during login. @@ -477,12 +1256,25 @@ class BrowserVncApplication(TypedDict, total=False): If disabled, the JWT will scope to the hostname by default """ + policies: List[BrowserVncApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + same_site_cookie_attribute: str """ Sets the SameSite cookie setting, which provides increased security against CSRF attacks. """ + scim_config: BrowserVncApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + self_hosted_domains: List[SelfHostedDomains] """List of domains that Access will secure.""" @@ -506,71 +1298,215 @@ class BrowserVncApplication(TypedDict, total=False): """ -class AppLauncherApplication(TypedDict, total=False): - type: Required[ApplicationType] - """The application type.""" +class BrowserVncApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" + precedence: int + """The order of execution for this policy. - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" + Must be unique for each policy within an app. + """ - allowed_idps: List[AllowedIdPs] - """The identity providers your users can select when connecting to this - application. - Defaults to all IdPs configured in your account. +class BrowserVncApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. """ - auto_redirect_to_identity: bool - """When set to `true`, users skip the identity provider selection step during - login. + name: Required[str] + """The name of the Access policy.""" - You must specify only one identity provider in allowed_idps. + id: str + """The UUID of the policy""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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 this application will be valid. + """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. """ -class DeviceEnrollmentPermissionsApplication(TypedDict, total=False): - type: Required[ApplicationType] - """The application type.""" +BrowserVncApplicationPolicy = Union[ + BrowserVncApplicationPolicyAccessAppPolicyLink, str, BrowserVncApplicationPolicyUnionMember2 +] - 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.""" +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" - allowed_idps: List[AllowedIdPs] - """The identity providers your users can select when connecting to this - application. + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" - Defaults to all IdPs configured in your account. + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. """ - auto_redirect_to_identity: bool - """When set to `true`, users skip the identity provider selection step during - login. + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ - You must specify only one identity provider in allowed_idps. + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. """ - session_duration: str - """The amount of time that tokens issued for this application will be valid. + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ - Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), - ms, s, m, h. + +BrowserVncApplicationSCIMConfigAuthentication = Union[ + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserVncApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserVncApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. """ + operations: BrowserVncApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" -class BrowserIsolationPermissionsApplication(TypedDict, total=False): + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserVncApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: BrowserVncApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[BrowserVncApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class AppLauncherApplication(TypedDict, total=False): type: Required[ApplicationType] """The application type.""" @@ -594,6 +1530,19 @@ class BrowserIsolationPermissionsApplication(TypedDict, total=False): You must specify only one identity provider in allowed_idps. """ + policies: List[AppLauncherApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + + scim_config: AppLauncherApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + session_duration: str """The amount of time that tokens issued for this application will be valid. @@ -602,33 +1551,891 @@ class BrowserIsolationPermissionsApplication(TypedDict, total=False): """ -class BookmarkApplication(TypedDict, total=False): - account_id: str - """The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.""" +class AppLauncherApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" - zone_id: str - """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" + precedence: int + """The order of execution for this policy. - app_launcher_visible: bool - """Displays the application in the App Launcher.""" + Must be unique for each policy within an app. + """ - domain: str - """The URL or domain of the bookmark.""" - logo_url: str - """The image URL for the logo shown in the App Launcher dashboard.""" +class AppLauncherApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" - name: str - """The name of the application.""" + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. - tags: List[str] - """The tags you want assigned to an application. + A user needs to meet only one of the Include rules. + """ - Tags are used to filter applications in the App Launcher dashboard. + name: Required[str] + """The name of the Access policy.""" + + id: str + """The UUID of the policy""" + + 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. """ - type: str - """The application type.""" + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +AppLauncherApplicationPolicy = Union[ + AppLauncherApplicationPolicyAccessAppPolicyLink, str, AppLauncherApplicationPolicyUnionMember2 +] + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +AppLauncherApplicationSCIMConfigAuthentication = Union[ + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class AppLauncherApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class AppLauncherApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: AppLauncherApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class AppLauncherApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: AppLauncherApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[AppLauncherApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class DeviceEnrollmentPermissionsApplication(TypedDict, total=False): + type: Required[ApplicationType] + """The application type.""" + + 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.""" + + allowed_idps: List[AllowedIdPs] + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + auto_redirect_to_identity: bool + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + policies: List[DeviceEnrollmentPermissionsApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + + scim_config: DeviceEnrollmentPermissionsApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + session_duration: str + """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. + """ + + +class DeviceEnrollmentPermissionsApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + +class DeviceEnrollmentPermissionsApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + name: Required[str] + """The name of the Access policy.""" + + id: str + """The UUID of the policy""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +DeviceEnrollmentPermissionsApplicationPolicy = Union[ + DeviceEnrollmentPermissionsApplicationPolicyAccessAppPolicyLink, + str, + DeviceEnrollmentPermissionsApplicationPolicyUnionMember2, +] + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic( + TypedDict, total=False +): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2( + TypedDict, total=False +): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication = Union[ + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class DeviceEnrollmentPermissionsApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[DeviceEnrollmentPermissionsApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class BrowserIsolationPermissionsApplication(TypedDict, total=False): + type: Required[ApplicationType] + """The application type.""" + + 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.""" + + allowed_idps: List[AllowedIdPs] + """The identity providers your users can select when connecting to this + application. + + Defaults to all IdPs configured in your account. + """ + + auto_redirect_to_identity: bool + """When set to `true`, users skip the identity provider selection step during + login. + + You must specify only one identity provider in allowed_idps. + """ + + policies: List[BrowserIsolationPermissionsApplicationPolicy] + """ + The policies that will apply to the application, in ascending order of + precedence. Items can reference existing policies or create new policies + exclusive to the application. + """ + + scim_config: BrowserIsolationPermissionsApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + session_duration: str + """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. + """ + + +class BrowserIsolationPermissionsApplicationPolicyAccessAppPolicyLink(TypedDict, total=False): + id: str + """The UUID of the policy""" + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + +class BrowserIsolationPermissionsApplicationPolicyUnionMember2(TypedDict, total=False): + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + name: Required[str] + """The name of the Access policy.""" + + id: str + """The UUID of the policy""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + precedence: int + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ + + 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. + """ + + +BrowserIsolationPermissionsApplicationPolicy = Union[ + BrowserIsolationPermissionsApplicationPolicyAccessAppPolicyLink, + str, + BrowserIsolationPermissionsApplicationPolicyUnionMember2, +] + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic( + TypedDict, total=False +): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + TypedDict, total=False +): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2( + TypedDict, total=False +): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthentication = Union[ + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserIsolationPermissionsApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: BrowserIsolationPermissionsApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[BrowserIsolationPermissionsApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class BookmarkApplication(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.""" + + app_launcher_visible: bool + """Displays the application in the App Launcher.""" + + domain: str + """The URL or domain of the bookmark.""" + + logo_url: str + """The image URL for the logo shown in the App Launcher dashboard.""" + + name: str + """The name of the application.""" + + scim_config: BookmarkApplicationSCIMConfig + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + tags: List[str] + """The tags you want assigned to an application. + + Tags are used to filter applications in the App Launcher dashboard. + """ + + type: str + """The application type.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(TypedDict, total=False): + password: Required[str] + """Password used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["httpbasic"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: Required[str] + """User name used to authenticate with the remote SCIM service.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(TypedDict, total=False): + token: Required[str] + """Token used to authenticate with the remote SCIM service.""" + + scheme: Required[Literal["oauthbearertoken"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(TypedDict, total=False): + authorization_url: Required[str] + """URL used to generate the auth code used during token generation.""" + + client_id: Required[str] + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: Required[str] + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Required[Literal["oauth2"]] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: Required[str] + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: List[str] + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BookmarkApplicationSCIMConfigAuthentication = Union[ + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BookmarkApplicationSCIMConfigMappingOperations(TypedDict, total=False): + create: bool + """Whether or not this mapping applies to create (POST) operations.""" + + delete: bool + """Whether or not this mapping applies to DELETE operations.""" + + update: bool + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BookmarkApplicationSCIMConfigMapping(TypedDict, total=False): + schema: Required[str] + """Which SCIM resource type this mapping applies to.""" + + enabled: bool + """Whether or not this mapping is enabled.""" + + filter: str + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: BookmarkApplicationSCIMConfigMappingOperations + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: str + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BookmarkApplicationSCIMConfig(TypedDict, total=False): + idp_uid: Required[str] + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: Required[str] + """The base URI for the application's SCIM-compatible API.""" + + authentication: BookmarkApplicationSCIMConfigAuthentication + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: bool + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: bool + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Iterable[BookmarkApplicationSCIMConfigMapping] + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ ApplicationUpdateParams = Union[ diff --git a/src/cloudflare/types/zero_trust/access/application_update_response.py b/src/cloudflare/types/zero_trust/access/application_update_response.py new file mode 100644 index 00000000000..9c96a2d760d --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/application_update_response.py @@ -0,0 +1,2325 @@ +# 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 pydantic import Field as FieldInfo + +from .decision import Decision +from ...._models import BaseModel +from ..access_rule import AccessRule +from .allowed_idps import AllowedIdPs +from .cors_headers import CORSHeaders +from .saml_saas_app import SAMLSaaSApp +from .application_type import ApplicationType +from .self_hosted_domains import SelfHostedDomains +from .applications.approval_group import ApprovalGroup + +__all__ = [ + "ApplicationUpdateResponse", + "SelfHostedApplication", + "SelfHostedApplicationPolicy", + "SelfHostedApplicationSCIMConfig", + "SelfHostedApplicationSCIMConfigAuthentication", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SelfHostedApplicationSCIMConfigMapping", + "SelfHostedApplicationSCIMConfigMappingOperations", + "SaaSApplication", + "SaaSApplicationPolicy", + "SaaSApplicationSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSApp", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions", + "SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions", + "SaaSApplicationSCIMConfig", + "SaaSApplicationSCIMConfigAuthentication", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "SaaSApplicationSCIMConfigMapping", + "SaaSApplicationSCIMConfigMappingOperations", + "BrowserSSHApplication", + "BrowserSSHApplicationPolicy", + "BrowserSSHApplicationSCIMConfig", + "BrowserSSHApplicationSCIMConfigAuthentication", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserSSHApplicationSCIMConfigMapping", + "BrowserSSHApplicationSCIMConfigMappingOperations", + "BrowserVncApplication", + "BrowserVncApplicationPolicy", + "BrowserVncApplicationSCIMConfig", + "BrowserVncApplicationSCIMConfigAuthentication", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserVncApplicationSCIMConfigMapping", + "BrowserVncApplicationSCIMConfigMappingOperations", + "AppLauncherApplication", + "AppLauncherApplicationPolicy", + "AppLauncherApplicationSCIMConfig", + "AppLauncherApplicationSCIMConfigAuthentication", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "AppLauncherApplicationSCIMConfigMapping", + "AppLauncherApplicationSCIMConfigMappingOperations", + "DeviceEnrollmentPermissionsApplication", + "DeviceEnrollmentPermissionsApplicationPolicy", + "DeviceEnrollmentPermissionsApplicationSCIMConfig", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMapping", + "DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations", + "BrowserIsolationPermissionsApplication", + "BrowserIsolationPermissionsApplicationPolicy", + "BrowserIsolationPermissionsApplicationSCIMConfig", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthentication", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BrowserIsolationPermissionsApplicationSCIMConfigMapping", + "BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations", + "BookmarkApplication", + "BookmarkApplicationSCIMConfig", + "BookmarkApplicationSCIMConfigAuthentication", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken", + "BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2", + "BookmarkApplicationSCIMConfigMapping", + "BookmarkApplicationSCIMConfigMappingOperations", +] + + +class SelfHostedApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SelfHostedApplicationSCIMConfigAuthentication = Union[ + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SelfHostedApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SelfHostedApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SelfHostedApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[SelfHostedApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SelfHostedApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[SelfHostedApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[SelfHostedApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[SelfHostedApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[SelfHostedApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 SaaSApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaimsSource(BaseModel): + name: Optional[str] = None + """The name of the IdP claim.""" + + name_by_idp: Optional[Dict[str, str]] = None + """A mapping from IdP ID to claim name.""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppCustomClaims(BaseModel): + name: Optional[str] = None + """The name of the claim.""" + + 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 SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions(BaseModel): + return_access_token_from_authorization_endpoint: Optional[bool] = None + """If an Access Token should be returned from the OIDC Authorization endpoint""" + + return_id_token_from_authorization_endpoint: Optional[bool] = None + """If an ID Token should be returned from the OIDC Authorization endpoint""" + + +class SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions(BaseModel): + lifetime: Optional[str] = None + """How long a refresh token will be valid for after creation. + + Valid units are m,h,d. Must be longer than 1m. + """ + + +class SaaSApplicationSaaSAppAccessOIDCSaaSApp(BaseModel): + access_token_lifetime: Optional[str] = None + """The lifetime of the OIDC Access Token after creation. + + Valid units are m,h. Must be greater than or equal to 1m and less than or equal + to 24h. + """ + + allow_pkce_without_client_secret: Optional[bool] = None + """ + If client secret should be required on the token endpoint when + authorization_code_with_pkce grant is used. + """ + + 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", "refresh_tokens", "hybrid", "implicit"]] + ] = 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""" + + hybrid_and_implicit_options: Optional[SaaSApplicationSaaSAppAccessOIDCSaaSAppHybridAndImplicitOptions] = None + + 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 + """ + + refresh_token_options: Optional[SaaSApplicationSaaSAppAccessOIDCSaaSAppRefreshTokenOptions] = None + + scopes: Optional[List[Literal["openid", "groups", "email", "profile"]]] = None + """ + Define the user information shared with access, "offline_access" scope will be + automatically enabled if refresh tokens are enabled + """ + + updated_at: Optional[datetime] = None + + +SaaSApplicationSaaSApp = Union[SAMLSaaSApp, SaaSApplicationSaaSAppAccessOIDCSaaSApp] + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +SaaSApplicationSCIMConfigAuthentication = Union[ + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + SaaSApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class SaaSApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class SaaSApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[SaaSApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class SaaSApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[SaaSApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[SaaSApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class SaaSApplication(BaseModel): + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[SaaSApplicationPolicy]] = None + + saas_app: Optional[SaaSApplicationSaaSApp] = None + + scim_config: Optional[SaaSApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BrowserSSHApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserSSHApplicationSCIMConfigAuthentication = Union[ + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserSSHApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserSSHApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserSSHApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserSSHApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserSSHApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserSSHApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserSSHApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[BrowserSSHApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[BrowserSSHApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 BrowserVncApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserVncApplicationSCIMConfigAuthentication = Union[ + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserVncApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserVncApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserVncApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserVncApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserVncApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserVncApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserVncApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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[AllowedIdPs]] = 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[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.""" + + 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 + """ + + policies: Optional[List[BrowserVncApplicationPolicy]] = None + + same_site_cookie_attribute: Optional[str] = None + """ + Sets the SameSite cookie setting, which provides increased security against CSRF + attacks. + """ + + scim_config: Optional[BrowserVncApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + self_hosted_domains: Optional[List[SelfHostedDomains]] = 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 AppLauncherApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +AppLauncherApplicationSCIMConfigAuthentication = Union[ + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + AppLauncherApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class AppLauncherApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class AppLauncherApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[AppLauncherApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class AppLauncherApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[AppLauncherApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[AppLauncherApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class AppLauncherApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[AppLauncherApplicationPolicy]] = None + + scim_config: Optional[AppLauncherApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 DeviceEnrollmentPermissionsApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + BaseModel +): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication = Union[ + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + DeviceEnrollmentPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class DeviceEnrollmentPermissionsApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class DeviceEnrollmentPermissionsApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[DeviceEnrollmentPermissionsApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class DeviceEnrollmentPermissionsApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[DeviceEnrollmentPermissionsApplicationPolicy]] = None + + scim_config: Optional[DeviceEnrollmentPermissionsApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BrowserIsolationPermissionsApplicationPolicy(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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 + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken( + BaseModel +): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BrowserIsolationPermissionsApplicationSCIMConfigAuthentication = Union[ + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BrowserIsolationPermissionsApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BrowserIsolationPermissionsApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BrowserIsolationPermissionsApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BrowserIsolationPermissionsApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BrowserIsolationPermissionsApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BrowserIsolationPermissionsApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +class BrowserIsolationPermissionsApplication(BaseModel): + type: ApplicationType + """The application type.""" + + id: Optional[str] = None + """UUID""" + + allowed_idps: Optional[List[AllowedIdPs]] = 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.""" + + policies: Optional[List[BrowserIsolationPermissionsApplicationPolicy]] = None + + scim_config: Optional[BrowserIsolationPermissionsApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic(BaseModel): + password: str + """Password used to authenticate with the remote SCIM service.""" + + scheme: Literal["httpbasic"] + """The authentication scheme to use when making SCIM requests to this application.""" + + user: str + """User name used to authenticate with the remote SCIM service.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken(BaseModel): + token: str + """Token used to authenticate with the remote SCIM service.""" + + scheme: Literal["oauthbearertoken"] + """The authentication scheme to use when making SCIM requests to this application.""" + + +class BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2(BaseModel): + authorization_url: str + """URL used to generate the auth code used during token generation.""" + + client_id: str + """ + Client ID used to authenticate when generating a token for authenticating with + the remote SCIM service. + """ + + client_secret: str + """ + Secret used to authenticate when generating a token for authenticating with the + remove SCIM service. + """ + + scheme: Literal["oauth2"] + """The authentication scheme to use when making SCIM requests to this application.""" + + token_url: str + """ + URL used to generate the token used to authenticate with the remote SCIM + service. + """ + + scopes: Optional[List[str]] = None + """ + The authorization scopes to request when generating the token used to + authenticate with the remove SCIM service. + """ + + +BookmarkApplicationSCIMConfigAuthentication = Union[ + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationHTTPBasic, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOAuthBearerToken, + BookmarkApplicationSCIMConfigAuthenticationAccessSCIMConfigAuthenticationOauth2, +] + + +class BookmarkApplicationSCIMConfigMappingOperations(BaseModel): + create: Optional[bool] = None + """Whether or not this mapping applies to create (POST) operations.""" + + delete: Optional[bool] = None + """Whether or not this mapping applies to DELETE operations.""" + + update: Optional[bool] = None + """Whether or not this mapping applies to update (PATCH/PUT) operations.""" + + +class BookmarkApplicationSCIMConfigMapping(BaseModel): + schema_: str = FieldInfo(alias="schema") + """Which SCIM resource type this mapping applies to.""" + + enabled: Optional[bool] = None + """Whether or not this mapping is enabled.""" + + filter: Optional[str] = None + """ + A + [SCIM filter expression](https://datatracker.ietf.org/doc/html/rfc7644#section-3.4.2.2) + that matches resources that should be provisioned to this application. + """ + + operations: Optional[BookmarkApplicationSCIMConfigMappingOperations] = None + """Whether or not this mapping applies to creates, updates, or deletes.""" + + transform_jsonata: Optional[str] = None + """ + A [JSONata](https://jsonata.org/) expression that transforms the resource before + provisioning it in the application. + """ + + +class BookmarkApplicationSCIMConfig(BaseModel): + idp_uid: str + """ + The UID of the IdP to use as the source for SCIM resources to provision to this + application. + """ + + remote_uri: str + """The base URI for the application's SCIM-compatible API.""" + + authentication: Optional[BookmarkApplicationSCIMConfigAuthentication] = None + """ + Attributes for configuring HTTP Basic authentication scheme for SCIM + provisioning to an application. + """ + + deactivate_on_delete: Optional[bool] = None + """ + If false, propagates DELETE requests to the target application for SCIM + resources. If true, sets 'active' to false on the SCIM resource. Note: Some + targets do not support DELETE operations. + """ + + enabled: Optional[bool] = None + """Whether SCIM provisioning is turned on for this application.""" + + mappings: Optional[List[BookmarkApplicationSCIMConfigMapping]] = None + """ + A list of mappings to apply to SCIM resources before provisioning them in this + application. These can transform or filter the resources to be provisioned. + """ + + +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.""" + + scim_config: Optional[BookmarkApplicationSCIMConfig] = None + """Configuration for provisioning to this application via SCIM. + + This is currently in closed beta. + """ + + 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 + + +ApplicationUpdateResponse = Union[ + SelfHostedApplication, + SaaSApplication, + BrowserSSHApplication, + BrowserVncApplication, + AppLauncherApplication, + DeviceEnrollmentPermissionsApplication, + BrowserIsolationPermissionsApplication, + BookmarkApplication, +] diff --git a/src/cloudflare/types/zero_trust/access/applications/__init__.py b/src/cloudflare/types/zero_trust/access/applications/__init__.py index a624e99e93d..206ec39071b 100644 --- a/src/cloudflare/types/zero_trust/access/applications/__init__.py +++ b/src/cloudflare/types/zero_trust/access/applications/__init__.py @@ -3,14 +3,17 @@ from __future__ import annotations from .ca import CA as CA -from .policy import Policy as Policy 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 .policy_get_response import PolicyGetResponse as PolicyGetResponse from .approval_group_param import ApprovalGroupParam as ApprovalGroupParam from .policy_create_params import PolicyCreateParams as PolicyCreateParams +from .policy_list_response import PolicyListResponse as PolicyListResponse from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .user_policy_check_geo import UserPolicyCheckGeo as UserPolicyCheckGeo +from .policy_create_response import PolicyCreateResponse as PolicyCreateResponse from .policy_delete_response import PolicyDeleteResponse as PolicyDeleteResponse +from .policy_update_response import PolicyUpdateResponse as PolicyUpdateResponse from .user_policy_check_list_response import UserPolicyCheckListResponse as UserPolicyCheckListResponse 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 4d782cdf8c0..358425ac3f4 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 @@ -3,8 +3,9 @@ from __future__ import annotations from typing import Iterable -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict +from ..decision import Decision from ...access_rule_param import AccessRuleParam from .approval_group_param import ApprovalGroupParam @@ -12,7 +13,7 @@ class PolicyCreateParams(TypedDict, total=False): - decision: Required[Literal["allow", "deny", "non_identity", "bypass"]] + decision: Required[Decision] """The action Access will take if a user matches this policy.""" include: Required[Iterable[AccessRuleParam]] @@ -53,7 +54,10 @@ class PolicyCreateParams(TypedDict, total=False): """ precedence: int - """The order of execution for this policy. Must be unique for each policy.""" + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ purpose_justification_prompt: str """A custom message that will appear on the purpose justification screen.""" diff --git a/src/cloudflare/types/zero_trust/access/applications/policy.py b/src/cloudflare/types/zero_trust/access/applications/policy_create_response.py similarity index 87% rename from src/cloudflare/types/zero_trust/access/applications/policy.py rename to src/cloudflare/types/zero_trust/access/applications/policy_create_response.py index b19d148cea2..733932309f2 100644 --- a/src/cloudflare/types/zero_trust/access/applications/policy.py +++ b/src/cloudflare/types/zero_trust/access/applications/policy_create_response.py @@ -2,18 +2,18 @@ from typing import List, Optional from datetime import datetime -from typing_extensions import Literal +from ..decision import Decision from ....._models import BaseModel from ...access_rule import AccessRule from .approval_group import ApprovalGroup -__all__ = ["Policy"] +__all__ = ["PolicyCreateResponse"] -class Policy(BaseModel): +class PolicyCreateResponse(BaseModel): id: Optional[str] = None - """UUID""" + """The UUID of the policy""" approval_groups: Optional[List[ApprovalGroup]] = None """Administrators who can approve a temporary authentication request.""" @@ -26,7 +26,7 @@ class Policy(BaseModel): created_at: Optional[datetime] = None - decision: Optional[Literal["allow", "deny", "non_identity", "bypass"]] = None + decision: Optional[Decision] = None """The action Access will take if a user matches this policy.""" exclude: Optional[List[AccessRule]] = None @@ -51,9 +51,6 @@ class Policy(BaseModel): 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.""" diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_get_response.py b/src/cloudflare/types/zero_trust/access/applications/policy_get_response.py new file mode 100644 index 00000000000..58009c55c07 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/applications/policy_get_response.py @@ -0,0 +1,73 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..decision import Decision +from ....._models import BaseModel +from ...access_rule import AccessRule +from .approval_group import ApprovalGroup + +__all__ = ["PolicyGetResponse"] + + +class PolicyGetResponse(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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_list_response.py b/src/cloudflare/types/zero_trust/access/applications/policy_list_response.py new file mode 100644 index 00000000000..af894ba6981 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/applications/policy_list_response.py @@ -0,0 +1,73 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..decision import Decision +from ....._models import BaseModel +from ...access_rule import AccessRule +from .approval_group import ApprovalGroup + +__all__ = ["PolicyListResponse"] + + +class PolicyListResponse(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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_update_params.py b/src/cloudflare/types/zero_trust/access/applications/policy_update_params.py index 6047e104f04..88019eb676e 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 @@ -3,8 +3,9 @@ from __future__ import annotations from typing import Iterable -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict +from ..decision import Decision from ...access_rule_param import AccessRuleParam from .approval_group_param import ApprovalGroupParam @@ -12,10 +13,10 @@ class PolicyUpdateParams(TypedDict, total=False): - uuid1: Required[str] + app_id: Required[str] """UUID""" - decision: Required[Literal["allow", "deny", "non_identity", "bypass"]] + decision: Required[Decision] """The action Access will take if a user matches this policy.""" include: Required[Iterable[AccessRuleParam]] @@ -56,7 +57,10 @@ class PolicyUpdateParams(TypedDict, total=False): """ precedence: int - """The order of execution for this policy. Must be unique for each policy.""" + """The order of execution for this policy. + + Must be unique for each policy within an app. + """ purpose_justification_prompt: str """A custom message that will appear on the purpose justification screen.""" diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_update_response.py b/src/cloudflare/types/zero_trust/access/applications/policy_update_response.py new file mode 100644 index 00000000000..a3649ba0866 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/applications/policy_update_response.py @@ -0,0 +1,73 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime + +from ..decision import Decision +from ....._models import BaseModel +from ...access_rule import AccessRule +from .approval_group import ApprovalGroup + +__all__ = ["PolicyUpdateResponse"] + + +class PolicyUpdateResponse(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + 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[Decision] = 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.""" + + 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/bookmark_create_params.py b/src/cloudflare/types/zero_trust/access/bookmark_create_params.py index 4680f846d12..a0278f281d7 100644 --- a/src/cloudflare/types/zero_trust/access/bookmark_create_params.py +++ b/src/cloudflare/types/zero_trust/access/bookmark_create_params.py @@ -8,6 +8,6 @@ class BookmarkCreateParams(TypedDict, total=False): - identifier: Required[str] + account_id: 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 index 58286a723f3..82a32f4b5e0 100644 --- a/src/cloudflare/types/zero_trust/access/bookmark_update_params.py +++ b/src/cloudflare/types/zero_trust/access/bookmark_update_params.py @@ -8,6 +8,6 @@ class BookmarkUpdateParams(TypedDict, total=False): - identifier: Required[str] + account_id: Required[str] body: Required[object] diff --git a/src/cloudflare/types/zero_trust/access/custom_page_create_params.py b/src/cloudflare/types/zero_trust/access/custom_page_create_params.py index f1890d141b8..585692c65ba 100644 --- a/src/cloudflare/types/zero_trust/access/custom_page_create_params.py +++ b/src/cloudflare/types/zero_trust/access/custom_page_create_params.py @@ -8,6 +8,9 @@ class CustomPageCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + custom_html: Required[str] """Custom page HTML.""" diff --git a/src/cloudflare/types/zero_trust/access/custom_page_update_params.py b/src/cloudflare/types/zero_trust/access/custom_page_update_params.py index 71c52739e3f..14d5ec2ca9c 100644 --- a/src/cloudflare/types/zero_trust/access/custom_page_update_params.py +++ b/src/cloudflare/types/zero_trust/access/custom_page_update_params.py @@ -8,7 +8,7 @@ class CustomPageUpdateParams(TypedDict, total=False): - identifier: Required[str] + account_id: Required[str] """Identifier""" custom_html: Required[str] diff --git a/src/cloudflare/types/zero_trust/access/decision.py b/src/cloudflare/types/zero_trust/access/decision.py new file mode 100644 index 00000000000..25de36df150 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/decision.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +__all__ = ["Decision"] + +Decision = Literal["allow", "deny", "non_identity", "bypass"] diff --git a/src/cloudflare/types/zero_trust/access/key_update_params.py b/src/cloudflare/types/zero_trust/access/key_update_params.py index 2c0f1d6ec45..b42e919649b 100644 --- a/src/cloudflare/types/zero_trust/access/key_update_params.py +++ b/src/cloudflare/types/zero_trust/access/key_update_params.py @@ -8,5 +8,8 @@ class KeyUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + key_rotation_interval_days: Required[float] """The number of days between key rotations.""" diff --git a/src/cloudflare/types/zero_trust/access/logs/__init__.py b/src/cloudflare/types/zero_trust/access/logs/__init__.py index 8044ec713b3..6054daa920f 100644 --- a/src/cloudflare/types/zero_trust/access/logs/__init__.py +++ b/src/cloudflare/types/zero_trust/access/logs/__init__.py @@ -3,4 +3,5 @@ from __future__ import annotations from .access_requests import AccessRequests as AccessRequests +from .access_request_list_params import AccessRequestListParams as AccessRequestListParams from .access_request_list_response import AccessRequestListResponse as AccessRequestListResponse diff --git a/src/cloudflare/types/zero_trust/access/logs/access_request_list_params.py b/src/cloudflare/types/zero_trust/access/logs/access_request_list_params.py new file mode 100644 index 00000000000..13be0a7d46b --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/logs/access_request_list_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ....._utils import PropertyInfo + +__all__ = ["AccessRequestListParams"] + + +class AccessRequestListParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + direction: Literal["desc", "asc"] + """The chronological sorting order for the logs.""" + + limit: int + """The maximum number of log entries to retrieve.""" + + since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """The earliest event timestamp to query.""" + + until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """The latest event timestamp to query.""" diff --git a/src/cloudflare/types/zero_trust/access/policy_create_params.py b/src/cloudflare/types/zero_trust/access/policy_create_params.py new file mode 100644 index 00000000000..a575b5e16a6 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/policy_create_params.py @@ -0,0 +1,70 @@ +# 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 .decision import Decision +from ..access_rule_param import AccessRuleParam +from .applications.approval_group_param import ApprovalGroupParam + +__all__ = ["PolicyCreateParams"] + + +class PolicyCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + name: Required[str] + """The name of the Access policy.""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + 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/policy_create_response.py b/src/cloudflare/types/zero_trust/access/policy_create_response.py new file mode 100644 index 00000000000..767b4f9bc18 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/policy_create_response.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 typing_extensions import Literal + +from .decision import Decision +from ...._models import BaseModel +from ..access_rule import AccessRule +from .applications.approval_group import ApprovalGroup + +__all__ = ["PolicyCreateResponse"] + + +class PolicyCreateResponse(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + app_count: Optional[int] = None + """Number of access applications currently using this policy.""" + + 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[Decision] = 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.""" + + 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. + """ + + reusable: Optional[Literal[True]] = None + + 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/policy_delete_response.py b/src/cloudflare/types/zero_trust/access/policy_delete_response.py new file mode 100644 index 00000000000..638056e64fd --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/policy_delete_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["PolicyDeleteResponse"] + + +class PolicyDeleteResponse(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" diff --git a/src/cloudflare/types/zero_trust/access/policy_get_response.py b/src/cloudflare/types/zero_trust/access/policy_get_response.py new file mode 100644 index 00000000000..b4476baf1d0 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/policy_get_response.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 typing_extensions import Literal + +from .decision import Decision +from ...._models import BaseModel +from ..access_rule import AccessRule +from .applications.approval_group import ApprovalGroup + +__all__ = ["PolicyGetResponse"] + + +class PolicyGetResponse(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + app_count: Optional[int] = None + """Number of access applications currently using this policy.""" + + 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[Decision] = 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.""" + + 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. + """ + + reusable: Optional[Literal[True]] = None + + 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/policy_list_response.py b/src/cloudflare/types/zero_trust/access/policy_list_response.py new file mode 100644 index 00000000000..2a2272663c7 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/policy_list_response.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 typing_extensions import Literal + +from .decision import Decision +from ...._models import BaseModel +from ..access_rule import AccessRule +from .applications.approval_group import ApprovalGroup + +__all__ = ["PolicyListResponse"] + + +class PolicyListResponse(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + app_count: Optional[int] = None + """Number of access applications currently using this policy.""" + + 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[Decision] = 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.""" + + 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. + """ + + reusable: Optional[Literal[True]] = None + + 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/policy_update_params.py b/src/cloudflare/types/zero_trust/access/policy_update_params.py new file mode 100644 index 00000000000..7ac64eebe4c --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/policy_update_params.py @@ -0,0 +1,70 @@ +# 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 .decision import Decision +from ..access_rule_param import AccessRuleParam +from .applications.approval_group_param import ApprovalGroupParam + +__all__ = ["PolicyUpdateParams"] + + +class PolicyUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + decision: Required[Decision] + """The action Access will take if a user matches this policy.""" + + include: Required[Iterable[AccessRuleParam]] + """Rules evaluated with an OR logical operator. + + A user needs to meet only one of the Include rules. + """ + + name: Required[str] + """The name of the Access policy.""" + + 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. + """ + + exclude: Iterable[AccessRuleParam] + """Rules evaluated with a NOT logical operator. + + To match the policy, a user cannot meet any of the Exclude 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. + """ + + 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/policy_update_response.py b/src/cloudflare/types/zero_trust/access/policy_update_response.py new file mode 100644 index 00000000000..8582785d404 --- /dev/null +++ b/src/cloudflare/types/zero_trust/access/policy_update_response.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 typing_extensions import Literal + +from .decision import Decision +from ...._models import BaseModel +from ..access_rule import AccessRule +from .applications.approval_group import ApprovalGroup + +__all__ = ["PolicyUpdateResponse"] + + +class PolicyUpdateResponse(BaseModel): + id: Optional[str] = None + """The UUID of the policy""" + + app_count: Optional[int] = None + """Number of access applications currently using this policy.""" + + 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[Decision] = 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.""" + + 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. + """ + + reusable: Optional[Literal[True]] = None + + 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/service_token.py b/src/cloudflare/types/zero_trust/access/service_token.py index 97ffd3bcdeb..a1e4338cb6f 100644 --- a/src/cloudflare/types/zero_trust/access/service_token.py +++ b/src/cloudflare/types/zero_trust/access/service_token.py @@ -9,7 +9,7 @@ class ServiceToken(BaseModel): - id: Optional[object] = None + id: Optional[str] = None """The ID of the service token.""" client_id: Optional[str] = None diff --git a/src/cloudflare/types/zero_trust/access/tag_create_params.py b/src/cloudflare/types/zero_trust/access/tag_create_params.py index d73f4a9177b..b28c8a8cc73 100644 --- a/src/cloudflare/types/zero_trust/access/tag_create_params.py +++ b/src/cloudflare/types/zero_trust/access/tag_create_params.py @@ -8,5 +8,8 @@ class TagCreateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + name: Required[str] """The name of the tag""" diff --git a/src/cloudflare/types/zero_trust/access/tag_update_params.py b/src/cloudflare/types/zero_trust/access/tag_update_params.py index 8c7cbb096cb..594920024fd 100644 --- a/src/cloudflare/types/zero_trust/access/tag_update_params.py +++ b/src/cloudflare/types/zero_trust/access/tag_update_params.py @@ -8,7 +8,7 @@ class TagUpdateParams(TypedDict, total=False): - identifier: Required[str] + account_id: Required[str] """Identifier""" name: Required[str] diff --git a/src/cloudflare/types/zero_trust/azure_ad.py b/src/cloudflare/types/zero_trust/azure_ad.py index 2d8690b282a..6b09f2c0581 100644 --- a/src/cloudflare/types/zero_trust/azure_ad.py +++ b/src/cloudflare/types/zero_trust/azure_ad.py @@ -4,7 +4,7 @@ from typing_extensions import Literal from ..._models import BaseModel -from .scim_config import ScimConfig +from .scim_config import SCIMConfig from .identity_provider_type import IdentityProviderType __all__ = ["AzureAD", "Config"] @@ -67,7 +67,7 @@ class AzureAD(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + 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/dex/colo_list_params.py b/src/cloudflare/types/zero_trust/dex/colo_list_params.py index f078937ff17..975e137ecac 100644 --- a/src/cloudflare/types/zero_trust/dex/colo_list_params.py +++ b/src/cloudflare/types/zero_trust/dex/colo_list_params.py @@ -12,12 +12,12 @@ class ColoListParams(TypedDict, total=False): account_id: Required[str] - time_end: Required[Annotated[str, PropertyInfo(alias="timeEnd")]] - """End time for connection period in RFC3339 (ISO 8601) format.""" - - time_start: Required[Annotated[str, PropertyInfo(alias="timeStart")]] + from_: Required[Annotated[str, PropertyInfo(alias="from")]] """Start time for connection period in RFC3339 (ISO 8601) format.""" + to: Required[str] + """End time for connection period in RFC3339 (ISO 8601) format.""" + sort_by: Annotated[Literal["fleet-status-usage", "application-tests-usage"], PropertyInfo(alias="sortBy")] """Type of usage that colos should be sorted by. diff --git a/src/cloudflare/types/zero_trust/dex/fleet_status/device_list_params.py b/src/cloudflare/types/zero_trust/dex/fleet_status/device_list_params.py index 187868d3ef2..f75de002a5a 100644 --- a/src/cloudflare/types/zero_trust/dex/fleet_status/device_list_params.py +++ b/src/cloudflare/types/zero_trust/dex/fleet_status/device_list_params.py @@ -2,7 +2,9 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ....._utils import PropertyInfo __all__ = ["DeviceListParams"] @@ -10,16 +12,24 @@ class DeviceListParams(TypedDict, total=False): account_id: Required[str] + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Timestamp in ISO format""" + page: Required[float] """Page number of paginated results""" per_page: Required[float] """Number of items per page""" - time_end: Required[str] - """Timestamp in ISO format""" + source: Required[Literal["last_seen", "hourly", "raw"]] + """Source: + + - `hourly` - device details aggregated hourly, up to 7 days prior + - `last_seen` - device details, up to 24 hours prior + - `raw` - device details, up to 7 days prior + """ - time_start: Required[str] + to: Required[str] """Timestamp in ISO format""" colo: str diff --git a/src/cloudflare/types/zero_trust/dex/fleet_status_over_time_params.py b/src/cloudflare/types/zero_trust/dex/fleet_status_over_time_params.py index ce01bfb979e..42bb856443c 100644 --- a/src/cloudflare/types/zero_trust/dex/fleet_status_over_time_params.py +++ b/src/cloudflare/types/zero_trust/dex/fleet_status_over_time_params.py @@ -2,7 +2,9 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing_extensions import Required, Annotated, TypedDict + +from ...._utils import PropertyInfo __all__ = ["FleetStatusOverTimeParams"] @@ -10,10 +12,10 @@ class FleetStatusOverTimeParams(TypedDict, total=False): account_id: Required[str] - time_end: Required[str] + from_: Required[Annotated[str, PropertyInfo(alias="from")]] """Timestamp in ISO format""" - time_start: Required[str] + to: Required[str] """Timestamp in ISO format""" colo: str diff --git a/src/cloudflare/types/zero_trust/dex/http_test_get_params.py b/src/cloudflare/types/zero_trust/dex/http_test_get_params.py index d0ce2cbe5d3..dd57bbf6128 100644 --- a/src/cloudflare/types/zero_trust/dex/http_test_get_params.py +++ b/src/cloudflare/types/zero_trust/dex/http_test_get_params.py @@ -13,15 +13,15 @@ class HTTPTestGetParams(TypedDict, total=False): account_id: Required[str] + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start time for aggregate metrics in ISO ms""" + interval: Required[Literal["minute", "hour"]] """Time interval for aggregate time slots.""" - time_end: Required[Annotated[str, PropertyInfo(alias="timeEnd")]] + to: Required[str] """End time for aggregate metrics in ISO ms""" - time_start: Required[Annotated[str, PropertyInfo(alias="timeStart")]] - """Start time for aggregate metrics in ISO ms""" - colo: str """Optionally filter result stats to a Cloudflare colo. diff --git a/src/cloudflare/types/zero_trust/dex/http_tests/percentile_get_params.py b/src/cloudflare/types/zero_trust/dex/http_tests/percentile_get_params.py index febc0fd6177..78d1009603e 100644 --- a/src/cloudflare/types/zero_trust/dex/http_tests/percentile_get_params.py +++ b/src/cloudflare/types/zero_trust/dex/http_tests/percentile_get_params.py @@ -13,12 +13,12 @@ class PercentileGetParams(TypedDict, total=False): account_id: Required[str] - time_end: Required[Annotated[str, PropertyInfo(alias="timeEnd")]] - """End time for aggregate metrics in ISO format""" - - time_start: Required[Annotated[str, PropertyInfo(alias="timeStart")]] + from_: Required[Annotated[str, PropertyInfo(alias="from")]] """Start time for aggregate metrics in ISO format""" + to: Required[str] + """End time for aggregate metrics in ISO format""" + colo: str """Optionally filter result stats to a Cloudflare colo. diff --git a/src/cloudflare/types/zero_trust/dex/traceroute_test_get_params.py b/src/cloudflare/types/zero_trust/dex/traceroute_test_get_params.py index dc8afa0c5d9..54b4a51b5fb 100644 --- a/src/cloudflare/types/zero_trust/dex/traceroute_test_get_params.py +++ b/src/cloudflare/types/zero_trust/dex/traceroute_test_get_params.py @@ -13,15 +13,15 @@ class TracerouteTestGetParams(TypedDict, total=False): account_id: Required[str] + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start time for aggregate metrics in ISO ms""" + interval: Required[Literal["minute", "hour"]] """Time interval for aggregate time slots.""" - time_end: Required[Annotated[str, PropertyInfo(alias="timeEnd")]] + to: Required[str] """End time for aggregate metrics in ISO ms""" - time_start: Required[Annotated[str, PropertyInfo(alias="timeStart")]] - """Start time for aggregate metrics in ISO ms""" - colo: str """Optionally filter result stats to a Cloudflare colo. diff --git a/src/cloudflare/types/zero_trust/dex/traceroute_test_network_path_params.py b/src/cloudflare/types/zero_trust/dex/traceroute_test_network_path_params.py index b23b29c2bff..b6ffc3f49e0 100644 --- a/src/cloudflare/types/zero_trust/dex/traceroute_test_network_path_params.py +++ b/src/cloudflare/types/zero_trust/dex/traceroute_test_network_path_params.py @@ -15,11 +15,11 @@ class TracerouteTestNetworkPathParams(TypedDict, total=False): device_id: Required[Annotated[str, PropertyInfo(alias="deviceId")]] """Device to filter tracroute result runs to""" + from_: Required[Annotated[str, PropertyInfo(alias="from")]] + """Start time for aggregate metrics in ISO ms""" + interval: Required[Literal["minute", "hour"]] """Time interval for aggregate time slots.""" - time_end: Required[Annotated[str, PropertyInfo(alias="timeEnd")]] + to: Required[str] """End time for aggregate metrics in ISO ms""" - - time_start: Required[Annotated[str, PropertyInfo(alias="timeStart")]] - """Start time for aggregate metrics in ISO ms""" diff --git a/src/cloudflare/types/zero_trust/dex/traceroute_test_percentiles_params.py b/src/cloudflare/types/zero_trust/dex/traceroute_test_percentiles_params.py index 5a4199a097d..d6ada52d1d2 100644 --- a/src/cloudflare/types/zero_trust/dex/traceroute_test_percentiles_params.py +++ b/src/cloudflare/types/zero_trust/dex/traceroute_test_percentiles_params.py @@ -13,12 +13,12 @@ class TracerouteTestPercentilesParams(TypedDict, total=False): account_id: Required[str] - time_end: Required[Annotated[str, PropertyInfo(alias="timeEnd")]] - """End time for aggregate metrics in ISO format""" - - time_start: Required[Annotated[str, PropertyInfo(alias="timeStart")]] + from_: Required[Annotated[str, PropertyInfo(alias="from")]] """Start time for aggregate metrics in ISO format""" + to: Required[str] + """End time for aggregate metrics in ISO format""" + colo: str """Optionally filter result stats to a Cloudflare colo. 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 index 2dc7a507b92..8b14533ea18 100644 --- 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 @@ -45,9 +45,6 @@ class NetworkPathGetResponse(BaseModel): 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""" 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 index 3427ac066d8..1a0500f09a4 100644 --- a/src/cloudflare/types/zero_trust/dlp/datasets/upload_edit_params.py +++ b/src/cloudflare/types/zero_trust/dlp/datasets/upload_edit_params.py @@ -12,4 +12,4 @@ class UploadEditParams(TypedDict, total=False): dataset_id: Required[str] - body: Required[object] + body: Required[str] diff --git a/src/cloudflare/types/zero_trust/gateway/__init__.py b/src/cloudflare/types/zero_trust/gateway/__init__.py index b8627d5f6fc..c3abd0c2212 100644 --- a/src/cloudflare/types/zero_trust/gateway/__init__.py +++ b/src/cloudflare/types/zero_trust/gateway/__init__.py @@ -57,6 +57,7 @@ from .configuration_update_params import ConfigurationUpdateParams as ConfigurationUpdateParams from .custom_certificate_settings import CustomCertificateSettings as CustomCertificateSettings from .notification_settings_param import NotificationSettingsParam as NotificationSettingsParam +from .proxy_endpoint_get_response import ProxyEndpointGetResponse as ProxyEndpointGetResponse from .body_scanning_settings_param import BodyScanningSettingsParam as BodyScanningSettingsParam from .proxy_endpoint_create_params import ProxyEndpointCreateParams as ProxyEndpointCreateParams from .configuration_update_response import ConfigurationUpdateResponse as ConfigurationUpdateResponse diff --git a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_get_response.py b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_get_response.py new file mode 100644 index 00000000000..225dd8730e2 --- /dev/null +++ b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_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 .proxy_endpoint import ProxyEndpoint + +__all__ = ["ProxyEndpointGetResponse"] + +ProxyEndpointGetResponse = List[ProxyEndpoint] diff --git a/src/cloudflare/types/zero_trust/identity_provider.py b/src/cloudflare/types/zero_trust/identity_provider.py index 6731d7bc439..6820dd7db58 100644 --- a/src/cloudflare/types/zero_trust/identity_provider.py +++ b/src/cloudflare/types/zero_trust/identity_provider.py @@ -4,7 +4,7 @@ from .azure_ad import AzureAD from ..._models import BaseModel -from .scim_config import ScimConfig +from .scim_config import SCIMConfig from .generic_oauth_config import GenericOAuthConfig from .identity_provider_type import IdentityProviderType @@ -76,7 +76,7 @@ class AccessCentrify(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -104,7 +104,7 @@ class AccessFacebook(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -132,7 +132,7 @@ class AccessGitHub(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -174,7 +174,7 @@ class AccessGoogle(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -219,7 +219,7 @@ class AccessGoogleApps(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -247,7 +247,7 @@ class AccessLinkedin(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -301,7 +301,7 @@ class AccessOIDC(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -349,7 +349,7 @@ class AccessOkta(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -394,7 +394,7 @@ class AccessOnelogin(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -439,7 +439,7 @@ class AccessPingone(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -507,7 +507,7 @@ class AccessSAML(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -535,7 +535,7 @@ class AccessYandex(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -563,7 +563,7 @@ class AccessOnetimepin(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + 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/identity_provider_create_params.py b/src/cloudflare/types/zero_trust/identity_provider_create_params.py index 907f7124fdb..2e8ddbc3ac4 100644 --- a/src/cloudflare/types/zero_trust/identity_provider_create_params.py +++ b/src/cloudflare/types/zero_trust/identity_provider_create_params.py @@ -5,7 +5,7 @@ from typing import List, Union, Iterable from typing_extensions import Literal, Required, TypedDict -from .scim_config_param import ScimConfigParam +from .scim_config_param import SCIMConfigParam from .identity_provider_type import IdentityProviderType from .generic_oauth_config_param import GenericOAuthConfigParam @@ -62,7 +62,7 @@ class AzureAD(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -129,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -180,7 +180,7 @@ class AccessFacebook(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -211,7 +211,7 @@ class AccessGitHub(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -242,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -287,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -335,7 +335,7 @@ class AccessLinkedin(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -366,7 +366,7 @@ class AccessOIDC(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -423,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -474,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -522,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -570,7 +570,7 @@ class AccessSAML(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -641,7 +641,7 @@ class AccessYandex(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -672,7 +672,7 @@ class AccessOnetimepin(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ 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/identity_provider_list_response.py b/src/cloudflare/types/zero_trust/identity_provider_list_response.py index 7fe980dcac8..59761e96afa 100644 --- a/src/cloudflare/types/zero_trust/identity_provider_list_response.py +++ b/src/cloudflare/types/zero_trust/identity_provider_list_response.py @@ -4,7 +4,7 @@ from .azure_ad import AzureAD from ..._models import BaseModel -from .scim_config import ScimConfig +from .scim_config import SCIMConfig from .generic_oauth_config import GenericOAuthConfig from .identity_provider_type import IdentityProviderType @@ -75,7 +75,7 @@ class AccessCentrify(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -103,7 +103,7 @@ class AccessFacebook(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -131,7 +131,7 @@ class AccessGitHub(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -173,7 +173,7 @@ class AccessGoogle(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -218,7 +218,7 @@ class AccessGoogleApps(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -246,7 +246,7 @@ class AccessLinkedin(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -300,7 +300,7 @@ class AccessOIDC(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -348,7 +348,7 @@ class AccessOkta(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -393,7 +393,7 @@ class AccessOnelogin(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -438,7 +438,7 @@ class AccessPingone(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -506,7 +506,7 @@ class AccessSAML(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + scim_config: Optional[SCIMConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -534,7 +534,7 @@ class AccessYandex(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[ScimConfig] = None + 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/identity_provider_update_params.py b/src/cloudflare/types/zero_trust/identity_provider_update_params.py index 9667f9f04ba..5507de7fdbd 100644 --- a/src/cloudflare/types/zero_trust/identity_provider_update_params.py +++ b/src/cloudflare/types/zero_trust/identity_provider_update_params.py @@ -5,7 +5,7 @@ from typing import List, Union, Iterable from typing_extensions import Literal, Required, TypedDict -from .scim_config_param import ScimConfigParam +from .scim_config_param import SCIMConfigParam from .identity_provider_type import IdentityProviderType from .generic_oauth_config_param import GenericOAuthConfigParam @@ -62,7 +62,7 @@ class AzureAD(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -129,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -180,7 +180,7 @@ class AccessFacebook(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -211,7 +211,7 @@ class AccessGitHub(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -242,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -287,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -335,7 +335,7 @@ class AccessLinkedin(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -366,7 +366,7 @@ class AccessOIDC(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -423,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -474,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -522,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: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -570,7 +570,7 @@ class AccessSAML(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -641,7 +641,7 @@ class AccessYandex(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. @@ -672,7 +672,7 @@ class AccessOnetimepin(TypedDict, total=False): zone_id: str """The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.""" - scim_config: ScimConfigParam + scim_config: SCIMConfigParam """ 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/risk_scoring/__init__.py b/src/cloudflare/types/zero_trust/risk_scoring/__init__.py index dce834add7c..8f787e32eb6 100644 --- a/src/cloudflare/types/zero_trust/risk_scoring/__init__.py +++ b/src/cloudflare/types/zero_trust/risk_scoring/__init__.py @@ -6,4 +6,10 @@ 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 .integration_get_response import IntegrationGetResponse as IntegrationGetResponse from .behaviour_update_response import BehaviourUpdateResponse as BehaviourUpdateResponse +from .integration_create_params import IntegrationCreateParams as IntegrationCreateParams +from .integration_list_response import IntegrationListResponse as IntegrationListResponse +from .integration_update_params import IntegrationUpdateParams as IntegrationUpdateParams +from .integration_create_response import IntegrationCreateResponse as IntegrationCreateResponse +from .integration_update_response import IntegrationUpdateResponse as IntegrationUpdateResponse 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 index c0180b2da17..87299513320 100644 --- a/src/cloudflare/types/zero_trust/risk_scoring/behaviour_update_params.py +++ b/src/cloudflare/types/zero_trust/risk_scoring/behaviour_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Optional +from typing import Dict from typing_extensions import Literal, Required, TypedDict __all__ = ["BehaviourUpdateParams", "Behaviors"] @@ -15,4 +15,4 @@ class BehaviourUpdateParams(TypedDict, total=False): class Behaviors(TypedDict, total=False): enabled: Required[bool] - risk_level: Required[Optional[Literal["low", "medium", "high"]]] + risk_level: Required[Literal["low", "medium", "high"]] diff --git a/src/cloudflare/types/zero_trust/risk_scoring/integration_create_params.py b/src/cloudflare/types/zero_trust/risk_scoring/integration_create_params.py new file mode 100644 index 00000000000..06b74f56012 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/integration_create_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 import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["IntegrationCreateParams"] + + +class IntegrationCreateParams(TypedDict, total=False): + account_id: Required[str] + + integration_type: Required[Literal["Okta"]] + + tenant_url: Required[str] + """The base url of the tenant, e.g. "https://tenant.okta.com" """ + + reference_id: Optional[str] + """A reference id that can be supplied by the client. + + Currently this should be set to the Access-Okta IDP ID (a UUIDv4). + https://developers.cloudflare.com/api/operations/access-identity-providers-get-an-access-identity-provider + """ diff --git a/src/cloudflare/types/zero_trust/risk_scoring/integration_create_response.py b/src/cloudflare/types/zero_trust/risk_scoring/integration_create_response.py new file mode 100644 index 00000000000..a30b33a1de8 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/integration_create_response.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["IntegrationCreateResponse"] + + +class IntegrationCreateResponse(BaseModel): + id: str + """The id of the integration, a UUIDv4.""" + + account_tag: str + """The Cloudflare account tag.""" + + active: bool + """Whether this integration is enabled and should export changes in risk score.""" + + created_at: datetime + """When the integration was created in RFC3339 format.""" + + integration_type: Literal["Okta"] + + reference_id: str + """ + A reference ID defined by the client. Should be set to the Access-Okta IDP + integration ID. Useful when the risk-score integration needs to be associated + with a secondary asset and recalled using that ID. + """ + + tenant_url: str + """The base URL for the tenant. E.g. "https://tenant.okta.com" """ + + well_known_url: str + """The URL for the Shared Signals Framework configuration, e.g. + + "/.well-known/sse-configuration/{integration_uuid}/". + https://openid.net/specs/openid-sse-framework-1_0.html#rfc.section.6.2.1 + """ diff --git a/src/cloudflare/types/zero_trust/risk_scoring/integration_get_response.py b/src/cloudflare/types/zero_trust/risk_scoring/integration_get_response.py new file mode 100644 index 00000000000..1e4bd01fa6c --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/integration_get_response.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["IntegrationGetResponse"] + + +class IntegrationGetResponse(BaseModel): + id: str + """The id of the integration, a UUIDv4.""" + + account_tag: str + """The Cloudflare account tag.""" + + active: bool + """Whether this integration is enabled and should export changes in risk score.""" + + created_at: datetime + """When the integration was created in RFC3339 format.""" + + integration_type: Literal["Okta"] + + reference_id: str + """ + A reference ID defined by the client. Should be set to the Access-Okta IDP + integration ID. Useful when the risk-score integration needs to be associated + with a secondary asset and recalled using that ID. + """ + + tenant_url: str + """The base URL for the tenant. E.g. "https://tenant.okta.com" """ + + well_known_url: str + """The URL for the Shared Signals Framework configuration, e.g. + + "/.well-known/sse-configuration/{integration_uuid}/". + https://openid.net/specs/openid-sse-framework-1_0.html#rfc.section.6.2.1 + """ diff --git a/src/cloudflare/types/zero_trust/risk_scoring/integration_list_response.py b/src/cloudflare/types/zero_trust/risk_scoring/integration_list_response.py new file mode 100644 index 00000000000..870bce91672 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/integration_list_response.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["IntegrationListResponse"] + + +class IntegrationListResponse(BaseModel): + id: str + """The id of the integration, a UUIDv4.""" + + account_tag: str + """The Cloudflare account tag.""" + + active: bool + """Whether this integration is enabled and should export changes in risk score.""" + + created_at: datetime + """When the integration was created in RFC3339 format.""" + + integration_type: Literal["Okta"] + + reference_id: str + """ + A reference ID defined by the client. Should be set to the Access-Okta IDP + integration ID. Useful when the risk-score integration needs to be associated + with a secondary asset and recalled using that ID. + """ + + tenant_url: str + """The base URL for the tenant. E.g. "https://tenant.okta.com" """ + + well_known_url: str + """The URL for the Shared Signals Framework configuration, e.g. + + "/.well-known/sse-configuration/{integration_uuid}/". + https://openid.net/specs/openid-sse-framework-1_0.html#rfc.section.6.2.1 + """ diff --git a/src/cloudflare/types/zero_trust/risk_scoring/integration_update_params.py b/src/cloudflare/types/zero_trust/risk_scoring/integration_update_params.py new file mode 100644 index 00000000000..82ad2a12b93 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/integration_update_params.py @@ -0,0 +1,28 @@ +# 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 Required, TypedDict + +__all__ = ["IntegrationUpdateParams"] + + +class IntegrationUpdateParams(TypedDict, total=False): + account_id: Required[str] + + active: Required[bool] + """Whether this integration is enabled. + + If disabled, no risk changes will be exported to the third-party. + """ + + tenant_url: Required[str] + """The base url of the tenant, e.g. "https://tenant.okta.com" """ + + reference_id: Optional[str] + """A reference id that can be supplied by the client. + + Currently this should be set to the Access-Okta IDP ID (a UUIDv4). + https://developers.cloudflare.com/api/operations/access-identity-providers-get-an-access-identity-provider + """ diff --git a/src/cloudflare/types/zero_trust/risk_scoring/integration_update_response.py b/src/cloudflare/types/zero_trust/risk_scoring/integration_update_response.py new file mode 100644 index 00000000000..5d084429b0c --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/integration_update_response.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["IntegrationUpdateResponse"] + + +class IntegrationUpdateResponse(BaseModel): + id: str + """The id of the integration, a UUIDv4.""" + + account_tag: str + """The Cloudflare account tag.""" + + active: bool + """Whether this integration is enabled and should export changes in risk score.""" + + created_at: datetime + """When the integration was created in RFC3339 format.""" + + integration_type: Literal["Okta"] + + reference_id: str + """ + A reference ID defined by the client. Should be set to the Access-Okta IDP + integration ID. Useful when the risk-score integration needs to be associated + with a secondary asset and recalled using that ID. + """ + + tenant_url: str + """The base URL for the tenant. E.g. "https://tenant.okta.com" """ + + well_known_url: str + """The URL for the Shared Signals Framework configuration, e.g. + + "/.well-known/sse-configuration/{integration_uuid}/". + https://openid.net/specs/openid-sse-framework-1_0.html#rfc.section.6.2.1 + """ diff --git a/src/cloudflare/types/zero_trust/risk_scoring/integrations/__init__.py b/src/cloudflare/types/zero_trust/risk_scoring/integrations/__init__.py new file mode 100644 index 00000000000..9a9f7de1c68 --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/integrations/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .reference_get_response import ReferenceGetResponse as ReferenceGetResponse diff --git a/src/cloudflare/types/zero_trust/risk_scoring/integrations/reference_get_response.py b/src/cloudflare/types/zero_trust/risk_scoring/integrations/reference_get_response.py new file mode 100644 index 00000000000..d0f79a48a3c --- /dev/null +++ b/src/cloudflare/types/zero_trust/risk_scoring/integrations/reference_get_response.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["ReferenceGetResponse"] + + +class ReferenceGetResponse(BaseModel): + id: str + """The id of the integration, a UUIDv4.""" + + account_tag: str + """The Cloudflare account tag.""" + + active: bool + """Whether this integration is enabled and should export changes in risk score.""" + + created_at: datetime + """When the integration was created in RFC3339 format.""" + + integration_type: Literal["Okta"] + + reference_id: str + """ + A reference ID defined by the client. Should be set to the Access-Okta IDP + integration ID. Useful when the risk-score integration needs to be associated + with a secondary asset and recalled using that ID. + """ + + tenant_url: str + """The base URL for the tenant. E.g. "https://tenant.okta.com" """ + + well_known_url: str + """The URL for the Shared Signals Framework configuration, e.g. + + "/.well-known/sse-configuration/{integration_uuid}/". + https://openid.net/specs/openid-sse-framework-1_0.html#rfc.section.6.2.1 + """ 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 index c15eb288655..8af39df8b36 100644 --- a/src/cloudflare/types/zero_trust/risk_scoring/summary_get_response.py +++ b/src/cloudflare/types/zero_trust/risk_scoring/summary_get_response.py @@ -16,7 +16,7 @@ class User(BaseModel): last_event: datetime - max_risk_level: Optional[Literal["low", "medium", "high"]] = None + max_risk_level: Literal["low", "medium", "high"] name: str diff --git a/src/cloudflare/types/zero_trust/risk_scoring_get_response.py b/src/cloudflare/types/zero_trust/risk_scoring_get_response.py index 2b6ae19f438..74c48968647 100644 --- a/src/cloudflare/types/zero_trust/risk_scoring_get_response.py +++ b/src/cloudflare/types/zero_trust/risk_scoring_get_response.py @@ -14,7 +14,7 @@ class Event(BaseModel): name: str - risk_level: Optional[Literal["low", "medium", "high"]] = None + risk_level: Literal["low", "medium", "high"] timestamp: datetime diff --git a/src/cloudflare/types/zero_trust/scim_config.py b/src/cloudflare/types/zero_trust/scim_config.py index f7f9f993662..625b2f12655 100644 --- a/src/cloudflare/types/zero_trust/scim_config.py +++ b/src/cloudflare/types/zero_trust/scim_config.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["ScimConfig"] +__all__ = ["SCIMConfig"] -class ScimConfig(BaseModel): +class SCIMConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for 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 index 2ae697d9a43..255b6cebe87 100644 --- a/src/cloudflare/types/zero_trust/scim_config_param.py +++ b/src/cloudflare/types/zero_trust/scim_config_param.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["ScimConfigParam"] +__all__ = ["SCIMConfigParam"] -class ScimConfigParam(TypedDict, total=False): +class SCIMConfigParam(TypedDict, total=False): enabled: bool """A flag to enable or disable SCIM for the identity provider.""" diff --git a/src/cloudflare/types/zero_trust/seat.py b/src/cloudflare/types/zero_trust/seat.py index bf56403a543..5d59613de0d 100644 --- a/src/cloudflare/types/zero_trust/seat.py +++ b/src/cloudflare/types/zero_trust/seat.py @@ -18,6 +18,6 @@ class Seat(BaseModel): """True if the seat is part of Gateway.""" seat_uid: Optional[str] = None - """Identifier""" + """The unique API identifier for the Zero Trust seat.""" updated_at: Optional[datetime] = None diff --git a/src/cloudflare/types/zero_trust/seat_edit_params.py b/src/cloudflare/types/zero_trust/seat_edit_params.py index e385a5e44d9..ace9d68ecfb 100644 --- a/src/cloudflare/types/zero_trust/seat_edit_params.py +++ b/src/cloudflare/types/zero_trust/seat_edit_params.py @@ -9,6 +9,9 @@ class SeatEditParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + body: Required[Iterable[Body]] @@ -18,3 +21,6 @@ class Body(TypedDict, total=False): gateway_seat: Required[bool] """True if the seat is part of Gateway.""" + + seat_uid: Required[str] + """The unique API identifier for the Zero Trust seat.""" diff --git a/src/cloudflare/types/zero_trust/tunnel_edit_response.py b/src/cloudflare/types/zero_trust/tunnel_edit_response.py index b1871e21042..6e910203a04 100644 --- a/src/cloudflare/types/zero_trust/tunnel_edit_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_edit_response.py @@ -78,7 +78,7 @@ class TunnelWARPConnectorTunnel(BaseModel): name: Optional[str] = None """A user-friendly name for a tunnel.""" - status: Optional[str] = None + status: Optional[Literal["inactive", "degraded", "healthy", "down"]] = None """The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is diff --git a/src/cloudflare/types/zero_trust/tunnel_list_params.py b/src/cloudflare/types/zero_trust/tunnel_list_params.py index e5f6d43dd32..82934968056 100644 --- a/src/cloudflare/types/zero_trust/tunnel_list_params.py +++ b/src/cloudflare/types/zero_trust/tunnel_list_params.py @@ -4,7 +4,7 @@ from typing import Union from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from ..._utils import PropertyInfo @@ -40,6 +40,15 @@ class TunnelListParams(TypedDict, total=False): per_page: float """Number of results to display.""" + status: Literal["inactive", "degraded", "healthy", "down"] + """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_types: str """The types of tunnels to filter separated by a comma.""" diff --git a/src/cloudflare/types/zero_trust/tunnel_list_response.py b/src/cloudflare/types/zero_trust/tunnel_list_response.py index ab94c69f9b7..60b42e47af8 100644 --- a/src/cloudflare/types/zero_trust/tunnel_list_response.py +++ b/src/cloudflare/types/zero_trust/tunnel_list_response.py @@ -78,7 +78,7 @@ class TunnelWARPConnectorTunnel(BaseModel): name: Optional[str] = None """A user-friendly name for a tunnel.""" - status: Optional[str] = None + status: Optional[Literal["inactive", "degraded", "healthy", "down"]] = None """The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is diff --git a/src/cloudflare/types/zones/__init__.py b/src/cloudflare/types/zones/__init__.py index 3d3e43049cf..c7b972f4d45 100644 --- a/src/cloudflare/types/zones/__init__.py +++ b/src/cloudflare/types/zones/__init__.py @@ -5,16 +5,12 @@ from .type import Type as Type 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 .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 .subscription_get_response import SubscriptionGetResponse as SubscriptionGetResponse from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse diff --git a/src/cloudflare/types/zones/dns_setting.py b/src/cloudflare/types/zones/dns_setting.py deleted file mode 100644 index ea337af7a25..00000000000 --- a/src/cloudflare/types/zones/dns_setting.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 ..._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 deleted file mode 100644 index fa2cdb1dca2..00000000000 --- a/src/cloudflare/types/zones/dns_setting_edit_params.py +++ /dev/null @@ -1,35 +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 - -from .nameserver_param import NameserverParam - -__all__ = ["DNSSettingEditParams"] - - -class DNSSettingEditParams(TypedDict, total=False): - zone_id: Required[str] - """Identifier""" - - foundation_dns: bool - """Whether to enable Foundation DNS Advanced Nameservers on the zone.""" - - multi_provider: bool - """ - 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. - """ - - secondary_overrides: bool - """ - Allows a Secondary DNS zone to use (proxied) override records and CNAME - flattening at the zone apex. - """ diff --git a/tests/api_resources/accounts/test_members.py b/tests/api_resources/accounts/test_members.py index 4b8885d1efd..0b40f4dd9f3 100644 --- a/tests/api_resources/accounts/test_members.py +++ b/tests/api_resources/accounts/test_members.py @@ -10,11 +10,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.shared import Member from cloudflare.types.accounts import ( + MemberGetResponse, MemberListResponse, - UserWithInviteCode, + MemberCreateResponse, MemberDeleteResponse, + MemberUpdateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,10 +24,11 @@ class TestMembers: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize - def test_method_create(self, client: Cloudflare) -> None: + def test_method_create_overload_1(self, client: Cloudflare) -> None: member = client.accounts.members.create( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", email="user@example.com", roles=[ "3536bcfad5faccb999b47003c79917fb", @@ -34,12 +36,13 @@ def test_method_create(self, client: Cloudflare) -> None: "3536bcfad5faccb999b47003c79917fb", ], ) - assert_matches_type(UserWithInviteCode, member, path=["response"]) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: + def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> None: member = client.accounts.members.create( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", email="user@example.com", roles=[ "3536bcfad5faccb999b47003c79917fb", @@ -48,12 +51,13 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: ], status="accepted", ) - assert_matches_type(UserWithInviteCode, member, path=["response"]) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize - def test_raw_response_create(self, client: Cloudflare) -> None: + def test_raw_response_create_overload_1(self, client: Cloudflare) -> None: response = client.accounts.members.with_raw_response.create( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", email="user@example.com", roles=[ "3536bcfad5faccb999b47003c79917fb", @@ -65,12 +69,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" member = response.parse() - assert_matches_type(UserWithInviteCode, member, path=["response"]) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize - def test_streaming_response_create(self, client: Cloudflare) -> None: + def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: with client.accounts.members.with_streaming_response.create( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", email="user@example.com", roles=[ "3536bcfad5faccb999b47003c79917fb", @@ -82,12 +87,13 @@ 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(UserWithInviteCode, member, path=["response"]) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize - def test_path_params_create(self, client: Cloudflare) -> None: + 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.accounts.members.with_raw_response.create( account_id="", @@ -99,94 +105,571 @@ def test_path_params_create(self, client: Cloudflare) -> None: ], ) + @pytest.mark.skip(reason="HTTP 422 error from prism") + @parametrize + def test_method_create_overload_2(self, client: Cloudflare) -> None: + member = client.accounts.members.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + email="user@example.com", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + ) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 error from prism") + @parametrize + def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> None: + member = client.accounts.members.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + email="user@example.com", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + status="accepted", + ) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 error from prism") + @parametrize + def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: + response = client.accounts.members.with_raw_response.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + email="user@example.com", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + member = response.parse() + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 error from prism") + @parametrize + def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: + with client.accounts.members.with_streaming_response.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + email="user@example.com", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + member = response.parse() + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="HTTP 422 error from prism") + @parametrize + def test_path_params_create_overload_2(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.accounts.members.with_raw_response.create( + account_id="", + email="user@example.com", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_update_overload_1(self, client: Cloudflare) -> None: + member = client.accounts.members.update( + "4536bcfad5faccb111b47003c79917fa", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_method_update(self, client: Cloudflare) -> None: + def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> None: member = client.accounts.members.update( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", roles=[ {"id": "3536bcfad5faccb999b47003c79917fb"}, {"id": "3536bcfad5faccb999b47003c79917fb"}, {"id": "3536bcfad5faccb999b47003c79917fb"}, ], ) - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: + def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: response = client.accounts.members.with_raw_response.update( "4536bcfad5faccb111b47003c79917fa", - account_id="string", - roles=[ - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + member = response.parse() + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: + with client.accounts.members.with_streaming_response.update( + "4536bcfad5faccb111b47003c79917fa", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + member = response.parse() + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_path_params_update_overload_1(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.accounts.members.with_raw_response.update( + "4536bcfad5faccb111b47003c79917fa", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"): + client.accounts.members.with_raw_response.update( + "", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_update_overload_2(self, client: Cloudflare) -> None: + member = client.accounts.members.update( + "4536bcfad5faccb111b47003c79917fa", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + ) + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_update_overload_2(self, client: Cloudflare) -> None: + response = client.accounts.members.with_raw_response.update( + "4536bcfad5faccb111b47003c79917fa", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, ], ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = response.parse() - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: + def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: with client.accounts.members.with_streaming_response.update( "4536bcfad5faccb111b47003c79917fa", - account_id="string", - roles=[ - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, + account_id="eb78d65290b24279ba6f44721b3ea3c4", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = response.parse() - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: + def test_path_params_update_overload_2(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.accounts.members.with_raw_response.update( "4536bcfad5faccb111b47003c79917fa", account_id="", - roles=[ - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, ], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"): client.accounts.members.with_raw_response.update( "", - account_id="string", - roles=[ - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, + account_id="eb78d65290b24279ba6f44721b3ea3c4", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, ], ) @parametrize def test_method_list(self, client: Cloudflare) -> None: member = client.accounts.members.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert_matches_type(SyncV4PagePaginationArray[MemberListResponse], member, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: member = client.accounts.members.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", direction="desc", order="status", page=1, @@ -198,7 +681,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.accounts.members.with_raw_response.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert response.is_closed is True @@ -209,7 +692,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.accounts.members.with_streaming_response.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -226,19 +709,21 @@ def test_path_params_list(self, client: Cloudflare) -> None: account_id="", ) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize def test_method_delete(self, client: Cloudflare) -> None: member = client.accounts.members.delete( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert_matches_type(Optional[MemberDeleteResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.accounts.members.with_raw_response.delete( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert response.is_closed is True @@ -246,11 +731,12 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: member = response.parse() assert_matches_type(Optional[MemberDeleteResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.accounts.members.with_streaming_response.delete( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -260,6 +746,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="HTTP 422 error from prism") @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 ''"): @@ -271,43 +758,47 @@ def test_path_params_delete(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"): client.accounts.members.with_raw_response.delete( "", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize def test_method_get(self, client: Cloudflare) -> None: member = client.accounts.members.get( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberGetResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.accounts.members.with_raw_response.get( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = response.parse() - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberGetResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.accounts.members.with_streaming_response.get( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = response.parse() - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberGetResponse], member, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="HTTP 422 error from prism") @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 ''"): @@ -319,17 +810,18 @@ def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"): client.accounts.members.with_raw_response.get( "", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) class TestAsyncMembers: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize - async def test_method_create(self, async_client: AsyncCloudflare) -> None: + async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: member = await async_client.accounts.members.create( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", email="user@example.com", roles=[ "3536bcfad5faccb999b47003c79917fb", @@ -337,12 +829,13 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "3536bcfad5faccb999b47003c79917fb", ], ) - assert_matches_type(UserWithInviteCode, member, path=["response"]) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + async def test_method_create_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: member = await async_client.accounts.members.create( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", email="user@example.com", roles=[ "3536bcfad5faccb999b47003c79917fb", @@ -351,12 +844,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare ], status="accepted", ) - assert_matches_type(UserWithInviteCode, member, path=["response"]) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize - async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: response = await async_client.accounts.members.with_raw_response.create( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", email="user@example.com", roles=[ "3536bcfad5faccb999b47003c79917fb", @@ -368,12 +862,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" member = await response.parse() - assert_matches_type(UserWithInviteCode, member, path=["response"]) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize - async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: async with async_client.accounts.members.with_streaming_response.create( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", email="user@example.com", roles=[ "3536bcfad5faccb999b47003c79917fb", @@ -385,12 +880,13 @@ 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(UserWithInviteCode, member, path=["response"]) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize - async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + 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.accounts.members.with_raw_response.create( account_id="", @@ -402,94 +898,571 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: ], ) + @pytest.mark.skip(reason="HTTP 422 error from prism") + @parametrize + async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None: + member = await async_client.accounts.members.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + email="user@example.com", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + ) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 error from prism") + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None: + member = await async_client.accounts.members.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + email="user@example.com", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + status="accepted", + ) + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 error from prism") + @parametrize + async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: + response = await async_client.accounts.members.with_raw_response.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + email="user@example.com", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + member = await response.parse() + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 error from prism") + @parametrize + async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: + async with async_client.accounts.members.with_streaming_response.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + email="user@example.com", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + member = await response.parse() + assert_matches_type(Optional[MemberCreateResponse], member, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="HTTP 422 error from prism") + @parametrize + async def test_path_params_create_overload_2(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.accounts.members.with_raw_response.create( + account_id="", + email="user@example.com", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> None: + member = await async_client.accounts.members.update( + "4536bcfad5faccb111b47003c79917fa", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: + async def test_method_update_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: member = await async_client.accounts.members.update( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", roles=[ {"id": "3536bcfad5faccb999b47003c79917fb"}, {"id": "3536bcfad5faccb999b47003c79917fb"}, {"id": "3536bcfad5faccb999b47003c79917fb"}, ], ) - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: response = await async_client.accounts.members.with_raw_response.update( "4536bcfad5faccb111b47003c79917fa", - account_id="string", - roles=[ - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + member = await response.parse() + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: + async with async_client.accounts.members.with_streaming_response.update( + "4536bcfad5faccb111b47003c79917fa", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + member = await response.parse() + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.accounts.members.with_raw_response.update( + "4536bcfad5faccb111b47003c79917fa", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"): + await async_client.accounts.members.with_raw_response.update( + "", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> None: + member = await async_client.accounts.members.update( + "4536bcfad5faccb111b47003c79917fa", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + ], + ) + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: + response = await async_client.accounts.members.with_raw_response.update( + "4536bcfad5faccb111b47003c79917fa", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, ], ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = await response.parse() - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: async with async_client.accounts.members.with_streaming_response.update( "4536bcfad5faccb111b47003c79917fa", - account_id="string", - roles=[ - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, + account_id="eb78d65290b24279ba6f44721b3ea3c4", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, ], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = await response.parse() - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberUpdateResponse], member, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.accounts.members.with_raw_response.update( "4536bcfad5faccb111b47003c79917fa", account_id="", - roles=[ - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, ], ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"): await async_client.accounts.members.with_raw_response.update( "", - account_id="string", - roles=[ - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, - {"id": "3536bcfad5faccb999b47003c79917fb"}, + account_id="eb78d65290b24279ba6f44721b3ea3c4", + policies=[ + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, + { + "access": "allow", + "permission_groups": [ + {"id": "c8fed203ed3043cba015a93ad1616f1f"}, + {"id": "82e64a83756745bbbb1c9c2701bf816b"}, + ], + "resource_groups": [ + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"}, + ], + }, ], ) @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: member = await async_client.accounts.members.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert_matches_type(AsyncV4PagePaginationArray[MemberListResponse], member, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: member = await async_client.accounts.members.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", direction="desc", order="status", page=1, @@ -501,7 +1474,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.accounts.members.with_raw_response.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert response.is_closed is True @@ -512,7 +1485,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.accounts.members.with_streaming_response.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -529,19 +1502,21 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: account_id="", ) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: member = await async_client.accounts.members.delete( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert_matches_type(Optional[MemberDeleteResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: response = await async_client.accounts.members.with_raw_response.delete( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert response.is_closed is True @@ -549,11 +1524,12 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: member = await response.parse() assert_matches_type(Optional[MemberDeleteResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: async with async_client.accounts.members.with_streaming_response.delete( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -563,6 +1539,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="HTTP 422 error from prism") @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 ''"): @@ -574,43 +1551,47 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"): await async_client.accounts.members.with_raw_response.delete( "", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: member = await async_client.accounts.members.get( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberGetResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.accounts.members.with_raw_response.get( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = await response.parse() - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberGetResponse], member, path=["response"]) + @pytest.mark.skip(reason="HTTP 422 error from prism") @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.accounts.members.with_streaming_response.get( "4536bcfad5faccb111b47003c79917fa", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = await response.parse() - assert_matches_type(Member, member, path=["response"]) + assert_matches_type(Optional[MemberGetResponse], member, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="HTTP 422 error from prism") @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 ''"): @@ -622,5 +1603,5 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"): await async_client.accounts.members.with_raw_response.get( "", - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) diff --git a/tests/api_resources/accounts/test_roles.py b/tests/api_resources/accounts/test_roles.py index 8da99847106..4236c1b2b13 100644 --- a/tests/api_resources/accounts/test_roles.py +++ b/tests/api_resources/accounts/test_roles.py @@ -11,7 +11,6 @@ from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.shared import Role -from cloudflare.types.accounts import RoleGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,14 +21,14 @@ class TestRoles: @parametrize def test_method_list(self, client: Cloudflare) -> None: role = client.accounts.roles.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert_matches_type(SyncSinglePage[Role], role, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.accounts.roles.with_raw_response.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert response.is_closed is True @@ -40,7 +39,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.accounts.roles.with_streaming_response.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -61,33 +60,33 @@ def test_path_params_list(self, client: Cloudflare) -> None: def test_method_get(self, client: Cloudflare) -> None: role = client.accounts.roles.get( {}, - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) - assert_matches_type(RoleGetResponse, role, path=["response"]) + assert_matches_type(object, role, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.accounts.roles.with_raw_response.get( {}, - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(RoleGetResponse, role, path=["response"]) + assert_matches_type(object, role, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.accounts.roles.with_streaming_response.get( {}, - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(RoleGetResponse, role, path=["response"]) + assert_matches_type(object, role, path=["response"]) assert cast(Any, response.is_closed) is True @@ -106,14 +105,14 @@ class TestAsyncRoles: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: role = await async_client.accounts.roles.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert_matches_type(AsyncSinglePage[Role], role, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.accounts.roles.with_raw_response.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert response.is_closed is True @@ -124,7 +123,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.accounts.roles.with_streaming_response.list( - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -145,33 +144,33 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: async def test_method_get(self, async_client: AsyncCloudflare) -> None: role = await async_client.accounts.roles.get( {}, - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) - assert_matches_type(RoleGetResponse, role, path=["response"]) + assert_matches_type(object, role, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.accounts.roles.with_raw_response.get( {}, - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(RoleGetResponse, role, path=["response"]) + assert_matches_type(object, role, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.accounts.roles.with_streaming_response.get( {}, - account_id="string", + account_id="eb78d65290b24279ba6f44721b3ea3c4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(RoleGetResponse, role, path=["response"]) + assert_matches_type(object, role, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/loa_documents/test_downloads.py b/tests/api_resources/addressing/loa_documents/test_downloads.py index db82ee230fa..5c401decdfe 100644 --- a/tests/api_resources/addressing/loa_documents/test_downloads.py +++ b/tests/api_resources/addressing/loa_documents/test_downloads.py @@ -5,10 +5,17 @@ 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, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -16,41 +23,71 @@ class TestDownloads: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) @parametrize - def test_method_get(self, client: Cloudflare) -> None: + @pytest.mark.respx(base_url=base_url) + def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) download = client.addressing.loa_documents.downloads.get( "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(object, download, path=["response"]) - + assert download.is_closed + assert download.json() == {"foo": "bar"} + assert cast(Any, download.is_closed) is True + assert isinstance(download, BinaryAPIResponse) + + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.addressing.loa_documents.downloads.with_raw_response.get( + @pytest.mark.respx(base_url=base_url) + def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + download = client.addressing.loa_documents.downloads.with_raw_response.get( "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - download = response.parse() - assert_matches_type(object, download, path=["response"]) + assert download.is_closed is True + assert download.http_request.headers.get("X-Stainless-Lang") == "python" + assert download.json() == {"foo": "bar"} + assert isinstance(download, BinaryAPIResponse) + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: + @pytest.mark.respx(base_url=base_url) + def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) with client.addressing.loa_documents.downloads.with_streaming_response.get( "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ) as download: + assert not download.is_closed + assert download.http_request.headers.get("X-Stainless-Lang") == "python" - download = response.parse() - assert_matches_type(object, download, path=["response"]) + assert download.json() == {"foo": "bar"} + assert cast(Any, download.is_closed) is True + assert isinstance(download, StreamedBinaryAPIResponse) - assert cast(Any, response.is_closed) is True + assert cast(Any, download.is_closed) is True + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) @parametrize + @pytest.mark.respx(base_url=base_url) def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.addressing.loa_documents.downloads.with_raw_response.get( @@ -68,41 +105,71 @@ def test_path_params_get(self, client: Cloudflare) -> None: class TestAsyncDownloads: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: + @pytest.mark.respx(base_url=base_url) + async def test_method_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) download = await async_client.addressing.loa_documents.downloads.get( "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(object, download, path=["response"]) - + assert download.is_closed + assert await download.json() == {"foo": "bar"} + assert cast(Any, download.is_closed) is True + assert isinstance(download, AsyncBinaryAPIResponse) + + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.addressing.loa_documents.downloads.with_raw_response.get( + @pytest.mark.respx(base_url=base_url) + async def test_raw_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + download = await async_client.addressing.loa_documents.downloads.with_raw_response.get( "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - download = await response.parse() - assert_matches_type(object, download, path=["response"]) + assert download.is_closed is True + assert download.http_request.headers.get("X-Stainless-Lang") == "python" + assert await download.json() == {"foo": "bar"} + assert isinstance(download, AsyncBinaryAPIResponse) + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + @pytest.mark.respx(base_url=base_url) + async def test_streaming_response_get(self, async_client: AsyncCloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/addressing/loa_documents/d933b1530bc56c9953cf8ce166da8004/download" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) async with async_client.addressing.loa_documents.downloads.with_streaming_response.get( "d933b1530bc56c9953cf8ce166da8004", account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ) as download: + assert not download.is_closed + assert download.http_request.headers.get("X-Stainless-Lang") == "python" - download = await response.parse() - assert_matches_type(object, download, path=["response"]) + assert await download.json() == {"foo": "bar"} + assert cast(Any, download.is_closed) is True + assert isinstance(download, AsyncStreamedBinaryAPIResponse) - assert cast(Any, response.is_closed) is True + assert cast(Any, download.is_closed) is True + @pytest.mark.skip( + reason="TODO: address broken spotlight error - https://github.com/cloudflare/cloudflare-typescript/actions/runs/9456639475/job/26048931174?pr=498#step:5:489" + ) @parametrize + @pytest.mark.respx(base_url=base_url) async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.addressing.loa_documents.downloads.with_raw_response.get( diff --git a/tests/api_resources/dcv_delegation/__init__.py b/tests/api_resources/addressing/regional_hostnames/__init__.py similarity index 100% rename from tests/api_resources/dcv_delegation/__init__.py rename to tests/api_resources/addressing/regional_hostnames/__init__.py diff --git a/tests/api_resources/addressing/regional_hostnames/test_regions.py b/tests/api_resources/addressing/regional_hostnames/test_regions.py new file mode 100644 index 00000000000..5d23799e1bf --- /dev/null +++ b/tests/api_resources/addressing/regional_hostnames/test_regions.py @@ -0,0 +1,99 @@ +# 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.addressing.regional_hostnames import RegionListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRegions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + region = client.addressing.regional_hostnames.regions.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[RegionListResponse], region, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.addressing.regional_hostnames.regions.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + region = response.parse() + assert_matches_type(SyncSinglePage[RegionListResponse], region, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.addressing.regional_hostnames.regions.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + region = response.parse() + assert_matches_type(SyncSinglePage[RegionListResponse], region, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.addressing.regional_hostnames.regions.with_raw_response.list( + account_id="", + ) + + +class TestAsyncRegions: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + region = await async_client.addressing.regional_hostnames.regions.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[RegionListResponse], region, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.regional_hostnames.regions.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + region = await response.parse() + assert_matches_type(AsyncSinglePage[RegionListResponse], region, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.regional_hostnames.regions.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + region = await response.parse() + assert_matches_type(AsyncSinglePage[RegionListResponse], region, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.addressing.regional_hostnames.regions.with_raw_response.list( + account_id="", + ) diff --git a/tests/api_resources/addressing/test_address_maps.py b/tests/api_resources/addressing/test_address_maps.py index 1a4e0b0a57c..f8e982e4260 100644 --- a/tests/api_resources/addressing/test_address_maps.py +++ b/tests/api_resources/addressing/test_address_maps.py @@ -9,6 +9,7 @@ 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.addressing import ( AddressMap, @@ -36,6 +37,24 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", description="My Ecommerce zones", enabled=True, + ips=["192.0.2.1", "192.0.2.1", "192.0.2.1"], + memberships=[ + { + "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), + "identifier": "023e105f4ecef8ad9ca31a8372d0c353", + "kind": "zone", + }, + { + "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), + "identifier": "023e105f4ecef8ad9ca31a8372d0c353", + "kind": "zone", + }, + { + "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), + "identifier": "023e105f4ecef8ad9ca31a8372d0c353", + "kind": "zone", + }, + ], ) assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) @@ -280,6 +299,24 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", description="My Ecommerce zones", enabled=True, + ips=["192.0.2.1", "192.0.2.1", "192.0.2.1"], + memberships=[ + { + "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), + "identifier": "023e105f4ecef8ad9ca31a8372d0c353", + "kind": "zone", + }, + { + "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), + "identifier": "023e105f4ecef8ad9ca31a8372d0c353", + "kind": "zone", + }, + { + "created_at": parse_datetime("2014-01-01T05:20:00.12345Z"), + "identifier": "023e105f4ecef8ad9ca31a8372d0c353", + "kind": "zone", + }, + ], ) assert_matches_type(Optional[AddressMapCreateResponse], address_map, path=["response"]) diff --git a/tests/api_resources/addressing/test_regional_hostnames.py b/tests/api_resources/addressing/test_regional_hostnames.py new file mode 100644 index 00000000000..3dc5d085fba --- /dev/null +++ b/tests/api_resources/addressing/test_regional_hostnames.py @@ -0,0 +1,495 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.addressing import ( + RegionalHostnameGetResponse, + RegionalHostnameEditResponse, + RegionalHostnameListResponse, + RegionalHostnameCreateResponse, + RegionalHostnameDeleteResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRegionalHostnames: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + regional_hostname = client.addressing.regional_hostnames.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + hostname="foo.example.com", + region_key="ca", + ) + assert_matches_type(Optional[RegionalHostnameCreateResponse], regional_hostname, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.addressing.regional_hostnames.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + hostname="foo.example.com", + region_key="ca", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional_hostname = response.parse() + assert_matches_type(Optional[RegionalHostnameCreateResponse], regional_hostname, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.addressing.regional_hostnames.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + hostname="foo.example.com", + region_key="ca", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional_hostname = response.parse() + assert_matches_type(Optional[RegionalHostnameCreateResponse], regional_hostname, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.addressing.regional_hostnames.with_raw_response.create( + zone_id="", + hostname="foo.example.com", + region_key="ca", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + regional_hostname = client.addressing.regional_hostnames.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[RegionalHostnameListResponse], regional_hostname, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.addressing.regional_hostnames.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional_hostname = response.parse() + assert_matches_type(SyncSinglePage[RegionalHostnameListResponse], regional_hostname, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.addressing.regional_hostnames.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional_hostname = response.parse() + assert_matches_type(SyncSinglePage[RegionalHostnameListResponse], regional_hostname, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.addressing.regional_hostnames.with_raw_response.list( + zone_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + regional_hostname = client.addressing.regional_hostnames.delete( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RegionalHostnameDeleteResponse, regional_hostname, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.addressing.regional_hostnames.with_raw_response.delete( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional_hostname = response.parse() + assert_matches_type(RegionalHostnameDeleteResponse, regional_hostname, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.addressing.regional_hostnames.with_streaming_response.delete( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional_hostname = response.parse() + assert_matches_type(RegionalHostnameDeleteResponse, regional_hostname, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.addressing.regional_hostnames.with_raw_response.delete( + "foo.example.com", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `hostname` but received ''"): + client.addressing.regional_hostnames.with_raw_response.delete( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + regional_hostname = client.addressing.regional_hostnames.edit( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + region_key="ca", + ) + assert_matches_type(Optional[RegionalHostnameEditResponse], regional_hostname, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.addressing.regional_hostnames.with_raw_response.edit( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + region_key="ca", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional_hostname = response.parse() + assert_matches_type(Optional[RegionalHostnameEditResponse], regional_hostname, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.addressing.regional_hostnames.with_streaming_response.edit( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + region_key="ca", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional_hostname = response.parse() + assert_matches_type(Optional[RegionalHostnameEditResponse], regional_hostname, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.addressing.regional_hostnames.with_raw_response.edit( + "foo.example.com", + zone_id="", + region_key="ca", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `hostname` but received ''"): + client.addressing.regional_hostnames.with_raw_response.edit( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + region_key="ca", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + regional_hostname = client.addressing.regional_hostnames.get( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[RegionalHostnameGetResponse], regional_hostname, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.addressing.regional_hostnames.with_raw_response.get( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional_hostname = response.parse() + assert_matches_type(Optional[RegionalHostnameGetResponse], regional_hostname, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.addressing.regional_hostnames.with_streaming_response.get( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional_hostname = response.parse() + assert_matches_type(Optional[RegionalHostnameGetResponse], regional_hostname, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.addressing.regional_hostnames.with_raw_response.get( + "foo.example.com", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `hostname` but received ''"): + client.addressing.regional_hostnames.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncRegionalHostnames: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + regional_hostname = await async_client.addressing.regional_hostnames.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + hostname="foo.example.com", + region_key="ca", + ) + assert_matches_type(Optional[RegionalHostnameCreateResponse], regional_hostname, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.regional_hostnames.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + hostname="foo.example.com", + region_key="ca", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional_hostname = await response.parse() + assert_matches_type(Optional[RegionalHostnameCreateResponse], regional_hostname, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.regional_hostnames.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + hostname="foo.example.com", + region_key="ca", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional_hostname = await response.parse() + assert_matches_type(Optional[RegionalHostnameCreateResponse], regional_hostname, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.addressing.regional_hostnames.with_raw_response.create( + zone_id="", + hostname="foo.example.com", + region_key="ca", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + regional_hostname = await async_client.addressing.regional_hostnames.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[RegionalHostnameListResponse], regional_hostname, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.regional_hostnames.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional_hostname = await response.parse() + assert_matches_type(AsyncSinglePage[RegionalHostnameListResponse], regional_hostname, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.regional_hostnames.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional_hostname = await response.parse() + assert_matches_type(AsyncSinglePage[RegionalHostnameListResponse], regional_hostname, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.addressing.regional_hostnames.with_raw_response.list( + zone_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + regional_hostname = await async_client.addressing.regional_hostnames.delete( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RegionalHostnameDeleteResponse, regional_hostname, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.regional_hostnames.with_raw_response.delete( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional_hostname = await response.parse() + assert_matches_type(RegionalHostnameDeleteResponse, regional_hostname, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.regional_hostnames.with_streaming_response.delete( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional_hostname = await response.parse() + assert_matches_type(RegionalHostnameDeleteResponse, regional_hostname, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.addressing.regional_hostnames.with_raw_response.delete( + "foo.example.com", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `hostname` but received ''"): + await async_client.addressing.regional_hostnames.with_raw_response.delete( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + regional_hostname = await async_client.addressing.regional_hostnames.edit( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + region_key="ca", + ) + assert_matches_type(Optional[RegionalHostnameEditResponse], regional_hostname, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.regional_hostnames.with_raw_response.edit( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + region_key="ca", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional_hostname = await response.parse() + assert_matches_type(Optional[RegionalHostnameEditResponse], regional_hostname, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.regional_hostnames.with_streaming_response.edit( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + region_key="ca", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional_hostname = await response.parse() + assert_matches_type(Optional[RegionalHostnameEditResponse], regional_hostname, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.addressing.regional_hostnames.with_raw_response.edit( + "foo.example.com", + zone_id="", + region_key="ca", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `hostname` but received ''"): + await async_client.addressing.regional_hostnames.with_raw_response.edit( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + region_key="ca", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + regional_hostname = await async_client.addressing.regional_hostnames.get( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[RegionalHostnameGetResponse], regional_hostname, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.addressing.regional_hostnames.with_raw_response.get( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + regional_hostname = await response.parse() + assert_matches_type(Optional[RegionalHostnameGetResponse], regional_hostname, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.addressing.regional_hostnames.with_streaming_response.get( + "foo.example.com", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + regional_hostname = await response.parse() + assert_matches_type(Optional[RegionalHostnameGetResponse], regional_hostname, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.addressing.regional_hostnames.with_raw_response.get( + "foo.example.com", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `hostname` but received ''"): + await async_client.addressing.regional_hostnames.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/ai_gateway/test_logs.py b/tests/api_resources/ai_gateway/test_logs.py index f6dc3fd63d1..78439db3a89 100644 --- a/tests/api_resources/ai_gateway/test_logs.py +++ b/tests/api_resources/ai_gateway/test_logs.py @@ -21,7 +21,7 @@ class TestLogs: @parametrize def test_method_get(self, client: Cloudflare) -> None: log = client.ai_gateway.logs.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) assert_matches_type(LogGetResponse, log, path=["response"]) @@ -29,7 +29,7 @@ def test_method_get(self, client: Cloudflare) -> None: @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: log = client.ai_gateway.logs.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", cached=True, direction="asc", @@ -46,7 +46,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.ai_gateway.logs.with_raw_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) @@ -58,7 +58,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.ai_gateway.logs.with_streaming_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) as response: assert not response.is_closed @@ -73,7 +73,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.ai_gateway.logs.with_raw_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="", ) @@ -90,7 +90,7 @@ class TestAsyncLogs: @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: log = await async_client.ai_gateway.logs.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) assert_matches_type(LogGetResponse, log, path=["response"]) @@ -98,7 +98,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: log = await async_client.ai_gateway.logs.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", cached=True, direction="asc", @@ -115,7 +115,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.ai_gateway.logs.with_raw_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) @@ -127,7 +127,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.ai_gateway.logs.with_streaming_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) as response: assert not response.is_closed @@ -142,7 +142,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.ai_gateway.logs.with_raw_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="", ) diff --git a/tests/api_resources/alerting/destinations/test_pagerduty.py b/tests/api_resources/alerting/destinations/test_pagerduty.py index 912f43e1c42..a0b32fc9ce4 100644 --- a/tests/api_resources/alerting/destinations/test_pagerduty.py +++ b/tests/api_resources/alerting/destinations/test_pagerduty.py @@ -22,13 +22,19 @@ class TestPagerduty: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize def test_method_create(self, client: Cloudflare) -> None: pagerduty = client.alerting.destinations.pagerduty.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PagerdutyCreateResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyCreateResponse], pagerduty, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.alerting.destinations.pagerduty.with_raw_response.create( @@ -38,8 +44,11 @@ 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" pagerduty = response.parse() - assert_matches_type(PagerdutyCreateResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyCreateResponse], pagerduty, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.alerting.destinations.pagerduty.with_streaming_response.create( @@ -49,10 +58,13 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerduty = response.parse() - assert_matches_type(PagerdutyCreateResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyCreateResponse], pagerduty, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @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 ''"): @@ -65,7 +77,7 @@ def test_method_delete(self, client: Cloudflare) -> None: pagerduty = client.alerting.destinations.pagerduty.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PagerdutyDeleteResponse], pagerduty, path=["response"]) + assert_matches_type(PagerdutyDeleteResponse, pagerduty, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -76,7 +88,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" pagerduty = response.parse() - assert_matches_type(Optional[PagerdutyDeleteResponse], pagerduty, path=["response"]) + assert_matches_type(PagerdutyDeleteResponse, pagerduty, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -87,7 +99,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerduty = response.parse() - assert_matches_type(Optional[PagerdutyDeleteResponse], pagerduty, path=["response"]) + assert_matches_type(PagerdutyDeleteResponse, pagerduty, path=["response"]) assert cast(Any, response.is_closed) is True @@ -136,14 +148,20 @@ def test_path_params_get(self, client: Cloudflare) -> None: account_id="", ) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize def test_method_link(self, client: Cloudflare) -> None: pagerduty = client.alerting.destinations.pagerduty.link( "8c71e667571b4f61b94d9e4b12158038", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PagerdutyLinkResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyLinkResponse], pagerduty, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize def test_raw_response_link(self, client: Cloudflare) -> None: response = client.alerting.destinations.pagerduty.with_raw_response.link( @@ -154,8 +172,11 @@ def test_raw_response_link(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerduty = response.parse() - assert_matches_type(PagerdutyLinkResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyLinkResponse], pagerduty, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize def test_streaming_response_link(self, client: Cloudflare) -> None: with client.alerting.destinations.pagerduty.with_streaming_response.link( @@ -166,10 +187,13 @@ def test_streaming_response_link(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerduty = response.parse() - assert_matches_type(PagerdutyLinkResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyLinkResponse], pagerduty, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize def test_path_params_link(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -188,13 +212,19 @@ def test_path_params_link(self, client: Cloudflare) -> None: class TestAsyncPagerduty: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: pagerduty = await async_client.alerting.destinations.pagerduty.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PagerdutyCreateResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyCreateResponse], pagerduty, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.alerting.destinations.pagerduty.with_raw_response.create( @@ -204,8 +234,11 @@ 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" pagerduty = await response.parse() - assert_matches_type(PagerdutyCreateResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyCreateResponse], pagerduty, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.alerting.destinations.pagerduty.with_streaming_response.create( @@ -215,10 +248,13 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerduty = await response.parse() - assert_matches_type(PagerdutyCreateResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyCreateResponse], pagerduty, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @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 ''"): @@ -231,7 +267,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: pagerduty = await async_client.alerting.destinations.pagerduty.delete( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PagerdutyDeleteResponse], pagerduty, path=["response"]) + assert_matches_type(PagerdutyDeleteResponse, pagerduty, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -242,7 +278,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" pagerduty = await response.parse() - assert_matches_type(Optional[PagerdutyDeleteResponse], pagerduty, path=["response"]) + assert_matches_type(PagerdutyDeleteResponse, pagerduty, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -253,7 +289,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerduty = await response.parse() - assert_matches_type(Optional[PagerdutyDeleteResponse], pagerduty, path=["response"]) + assert_matches_type(PagerdutyDeleteResponse, pagerduty, path=["response"]) assert cast(Any, response.is_closed) is True @@ -302,14 +338,20 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: account_id="", ) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize async def test_method_link(self, async_client: AsyncCloudflare) -> None: pagerduty = await async_client.alerting.destinations.pagerduty.link( "8c71e667571b4f61b94d9e4b12158038", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PagerdutyLinkResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyLinkResponse], pagerduty, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize async def test_raw_response_link(self, async_client: AsyncCloudflare) -> None: response = await async_client.alerting.destinations.pagerduty.with_raw_response.link( @@ -320,8 +362,11 @@ async def test_raw_response_link(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerduty = await response.parse() - assert_matches_type(PagerdutyLinkResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyLinkResponse], pagerduty, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize async def test_streaming_response_link(self, async_client: AsyncCloudflare) -> None: async with async_client.alerting.destinations.pagerduty.with_streaming_response.link( @@ -332,10 +377,13 @@ async def test_streaming_response_link(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" pagerduty = await response.parse() - assert_matches_type(PagerdutyLinkResponse, pagerduty, path=["response"]) + assert_matches_type(Optional[PagerdutyLinkResponse], pagerduty, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4285" + ) @parametrize async def test_path_params_link(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): diff --git a/tests/api_resources/alerting/destinations/test_webhooks.py b/tests/api_resources/alerting/destinations/test_webhooks.py index 9da98e9f458..bf8bc07acdf 100644 --- a/tests/api_resources/alerting/destinations/test_webhooks.py +++ b/tests/api_resources/alerting/destinations/test_webhooks.py @@ -23,6 +23,9 @@ class TestWebhooks: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_method_create(self, client: Cloudflare) -> None: webhook = client.alerting.destinations.webhooks.create( @@ -30,8 +33,11 @@ def test_method_create(self, client: Cloudflare) -> None: name="Slack Webhook", url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", ) - assert_matches_type(WebhookCreateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookCreateResponse], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: webhook = client.alerting.destinations.webhooks.create( @@ -40,8 +46,11 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", secret="string", ) - assert_matches_type(WebhookCreateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookCreateResponse], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.alerting.destinations.webhooks.with_raw_response.create( @@ -53,8 +62,11 @@ 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" webhook = response.parse() - assert_matches_type(WebhookCreateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookCreateResponse], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.alerting.destinations.webhooks.with_streaming_response.create( @@ -66,10 +78,13 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(WebhookCreateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookCreateResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -79,6 +94,9 @@ def test_path_params_create(self, client: Cloudflare) -> None: url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", ) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_method_update(self, client: Cloudflare) -> None: webhook = client.alerting.destinations.webhooks.update( @@ -87,8 +105,11 @@ def test_method_update(self, client: Cloudflare) -> None: name="Slack Webhook", url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: webhook = client.alerting.destinations.webhooks.update( @@ -98,8 +119,11 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", secret="string", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.alerting.destinations.webhooks.with_raw_response.update( @@ -112,8 +136,11 @@ 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( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.alerting.destinations.webhooks.with_streaming_response.update( @@ -126,10 +153,13 @@ 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 + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @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 ''"): @@ -192,7 +222,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "b115d5ec-15c6-41ee-8b76-92c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) + assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -204,7 +234,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" webhook = response.parse() - assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) + assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -216,7 +246,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) + assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -234,14 +264,20 @@ def test_path_params_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_method_get(self, client: Cloudflare) -> None: webhook = client.alerting.destinations.webhooks.get( "b115d5ec-15c6-41ee-8b76-92c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Webhooks, webhook, path=["response"]) + assert_matches_type(Optional[Webhooks], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.alerting.destinations.webhooks.with_raw_response.get( @@ -252,8 +288,11 @@ 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(Webhooks, webhook, path=["response"]) + assert_matches_type(Optional[Webhooks], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.alerting.destinations.webhooks.with_streaming_response.get( @@ -264,10 +303,13 @@ 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(Webhooks, webhook, path=["response"]) + assert_matches_type(Optional[Webhooks], webhook, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @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 ''"): @@ -286,6 +328,9 @@ def test_path_params_get(self, client: Cloudflare) -> None: class TestAsyncWebhooks: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: webhook = await async_client.alerting.destinations.webhooks.create( @@ -293,8 +338,11 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="Slack Webhook", url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", ) - assert_matches_type(WebhookCreateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookCreateResponse], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: webhook = await async_client.alerting.destinations.webhooks.create( @@ -303,8 +351,11 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", secret="string", ) - assert_matches_type(WebhookCreateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookCreateResponse], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.alerting.destinations.webhooks.with_raw_response.create( @@ -316,8 +367,11 @@ 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" webhook = await response.parse() - assert_matches_type(WebhookCreateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookCreateResponse], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.alerting.destinations.webhooks.with_streaming_response.create( @@ -329,10 +383,13 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(WebhookCreateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookCreateResponse], webhook, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @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 ''"): @@ -342,6 +399,9 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", ) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: webhook = await async_client.alerting.destinations.webhooks.update( @@ -350,8 +410,11 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: name="Slack Webhook", url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: webhook = await async_client.alerting.destinations.webhooks.update( @@ -361,8 +424,11 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare url="https://hooks.slack.com/services/Ds3fdBFbV/456464Gdd", secret="string", ) - assert_matches_type(WebhookUpdateResponse, webhook, path=["response"]) + assert_matches_type(Optional[WebhookUpdateResponse], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.alerting.destinations.webhooks.with_raw_response.update( @@ -375,8 +441,11 @@ 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( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.alerting.destinations.webhooks.with_streaming_response.update( @@ -389,10 +458,13 @@ 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 + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @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 ''"): @@ -455,7 +527,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "b115d5ec-15c6-41ee-8b76-92c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) + assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -467,7 +539,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" webhook = await response.parse() - assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) + assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -479,7 +551,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(Optional[WebhookDeleteResponse], webhook, path=["response"]) + assert_matches_type(WebhookDeleteResponse, webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -497,14 +569,20 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: webhook = await async_client.alerting.destinations.webhooks.get( "b115d5ec-15c6-41ee-8b76-92c449b5227b", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Webhooks, webhook, path=["response"]) + assert_matches_type(Optional[Webhooks], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.alerting.destinations.webhooks.with_raw_response.get( @@ -515,8 +593,11 @@ 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(Webhooks, webhook, path=["response"]) + assert_matches_type(Optional[Webhooks], webhook, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.alerting.destinations.webhooks.with_streaming_response.get( @@ -527,10 +608,13 @@ 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(Webhooks, webhook, path=["response"]) + assert_matches_type(Optional[Webhooks], webhook, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4291" + ) @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 ''"): diff --git a/tests/api_resources/alerting/test_policies.py b/tests/api_resources/alerting/test_policies.py index c66a55a5837..7f5b50e9c10 100644 --- a/tests/api_resources/alerting/test_policies.py +++ b/tests/api_resources/alerting/test_policies.py @@ -23,6 +23,9 @@ class TestPolicies: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_method_create(self, client: Cloudflare) -> None: policy = client.alerting.policies.create( @@ -36,8 +39,11 @@ def test_method_create(self, client: Cloudflare) -> None: }, name="SSL Notification Event Policy", ) - assert_matches_type(PolicyCreateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: policy = client.alerting.policies.create( @@ -94,8 +100,11 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "zones": ["string", "string", "string"], }, ) - assert_matches_type(PolicyCreateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.alerting.policies.with_raw_response.create( @@ -113,8 +122,11 @@ 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(PolicyCreateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.alerting.policies.with_streaming_response.create( @@ -132,10 +144,13 @@ 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(PolicyCreateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @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 ''"): @@ -151,14 +166,20 @@ def test_path_params_create(self, client: Cloudflare) -> None: name="SSL Notification Event Policy", ) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_method_update(self, client: Cloudflare) -> None: policy = client.alerting.policies.update( "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: policy = client.alerting.policies.update( @@ -216,8 +237,11 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: }, name="SSL Notification Event Policy", ) - assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.alerting.policies.with_raw_response.update( @@ -228,8 +252,11 @@ 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(PolicyUpdateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.alerting.policies.with_streaming_response.update( @@ -240,10 +267,13 @@ 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(PolicyUpdateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @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 ''"): @@ -302,7 +332,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) + assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -314,7 +344,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(Optional[PolicyDeleteResponse], policy, path=["response"]) + assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -326,7 +356,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(Optional[PolicyDeleteResponse], policy, path=["response"]) + assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -344,14 +374,20 @@ def test_path_params_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_method_get(self, client: Cloudflare) -> None: policy = client.alerting.policies.get( "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.alerting.policies.with_raw_response.get( @@ -362,8 +398,11 @@ 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(Policy, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.alerting.policies.with_streaming_response.get( @@ -374,10 +413,13 @@ 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(Policy, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @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 ''"): @@ -396,6 +438,9 @@ def test_path_params_get(self, client: Cloudflare) -> None: class TestAsyncPolicies: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: policy = await async_client.alerting.policies.create( @@ -409,8 +454,11 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: }, name="SSL Notification Event Policy", ) - assert_matches_type(PolicyCreateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: policy = await async_client.alerting.policies.create( @@ -467,8 +515,11 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "zones": ["string", "string", "string"], }, ) - assert_matches_type(PolicyCreateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.alerting.policies.with_raw_response.create( @@ -486,8 +537,11 @@ 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(PolicyCreateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.alerting.policies.with_streaming_response.create( @@ -505,10 +559,13 @@ 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(PolicyCreateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @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 ''"): @@ -524,14 +581,20 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: name="SSL Notification Event Policy", ) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: policy = await async_client.alerting.policies.update( "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: policy = await async_client.alerting.policies.update( @@ -589,8 +652,11 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare }, name="SSL Notification Event Policy", ) - assert_matches_type(PolicyUpdateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.alerting.policies.with_raw_response.update( @@ -601,8 +667,11 @@ 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(PolicyUpdateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.alerting.policies.with_streaming_response.update( @@ -613,10 +682,13 @@ 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(PolicyUpdateResponse, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @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 ''"): @@ -675,7 +747,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) + assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -687,7 +759,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(Optional[PolicyDeleteResponse], policy, path=["response"]) + assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -699,7 +771,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(Optional[PolicyDeleteResponse], policy, path=["response"]) + assert_matches_type(PolicyDeleteResponse, policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -717,14 +789,20 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: policy = await async_client.alerting.policies.get( "0da2b59e-f118-439d-8097-bdfb215203c9", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.alerting.policies.with_raw_response.get( @@ -735,8 +813,11 @@ 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(Policy, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.alerting.policies.with_streaming_response.get( @@ -747,10 +828,13 @@ 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(Policy, policy, path=["response"]) + assert_matches_type(Optional[Policy], policy, path=["response"]) assert cast(Any, response.is_closed) is True + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9327225061/job/25676826349?pr=482#step:5:4274" + ) @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 ''"): diff --git a/tests/api_resources/logs/control/retention/__init__.py b/tests/api_resources/api_gateway/__init__.py similarity index 100% rename from tests/api_resources/logs/control/retention/__init__.py rename to tests/api_resources/api_gateway/__init__.py diff --git a/tests/api_resources/api_gateway/discovery/__init__.py b/tests/api_resources/api_gateway/discovery/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/api_gateway/discovery/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/api_gateway/discovery/test_operations.py b/tests/api_resources/api_gateway/discovery/test_operations.py new file mode 100644 index 00000000000..3318acf896a --- /dev/null +++ b/tests/api_resources/api_gateway/discovery/test_operations.py @@ -0,0 +1,248 @@ +# 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.api_gateway import DiscoveryOperation +from cloudflare.types.api_gateway.discovery import OperationEditResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestOperations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + operation = client.api_gateway.discovery.operations.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[DiscoveryOperation], operation, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + operation = client.api_gateway.discovery.operations.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + diff=True, + direction="desc", + endpoint="/api/v1", + host=["api.cloudflare.com"], + method=["GET"], + order="method", + origin="ML", + page={}, + per_page={}, + state="review", + ) + assert_matches_type(SyncSinglePage[DiscoveryOperation], operation, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.api_gateway.discovery.operations.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = response.parse() + assert_matches_type(SyncSinglePage[DiscoveryOperation], operation, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.api_gateway.discovery.operations.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = response.parse() + assert_matches_type(SyncSinglePage[DiscoveryOperation], operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.discovery.operations.with_raw_response.list( + zone_id="", + ) + + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + operation = client.api_gateway.discovery.operations.edit( + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(OperationEditResponse, operation, path=["response"]) + + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + operation = client.api_gateway.discovery.operations.edit( + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + state="review", + ) + assert_matches_type(OperationEditResponse, operation, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.api_gateway.discovery.operations.with_raw_response.edit( + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = response.parse() + assert_matches_type(OperationEditResponse, operation, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.api_gateway.discovery.operations.with_streaming_response.edit( + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = response.parse() + assert_matches_type(OperationEditResponse, operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.discovery.operations.with_raw_response.edit( + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `operation_id` but received ''"): + client.api_gateway.discovery.operations.with_raw_response.edit( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncOperations: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.discovery.operations.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[DiscoveryOperation], operation, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.discovery.operations.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + diff=True, + direction="desc", + endpoint="/api/v1", + host=["api.cloudflare.com"], + method=["GET"], + order="method", + origin="ML", + page={}, + per_page={}, + state="review", + ) + assert_matches_type(AsyncSinglePage[DiscoveryOperation], operation, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.discovery.operations.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = await response.parse() + assert_matches_type(AsyncSinglePage[DiscoveryOperation], operation, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.discovery.operations.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = await response.parse() + assert_matches_type(AsyncSinglePage[DiscoveryOperation], operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.discovery.operations.with_raw_response.list( + zone_id="", + ) + + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.discovery.operations.edit( + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(OperationEditResponse, operation, path=["response"]) + + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.discovery.operations.edit( + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + state="review", + ) + assert_matches_type(OperationEditResponse, operation, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.discovery.operations.with_raw_response.edit( + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = await response.parse() + assert_matches_type(OperationEditResponse, operation, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.discovery.operations.with_streaming_response.edit( + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = await response.parse() + assert_matches_type(OperationEditResponse, operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.discovery.operations.with_raw_response.edit( + "0d9bf70c-92e1-4bb3-9411-34a3bcc59003", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `operation_id` but received ''"): + await async_client.api_gateway.discovery.operations.with_raw_response.edit( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/api_gateway/operations/__init__.py b/tests/api_resources/api_gateway/operations/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/api_gateway/operations/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/api_gateway/operations/test_schema_validation.py b/tests/api_resources/api_gateway/operations/test_schema_validation.py new file mode 100644 index 00000000000..c821655f2da --- /dev/null +++ b/tests/api_resources/api_gateway/operations/test_schema_validation.py @@ -0,0 +1,344 @@ +# 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.api_gateway.operations import ( + SettingsMultipleRequest, + SchemaValidationGetResponse, + SchemaValidationUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSchemaValidation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + schema_validation = client.api_gateway.operations.schema_validation.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SchemaValidationUpdateResponse, schema_validation, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + schema_validation = client.api_gateway.operations.schema_validation.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + mitigation_action="block", + ) + assert_matches_type(SchemaValidationUpdateResponse, schema_validation, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.api_gateway.operations.schema_validation.with_raw_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = response.parse() + assert_matches_type(SchemaValidationUpdateResponse, schema_validation, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.api_gateway.operations.schema_validation.with_streaming_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = response.parse() + assert_matches_type(SchemaValidationUpdateResponse, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.operations.schema_validation.with_raw_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `operation_id` but received ''"): + client.api_gateway.operations.schema_validation.with_raw_response.update( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + schema_validation = client.api_gateway.operations.schema_validation.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + settings_multiple_request={ + "3818d821-5901-4147-a474-f5f5aec1d54e": {}, + "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": {}, + }, + ) + assert_matches_type(SettingsMultipleRequest, schema_validation, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.api_gateway.operations.schema_validation.with_raw_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + settings_multiple_request={ + "3818d821-5901-4147-a474-f5f5aec1d54e": {}, + "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": {}, + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = response.parse() + assert_matches_type(SettingsMultipleRequest, schema_validation, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.api_gateway.operations.schema_validation.with_streaming_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + settings_multiple_request={ + "3818d821-5901-4147-a474-f5f5aec1d54e": {}, + "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": {}, + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = response.parse() + assert_matches_type(SettingsMultipleRequest, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.operations.schema_validation.with_raw_response.edit( + zone_id="", + settings_multiple_request={ + "3818d821-5901-4147-a474-f5f5aec1d54e": {}, + "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": {}, + }, + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + schema_validation = client.api_gateway.operations.schema_validation.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SchemaValidationGetResponse, schema_validation, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.api_gateway.operations.schema_validation.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = response.parse() + assert_matches_type(SchemaValidationGetResponse, schema_validation, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.api_gateway.operations.schema_validation.with_streaming_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = response.parse() + assert_matches_type(SchemaValidationGetResponse, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.operations.schema_validation.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `operation_id` but received ''"): + client.api_gateway.operations.schema_validation.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncSchemaValidation: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + schema_validation = await async_client.api_gateway.operations.schema_validation.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SchemaValidationUpdateResponse, schema_validation, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + schema_validation = await async_client.api_gateway.operations.schema_validation.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + mitigation_action="block", + ) + assert_matches_type(SchemaValidationUpdateResponse, schema_validation, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.operations.schema_validation.with_raw_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = await response.parse() + assert_matches_type(SchemaValidationUpdateResponse, schema_validation, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.operations.schema_validation.with_streaming_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = await response.parse() + assert_matches_type(SchemaValidationUpdateResponse, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.operations.schema_validation.with_raw_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `operation_id` but received ''"): + await async_client.api_gateway.operations.schema_validation.with_raw_response.update( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + schema_validation = await async_client.api_gateway.operations.schema_validation.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + settings_multiple_request={ + "3818d821-5901-4147-a474-f5f5aec1d54e": {}, + "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": {}, + }, + ) + assert_matches_type(SettingsMultipleRequest, schema_validation, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.operations.schema_validation.with_raw_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + settings_multiple_request={ + "3818d821-5901-4147-a474-f5f5aec1d54e": {}, + "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": {}, + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = await response.parse() + assert_matches_type(SettingsMultipleRequest, schema_validation, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.operations.schema_validation.with_streaming_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + settings_multiple_request={ + "3818d821-5901-4147-a474-f5f5aec1d54e": {}, + "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": {}, + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = await response.parse() + assert_matches_type(SettingsMultipleRequest, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.operations.schema_validation.with_raw_response.edit( + zone_id="", + settings_multiple_request={ + "3818d821-5901-4147-a474-f5f5aec1d54e": {}, + "b17c8043-99a0-4202-b7d9-8f7cdbee02cd": {}, + }, + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + schema_validation = await async_client.api_gateway.operations.schema_validation.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SchemaValidationGetResponse, schema_validation, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.operations.schema_validation.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = await response.parse() + assert_matches_type(SchemaValidationGetResponse, schema_validation, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.operations.schema_validation.with_streaming_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = await response.parse() + assert_matches_type(SchemaValidationGetResponse, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.operations.schema_validation.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `operation_id` but received ''"): + await async_client.api_gateway.operations.schema_validation.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/api_gateway/settings/__init__.py b/tests/api_resources/api_gateway/settings/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/api_gateway/settings/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/api_gateway/settings/test_schema_validation.py b/tests/api_resources/api_gateway/settings/test_schema_validation.py new file mode 100644 index 00000000000..f0d5bb47925 --- /dev/null +++ b/tests/api_resources/api_gateway/settings/test_schema_validation.py @@ -0,0 +1,200 @@ +# 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.api_gateway.settings import Settings + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSchemaValidation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + schema_validation = client.api_gateway.settings.schema_validation.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_default_mitigation_action="block", + ) + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + schema_validation = client.api_gateway.settings.schema_validation.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_default_mitigation_action="block", + validation_override_mitigation_action="none", + ) + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.api_gateway.settings.schema_validation.with_raw_response.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_default_mitigation_action="block", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.api_gateway.settings.schema_validation.with_streaming_response.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_default_mitigation_action="block", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.settings.schema_validation.with_raw_response.update( + zone_id="", + validation_default_mitigation_action="block", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + schema_validation = client.api_gateway.settings.schema_validation.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.api_gateway.settings.schema_validation.with_raw_response.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.api_gateway.settings.schema_validation.with_streaming_response.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.settings.schema_validation.with_raw_response.get( + zone_id="", + ) + + +class TestAsyncSchemaValidation: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + schema_validation = await async_client.api_gateway.settings.schema_validation.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_default_mitigation_action="block", + ) + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + schema_validation = await async_client.api_gateway.settings.schema_validation.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_default_mitigation_action="block", + validation_override_mitigation_action="none", + ) + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.settings.schema_validation.with_raw_response.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_default_mitigation_action="block", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = await response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.settings.schema_validation.with_streaming_response.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_default_mitigation_action="block", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = await response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.settings.schema_validation.with_raw_response.update( + zone_id="", + validation_default_mitigation_action="block", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + schema_validation = await async_client.api_gateway.settings.schema_validation.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.settings.schema_validation.with_raw_response.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = await response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.settings.schema_validation.with_streaming_response.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = await response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.settings.schema_validation.with_raw_response.get( + zone_id="", + ) diff --git a/tests/api_resources/api_gateway/test_configurations.py b/tests/api_resources/api_gateway/test_configurations.py new file mode 100644 index 00000000000..675123bd057 --- /dev/null +++ b/tests/api_resources/api_gateway/test_configurations.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.api_gateway import ( + Configuration, + ConfigurationUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestConfigurations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + configuration = client.api_gateway.configurations.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + configuration = client.api_gateway.configurations.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + auth_id_characteristics=[ + { + "name": "authorization", + "type": "header", + } + ], + ) + assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.api_gateway.configurations.with_raw_response.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + 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"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.api_gateway.configurations.with_streaming_response.update( + zone_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(ConfigurationUpdateResponse, configuration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.configurations.with_raw_response.update( + zone_id="", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + configuration = client.api_gateway.configurations.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Configuration, configuration, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + configuration = client.api_gateway.configurations.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + properties=["auth_id_characteristics"], + ) + assert_matches_type(Configuration, configuration, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.api_gateway.configurations.with_raw_response.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + configuration = response.parse() + assert_matches_type(Configuration, configuration, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.api_gateway.configurations.with_streaming_response.get( + zone_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(Configuration, configuration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.configurations.with_raw_response.get( + zone_id="", + ) + + +class TestAsyncConfigurations: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + configuration = await async_client.api_gateway.configurations.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + configuration = await async_client.api_gateway.configurations.update( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + auth_id_characteristics=[ + { + "name": "authorization", + "type": "header", + } + ], + ) + assert_matches_type(ConfigurationUpdateResponse, configuration, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.configurations.with_raw_response.update( + zone_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(ConfigurationUpdateResponse, configuration, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.configurations.with_streaming_response.update( + zone_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(ConfigurationUpdateResponse, configuration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.configurations.with_raw_response.update( + zone_id="", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + configuration = await async_client.api_gateway.configurations.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Configuration, configuration, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + configuration = await async_client.api_gateway.configurations.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + properties=["auth_id_characteristics"], + ) + assert_matches_type(Configuration, configuration, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.configurations.with_raw_response.get( + zone_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(Configuration, configuration, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.configurations.with_streaming_response.get( + zone_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(Configuration, configuration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.configurations.with_raw_response.get( + zone_id="", + ) diff --git a/tests/api_resources/api_gateway/test_discovery.py b/tests/api_resources/api_gateway/test_discovery.py new file mode 100644 index 00000000000..f41ab529266 --- /dev/null +++ b/tests/api_resources/api_gateway/test_discovery.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.types.api_gateway import DiscoveryGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestDiscovery: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + discovery = client.api_gateway.discovery.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(DiscoveryGetResponse, discovery, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.api_gateway.discovery.with_raw_response.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + discovery = response.parse() + assert_matches_type(DiscoveryGetResponse, discovery, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.api_gateway.discovery.with_streaming_response.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + discovery = response.parse() + assert_matches_type(DiscoveryGetResponse, discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.discovery.with_raw_response.get( + zone_id="", + ) + + +class TestAsyncDiscovery: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + discovery = await async_client.api_gateway.discovery.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(DiscoveryGetResponse, discovery, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.discovery.with_raw_response.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + discovery = await response.parse() + assert_matches_type(DiscoveryGetResponse, discovery, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.discovery.with_streaming_response.get( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + discovery = await response.parse() + assert_matches_type(DiscoveryGetResponse, discovery, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.discovery.with_raw_response.get( + zone_id="", + ) diff --git a/tests/api_resources/api_gateway/test_operations.py b/tests/api_resources/api_gateway/test_operations.py new file mode 100644 index 00000000000..6c0d2194715 --- /dev/null +++ b/tests/api_resources/api_gateway/test_operations.py @@ -0,0 +1,555 @@ +# 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.api_gateway import ( + APIShield, + OperationCreateResponse, + OperationDeleteResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestOperations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + operation = client.api_gateway.operations.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + ], + ) + assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.api_gateway.operations.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = response.parse() + assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.api_gateway.operations.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = response.parse() + assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.operations.with_raw_response.create( + zone_id="", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + ], + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + operation = client.api_gateway.operations.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[APIShield], operation, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + operation = client.api_gateway.operations.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + direction="desc", + endpoint="/api/v1", + feature=["thresholds"], + host=["api.cloudflare.com"], + method=["GET"], + order="method", + page={}, + per_page=5, + ) + assert_matches_type(SyncSinglePage[APIShield], operation, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.api_gateway.operations.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = response.parse() + assert_matches_type(SyncSinglePage[APIShield], operation, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.api_gateway.operations.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = response.parse() + assert_matches_type(SyncSinglePage[APIShield], operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.operations.with_raw_response.list( + zone_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + operation = client.api_gateway.operations.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(OperationDeleteResponse, operation, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.api_gateway.operations.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = response.parse() + assert_matches_type(OperationDeleteResponse, operation, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.api_gateway.operations.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = response.parse() + assert_matches_type(OperationDeleteResponse, operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.operations.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `operation_id` but received ''"): + client.api_gateway.operations.with_raw_response.delete( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + operation = client.api_gateway.operations.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(APIShield, operation, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + operation = client.api_gateway.operations.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + feature=["thresholds"], + ) + assert_matches_type(APIShield, operation, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.api_gateway.operations.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = response.parse() + assert_matches_type(APIShield, operation, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.api_gateway.operations.with_streaming_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = response.parse() + assert_matches_type(APIShield, operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.operations.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `operation_id` but received ''"): + client.api_gateway.operations.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncOperations: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.operations.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + ], + ) + assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.operations.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + ], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = await response.parse() + assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.operations.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = await response.parse() + assert_matches_type(Optional[OperationCreateResponse], operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.operations.with_raw_response.create( + zone_id="", + body=[ + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + { + "endpoint": "/api/v1/users/{var1}", + "host": "www.example.com", + "method": "GET", + }, + ], + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.operations.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[APIShield], operation, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.operations.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + direction="desc", + endpoint="/api/v1", + feature=["thresholds"], + host=["api.cloudflare.com"], + method=["GET"], + order="method", + page={}, + per_page=5, + ) + assert_matches_type(AsyncSinglePage[APIShield], operation, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.operations.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = await response.parse() + assert_matches_type(AsyncSinglePage[APIShield], operation, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.operations.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = await response.parse() + assert_matches_type(AsyncSinglePage[APIShield], operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.operations.with_raw_response.list( + zone_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.operations.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(OperationDeleteResponse, operation, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.operations.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = await response.parse() + assert_matches_type(OperationDeleteResponse, operation, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.operations.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = await response.parse() + assert_matches_type(OperationDeleteResponse, operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.operations.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `operation_id` but received ''"): + await async_client.api_gateway.operations.with_raw_response.delete( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.operations.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(APIShield, operation, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.operations.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + feature=["thresholds"], + ) + assert_matches_type(APIShield, operation, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.operations.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = await response.parse() + assert_matches_type(APIShield, operation, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.operations.with_streaming_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = await response.parse() + assert_matches_type(APIShield, operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.operations.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `operation_id` but received ''"): + await async_client.api_gateway.operations.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/api_gateway/test_schema_validation.py b/tests/api_resources/api_gateway/test_schema_validation.py new file mode 100644 index 00000000000..dbe446a6c02 --- /dev/null +++ b/tests/api_resources/api_gateway/test_schema_validation.py @@ -0,0 +1,116 @@ +# 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.api_gateway.settings import Settings + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSchemaValidation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + schema_validation = client.api_gateway.schema_validation.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + schema_validation = client.api_gateway.schema_validation.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_default_mitigation_action="block", + validation_override_mitigation_action="none", + ) + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.api_gateway.schema_validation.with_raw_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.api_gateway.schema_validation.with_streaming_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.schema_validation.with_raw_response.edit( + zone_id="", + ) + + +class TestAsyncSchemaValidation: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + schema_validation = await async_client.api_gateway.schema_validation.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + schema_validation = await async_client.api_gateway.schema_validation.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_default_mitigation_action="block", + validation_override_mitigation_action="none", + ) + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.schema_validation.with_raw_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema_validation = await response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.schema_validation.with_streaming_response.edit( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema_validation = await response.parse() + assert_matches_type(Settings, schema_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.schema_validation.with_raw_response.edit( + zone_id="", + ) diff --git a/tests/api_resources/api_gateway/test_schemas.py b/tests/api_resources/api_gateway/test_schemas.py new file mode 100644 index 00000000000..5c2542b4cb5 --- /dev/null +++ b/tests/api_resources/api_gateway/test_schemas.py @@ -0,0 +1,116 @@ +# 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.api_gateway import SchemaListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSchemas: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + schema = client.api_gateway.schemas.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SchemaListResponse, schema, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + schema = client.api_gateway.schemas.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + feature=["thresholds"], + host=["www.example.com"], + ) + assert_matches_type(SchemaListResponse, schema, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.api_gateway.schemas.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema = response.parse() + assert_matches_type(SchemaListResponse, schema, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.api_gateway.schemas.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema = response.parse() + assert_matches_type(SchemaListResponse, schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.schemas.with_raw_response.list( + zone_id="", + ) + + +class TestAsyncSchemas: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + schema = await async_client.api_gateway.schemas.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SchemaListResponse, schema, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + schema = await async_client.api_gateway.schemas.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + feature=["thresholds"], + host=["www.example.com"], + ) + assert_matches_type(SchemaListResponse, schema, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.schemas.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema = await response.parse() + assert_matches_type(SchemaListResponse, schema, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.schemas.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema = await response.parse() + assert_matches_type(SchemaListResponse, schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.schemas.with_raw_response.list( + zone_id="", + ) diff --git a/tests/api_resources/api_gateway/test_user_schemas.py b/tests/api_resources/api_gateway/test_user_schemas.py new file mode 100644 index 00000000000..dddeafd45e8 --- /dev/null +++ b/tests/api_resources/api_gateway/test_user_schemas.py @@ -0,0 +1,563 @@ +# 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.api_gateway import ( + PublicSchema, + SchemaUpload, + UserSchemaDeleteResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestUserSchemas: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + user_schema = client.api_gateway.user_schemas.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + file=b"raw file contents", + kind="openapi_v3", + ) + assert_matches_type(SchemaUpload, user_schema, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + user_schema = client.api_gateway.user_schemas.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + file=b"raw file contents", + kind="openapi_v3", + name="petstore schema", + validation_enabled="true", + ) + assert_matches_type(SchemaUpload, user_schema, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.api_gateway.user_schemas.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + file=b"raw file contents", + kind="openapi_v3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_schema = response.parse() + assert_matches_type(SchemaUpload, user_schema, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.api_gateway.user_schemas.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + file=b"raw file contents", + kind="openapi_v3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_schema = response.parse() + assert_matches_type(SchemaUpload, user_schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.user_schemas.with_raw_response.create( + zone_id="", + file=b"raw file contents", + kind="openapi_v3", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + user_schema = client.api_gateway.user_schemas.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[PublicSchema], user_schema, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + user_schema = client.api_gateway.user_schemas.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + omit_source=True, + page={}, + per_page={}, + validation_enabled=True, + ) + assert_matches_type(SyncSinglePage[PublicSchema], user_schema, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.api_gateway.user_schemas.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_schema = response.parse() + assert_matches_type(SyncSinglePage[PublicSchema], user_schema, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.api_gateway.user_schemas.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_schema = response.parse() + assert_matches_type(SyncSinglePage[PublicSchema], user_schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.user_schemas.with_raw_response.list( + zone_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + user_schema = client.api_gateway.user_schemas.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.api_gateway.user_schemas.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_schema = response.parse() + assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.api_gateway.user_schemas.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_schema = response.parse() + assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.user_schemas.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `schema_id` but received ''"): + client.api_gateway.user_schemas.with_raw_response.delete( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + user_schema = client.api_gateway.user_schemas.edit( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + user_schema = client.api_gateway.user_schemas.edit( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_enabled=True, + ) + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.api_gateway.user_schemas.with_raw_response.edit( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_schema = response.parse() + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.api_gateway.user_schemas.with_streaming_response.edit( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_schema = response.parse() + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.user_schemas.with_raw_response.edit( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `schema_id` but received ''"): + client.api_gateway.user_schemas.with_raw_response.edit( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + user_schema = client.api_gateway.user_schemas.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + user_schema = client.api_gateway.user_schemas.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + omit_source=True, + ) + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.api_gateway.user_schemas.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_schema = response.parse() + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.api_gateway.user_schemas.with_streaming_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_schema = response.parse() + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.user_schemas.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `schema_id` but received ''"): + client.api_gateway.user_schemas.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncUserSchemas: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + user_schema = await async_client.api_gateway.user_schemas.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + file=b"raw file contents", + kind="openapi_v3", + ) + assert_matches_type(SchemaUpload, user_schema, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + user_schema = await async_client.api_gateway.user_schemas.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + file=b"raw file contents", + kind="openapi_v3", + name="petstore schema", + validation_enabled="true", + ) + assert_matches_type(SchemaUpload, user_schema, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.user_schemas.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + file=b"raw file contents", + kind="openapi_v3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_schema = await response.parse() + assert_matches_type(SchemaUpload, user_schema, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.user_schemas.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + file=b"raw file contents", + kind="openapi_v3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_schema = await response.parse() + assert_matches_type(SchemaUpload, user_schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.user_schemas.with_raw_response.create( + zone_id="", + file=b"raw file contents", + kind="openapi_v3", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + user_schema = await async_client.api_gateway.user_schemas.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[PublicSchema], user_schema, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + user_schema = await async_client.api_gateway.user_schemas.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + omit_source=True, + page={}, + per_page={}, + validation_enabled=True, + ) + assert_matches_type(AsyncSinglePage[PublicSchema], user_schema, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.user_schemas.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_schema = await response.parse() + assert_matches_type(AsyncSinglePage[PublicSchema], user_schema, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.user_schemas.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_schema = await response.parse() + assert_matches_type(AsyncSinglePage[PublicSchema], user_schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.user_schemas.with_raw_response.list( + zone_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + user_schema = await async_client.api_gateway.user_schemas.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.user_schemas.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_schema = await response.parse() + assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.user_schemas.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_schema = await response.parse() + assert_matches_type(UserSchemaDeleteResponse, user_schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.user_schemas.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `schema_id` but received ''"): + await async_client.api_gateway.user_schemas.with_raw_response.delete( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + user_schema = await async_client.api_gateway.user_schemas.edit( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + user_schema = await async_client.api_gateway.user_schemas.edit( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + validation_enabled=True, + ) + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.user_schemas.with_raw_response.edit( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_schema = await response.parse() + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.user_schemas.with_streaming_response.edit( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_schema = await response.parse() + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.user_schemas.with_raw_response.edit( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `schema_id` but received ''"): + await async_client.api_gateway.user_schemas.with_raw_response.edit( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + user_schema = await async_client.api_gateway.user_schemas.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + user_schema = await async_client.api_gateway.user_schemas.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + omit_source=True, + ) + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.user_schemas.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user_schema = await response.parse() + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.user_schemas.with_streaming_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user_schema = await response.parse() + assert_matches_type(PublicSchema, user_schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.user_schemas.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `schema_id` but received ''"): + await async_client.api_gateway.user_schemas.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/api_gateway/user_schemas/__init__.py b/tests/api_resources/api_gateway/user_schemas/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/api_gateway/user_schemas/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/api_gateway/user_schemas/test_operations.py b/tests/api_resources/api_gateway/user_schemas/test_operations.py new file mode 100644 index 00000000000..ff5257f64c9 --- /dev/null +++ b/tests/api_resources/api_gateway/user_schemas/test_operations.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 +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.api_gateway.user_schemas import OperationListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestOperations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + operation = client.api_gateway.user_schemas.operations.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[OperationListResponse], operation, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + operation = client.api_gateway.user_schemas.operations.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + endpoint="/api/v1", + feature=["thresholds"], + host=["api.cloudflare.com"], + method=["GET"], + operation_status="new", + page={}, + per_page={}, + ) + assert_matches_type(SyncSinglePage[OperationListResponse], operation, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.api_gateway.user_schemas.operations.with_raw_response.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = response.parse() + assert_matches_type(SyncSinglePage[OperationListResponse], operation, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.api_gateway.user_schemas.operations.with_streaming_response.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = response.parse() + assert_matches_type(SyncSinglePage[OperationListResponse], operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.api_gateway.user_schemas.operations.with_raw_response.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `schema_id` but received ''"): + client.api_gateway.user_schemas.operations.with_raw_response.list( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncOperations: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.user_schemas.operations.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[OperationListResponse], operation, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + operation = await async_client.api_gateway.user_schemas.operations.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + endpoint="/api/v1", + feature=["thresholds"], + host=["api.cloudflare.com"], + method=["GET"], + operation_status="new", + page={}, + per_page={}, + ) + assert_matches_type(AsyncSinglePage[OperationListResponse], operation, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.api_gateway.user_schemas.operations.with_raw_response.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + operation = await response.parse() + assert_matches_type(AsyncSinglePage[OperationListResponse], operation, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.api_gateway.user_schemas.operations.with_streaming_response.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + operation = await response.parse() + assert_matches_type(AsyncSinglePage[OperationListResponse], operation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.api_gateway.user_schemas.operations.with_raw_response.list( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `schema_id` but received ''"): + await async_client.api_gateway.user_schemas.operations.with_raw_response.list( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/calls/__init__.py b/tests/api_resources/calls/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/calls/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/calls/turn/__init__.py b/tests/api_resources/calls/turn/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/calls/turn/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/calls/turn/test_keys.py b/tests/api_resources/calls/turn/test_keys.py new file mode 100644 index 00000000000..65c537af125 --- /dev/null +++ b/tests/api_resources/calls/turn/test_keys.py @@ -0,0 +1,500 @@ +# 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.calls.turn import ( + KeyListResponse, + KeyCreateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestKeys: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + key = client.calls.turn.keys.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(KeyCreateResponse, key, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + key = client.calls.turn.keys.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="my-turn-key", + ) + assert_matches_type(KeyCreateResponse, key, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.calls.turn.keys.with_raw_response.create( + 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(KeyCreateResponse, key, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.calls.turn.keys.with_streaming_response.create( + 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(KeyCreateResponse, key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.calls.turn.keys.with_raw_response.create( + account_id="", + ) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + key = client.calls.turn.keys.update( + "2a95132c15732412d22c1476fa83f27a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(str, key, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + key = client.calls.turn.keys.update( + "2a95132c15732412d22c1476fa83f27a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="my-turn-key", + ) + assert_matches_type(str, key, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.calls.turn.keys.with_raw_response.update( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.calls.turn.keys.with_streaming_response.update( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.calls.turn.keys.with_raw_response.update( + "2a95132c15732412d22c1476fa83f27a", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_id` but received ''"): + client.calls.turn.keys.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + key = client.calls.turn.keys.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[KeyListResponse], key, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.calls.turn.keys.with_raw_response.list( + 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(SyncSinglePage[KeyListResponse], key, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.calls.turn.keys.with_streaming_response.list( + 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(SyncSinglePage[KeyListResponse], key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.calls.turn.keys.with_raw_response.list( + account_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + key = client.calls.turn.keys.delete( + "2a95132c15732412d22c1476fa83f27a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(str, key, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.calls.turn.keys.with_raw_response.delete( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.calls.turn.keys.with_streaming_response.delete( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.calls.turn.keys.with_raw_response.delete( + "2a95132c15732412d22c1476fa83f27a", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_id` but received ''"): + client.calls.turn.keys.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + key = client.calls.turn.keys.get( + "2a95132c15732412d22c1476fa83f27a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(str, key, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.calls.turn.keys.with_raw_response.get( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.calls.turn.keys.with_streaming_response.get( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.calls.turn.keys.with_raw_response.get( + "2a95132c15732412d22c1476fa83f27a", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_id` but received ''"): + client.calls.turn.keys.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncKeys: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + key = await async_client.calls.turn.keys.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(KeyCreateResponse, key, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + key = await async_client.calls.turn.keys.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="my-turn-key", + ) + assert_matches_type(KeyCreateResponse, key, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.calls.turn.keys.with_raw_response.create( + 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(KeyCreateResponse, key, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.calls.turn.keys.with_streaming_response.create( + 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(KeyCreateResponse, key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.calls.turn.keys.with_raw_response.create( + account_id="", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + key = await async_client.calls.turn.keys.update( + "2a95132c15732412d22c1476fa83f27a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(str, key, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + key = await async_client.calls.turn.keys.update( + "2a95132c15732412d22c1476fa83f27a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="my-turn-key", + ) + assert_matches_type(str, key, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.calls.turn.keys.with_raw_response.update( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.calls.turn.keys.with_streaming_response.update( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.calls.turn.keys.with_raw_response.update( + "2a95132c15732412d22c1476fa83f27a", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_id` but received ''"): + await async_client.calls.turn.keys.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + key = await async_client.calls.turn.keys.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[KeyListResponse], key, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.calls.turn.keys.with_raw_response.list( + 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(AsyncSinglePage[KeyListResponse], key, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.calls.turn.keys.with_streaming_response.list( + 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(AsyncSinglePage[KeyListResponse], key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.calls.turn.keys.with_raw_response.list( + account_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + key = await async_client.calls.turn.keys.delete( + "2a95132c15732412d22c1476fa83f27a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(str, key, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.calls.turn.keys.with_raw_response.delete( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.calls.turn.keys.with_streaming_response.delete( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.calls.turn.keys.with_raw_response.delete( + "2a95132c15732412d22c1476fa83f27a", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_id` but received ''"): + await async_client.calls.turn.keys.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + key = await async_client.calls.turn.keys.get( + "2a95132c15732412d22c1476fa83f27a", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(str, key, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.calls.turn.keys.with_raw_response.get( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.calls.turn.keys.with_streaming_response.get( + "2a95132c15732412d22c1476fa83f27a", + 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(str, key, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.calls.turn.keys.with_raw_response.get( + "2a95132c15732412d22c1476fa83f27a", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_id` but received ''"): + await async_client.calls.turn.keys.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/d1/test_database.py b/tests/api_resources/d1/test_database.py index 30697981791..68fd53cc39b 100644 --- a/tests/api_resources/d1/test_database.py +++ b/tests/api_resources/d1/test_database.py @@ -11,6 +11,7 @@ from tests.utils import assert_matches_type from cloudflare.types.d1 import ( D1, + DatabaseRawResponse, DatabaseListResponse, DatabaseQueryResponse, DatabaseCreateResponse, @@ -118,7 +119,7 @@ def test_path_params_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: database = client.d1.database.delete( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(DatabaseDeleteResponse, database, path=["response"]) @@ -126,7 +127,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.d1.database.with_raw_response.delete( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -138,7 +139,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.d1.database.with_streaming_response.delete( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -150,23 +151,23 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @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.d1.database.with_raw_response.delete( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"): client.d1.database.with_raw_response.delete( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize def test_method_get(self, client: Cloudflare) -> None: database = client.d1.database.get( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(D1, database, path=["response"]) @@ -174,7 +175,7 @@ def test_method_get(self, client: Cloudflare) -> None: def test_raw_response_get(self, client: Cloudflare) -> None: response = client.d1.database.with_raw_response.get( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -186,7 +187,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: def test_streaming_response_get(self, client: Cloudflare) -> None: with client.d1.database.with_streaming_response.get( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -198,23 +199,23 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.d1.database.with_raw_response.get( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"): client.d1.database.with_raw_response.get( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize def test_method_query(self, client: Cloudflare) -> None: database = client.d1.database.query( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", ) assert_matches_type(DatabaseQueryResponse, database, path=["response"]) @@ -223,7 +224,7 @@ def test_method_query(self, client: Cloudflare) -> None: def test_method_query_with_all_params(self, client: Cloudflare) -> None: database = client.d1.database.query( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", params=["firstParam", "secondParam"], ) @@ -233,7 +234,7 @@ def test_method_query_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_query(self, client: Cloudflare) -> None: response = client.d1.database.with_raw_response.query( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", ) @@ -246,7 +247,7 @@ def test_raw_response_query(self, client: Cloudflare) -> None: def test_streaming_response_query(self, client: Cloudflare) -> None: with client.d1.database.with_streaming_response.query( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", ) as response: assert not response.is_closed @@ -259,17 +260,80 @@ def test_streaming_response_query(self, client: Cloudflare) -> None: @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.d1.database.with_raw_response.query( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="", + account_id="", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"): client.d1.database.with_raw_response.query( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + ) + + @parametrize + def test_method_raw(self, client: Cloudflare) -> None: + database = client.d1.database.raw( + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + ) + assert_matches_type(DatabaseRawResponse, database, path=["response"]) + + @parametrize + def test_method_raw_with_all_params(self, client: Cloudflare) -> None: + database = client.d1.database.raw( + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + params=["firstParam", "secondParam"], + ) + assert_matches_type(DatabaseRawResponse, database, path=["response"]) + + @parametrize + def test_raw_response_raw(self, client: Cloudflare) -> None: + response = client.d1.database.with_raw_response.raw( + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + database = response.parse() + assert_matches_type(DatabaseRawResponse, database, path=["response"]) + + @parametrize + def test_streaming_response_raw(self, client: Cloudflare) -> None: + with client.d1.database.with_streaming_response.raw( + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + database = response.parse() + assert_matches_type(DatabaseRawResponse, database, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_raw(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.d1.database.with_raw_response.raw( + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + account_id="", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"): + client.d1.database.with_raw_response.raw( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", ) @@ -371,7 +435,7 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: database = await async_client.d1.database.delete( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(DatabaseDeleteResponse, database, path=["response"]) @@ -379,7 +443,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.d1.database.with_raw_response.delete( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -391,7 +455,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.d1.database.with_streaming_response.delete( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -403,23 +467,23 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @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.d1.database.with_raw_response.delete( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"): await async_client.d1.database.with_raw_response.delete( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: database = await async_client.d1.database.get( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(D1, database, path=["response"]) @@ -427,7 +491,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.d1.database.with_raw_response.get( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -439,7 +503,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.d1.database.with_streaming_response.get( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -451,23 +515,23 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.d1.database.with_raw_response.get( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"): await async_client.d1.database.with_raw_response.get( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize async def test_method_query(self, async_client: AsyncCloudflare) -> None: database = await async_client.d1.database.query( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", ) assert_matches_type(DatabaseQueryResponse, database, path=["response"]) @@ -476,7 +540,7 @@ async def test_method_query(self, async_client: AsyncCloudflare) -> None: async def test_method_query_with_all_params(self, async_client: AsyncCloudflare) -> None: database = await async_client.d1.database.query( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", params=["firstParam", "secondParam"], ) @@ -486,7 +550,7 @@ async def test_method_query_with_all_params(self, async_client: AsyncCloudflare) async def test_raw_response_query(self, async_client: AsyncCloudflare) -> None: response = await async_client.d1.database.with_raw_response.query( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", ) @@ -499,7 +563,7 @@ async def test_raw_response_query(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_query(self, async_client: AsyncCloudflare) -> None: async with async_client.d1.database.with_streaming_response.query( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", ) as response: assert not response.is_closed @@ -512,16 +576,79 @@ async def test_streaming_response_query(self, async_client: AsyncCloudflare) -> @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.d1.database.with_raw_response.query( "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - account_identifier="", + account_id="", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"): await async_client.d1.database.with_raw_response.query( "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + ) + + @parametrize + async def test_method_raw(self, async_client: AsyncCloudflare) -> None: + database = await async_client.d1.database.raw( + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + ) + assert_matches_type(DatabaseRawResponse, database, path=["response"]) + + @parametrize + async def test_method_raw_with_all_params(self, async_client: AsyncCloudflare) -> None: + database = await async_client.d1.database.raw( + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + params=["firstParam", "secondParam"], + ) + assert_matches_type(DatabaseRawResponse, database, path=["response"]) + + @parametrize + async def test_raw_response_raw(self, async_client: AsyncCloudflare) -> None: + response = await async_client.d1.database.with_raw_response.raw( + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + database = await response.parse() + assert_matches_type(DatabaseRawResponse, database, path=["response"]) + + @parametrize + async def test_streaming_response_raw(self, async_client: AsyncCloudflare) -> None: + async with async_client.d1.database.with_streaming_response.raw( + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + database = await response.parse() + assert_matches_type(DatabaseRawResponse, database, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_raw(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.d1.database.with_raw_response.raw( + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + account_id="", + sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"): + await async_client.d1.database.with_raw_response.raw( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", sql="SELECT * FROM myTable WHERE field = ? OR field = ?;", ) diff --git a/tests/api_resources/dns/test_settings.py b/tests/api_resources/dns/test_settings.py new file mode 100644 index 00000000000..c0dd59c2aa2 --- /dev/null +++ b/tests/api_resources/dns/test_settings.py @@ -0,0 +1,276 @@ +# 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.dns 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="HTTP 422 from prism") + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + setting = client.dns.settings.edit( + account_id="string", + ) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + setting = client.dns.settings.edit( + account_id="string", + zone_defaults={ + "foundation_dns": False, + "multi_provider": False, + "nameservers": {"type": "cloudflare.standard"}, + "ns_ttl": 86400, + "secondary_overrides": False, + "soa": { + "expire": 604800, + "min_ttl": 1800, + "mname": "kristina.ns.cloudflare.com", + "refresh": 10000, + "retry": 2400, + "rname": "admin.example.com", + "ttl": 3600, + }, + "zone_mode": "dns_only", + }, + ) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.dns.settings.with_raw_response.edit( + account_id="string", + ) + + 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="HTTP 422 from prism") + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.dns.settings.with_streaming_response.edit( + account_id="string", + ) 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="HTTP 422 from prism") + @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.dns.settings.with_raw_response.edit( + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.dns.settings.with_raw_response.edit( + account_id="string", + ) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + setting = client.dns.settings.get( + account_id="string", + ) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + setting = client.dns.settings.get( + account_id="string", + ) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.dns.settings.with_raw_response.get( + account_id="string", + ) + + 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(reason="HTTP 422 from prism") + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.dns.settings.with_streaming_response.get( + account_id="string", + ) 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(reason="HTTP 422 from prism") + @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.dns.settings.with_raw_response.get( + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.dns.settings.with_raw_response.get( + account_id="string", + ) + + +class TestAsyncSettings: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + setting = await async_client.dns.settings.edit( + account_id="string", + ) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + setting = await async_client.dns.settings.edit( + account_id="string", + zone_defaults={ + "foundation_dns": False, + "multi_provider": False, + "nameservers": {"type": "cloudflare.standard"}, + "ns_ttl": 86400, + "secondary_overrides": False, + "soa": { + "expire": 604800, + "min_ttl": 1800, + "mname": "kristina.ns.cloudflare.com", + "refresh": 10000, + "retry": 2400, + "rname": "admin.example.com", + "ttl": 3600, + }, + "zone_mode": "dns_only", + }, + ) + assert_matches_type(Optional[SettingEditResponse], setting, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.dns.settings.with_raw_response.edit( + account_id="string", + ) + + 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="HTTP 422 from prism") + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.dns.settings.with_streaming_response.edit( + account_id="string", + ) 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="HTTP 422 from prism") + @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.dns.settings.with_raw_response.edit( + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.dns.settings.with_raw_response.edit( + account_id="string", + ) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + setting = await async_client.dns.settings.get( + account_id="string", + ) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + setting = await async_client.dns.settings.get( + account_id="string", + ) + assert_matches_type(Optional[SettingGetResponse], setting, path=["response"]) + + @pytest.mark.skip(reason="HTTP 422 from prism") + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.dns.settings.with_raw_response.get( + account_id="string", + ) + + 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(reason="HTTP 422 from prism") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.dns.settings.with_streaming_response.get( + account_id="string", + ) 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(reason="HTTP 422 from prism") + @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.dns.settings.with_raw_response.get( + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.dns.settings.with_raw_response.get( + account_id="string", + ) diff --git a/tests/api_resources/firewall/test_rules.py b/tests/api_resources/firewall/test_rules.py index 7ae57fa47e3..4864bb5a5fa 100644 --- a/tests/api_resources/firewall/test_rules.py +++ b/tests/api_resources/firewall/test_rules.py @@ -16,6 +16,8 @@ RuleCreateResponse, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,19 +27,22 @@ class TestRules: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_create(self, client: Cloudflare) -> None: - rule = client.firewall.rules.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + rule = client.firewall.rules.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.firewall.rules.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = client.firewall.rules.with_raw_response.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -47,45 +52,50 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.firewall.rules.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.firewall.rules.with_streaming_response.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) + rule = response.parse() + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.firewall.rules.with_raw_response.create( - "", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.firewall.rules.with_raw_response.create( + "", + body={}, + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update(self, client: Cloudflare) -> None: - rule = client.firewall.rules.update( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + rule = client.firewall.rules.update( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.firewall.rules.with_raw_response.update( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = client.firewall.rules.with_raw_response.update( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -95,61 +105,68 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.firewall.rules.with_streaming_response.update( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.firewall.rules.with_streaming_response.update( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(FirewallRule, rule, path=["response"]) + rule = response.parse() + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): - client.firewall.rules.with_raw_response.update( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.firewall.rules.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.firewall.rules.with_raw_response.update( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.firewall.rules.with_raw_response.update( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) @parametrize def test_method_list(self, client: Cloudflare) -> None: - rule = client.firewall.rules.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + rule = client.firewall.rules.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) @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, - ) + with pytest.warns(DeprecationWarning): + rule = client.firewall.rules.list( + "023e105f4ecef8ad9ca31a8372d0c353", + id="372e67954025e0ba6aaa6d586b9e0b60", + action="block", + description="mir", + page=1, + paused=False, + per_page=5, + ) + assert_matches_type(SyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.firewall.rules.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.firewall.rules.with_raw_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -158,38 +175,43 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.firewall.rules.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.firewall.rules.with_streaming_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(SyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) + rule = response.parse() + assert_matches_type(SyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.firewall.rules.with_raw_response.list( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.firewall.rules.with_raw_response.list( + "", + ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: - rule = client.firewall.rules.delete( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + rule = client.firewall.rules.delete( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(FirewallRule, rule, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.firewall.rules.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.firewall.rules.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -198,50 +220,55 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.firewall.rules.with_streaming_response.delete( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.firewall.rules.with_streaming_response.delete( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(FirewallRule, rule, path=["response"]) + rule = response.parse() + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.firewall.rules.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.firewall.rules.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.firewall.rules.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.firewall.rules.with_raw_response.delete( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_edit(self, client: Cloudflare) -> None: - rule = client.firewall.rules.edit( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + rule = client.firewall.rules.edit( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.firewall.rules.with_raw_response.edit( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = client.firewall.rules.with_raw_response.edit( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -251,59 +278,66 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.firewall.rules.with_streaming_response.edit( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.firewall.rules.with_streaming_response.edit( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rule = response.parse() - assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) + rule = response.parse() + assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): - client.firewall.rules.with_raw_response.edit( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.firewall.rules.with_raw_response.edit( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.firewall.rules.with_raw_response.edit( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.firewall.rules.with_raw_response.edit( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) @parametrize def test_method_get(self, client: Cloudflare) -> None: - rule = client.firewall.rules.get( - "023e105f4ecef8ad9ca31a8372d0c353", - path_id="372e67954025e0ba6aaa6d586b9e0b60", - ) + with pytest.warns(DeprecationWarning): + rule = client.firewall.rules.get( + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", + ) + assert_matches_type(FirewallRule, rule, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: - rule = client.firewall.rules.get( - "023e105f4ecef8ad9ca31a8372d0c353", - path_id="372e67954025e0ba6aaa6d586b9e0b60", - query_id="372e67954025e0ba6aaa6d586b9e0b60", - ) + with pytest.warns(DeprecationWarning): + rule = client.firewall.rules.get( + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", + query_id="372e67954025e0ba6aaa6d586b9e0b60", + ) + assert_matches_type(FirewallRule, rule, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.firewall.rules.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - path_id="372e67954025e0ba6aaa6d586b9e0b60", - ) + with pytest.warns(DeprecationWarning): + response = client.firewall.rules.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -312,32 +346,34 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.firewall.rules.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - path_id="372e67954025e0ba6aaa6d586b9e0b60", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.firewall.rules.with_streaming_response.get( + "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(FirewallRule, rule, path=["response"]) + rule = response.parse() + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): - client.firewall.rules.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - path_id="", - query_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): + client.firewall.rules.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="", + query_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.firewall.rules.with_raw_response.get( - "", - path_id="372e67954025e0ba6aaa6d586b9e0b60", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.firewall.rules.with_raw_response.get( + "", + path_id="372e67954025e0ba6aaa6d586b9e0b60", + ) class TestAsyncRules: @@ -346,19 +382,22 @@ class TestAsyncRules: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.firewall.rules.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + rule = await async_client.firewall.rules.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.firewall.rules.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.firewall.rules.with_raw_response.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -368,45 +407,50 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.firewall.rules.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.firewall.rules.with_streaming_response.create( + "023e105f4ecef8ad9ca31a8372d0c353", + 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(Optional[RuleCreateResponse], rule, path=["response"]) + rule = await response.parse() + assert_matches_type(Optional[RuleCreateResponse], rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.firewall.rules.with_raw_response.create( - "", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.firewall.rules.with_raw_response.create( + "", + body={}, + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.firewall.rules.update( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + rule = await async_client.firewall.rules.update( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(FirewallRule, rule, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.firewall.rules.with_raw_response.update( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.firewall.rules.with_raw_response.update( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -416,61 +460,68 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.firewall.rules.with_streaming_response.update( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.firewall.rules.with_streaming_response.update( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + 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(FirewallRule, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update(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.rules.with_raw_response.update( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.firewall.rules.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.firewall.rules.with_raw_response.update( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.firewall.rules.with_raw_response.update( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.firewall.rules.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + rule = await async_client.firewall.rules.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) @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, - ) + with pytest.warns(DeprecationWarning): + 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[FirewallRule], rule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.firewall.rules.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.firewall.rules.with_raw_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -479,38 +530,43 @@ 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.firewall.rules.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.firewall.rules.with_streaming_response.list( + "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(AsyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) + rule = await response.parse() + assert_matches_type(AsyncV4PagePaginationArray[FirewallRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.firewall.rules.with_raw_response.list( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.firewall.rules.with_raw_response.list( + "", + ) @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.firewall.rules.delete( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + rule = await async_client.firewall.rules.delete( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(FirewallRule, rule, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.firewall.rules.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.firewall.rules.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -519,50 +575,55 @@ 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.firewall.rules.with_streaming_response.delete( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.firewall.rules.with_streaming_response.delete( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="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(FirewallRule, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.firewall.rules.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.firewall.rules.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.firewall.rules.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.firewall.rules.with_raw_response.delete( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.firewall.rules.edit( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + rule = await async_client.firewall.rules.edit( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.firewall.rules.with_raw_response.edit( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.firewall.rules.with_raw_response.edit( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -572,59 +633,66 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.firewall.rules.with_streaming_response.edit( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.firewall.rules.with_streaming_response.edit( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + 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(Optional[RuleEditResponse], rule, path=["response"]) + rule = await response.parse() + assert_matches_type(Optional[RuleEditResponse], rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): - await async_client.firewall.rules.with_raw_response.edit( - "372e67954025e0ba6aaa6d586b9e0b60", - zone_identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.firewall.rules.with_raw_response.edit( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.firewall.rules.with_raw_response.edit( + "372e67954025e0ba6aaa6d586b9e0b60", + zone_identifier="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.firewall.rules.with_raw_response.edit( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.firewall.rules.get( - "023e105f4ecef8ad9ca31a8372d0c353", - path_id="372e67954025e0ba6aaa6d586b9e0b60", - ) + with pytest.warns(DeprecationWarning): + rule = await async_client.firewall.rules.get( + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", + ) + assert_matches_type(FirewallRule, rule, path=["response"]) @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", - ) + with pytest.warns(DeprecationWarning): + rule = await async_client.firewall.rules.get( + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", + query_id="372e67954025e0ba6aaa6d586b9e0b60", + ) + assert_matches_type(FirewallRule, rule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.firewall.rules.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - path_id="372e67954025e0ba6aaa6d586b9e0b60", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.firewall.rules.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="372e67954025e0ba6aaa6d586b9e0b60", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -633,29 +701,31 @@ 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.rules.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - path_id="372e67954025e0ba6aaa6d586b9e0b60", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.firewall.rules.with_streaming_response.get( + "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(FirewallRule, rule, path=["response"]) + rule = await response.parse() + assert_matches_type(FirewallRule, rule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): - await async_client.firewall.rules.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - path_id="", - query_id="", - ) - - 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( - "", - path_id="372e67954025e0ba6aaa6d586b9e0b60", - ) + with pytest.warns(DeprecationWarning): + 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( + "023e105f4ecef8ad9ca31a8372d0c353", + path_id="", + query_id="", + ) + + 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( + "", + path_id="372e67954025e0ba6aaa6d586b9e0b60", + ) diff --git a/tests/api_resources/iam/__init__.py b/tests/api_resources/iam/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/iam/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/iam/test_permission_groups.py b/tests/api_resources/iam/test_permission_groups.py new file mode 100644 index 00000000000..298235ce84e --- /dev/null +++ b/tests/api_resources/iam/test_permission_groups.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.iam import PermissionGroupGetResponse +from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPermissionGroups: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + permission_group = client.iam.permission_groups.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(SyncV4PagePaginationArray[object], permission_group, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + permission_group = client.iam.permission_groups.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + id="6d7f2f5f5b1d4a0e9081fdc98d432fd1", + label="labelOfThePermissionGroup", + name="NameOfThePermissionGroup", + page=1, + per_page=5, + ) + assert_matches_type(SyncV4PagePaginationArray[object], permission_group, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.iam.permission_groups.with_raw_response.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + permission_group = response.parse() + assert_matches_type(SyncV4PagePaginationArray[object], permission_group, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.iam.permission_groups.with_streaming_response.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + permission_group = response.parse() + assert_matches_type(SyncV4PagePaginationArray[object], permission_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.iam.permission_groups.with_raw_response.list( + account_id="", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + permission_group = client.iam.permission_groups.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(PermissionGroupGetResponse, permission_group, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.iam.permission_groups.with_raw_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + permission_group = response.parse() + assert_matches_type(PermissionGroupGetResponse, permission_group, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.iam.permission_groups.with_streaming_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + permission_group = response.parse() + assert_matches_type(PermissionGroupGetResponse, permission_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.iam.permission_groups.with_raw_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `permission_group_id` but received ''"): + client.iam.permission_groups.with_raw_response.get( + "", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + +class TestAsyncPermissionGroups: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + permission_group = await async_client.iam.permission_groups.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(AsyncV4PagePaginationArray[object], permission_group, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + permission_group = await async_client.iam.permission_groups.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + id="6d7f2f5f5b1d4a0e9081fdc98d432fd1", + label="labelOfThePermissionGroup", + name="NameOfThePermissionGroup", + page=1, + per_page=5, + ) + assert_matches_type(AsyncV4PagePaginationArray[object], permission_group, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.iam.permission_groups.with_raw_response.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + permission_group = await response.parse() + assert_matches_type(AsyncV4PagePaginationArray[object], permission_group, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.iam.permission_groups.with_streaming_response.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + permission_group = await response.parse() + assert_matches_type(AsyncV4PagePaginationArray[object], permission_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.iam.permission_groups.with_raw_response.list( + account_id="", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + permission_group = await async_client.iam.permission_groups.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(PermissionGroupGetResponse, permission_group, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.iam.permission_groups.with_raw_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + permission_group = await response.parse() + assert_matches_type(PermissionGroupGetResponse, permission_group, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.iam.permission_groups.with_streaming_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + permission_group = await response.parse() + assert_matches_type(PermissionGroupGetResponse, permission_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.iam.permission_groups.with_raw_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `permission_group_id` but received ''"): + await async_client.iam.permission_groups.with_raw_response.get( + "", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) diff --git a/tests/api_resources/iam/test_resource_groups.py b/tests/api_resources/iam/test_resource_groups.py new file mode 100644 index 00000000000..a08c3160026 --- /dev/null +++ b/tests/api_resources/iam/test_resource_groups.py @@ -0,0 +1,700 @@ +# 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.iam import ( + ResourceGroupGetResponse, + ResourceGroupCreateResponse, + ResourceGroupDeleteResponse, + ResourceGroupUpdateResponse, +) +from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestResourceGroups: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + resource_group = client.iam.resource_groups.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + resource_group = client.iam.resource_groups.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + meta={"editable": "false"}, + ) + assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.iam.resource_groups.with_raw_response.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource_group = response.parse() + assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.iam.resource_groups.with_streaming_response.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource_group = response.parse() + assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.iam.resource_groups.with_raw_response.create( + account_id="", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + resource_group = client.iam.resource_groups.update( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + resource_group = client.iam.resource_groups.update( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + meta={"editable": "false"}, + ) + assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.iam.resource_groups.with_raw_response.update( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource_group = response.parse() + assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.iam.resource_groups.with_streaming_response.update( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource_group = response.parse() + assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.iam.resource_groups.with_raw_response.update( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_group_id` but received ''"): + client.iam.resource_groups.with_raw_response.update( + "", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + resource_group = client.iam.resource_groups.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(SyncV4PagePaginationArray[object], resource_group, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + resource_group = client.iam.resource_groups.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + id="6d7f2f5f5b1d4a0e9081fdc98d432fd1", + name="NameOfTheResourceGroup", + page=1, + per_page=5, + ) + assert_matches_type(SyncV4PagePaginationArray[object], resource_group, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.iam.resource_groups.with_raw_response.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource_group = response.parse() + assert_matches_type(SyncV4PagePaginationArray[object], resource_group, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.iam.resource_groups.with_streaming_response.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource_group = response.parse() + assert_matches_type(SyncV4PagePaginationArray[object], resource_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.iam.resource_groups.with_raw_response.list( + account_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + resource_group = client.iam.resource_groups.delete( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(Optional[ResourceGroupDeleteResponse], resource_group, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.iam.resource_groups.with_raw_response.delete( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource_group = response.parse() + assert_matches_type(Optional[ResourceGroupDeleteResponse], resource_group, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.iam.resource_groups.with_streaming_response.delete( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource_group = response.parse() + assert_matches_type(Optional[ResourceGroupDeleteResponse], resource_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.iam.resource_groups.with_raw_response.delete( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_group_id` but received ''"): + client.iam.resource_groups.with_raw_response.delete( + "", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + resource_group = client.iam.resource_groups.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(ResourceGroupGetResponse, resource_group, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.iam.resource_groups.with_raw_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource_group = response.parse() + assert_matches_type(ResourceGroupGetResponse, resource_group, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.iam.resource_groups.with_streaming_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource_group = response.parse() + assert_matches_type(ResourceGroupGetResponse, resource_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.iam.resource_groups.with_raw_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_group_id` but received ''"): + client.iam.resource_groups.with_raw_response.get( + "", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + +class TestAsyncResourceGroups: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + resource_group = await async_client.iam.resource_groups.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + resource_group = await async_client.iam.resource_groups.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + meta={"editable": "false"}, + ) + assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.iam.resource_groups.with_raw_response.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource_group = await response.parse() + assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.iam.resource_groups.with_streaming_response.create( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource_group = await response.parse() + assert_matches_type(ResourceGroupCreateResponse, resource_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.iam.resource_groups.with_raw_response.create( + account_id="", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + resource_group = await async_client.iam.resource_groups.update( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + resource_group = await async_client.iam.resource_groups.update( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + meta={"editable": "false"}, + ) + assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.iam.resource_groups.with_raw_response.update( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource_group = await response.parse() + assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.iam.resource_groups.with_streaming_response.update( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource_group = await response.parse() + assert_matches_type(ResourceGroupUpdateResponse, resource_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.iam.resource_groups.with_raw_response.update( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_group_id` but received ''"): + await async_client.iam.resource_groups.with_raw_response.update( + "", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + scope={ + "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", + "objects": [ + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + {"key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5"}, + ], + }, + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + resource_group = await async_client.iam.resource_groups.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(AsyncV4PagePaginationArray[object], resource_group, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + resource_group = await async_client.iam.resource_groups.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + id="6d7f2f5f5b1d4a0e9081fdc98d432fd1", + name="NameOfTheResourceGroup", + page=1, + per_page=5, + ) + assert_matches_type(AsyncV4PagePaginationArray[object], resource_group, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.iam.resource_groups.with_raw_response.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource_group = await response.parse() + assert_matches_type(AsyncV4PagePaginationArray[object], resource_group, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.iam.resource_groups.with_streaming_response.list( + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource_group = await response.parse() + assert_matches_type(AsyncV4PagePaginationArray[object], resource_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.iam.resource_groups.with_raw_response.list( + account_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + resource_group = await async_client.iam.resource_groups.delete( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(Optional[ResourceGroupDeleteResponse], resource_group, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.iam.resource_groups.with_raw_response.delete( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource_group = await response.parse() + assert_matches_type(Optional[ResourceGroupDeleteResponse], resource_group, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.iam.resource_groups.with_streaming_response.delete( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource_group = await response.parse() + assert_matches_type(Optional[ResourceGroupDeleteResponse], resource_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.iam.resource_groups.with_raw_response.delete( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_group_id` but received ''"): + await async_client.iam.resource_groups.with_raw_response.delete( + "", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + resource_group = await async_client.iam.resource_groups.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + assert_matches_type(ResourceGroupGetResponse, resource_group, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.iam.resource_groups.with_raw_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + resource_group = await response.parse() + assert_matches_type(ResourceGroupGetResponse, resource_group, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.iam.resource_groups.with_streaming_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + resource_group = await response.parse() + assert_matches_type(ResourceGroupGetResponse, resource_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.iam.resource_groups.with_raw_response.get( + "6d7f2f5f5b1d4a0e9081fdc98d432fd1", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `resource_group_id` but received ''"): + await async_client.iam.resource_groups.with_raw_response.get( + "", + account_id="eb78d65290b24279ba6f44721b3ea3c4", + ) diff --git a/tests/api_resources/intel/test_indicator_feeds.py b/tests/api_resources/intel/test_indicator_feeds.py index e0c1a3dea7a..45aee641fae 100644 --- a/tests/api_resources/intel/test_indicator_feeds.py +++ b/tests/api_resources/intel/test_indicator_feeds.py @@ -83,9 +83,10 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: indicator_feed = client.intel.indicator_feeds.update( 12, account_id="023e105f4ecef8ad9ca31a8372d0c353", - feed_description="This is an example description", + description="This is an example description", is_attributable=True, is_public=True, + name="indicator_list", ) assert_matches_type(Optional[IndicatorFeedUpdateResponse], indicator_feed, path=["response"]) @@ -309,9 +310,10 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare indicator_feed = await async_client.intel.indicator_feeds.update( 12, account_id="023e105f4ecef8ad9ca31a8372d0c353", - feed_description="This is an example description", + description="This is an example description", is_attributable=True, is_public=True, + name="indicator_list", ) assert_matches_type(Optional[IndicatorFeedUpdateResponse], indicator_feed, path=["response"]) diff --git a/tests/api_resources/kv/namespaces/test_bulk.py b/tests/api_resources/kv/namespaces/test_bulk.py index c941e118037..6a37a64f90e 100644 --- a/tests/api_resources/kv/namespaces/test_bulk.py +++ b/tests/api_resources/kv/namespaces/test_bulk.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -24,7 +24,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body=[{}, {}, {}], ) - assert_matches_type(BulkUpdateResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -37,7 +37,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" bulk = response.parse() - assert_matches_type(BulkUpdateResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -50,7 +50,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bulk = response.parse() - assert_matches_type(BulkUpdateResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) assert cast(Any, response.is_closed) is True @@ -76,7 +76,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -88,7 +88,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" bulk = response.parse() - assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -100,7 +100,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bulk = response.parse() - assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) assert cast(Any, response.is_closed) is True @@ -129,7 +129,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", body=[{}, {}, {}], ) - assert_matches_type(BulkUpdateResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -142,7 +142,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" bulk = await response.parse() - assert_matches_type(BulkUpdateResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -155,7 +155,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" bulk = await response.parse() - assert_matches_type(BulkUpdateResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkUpdateResponse], bulk, path=["response"]) assert cast(Any, response.is_closed) is True @@ -181,7 +181,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -193,7 +193,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" bulk = await response.parse() - assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -205,7 +205,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" bulk = await response.parse() - assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + assert_matches_type(Optional[BulkDeleteResponse], bulk, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/kv/namespaces/test_metadata.py b/tests/api_resources/kv/namespaces/test_metadata.py index e7f40bbb7bd..7c8a4325a43 100644 --- a/tests/api_resources/kv/namespaces/test_metadata.py +++ b/tests/api_resources/kv/namespaces/test_metadata.py @@ -3,12 +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.kv.namespaces import MetadataGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", ) - assert_matches_type(object, metadata, path=["response"]) + assert_matches_type(Optional[MetadataGetResponse], metadata, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -36,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" metadata = response.parse() - assert_matches_type(object, metadata, path=["response"]) + assert_matches_type(Optional[MetadataGetResponse], metadata, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -49,7 +50,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" metadata = response.parse() - assert_matches_type(object, metadata, path=["response"]) + assert_matches_type(Optional[MetadataGetResponse], metadata, path=["response"]) assert cast(Any, response.is_closed) is True @@ -87,7 +88,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", ) - assert_matches_type(object, metadata, path=["response"]) + assert_matches_type(Optional[MetadataGetResponse], metadata, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -100,7 +101,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" metadata = await response.parse() - assert_matches_type(object, metadata, path=["response"]) + assert_matches_type(Optional[MetadataGetResponse], metadata, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -113,7 +114,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" metadata = await response.parse() - assert_matches_type(object, metadata, path=["response"]) + assert_matches_type(Optional[MetadataGetResponse], metadata, 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 af7e9da5b3b..36b3d06967a 100644 --- a/tests/api_resources/kv/namespaces/test_values.py +++ b/tests/api_resources/kv/namespaces/test_values.py @@ -3,16 +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.kv.namespaces import ( - ValueDeleteResponse, - ValueUpdateResponse, +from cloudflare._response import ( + BinaryAPIResponse, + AsyncBinaryAPIResponse, + StreamedBinaryAPIResponse, + AsyncStreamedBinaryAPIResponse, ) +from cloudflare.types.kv.namespaces import ValueDeleteResponse, ValueUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,7 +35,7 @@ def test_method_update(self, client: Cloudflare) -> None: metadata='{"someMetadataKey": "someMetadataValue"}', value="Some Value", ) - assert_matches_type(ValueUpdateResponse, value, path=["response"]) + assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -46,7 +51,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" value = response.parse() - assert_matches_type(ValueUpdateResponse, value, path=["response"]) + assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -62,7 +67,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" value = response.parse() - assert_matches_type(ValueUpdateResponse, value, path=["response"]) + assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) assert cast(Any, response.is_closed) is True @@ -103,7 +108,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", ) - assert_matches_type(ValueDeleteResponse, value, path=["response"]) + assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -116,7 +121,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" value = response.parse() - assert_matches_type(ValueDeleteResponse, value, path=["response"]) + assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -129,7 +134,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" value = response.parse() - assert_matches_type(ValueDeleteResponse, value, path=["response"]) + assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) assert cast(Any, response.is_closed) is True @@ -156,44 +161,66 @@ def test_path_params_delete(self, client: Cloudflare) -> None: namespace_id="0f2ac74b498b48028cb68387c421e279", ) + @pytest.mark.skip(reason="HTTP 406 from prism") @parametrize - def test_method_get(self, client: Cloudflare) -> None: + @pytest.mark.respx(base_url=base_url) + def test_method_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/storage/kv/namespaces/0f2ac74b498b48028cb68387c421e279/values/My-Key" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) value = client.kv.namespaces.values.get( "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", ) - assert_matches_type(str, value, path=["response"]) + assert value.is_closed + assert value.json() == {"foo": "bar"} + assert cast(Any, value.is_closed) is True + assert isinstance(value, BinaryAPIResponse) + @pytest.mark.skip(reason="HTTP 406 from prism") @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.kv.namespaces.values.with_raw_response.get( + @pytest.mark.respx(base_url=base_url) + def test_raw_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/storage/kv/namespaces/0f2ac74b498b48028cb68387c421e279/values/My-Key" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + value = client.kv.namespaces.values.with_raw_response.get( "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", ) - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - value = response.parse() - assert_matches_type(str, value, path=["response"]) + assert value.is_closed is True + assert value.http_request.headers.get("X-Stainless-Lang") == "python" + assert value.json() == {"foo": "bar"} + assert isinstance(value, BinaryAPIResponse) + @pytest.mark.skip(reason="HTTP 406 from prism") @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: + @pytest.mark.respx(base_url=base_url) + def test_streaming_response_get(self, client: Cloudflare, respx_mock: MockRouter) -> None: + respx_mock.get( + "/accounts/023e105f4ecef8ad9ca31a8372d0c353/storage/kv/namespaces/0f2ac74b498b48028cb68387c421e279/values/My-Key" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) with client.kv.namespaces.values.with_streaming_response.get( "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ) as value: + assert not value.is_closed + assert value.http_request.headers.get("X-Stainless-Lang") == "python" - value = response.parse() - assert_matches_type(str, value, path=["response"]) + assert value.json() == {"foo": "bar"} + assert cast(Any, value.is_closed) is True + assert isinstance(value, StreamedBinaryAPIResponse) - assert cast(Any, response.is_closed) is True + assert cast(Any, value.is_closed) is True + @pytest.mark.skip(reason="HTTP 406 from prism") @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.kv.namespaces.values.with_raw_response.get( @@ -230,7 +257,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: metadata='{"someMetadataKey": "someMetadataValue"}', value="Some Value", ) - assert_matches_type(ValueUpdateResponse, value, path=["response"]) + assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -246,7 +273,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" value = await response.parse() - assert_matches_type(ValueUpdateResponse, value, path=["response"]) + assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -262,7 +289,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" value = await response.parse() - assert_matches_type(ValueUpdateResponse, value, path=["response"]) + assert_matches_type(Optional[ValueUpdateResponse], value, path=["response"]) assert cast(Any, response.is_closed) is True @@ -303,7 +330,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", ) - assert_matches_type(ValueDeleteResponse, value, path=["response"]) + assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -316,7 +343,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" value = await response.parse() - assert_matches_type(ValueDeleteResponse, value, path=["response"]) + assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -329,7 +356,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" value = await response.parse() - assert_matches_type(ValueDeleteResponse, value, path=["response"]) + assert_matches_type(Optional[ValueDeleteResponse], value, path=["response"]) assert cast(Any, response.is_closed) is True @@ -356,44 +383,66 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: namespace_id="0f2ac74b498b48028cb68387c421e279", ) + @pytest.mark.skip(reason="HTTP 406 from prism") @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: + @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/storage/kv/namespaces/0f2ac74b498b48028cb68387c421e279/values/My-Key" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) value = await async_client.kv.namespaces.values.get( "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", ) - assert_matches_type(str, value, path=["response"]) + assert value.is_closed + assert await value.json() == {"foo": "bar"} + assert cast(Any, value.is_closed) is True + assert isinstance(value, AsyncBinaryAPIResponse) + @pytest.mark.skip(reason="HTTP 406 from prism") @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.kv.namespaces.values.with_raw_response.get( + @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/storage/kv/namespaces/0f2ac74b498b48028cb68387c421e279/values/My-Key" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + value = await async_client.kv.namespaces.values.with_raw_response.get( "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", ) - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - value = await response.parse() - assert_matches_type(str, value, path=["response"]) + assert value.is_closed is True + assert value.http_request.headers.get("X-Stainless-Lang") == "python" + assert await value.json() == {"foo": "bar"} + assert isinstance(value, AsyncBinaryAPIResponse) + @pytest.mark.skip(reason="HTTP 406 from prism") @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + @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/storage/kv/namespaces/0f2ac74b498b48028cb68387c421e279/values/My-Key" + ).mock(return_value=httpx.Response(200, json={"foo": "bar"})) async with async_client.kv.namespaces.values.with_streaming_response.get( "My-Key", account_id="023e105f4ecef8ad9ca31a8372d0c353", namespace_id="0f2ac74b498b48028cb68387c421e279", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ) as value: + assert not value.is_closed + assert value.http_request.headers.get("X-Stainless-Lang") == "python" - value = await response.parse() - assert_matches_type(str, value, path=["response"]) + assert await value.json() == {"foo": "bar"} + assert cast(Any, value.is_closed) is True + assert isinstance(value, AsyncStreamedBinaryAPIResponse) - assert cast(Any, response.is_closed) is True + assert cast(Any, value.is_closed) is True + @pytest.mark.skip(reason="HTTP 406 from prism") @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.kv.namespaces.values.with_raw_response.get( diff --git a/tests/api_resources/kv/test_namespaces.py b/tests/api_resources/kv/test_namespaces.py index aca5a2593f2..c8be55ff1e2 100644 --- a/tests/api_resources/kv/test_namespaces.py +++ b/tests/api_resources/kv/test_namespaces.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -28,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", title="My Own Namespace", ) - assert_matches_type(Namespace, namespace, path=["response"]) + assert_matches_type(Optional[Namespace], namespace, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -40,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(Namespace, namespace, path=["response"]) + assert_matches_type(Optional[Namespace], namespace, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -52,7 +52,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(Namespace, namespace, path=["response"]) + assert_matches_type(Optional[Namespace], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -71,7 +71,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", title="My Own Namespace", ) - assert_matches_type(NamespaceUpdateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -84,7 +84,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" namespace = response.parse() - assert_matches_type(NamespaceUpdateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -97,7 +97,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(NamespaceUpdateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -172,7 +172,7 @@ def test_method_delete(self, client: Cloudflare) -> None: "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceDeleteResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -184,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" namespace = response.parse() - assert_matches_type(NamespaceDeleteResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -196,7 +196,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(NamespaceDeleteResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -214,6 +214,54 @@ def test_path_params_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + namespace = client.kv.namespaces.get( + "0f2ac74b498b48028cb68387c421e279", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[Namespace], namespace, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.kv.namespaces.with_raw_response.get( + "0f2ac74b498b48028cb68387c421e279", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + namespace = response.parse() + assert_matches_type(Optional[Namespace], namespace, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.kv.namespaces.with_streaming_response.get( + "0f2ac74b498b48028cb68387c421e279", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + namespace = response.parse() + assert_matches_type(Optional[Namespace], namespace, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.kv.namespaces.with_raw_response.get( + "0f2ac74b498b48028cb68387c421e279", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `namespace_id` but received ''"): + client.kv.namespaces.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + class TestAsyncNamespaces: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -224,7 +272,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", title="My Own Namespace", ) - assert_matches_type(Namespace, namespace, path=["response"]) + assert_matches_type(Optional[Namespace], namespace, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -236,7 +284,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(Namespace, namespace, path=["response"]) + assert_matches_type(Optional[Namespace], namespace, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -248,7 +296,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(Namespace, namespace, path=["response"]) + assert_matches_type(Optional[Namespace], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -267,7 +315,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", title="My Own Namespace", ) - assert_matches_type(NamespaceUpdateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -280,7 +328,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" namespace = await response.parse() - assert_matches_type(NamespaceUpdateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -293,7 +341,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(NamespaceUpdateResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceUpdateResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -368,7 +416,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: "0f2ac74b498b48028cb68387c421e279", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceDeleteResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -380,7 +428,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" namespace = await response.parse() - assert_matches_type(NamespaceDeleteResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -392,7 +440,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(NamespaceDeleteResponse, namespace, path=["response"]) + assert_matches_type(Optional[NamespaceDeleteResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -409,3 +457,51 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: "", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + namespace = await async_client.kv.namespaces.get( + "0f2ac74b498b48028cb68387c421e279", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[Namespace], namespace, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.kv.namespaces.with_raw_response.get( + "0f2ac74b498b48028cb68387c421e279", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + namespace = await response.parse() + assert_matches_type(Optional[Namespace], namespace, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.kv.namespaces.with_streaming_response.get( + "0f2ac74b498b48028cb68387c421e279", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + namespace = await response.parse() + assert_matches_type(Optional[Namespace], namespace, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.kv.namespaces.with_raw_response.get( + "0f2ac74b498b48028cb68387c421e279", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `namespace_id` but received ''"): + await async_client.kv.namespaces.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/logs/control/retention/test_flag.py b/tests/api_resources/logs/control/test_retention.py similarity index 65% rename from tests/api_resources/logs/control/retention/test_flag.py rename to tests/api_resources/logs/control/test_retention.py index ace95eb0dd9..b3ae8454210 100644 --- a/tests/api_resources/logs/control/retention/test_flag.py +++ b/tests/api_resources/logs/control/test_retention.py @@ -9,174 +9,174 @@ 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 import RetentionGetResponse, RetentionCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestFlag: +class TestRetention: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_create(self, client: Cloudflare) -> None: - flag = client.logs.control.retention.flag.create( + retention = client.logs.control.retention.create( "023e105f4ecef8ad9ca31a8372d0c353", flag=True, ) - assert_matches_type(FlagCreateResponse, flag, path=["response"]) + assert_matches_type(RetentionCreateResponse, retention, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.logs.control.retention.flag.with_raw_response.create( + response = client.logs.control.retention.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", flag=True, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flag = response.parse() - assert_matches_type(FlagCreateResponse, flag, path=["response"]) + retention = response.parse() + assert_matches_type(RetentionCreateResponse, retention, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.logs.control.retention.flag.with_streaming_response.create( + with client.logs.control.retention.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", flag=True, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flag = response.parse() - assert_matches_type(FlagCreateResponse, flag, path=["response"]) + retention = response.parse() + assert_matches_type(RetentionCreateResponse, retention, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.logs.control.retention.flag.with_raw_response.create( + client.logs.control.retention.with_raw_response.create( "", flag=True, ) @parametrize def test_method_get(self, client: Cloudflare) -> None: - flag = client.logs.control.retention.flag.get( + retention = client.logs.control.retention.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(FlagGetResponse, flag, path=["response"]) + assert_matches_type(RetentionGetResponse, retention, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.logs.control.retention.flag.with_raw_response.get( + response = client.logs.control.retention.with_raw_response.get( "023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flag = response.parse() - assert_matches_type(FlagGetResponse, flag, path=["response"]) + retention = response.parse() + assert_matches_type(RetentionGetResponse, retention, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.logs.control.retention.flag.with_streaming_response.get( + with client.logs.control.retention.with_streaming_response.get( "023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flag = response.parse() - assert_matches_type(FlagGetResponse, flag, path=["response"]) + retention = response.parse() + assert_matches_type(RetentionGetResponse, retention, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.logs.control.retention.flag.with_raw_response.get( + client.logs.control.retention.with_raw_response.get( "", ) -class TestAsyncFlag: +class TestAsyncRetention: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - flag = await async_client.logs.control.retention.flag.create( + retention = await async_client.logs.control.retention.create( "023e105f4ecef8ad9ca31a8372d0c353", flag=True, ) - assert_matches_type(FlagCreateResponse, flag, path=["response"]) + assert_matches_type(RetentionCreateResponse, retention, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.logs.control.retention.flag.with_raw_response.create( + response = await async_client.logs.control.retention.with_raw_response.create( "023e105f4ecef8ad9ca31a8372d0c353", flag=True, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flag = await response.parse() - assert_matches_type(FlagCreateResponse, flag, path=["response"]) + retention = await response.parse() + assert_matches_type(RetentionCreateResponse, retention, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.logs.control.retention.flag.with_streaming_response.create( + async with async_client.logs.control.retention.with_streaming_response.create( "023e105f4ecef8ad9ca31a8372d0c353", flag=True, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flag = await response.parse() - assert_matches_type(FlagCreateResponse, flag, path=["response"]) + retention = await response.parse() + assert_matches_type(RetentionCreateResponse, retention, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.logs.control.retention.flag.with_raw_response.create( + await async_client.logs.control.retention.with_raw_response.create( "", flag=True, ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - flag = await async_client.logs.control.retention.flag.get( + retention = await async_client.logs.control.retention.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(FlagGetResponse, flag, path=["response"]) + assert_matches_type(RetentionGetResponse, retention, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.logs.control.retention.flag.with_raw_response.get( + response = await async_client.logs.control.retention.with_raw_response.get( "023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flag = await response.parse() - assert_matches_type(FlagGetResponse, flag, path=["response"]) + retention = await response.parse() + assert_matches_type(RetentionGetResponse, retention, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.logs.control.retention.flag.with_streaming_response.get( + async with async_client.logs.control.retention.with_streaming_response.get( "023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - flag = await response.parse() - assert_matches_type(FlagGetResponse, flag, path=["response"]) + retention = await response.parse() + assert_matches_type(RetentionGetResponse, retention, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.logs.control.retention.flag.with_raw_response.get( + await async_client.logs.control.retention.with_raw_response.get( "", ) diff --git a/tests/api_resources/magic_transit/sites/test_acls.py b/tests/api_resources/magic_transit/sites/test_acls.py index 107cdc54368..4bcac3f4126 100644 --- a/tests/api_resources/magic_transit/sites/test_acls.py +++ b/tests/api_resources/magic_transit/sites/test_acls.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.magic_transit.sites import ACL +from cloudflare.types.magic_transit.sites import ( + ACL, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -298,6 +300,91 @@ def test_path_params_delete(self, client: Cloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + acl = client.magic_transit.sites.acls.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ACL, acl, path=["response"]) + + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + acl = client.magic_transit.sites.acls.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + 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(ACL, acl, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.magic_transit.sites.acls.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + acl = response.parse() + assert_matches_type(ACL, acl, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.magic_transit.sites.acls.with_streaming_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + acl = response.parse() + assert_matches_type(ACL, acl, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.sites.acls.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): + client.magic_transit.sites.acls.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"): + client.magic_transit.sites.acls.with_raw_response.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + @parametrize def test_method_get(self, client: Cloudflare) -> None: acl = client.magic_transit.sites.acls.get( @@ -642,6 +729,91 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + acl = await async_client.magic_transit.sites.acls.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ACL, acl, path=["response"]) + + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + acl = await async_client.magic_transit.sites.acls.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + 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(ACL, acl, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.sites.acls.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + acl = await response.parse() + assert_matches_type(ACL, acl, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.sites.acls.with_streaming_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + acl = await response.parse() + assert_matches_type(ACL, acl, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.sites.acls.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + 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.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `acl_identifier` but received ''"): + await async_client.magic_transit.sites.acls.with_raw_response.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: acl = await async_client.magic_transit.sites.acls.get( diff --git a/tests/api_resources/magic_transit/sites/test_lans.py b/tests/api_resources/magic_transit/sites/test_lans.py index a6cbd9c9307..73aee303592 100644 --- a/tests/api_resources/magic_transit/sites/test_lans.py +++ b/tests/api_resources/magic_transit/sites/test_lans.py @@ -337,6 +337,111 @@ def test_path_params_delete(self, client: Cloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + lan = client.magic_transit.sites.lans.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(LAN, lan, path=["response"]) + + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + lan = client.magic_transit.sites.lans.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + 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, + ) + assert_matches_type(LAN, lan, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.magic_transit.sites.lans.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lan = response.parse() + assert_matches_type(LAN, lan, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.magic_transit.sites.lans.with_streaming_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lan = response.parse() + assert_matches_type(LAN, lan, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.sites.lans.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): + client.magic_transit.sites.lans.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `lan_id` but received ''"): + client.magic_transit.sites.lans.with_raw_response.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + @parametrize def test_method_get(self, client: Cloudflare) -> None: lan = client.magic_transit.sites.lans.get( @@ -717,6 +822,111 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + lan = await async_client.magic_transit.sites.lans.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(LAN, lan, path=["response"]) + + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + lan = await async_client.magic_transit.sites.lans.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + 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, + ) + assert_matches_type(LAN, lan, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.sites.lans.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lan = await response.parse() + assert_matches_type(LAN, lan, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.sites.lans.with_streaming_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lan = await response.parse() + assert_matches_type(LAN, lan, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.sites.lans.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + 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.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `lan_id` but received ''"): + await async_client.magic_transit.sites.lans.with_raw_response.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: lan = await async_client.magic_transit.sites.lans.get( diff --git a/tests/api_resources/magic_transit/sites/test_wans.py b/tests/api_resources/magic_transit/sites/test_wans.py index 86079814ce2..d8fa728ed91 100644 --- a/tests/api_resources/magic_transit/sites/test_wans.py +++ b/tests/api_resources/magic_transit/sites/test_wans.py @@ -282,6 +282,84 @@ def test_path_params_delete(self, client: Cloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + wan = client.magic_transit.sites.wans.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(WAN, wan, path=["response"]) + + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + wan = client.magic_transit.sites.wans.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + 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(WAN, wan, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.magic_transit.sites.wans.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + wan = response.parse() + assert_matches_type(WAN, wan, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.magic_transit.sites.wans.with_streaming_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + wan = response.parse() + assert_matches_type(WAN, wan, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.sites.wans.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): + client.magic_transit.sites.wans.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `wan_id` but received ''"): + client.magic_transit.sites.wans.with_raw_response.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + @parametrize def test_method_get(self, client: Cloudflare) -> None: wan = client.magic_transit.sites.wans.get( @@ -607,6 +685,84 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: site_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + wan = await async_client.magic_transit.sites.wans.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(WAN, wan, path=["response"]) + + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + wan = await async_client.magic_transit.sites.wans.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + 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(WAN, wan, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.sites.wans.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + wan = await response.parse() + assert_matches_type(WAN, wan, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.sites.wans.with_streaming_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + wan = await response.parse() + assert_matches_type(WAN, wan, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.sites.wans.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + 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.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `wan_id` but received ''"): + await async_client.magic_transit.sites.wans.with_raw_response.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + site_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: wan = await async_client.magic_transit.sites.wans.get( diff --git a/tests/api_resources/magic_transit/test_apps.py b/tests/api_resources/magic_transit/test_apps.py new file mode 100644 index 00000000000..1cd6c73830d --- /dev/null +++ b/tests/api_resources/magic_transit/test_apps.py @@ -0,0 +1,960 @@ +# 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.magic_transit import ( + AppListResponse, + AppCreateResponse, + AppDeleteResponse, + AppUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestApps: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_method_create_overload_1(self, client: Cloudflare) -> None: + app = client.magic_transit.apps.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_raw_response_create_overload_1(self, client: Cloudflare) -> None: + response = client.magic_transit.apps.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None: + with client.magic_transit.apps.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" + + app = response.parse() + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @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.magic_transit.apps.with_raw_response.create( + account_id="", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_method_create_overload_2(self, client: Cloudflare) -> None: + app = client.magic_transit.apps.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_raw_response_create_overload_2(self, client: Cloudflare) -> None: + response = client.magic_transit.apps.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None: + with client.magic_transit.apps.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" + + app = response.parse() + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_path_params_create_overload_2(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.apps.with_raw_response.create( + account_id="", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_method_update_overload_1(self, client: Cloudflare) -> None: + app = client.magic_transit.apps.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_raw_response_update_overload_1(self, client: Cloudflare) -> None: + response = client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: + with client.magic_transit.apps.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" + + app = response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_path_params_update_overload_1(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_app_id` but received ''"): + client.magic_transit.apps.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_method_update_overload_2(self, client: Cloudflare) -> None: + app = client.magic_transit.apps.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_raw_response_update_overload_2(self, client: Cloudflare) -> None: + response = client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: + with client.magic_transit.apps.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" + + app = response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_path_params_update_overload_2(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_app_id` but received ''"): + client.magic_transit.apps.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_method_update_overload_3(self, client: Cloudflare) -> None: + app = client.magic_transit.apps.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_raw_response_update_overload_3(self, client: Cloudflare) -> None: + response = client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_streaming_response_update_overload_3(self, client: Cloudflare) -> None: + with client.magic_transit.apps.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" + + app = response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_path_params_update_overload_3(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_app_id` but received ''"): + client.magic_transit.apps.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_method_update_overload_4(self, client: Cloudflare) -> None: + app = client.magic_transit.apps.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_raw_response_update_overload_4(self, client: Cloudflare) -> None: + response = client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_streaming_response_update_overload_4(self, client: Cloudflare) -> None: + with client.magic_transit.apps.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" + + app = response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_path_params_update_overload_4(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_app_id` but received ''"): + client.magic_transit.apps.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + app = client.magic_transit.apps.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[AppListResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.magic_transit.apps.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(SyncSinglePage[AppListResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.magic_transit.apps.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert_matches_type(SyncSinglePage[AppListResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @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.magic_transit.apps.with_raw_response.list( + account_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + app = client.magic_transit.apps.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[AppDeleteResponse], app, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.magic_transit.apps.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = response.parse() + assert_matches_type(Optional[AppDeleteResponse], app, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.magic_transit.apps.with_streaming_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = response.parse() + assert_matches_type(Optional[AppDeleteResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.apps.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_app_id` but received ''"): + client.magic_transit.apps.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncApps: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: + app = await async_client.magic_transit.apps.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.apps.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.apps.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" + + app = await response.parse() + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @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.magic_transit.apps.with_raw_response.create( + account_id="", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None: + app = await async_client.magic_transit.apps.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.apps.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.apps.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" + + app = await response.parse() + assert_matches_type(Optional[AppCreateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_path_params_create_overload_2(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.create( + account_id="", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> None: + app = await async_client.magic_transit.apps.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_streaming_response_update_overload_1(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.apps.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" + + app = await response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_app_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> None: + app = await async_client.magic_transit.apps.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_streaming_response_update_overload_2(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.apps.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" + + app = await response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_app_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> None: + app = await async_client.magic_transit.apps.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_raw_response_update_overload_3(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_streaming_response_update_overload_3(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.apps.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" + + app = await response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_path_params_update_overload_3(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_app_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_method_update_overload_4(self, async_client: AsyncCloudflare) -> None: + app = await async_client.magic_transit.apps.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_raw_response_update_overload_4(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_streaming_response_update_overload_4(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.apps.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" + + app = await response.parse() + assert_matches_type(Optional[AppUpdateResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_path_params_update_overload_4(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_app_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + app = await async_client.magic_transit.apps.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[AppListResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.apps.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(AsyncSinglePage[AppListResponse], app, path=["response"]) + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.apps.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert_matches_type(AsyncSinglePage[AppListResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip( + reason="prism errors - https://github.com/cloudflare/cloudflare-python/actions/runs/9360388260/job/25765690361?pr=482#step:5:7212" + ) + @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.magic_transit.apps.with_raw_response.list( + account_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + app = await async_client.magic_transit.apps.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[AppDeleteResponse], app, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.apps.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + app = await response.parse() + assert_matches_type(Optional[AppDeleteResponse], app, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.apps.with_streaming_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + app = await response.parse() + assert_matches_type(Optional[AppDeleteResponse], app, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_app_id` but received ''"): + await async_client.magic_transit.apps.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/magic_transit/test_connectors.py b/tests/api_resources/magic_transit/test_connectors.py new file mode 100644 index 00000000000..b2e77874a82 --- /dev/null +++ b/tests/api_resources/magic_transit/test_connectors.py @@ -0,0 +1,444 @@ +# 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.magic_transit import ( + ConnectorGetResponse, + ConnectorEditResponse, + ConnectorListResponse, + ConnectorUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestConnectors: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + connector = client.magic_transit.connectors.update( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ConnectorUpdateResponse, connector, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + connector = client.magic_transit.connectors.update( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + activated=True, + interrupt_window_duration_hours=0, + interrupt_window_hour_of_day=0, + notes="string", + timezone="string", + ) + assert_matches_type(ConnectorUpdateResponse, connector, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.magic_transit.connectors.with_raw_response.update( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connector = response.parse() + assert_matches_type(ConnectorUpdateResponse, connector, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.magic_transit.connectors.with_streaming_response.update( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connector = response.parse() + assert_matches_type(ConnectorUpdateResponse, connector, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.connectors.with_raw_response.update( + "string", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"): + client.magic_transit.connectors.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + connector = client.magic_transit.connectors.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[ConnectorListResponse], connector, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.magic_transit.connectors.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connector = response.parse() + assert_matches_type(SyncSinglePage[ConnectorListResponse], connector, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.magic_transit.connectors.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connector = response.parse() + assert_matches_type(SyncSinglePage[ConnectorListResponse], connector, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.connectors.with_raw_response.list( + account_id="", + ) + + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + connector = client.magic_transit.connectors.edit( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ConnectorEditResponse, connector, path=["response"]) + + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + connector = client.magic_transit.connectors.edit( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + activated=True, + interrupt_window_duration_hours=0, + interrupt_window_hour_of_day=0, + notes="string", + timezone="string", + ) + assert_matches_type(ConnectorEditResponse, connector, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.magic_transit.connectors.with_raw_response.edit( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connector = response.parse() + assert_matches_type(ConnectorEditResponse, connector, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.magic_transit.connectors.with_streaming_response.edit( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connector = response.parse() + assert_matches_type(ConnectorEditResponse, connector, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.connectors.with_raw_response.edit( + "string", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"): + client.magic_transit.connectors.with_raw_response.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + connector = client.magic_transit.connectors.get( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ConnectorGetResponse, connector, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.magic_transit.connectors.with_raw_response.get( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connector = response.parse() + assert_matches_type(ConnectorGetResponse, connector, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.magic_transit.connectors.with_streaming_response.get( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connector = response.parse() + assert_matches_type(ConnectorGetResponse, connector, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.connectors.with_raw_response.get( + "string", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"): + client.magic_transit.connectors.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncConnectors: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + connector = await async_client.magic_transit.connectors.update( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ConnectorUpdateResponse, connector, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + connector = await async_client.magic_transit.connectors.update( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + activated=True, + interrupt_window_duration_hours=0, + interrupt_window_hour_of_day=0, + notes="string", + timezone="string", + ) + assert_matches_type(ConnectorUpdateResponse, connector, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.connectors.with_raw_response.update( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connector = await response.parse() + assert_matches_type(ConnectorUpdateResponse, connector, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.connectors.with_streaming_response.update( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connector = await response.parse() + assert_matches_type(ConnectorUpdateResponse, connector, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.connectors.with_raw_response.update( + "string", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"): + await async_client.magic_transit.connectors.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + connector = await async_client.magic_transit.connectors.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[ConnectorListResponse], connector, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.connectors.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connector = await response.parse() + assert_matches_type(AsyncSinglePage[ConnectorListResponse], connector, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.connectors.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connector = await response.parse() + assert_matches_type(AsyncSinglePage[ConnectorListResponse], connector, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.connectors.with_raw_response.list( + account_id="", + ) + + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + connector = await async_client.magic_transit.connectors.edit( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ConnectorEditResponse, connector, path=["response"]) + + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + connector = await async_client.magic_transit.connectors.edit( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + activated=True, + interrupt_window_duration_hours=0, + interrupt_window_hour_of_day=0, + notes="string", + timezone="string", + ) + assert_matches_type(ConnectorEditResponse, connector, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.connectors.with_raw_response.edit( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connector = await response.parse() + assert_matches_type(ConnectorEditResponse, connector, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.connectors.with_streaming_response.edit( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connector = await response.parse() + assert_matches_type(ConnectorEditResponse, connector, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.connectors.with_raw_response.edit( + "string", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"): + await async_client.magic_transit.connectors.with_raw_response.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + connector = await async_client.magic_transit.connectors.get( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(ConnectorGetResponse, connector, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.connectors.with_raw_response.get( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connector = await response.parse() + assert_matches_type(ConnectorGetResponse, connector, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.connectors.with_streaming_response.get( + "string", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connector = await response.parse() + assert_matches_type(ConnectorGetResponse, connector, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.connectors.with_raw_response.get( + "string", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"): + await async_client.magic_transit.connectors.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/magic_transit/test_sites.py b/tests/api_resources/magic_transit/test_sites.py index a4cfda99cf1..ea1cafd24af 100644 --- a/tests/api_resources/magic_transit/test_sites.py +++ b/tests/api_resources/magic_transit/test_sites.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.magic_transit import Site +from cloudflare.types.magic_transit import ( + Site, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -234,6 +236,70 @@ def test_path_params_delete(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + site = client.magic_transit.sites.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Site, site, path=["response"]) + + @parametrize + def test_method_edit_with_all_params(self, client: Cloudflare) -> None: + site = client.magic_transit.sites.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + connector_id="ac60d3d0435248289d446cedd870bcf4", + description="string", + location={ + "lat": "37.6192", + "lon": "122.3816", + }, + name="site_1", + secondary_connector_id="8d67040d3835dbcf46ce29da440dc482", + ) + assert_matches_type(Site, site, path=["response"]) + + @parametrize + def test_raw_response_edit(self, client: Cloudflare) -> None: + response = client.magic_transit.sites.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + site = response.parse() + assert_matches_type(Site, site, path=["response"]) + + @parametrize + def test_streaming_response_edit(self, client: Cloudflare) -> None: + with client.magic_transit.sites.with_streaming_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + site = response.parse() + assert_matches_type(Site, site, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_edit(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.magic_transit.sites.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `site_id` but received ''"): + client.magic_transit.sites.with_raw_response.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + @parametrize def test_method_get(self, client: Cloudflare) -> None: site = client.magic_transit.sites.get( @@ -502,6 +568,70 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", ) + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + site = await async_client.magic_transit.sites.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Site, site, path=["response"]) + + @parametrize + async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: + site = await async_client.magic_transit.sites.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + connector_id="ac60d3d0435248289d446cedd870bcf4", + description="string", + location={ + "lat": "37.6192", + "lon": "122.3816", + }, + name="site_1", + secondary_connector_id="8d67040d3835dbcf46ce29da440dc482", + ) + assert_matches_type(Site, site, path=["response"]) + + @parametrize + async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: + response = await async_client.magic_transit.sites.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + site = await response.parse() + assert_matches_type(Site, site, path=["response"]) + + @parametrize + async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: + async with async_client.magic_transit.sites.with_streaming_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + site = await response.parse() + assert_matches_type(Site, site, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.magic_transit.sites.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + account_id="", + ) + + 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.edit( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: site = await async_client.magic_transit.sites.get( diff --git a/tests/api_resources/page_shield/test_connections.py b/tests/api_resources/page_shield/test_connections.py index f0a138460d7..74e8e45713e 100644 --- a/tests/api_resources/page_shield/test_connections.py +++ b/tests/api_resources/page_shield/test_connections.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -78,34 +78,34 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_get(self, client: Cloudflare) -> None: connection = client.page_shield.connections.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Connection, connection, path=["response"]) + assert_matches_type(Optional[Connection], connection, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.page_shield.connections.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = response.parse() - assert_matches_type(Connection, connection, path=["response"]) + assert_matches_type(Optional[Connection], connection, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.page_shield.connections.with_streaming_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = response.parse() - assert_matches_type(Connection, connection, path=["response"]) + assert_matches_type(Optional[Connection], connection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -113,7 +113,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_id` but received ''"): client.page_shield.connections.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", ) @@ -187,34 +187,34 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: connection = await async_client.page_shield.connections.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Connection, connection, path=["response"]) + assert_matches_type(Optional[Connection], connection, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.page_shield.connections.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = await response.parse() - assert_matches_type(Connection, connection, path=["response"]) + assert_matches_type(Optional[Connection], connection, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.page_shield.connections.with_streaming_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = await response.parse() - assert_matches_type(Connection, connection, path=["response"]) + assert_matches_type(Optional[Connection], connection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -222,7 +222,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_id` but received ''"): await async_client.page_shield.connections.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", ) diff --git a/tests/api_resources/page_shield/test_cookies.py b/tests/api_resources/page_shield/test_cookies.py new file mode 100644 index 00000000000..7c516ab4e7d --- /dev/null +++ b/tests/api_resources/page_shield/test_cookies.py @@ -0,0 +1,237 @@ +# 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.page_shield import CookieGetResponse, CookieListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCookies: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + cookie = client.page_shield.cookies.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[CookieListResponse], cookie, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + cookie = client.page_shield.cookies.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + direction="asc", + domain="example.com", + export="csv", + hosts="blog.cloudflare.com,www.example*,*cloudflare.com", + http_only=True, + name="session_id", + order_by="first_seen_at", + page="2", + page_url="example.com/page,*/checkout,example.com/*,*checkout*", + path="/", + per_page=100, + same_site="strict", + secure=True, + type="first_party", + ) + assert_matches_type(SyncSinglePage[CookieListResponse], cookie, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.page_shield.cookies.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cookie = response.parse() + assert_matches_type(SyncSinglePage[CookieListResponse], cookie, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.page_shield.cookies.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cookie = response.parse() + assert_matches_type(SyncSinglePage[CookieListResponse], cookie, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.page_shield.cookies.with_raw_response.list( + zone_id="", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + cookie = client.page_shield.cookies.get( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[CookieGetResponse], cookie, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.page_shield.cookies.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cookie = response.parse() + assert_matches_type(Optional[CookieGetResponse], cookie, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.page_shield.cookies.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" + + cookie = response.parse() + assert_matches_type(Optional[CookieGetResponse], cookie, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.page_shield.cookies.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cookie_id` but received ''"): + client.page_shield.cookies.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncCookies: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + cookie = await async_client.page_shield.cookies.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[CookieListResponse], cookie, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + cookie = await async_client.page_shield.cookies.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + direction="asc", + domain="example.com", + export="csv", + hosts="blog.cloudflare.com,www.example*,*cloudflare.com", + http_only=True, + name="session_id", + order_by="first_seen_at", + page="2", + page_url="example.com/page,*/checkout,example.com/*,*checkout*", + path="/", + per_page=100, + same_site="strict", + secure=True, + type="first_party", + ) + assert_matches_type(AsyncSinglePage[CookieListResponse], cookie, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.page_shield.cookies.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cookie = await response.parse() + assert_matches_type(AsyncSinglePage[CookieListResponse], cookie, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.page_shield.cookies.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cookie = await response.parse() + assert_matches_type(AsyncSinglePage[CookieListResponse], cookie, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.page_shield.cookies.with_raw_response.list( + zone_id="", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + cookie = await async_client.page_shield.cookies.get( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[CookieGetResponse], cookie, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.page_shield.cookies.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cookie = await response.parse() + assert_matches_type(Optional[CookieGetResponse], cookie, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.page_shield.cookies.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" + + cookie = await response.parse() + assert_matches_type(Optional[CookieGetResponse], cookie, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.page_shield.cookies.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `cookie_id` but received ''"): + await async_client.page_shield.cookies.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/page_shield/test_policies.py b/tests/api_resources/page_shield/test_policies.py index 500d4d23d0e..d2ff101721c 100644 --- a/tests/api_resources/page_shield/test_policies.py +++ b/tests/api_resources/page_shield/test_policies.py @@ -3,14 +3,19 @@ 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.page_shield import Policy +from cloudflare.types.page_shield import ( + PolicyGetResponse, + PolicyListResponse, + PolicyCreateResponse, + PolicyUpdateResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,13 +25,6 @@ class TestPolicies: @parametrize def test_method_create(self, client: Cloudflare) -> None: - policy = client.page_shield.policies.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Policy, policy, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: policy = client.page_shield.policies.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="allow", @@ -35,29 +33,39 @@ 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(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.page_shield.policies.with_raw_response.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + action="allow", + description="Checkout page CSP policy", + enabled=True, + expression='ends_with(http.request.uri.path, "/checkout")', + value="script-src 'none';", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.page_shield.policies.with_streaming_response.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + action="allow", + description="Checkout page CSP policy", + enabled=True, + expression='ends_with(http.request.uri.path, "/checkout")', + value="script-src 'none';", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -66,20 +74,25 @@ 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.page_shield.policies.with_raw_response.create( zone_id="", + action="allow", + description="Checkout page CSP policy", + enabled=True, + expression='ends_with(http.request.uri.path, "/checkout")', + value="script-src 'none';", ) @parametrize def test_method_update(self, client: Cloudflare) -> None: policy = client.page_shield.policies.update( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: policy = client.page_shield.policies.update( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="allow", description="Checkout page CSP policy", @@ -87,31 +100,31 @@ 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(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.page_shield.policies.with_raw_response.update( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.page_shield.policies.with_streaming_response.update( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -119,7 +132,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 `zone_id` but received ''"): client.page_shield.policies.with_raw_response.update( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", ) @@ -134,7 +147,7 @@ def test_method_list(self, client: Cloudflare) -> None: policy = client.page_shield.policies.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -145,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" policy = response.parse() - assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -156,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[Policy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -170,7 +183,7 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_delete(self, client: Cloudflare) -> None: policy = client.page_shield.policies.delete( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert policy is None @@ -178,7 +191,7 @@ def test_method_delete(self, client: Cloudflare) -> None: @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.page_shield.policies.with_raw_response.delete( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -190,7 +203,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.page_shield.policies.with_streaming_response.delete( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed @@ -205,7 +218,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 `zone_id` but received ''"): client.page_shield.policies.with_raw_response.delete( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", ) @@ -218,34 +231,34 @@ def test_path_params_delete(self, client: Cloudflare) -> None: @parametrize def test_method_get(self, client: Cloudflare) -> None: policy = client.page_shield.policies.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.page_shield.policies.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.page_shield.policies.with_streaming_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -253,7 +266,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_id` but received ''"): client.page_shield.policies.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", ) @@ -269,13 +282,6 @@ class TestAsyncPolicies: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - policy = await async_client.page_shield.policies.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Policy, policy, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: policy = await async_client.page_shield.policies.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="allow", @@ -284,29 +290,39 @@ 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(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.page_shield.policies.with_raw_response.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + action="allow", + description="Checkout page CSP policy", + enabled=True, + expression='ends_with(http.request.uri.path, "/checkout")', + value="script-src 'none';", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.page_shield.policies.with_streaming_response.create( zone_id="023e105f4ecef8ad9ca31a8372d0c353", + action="allow", + description="Checkout page CSP policy", + enabled=True, + expression='ends_with(http.request.uri.path, "/checkout")', + value="script-src 'none';", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -315,20 +331,25 @@ 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.page_shield.policies.with_raw_response.create( zone_id="", + action="allow", + description="Checkout page CSP policy", + enabled=True, + expression='ends_with(http.request.uri.path, "/checkout")', + value="script-src 'none';", ) @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: policy = await async_client.page_shield.policies.update( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: policy = await async_client.page_shield.policies.update( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", action="allow", description="Checkout page CSP policy", @@ -336,31 +357,31 @@ 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(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.page_shield.policies.with_raw_response.update( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.page_shield.policies.with_streaming_response.update( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -368,7 +389,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 `zone_id` but received ''"): await async_client.page_shield.policies.with_raw_response.update( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", ) @@ -383,7 +404,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[Policy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -394,7 +415,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[Policy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -405,7 +426,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[Policy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -419,7 +440,7 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: policy = await async_client.page_shield.policies.delete( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert policy is None @@ -427,7 +448,7 @@ 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.page_shield.policies.with_raw_response.delete( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -439,7 +460,7 @@ 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.page_shield.policies.with_streaming_response.delete( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed @@ -454,7 +475,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 `zone_id` but received ''"): await async_client.page_shield.policies.with_raw_response.delete( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", ) @@ -467,34 +488,34 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: policy = await async_client.page_shield.policies.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.page_shield.policies.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.page_shield.policies.with_streaming_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Policy, policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -502,7 +523,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_id` but received ''"): await async_client.page_shield.policies.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", ) diff --git a/tests/api_resources/page_shield/test_scripts.py b/tests/api_resources/page_shield/test_scripts.py index a93e18c8b85..c874f315be8 100644 --- a/tests/api_resources/page_shield/test_scripts.py +++ b/tests/api_resources/page_shield/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 pytest @@ -79,34 +79,34 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_get(self, client: Cloudflare) -> None: script = client.page_shield.scripts.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScriptGetResponse, script, path=["response"]) + assert_matches_type(Optional[ScriptGetResponse], script, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.page_shield.scripts.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", 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(ScriptGetResponse, script, path=["response"]) + assert_matches_type(Optional[ScriptGetResponse], script, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.page_shield.scripts.with_streaming_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", 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(ScriptGetResponse, script, path=["response"]) + assert_matches_type(Optional[ScriptGetResponse], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -114,7 +114,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_id` but received ''"): client.page_shield.scripts.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", ) @@ -189,34 +189,34 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: script = await async_client.page_shield.scripts.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScriptGetResponse, script, path=["response"]) + assert_matches_type(Optional[ScriptGetResponse], script, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.page_shield.scripts.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", 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(ScriptGetResponse, script, path=["response"]) + assert_matches_type(Optional[ScriptGetResponse], script, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.page_shield.scripts.with_streaming_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", 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(ScriptGetResponse, script, path=["response"]) + assert_matches_type(Optional[ScriptGetResponse], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -224,7 +224,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_id` but received ''"): await async_client.page_shield.scripts.with_raw_response.get( - "c9ef84a6bf5e47138c75d95e2f933e8f", + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="", ) diff --git a/tests/api_resources/pages/test_projects.py b/tests/api_resources/pages/test_projects.py index 562db3e98af..c3f969b628b 100644 --- a/tests/api_resources/pages/test_projects.py +++ b/tests/api_resources/pages/test_projects.py @@ -63,7 +63,12 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "mtls_certificates": {"mtls": {"certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e"}}, "placement": {"mode": "smart"}, "queue_producers": {"queue_producer_binding": {"name": "some-queue"}}, - "r2_buckets": {"r2_binding": {"name": "some-bucket"}}, + "r2_buckets": { + "r2_binding": { + "jurisdiction": "eu", + "name": "some-bucket", + } + }, "services": { "service_binding": { "entrypoint": "MyHandler", @@ -92,7 +97,12 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: "mtls_certificates": {"mtls": {"certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e"}}, "placement": {"mode": "smart"}, "queue_producers": {"queue_producer_binding": {"name": "some-queue"}}, - "r2_buckets": {"r2_binding": {"name": "some-bucket"}}, + "r2_buckets": { + "r2_binding": { + "jurisdiction": "eu", + "name": "some-bucket", + } + }, "services": { "service_binding": { "entrypoint": "MyHandler", @@ -494,7 +504,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "mtls_certificates": {"mtls": {"certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e"}}, "placement": {"mode": "smart"}, "queue_producers": {"queue_producer_binding": {"name": "some-queue"}}, - "r2_buckets": {"r2_binding": {"name": "some-bucket"}}, + "r2_buckets": { + "r2_binding": { + "jurisdiction": "eu", + "name": "some-bucket", + } + }, "services": { "service_binding": { "entrypoint": "MyHandler", @@ -523,7 +538,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare "mtls_certificates": {"mtls": {"certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e"}}, "placement": {"mode": "smart"}, "queue_producers": {"queue_producer_binding": {"name": "some-queue"}}, - "r2_buckets": {"r2_binding": {"name": "some-bucket"}}, + "r2_buckets": { + "r2_binding": { + "jurisdiction": "eu", + "name": "some-bucket", + } + }, "services": { "service_binding": { "entrypoint": "MyHandler", diff --git a/tests/api_resources/r2/test_buckets.py b/tests/api_resources/r2/test_buckets.py index 956a75d7441..0b1049530c9 100644 --- a/tests/api_resources/r2/test_buckets.py +++ b/tests/api_resources/r2/test_buckets.py @@ -32,6 +32,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", name="example-bucket", location_hint="apac", + storage_class="Standard", ) assert_matches_type(Bucket, bucket, path=["response"]) @@ -234,6 +235,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_id="023e105f4ecef8ad9ca31a8372d0c353", name="example-bucket", location_hint="apac", + storage_class="Standard", ) assert_matches_type(Bucket, bucket, path=["response"]) diff --git a/tests/api_resources/r2/test_temporary_credentials.py b/tests/api_resources/r2/test_temporary_credentials.py new file mode 100644 index 00000000000..3bdf9c876b1 --- /dev/null +++ b/tests/api_resources/r2/test_temporary_credentials.py @@ -0,0 +1,156 @@ +# 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.r2 import TemporaryCredentialCreateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTemporaryCredentials: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + temporary_credential = client.r2.temporary_credentials.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket="example-bucket", + parent_access_key_id="example-access-key-id", + permission="object-read-write", + ttl_seconds=3600, + ) + assert_matches_type(TemporaryCredentialCreateResponse, temporary_credential, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + temporary_credential = client.r2.temporary_credentials.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket="example-bucket", + parent_access_key_id="example-access-key-id", + permission="object-read-write", + ttl_seconds=3600, + objects=["example-object"], + prefixes=["example-prefix/"], + ) + assert_matches_type(TemporaryCredentialCreateResponse, temporary_credential, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.r2.temporary_credentials.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket="example-bucket", + parent_access_key_id="example-access-key-id", + permission="object-read-write", + ttl_seconds=3600, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + temporary_credential = response.parse() + assert_matches_type(TemporaryCredentialCreateResponse, temporary_credential, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.r2.temporary_credentials.with_streaming_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket="example-bucket", + parent_access_key_id="example-access-key-id", + permission="object-read-write", + ttl_seconds=3600, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + temporary_credential = response.parse() + assert_matches_type(TemporaryCredentialCreateResponse, temporary_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.r2.temporary_credentials.with_raw_response.create( + account_id="", + bucket="example-bucket", + parent_access_key_id="example-access-key-id", + permission="object-read-write", + ttl_seconds=3600, + ) + + +class TestAsyncTemporaryCredentials: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + temporary_credential = await async_client.r2.temporary_credentials.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket="example-bucket", + parent_access_key_id="example-access-key-id", + permission="object-read-write", + ttl_seconds=3600, + ) + assert_matches_type(TemporaryCredentialCreateResponse, temporary_credential, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + temporary_credential = await async_client.r2.temporary_credentials.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket="example-bucket", + parent_access_key_id="example-access-key-id", + permission="object-read-write", + ttl_seconds=3600, + objects=["example-object"], + prefixes=["example-prefix/"], + ) + assert_matches_type(TemporaryCredentialCreateResponse, temporary_credential, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.r2.temporary_credentials.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket="example-bucket", + parent_access_key_id="example-access-key-id", + permission="object-read-write", + ttl_seconds=3600, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + temporary_credential = await response.parse() + assert_matches_type(TemporaryCredentialCreateResponse, temporary_credential, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.r2.temporary_credentials.with_streaming_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + bucket="example-bucket", + parent_access_key_id="example-access-key-id", + permission="object-read-write", + ttl_seconds=3600, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + temporary_credential = await response.parse() + assert_matches_type(TemporaryCredentialCreateResponse, temporary_credential, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.r2.temporary_credentials.with_raw_response.create( + account_id="", + bucket="example-bucket", + parent_access_key_id="example-access-key-id", + permission="object-read-write", + ttl_seconds=3600, + ) diff --git a/tests/api_resources/radar/bgp/hijacks/test_events.py b/tests/api_resources/radar/bgp/hijacks/test_events.py index f0f7fa02ebe..806bea3adbe 100644 --- a/tests/api_resources/radar/bgp/hijacks/test_events.py +++ b/tests/api_resources/radar/bgp/hijacks/test_events.py @@ -39,7 +39,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: min_confidence=0, page=0, per_page=0, - prefix="string", + prefix="1.1.1.0/24", sort_by="TIME", sort_order="DESC", victim_asn=0, @@ -90,7 +90,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) min_confidence=0, page=0, per_page=0, - prefix="string", + prefix="1.1.1.0/24", sort_by="TIME", sort_order="DESC", victim_asn=0, diff --git a/tests/api_resources/radar/bgp/test_ips.py b/tests/api_resources/radar/bgp/test_ips.py new file mode 100644 index 00000000000..d8438d9d709 --- /dev/null +++ b/tests/api_resources/radar/bgp/test_ips.py @@ -0,0 +1,101 @@ +# 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 IPTimeseriesResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestIPs: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_timeseries(self, client: Cloudflare) -> None: + ip = client.radar.bgp.ips.timeseries() + assert_matches_type(IPTimeseriesResponse, ip, path=["response"]) + + @parametrize + def test_method_timeseries_with_all_params(self, client: Cloudflare) -> None: + ip = client.radar.bgp.ips.timeseries( + asn="174,7922", + date_end=parse_datetime("2023-09-01T11:41:33.782Z"), + date_range="7d", + date_start=parse_datetime("2023-09-01T11:41:33.782Z"), + format="JSON", + include_delay=True, + location="US,CA", + name=["string", "string", "string"], + ) + assert_matches_type(IPTimeseriesResponse, ip, path=["response"]) + + @parametrize + def test_raw_response_timeseries(self, client: Cloudflare) -> None: + response = client.radar.bgp.ips.with_raw_response.timeseries() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip = response.parse() + assert_matches_type(IPTimeseriesResponse, ip, path=["response"]) + + @parametrize + def test_streaming_response_timeseries(self, client: Cloudflare) -> None: + with client.radar.bgp.ips.with_streaming_response.timeseries() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip = response.parse() + assert_matches_type(IPTimeseriesResponse, ip, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncIPs: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_timeseries(self, async_client: AsyncCloudflare) -> None: + ip = await async_client.radar.bgp.ips.timeseries() + assert_matches_type(IPTimeseriesResponse, ip, path=["response"]) + + @parametrize + async def test_method_timeseries_with_all_params(self, async_client: AsyncCloudflare) -> None: + ip = await async_client.radar.bgp.ips.timeseries( + asn="174,7922", + date_end=parse_datetime("2023-09-01T11:41:33.782Z"), + date_range="7d", + date_start=parse_datetime("2023-09-01T11:41:33.782Z"), + format="JSON", + include_delay=True, + location="US,CA", + name=["string", "string", "string"], + ) + assert_matches_type(IPTimeseriesResponse, ip, path=["response"]) + + @parametrize + async def test_raw_response_timeseries(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.bgp.ips.with_raw_response.timeseries() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ip = await response.parse() + assert_matches_type(IPTimeseriesResponse, ip, path=["response"]) + + @parametrize + async def test_streaming_response_timeseries(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.bgp.ips.with_streaming_response.timeseries() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ip = await response.parse() + assert_matches_type(IPTimeseriesResponse, ip, 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 a1bf66bc655..bcb74fee056 100644 --- a/tests/api_resources/radar/bgp/test_routes.py +++ b/tests/api_resources/radar/bgp/test_routes.py @@ -9,12 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare._utils import parse_datetime from cloudflare.types.radar.bgp import ( + RouteAsesResponse, RouteMoasResponse, RouteStatsResponse, RoutePfx2asResponse, - RouteTimeseriesResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,6 +22,42 @@ class TestRoutes: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_ases(self, client: Cloudflare) -> None: + route = client.radar.bgp.routes.ases() + assert_matches_type(RouteAsesResponse, route, path=["response"]) + + @parametrize + def test_method_ases_with_all_params(self, client: Cloudflare) -> None: + route = client.radar.bgp.routes.ases( + format="JSON", + limit=5, + location="US", + sort_by="ipv4", + sort_order="desc", + ) + assert_matches_type(RouteAsesResponse, route, path=["response"]) + + @parametrize + def test_raw_response_ases(self, client: Cloudflare) -> None: + response = client.radar.bgp.routes.with_raw_response.ases() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + route = response.parse() + assert_matches_type(RouteAsesResponse, route, path=["response"]) + + @parametrize + def test_streaming_response_ases(self, client: Cloudflare) -> None: + with client.radar.bgp.routes.with_streaming_response.ases() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + route = response.parse() + assert_matches_type(RouteAsesResponse, route, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_moas(self, client: Cloudflare) -> None: route = client.radar.bgp.routes.moas() @@ -34,7 +69,7 @@ def test_method_moas_with_all_params(self, client: Cloudflare) -> None: format="JSON", invalid_only=True, origin=0, - prefix="string", + prefix="1.1.1.0/24", ) assert_matches_type(RouteMoasResponse, route, path=["response"]) @@ -128,48 +163,46 @@ def test_streaming_response_stats(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True + +class TestAsyncRoutes: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize - def test_method_timeseries(self, client: Cloudflare) -> None: - route = client.radar.bgp.routes.timeseries() - assert_matches_type(RouteTimeseriesResponse, route, path=["response"]) + async def test_method_ases(self, async_client: AsyncCloudflare) -> None: + route = await async_client.radar.bgp.routes.ases() + assert_matches_type(RouteAsesResponse, route, path=["response"]) @parametrize - def test_method_timeseries_with_all_params(self, client: Cloudflare) -> None: - route = client.radar.bgp.routes.timeseries( - asn=174, - date_end=parse_datetime("2023-09-01T11:41:33.782Z"), - date_range="7d", - date_start=parse_datetime("2023-09-01T11:41:33.782Z"), + async def test_method_ases_with_all_params(self, async_client: AsyncCloudflare) -> None: + route = await async_client.radar.bgp.routes.ases( format="JSON", - include_delay=True, + limit=5, location="US", + sort_by="ipv4", + sort_order="desc", ) - assert_matches_type(RouteTimeseriesResponse, route, path=["response"]) + assert_matches_type(RouteAsesResponse, route, path=["response"]) @parametrize - def test_raw_response_timeseries(self, client: Cloudflare) -> None: - response = client.radar.bgp.routes.with_raw_response.timeseries() + async def test_raw_response_ases(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.bgp.routes.with_raw_response.ases() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - route = response.parse() - assert_matches_type(RouteTimeseriesResponse, route, path=["response"]) + route = await response.parse() + assert_matches_type(RouteAsesResponse, route, path=["response"]) @parametrize - def test_streaming_response_timeseries(self, client: Cloudflare) -> None: - with client.radar.bgp.routes.with_streaming_response.timeseries() as response: + async def test_streaming_response_ases(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.bgp.routes.with_streaming_response.ases() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - route = response.parse() - assert_matches_type(RouteTimeseriesResponse, route, path=["response"]) + route = await response.parse() + assert_matches_type(RouteAsesResponse, route, path=["response"]) assert cast(Any, response.is_closed) is True - -class TestAsyncRoutes: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize async def test_method_moas(self, async_client: AsyncCloudflare) -> None: route = await async_client.radar.bgp.routes.moas() @@ -181,7 +214,7 @@ async def test_method_moas_with_all_params(self, async_client: AsyncCloudflare) format="JSON", invalid_only=True, origin=0, - prefix="string", + prefix="1.1.1.0/24", ) assert_matches_type(RouteMoasResponse, route, path=["response"]) @@ -274,41 +307,3 @@ async def test_streaming_response_stats(self, async_client: AsyncCloudflare) -> assert_matches_type(RouteStatsResponse, route, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_timeseries(self, async_client: AsyncCloudflare) -> None: - route = await async_client.radar.bgp.routes.timeseries() - assert_matches_type(RouteTimeseriesResponse, route, path=["response"]) - - @parametrize - async def test_method_timeseries_with_all_params(self, async_client: AsyncCloudflare) -> None: - route = await async_client.radar.bgp.routes.timeseries( - asn=174, - date_end=parse_datetime("2023-09-01T11:41:33.782Z"), - 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"]) - - @parametrize - async def test_raw_response_timeseries(self, async_client: AsyncCloudflare) -> None: - response = await async_client.radar.bgp.routes.with_raw_response.timeseries() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - route = await response.parse() - assert_matches_type(RouteTimeseriesResponse, route, path=["response"]) - - @parametrize - async def test_streaming_response_timeseries(self, async_client: AsyncCloudflare) -> None: - async with async_client.radar.bgp.routes.with_streaming_response.timeseries() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - route = await response.parse() - assert_matches_type(RouteTimeseriesResponse, route, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/radar/bgp/top/test_ases.py b/tests/api_resources/radar/bgp/top/test_ases.py index 0eb51280b0a..137f86bd408 100644 --- a/tests/api_resources/radar/bgp/top/test_ases.py +++ b/tests/api_resources/radar/bgp/top/test_ases.py @@ -41,7 +41,23 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: format="JSON", limit=5, name=["string", "string", "string"], - prefix=["string", "string", "string"], + prefix=[ + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + ], update_type=["ANNOUNCEMENT", "WITHDRAWAL"], ) assert_matches_type(AseGetResponse, ase, path=["response"]) @@ -127,7 +143,23 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - format="JSON", limit=5, name=["string", "string", "string"], - prefix=["string", "string", "string"], + prefix=[ + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + ], update_type=["ANNOUNCEMENT", "WITHDRAWAL"], ) assert_matches_type(AseGetResponse, ase, path=["response"]) 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 c1196859b45..298efb20286 100644 --- a/tests/api_resources/radar/http/ases/test_bot_class.py +++ b/tests/api_resources/radar/http/ases/test_bot_class.py @@ -30,6 +30,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: bot_class = client.radar.http.ases.bot_class.get( "LIKELY_AUTOMATED", asn=["string", "string", "string"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -95,6 +96,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - bot_class = await async_client.radar.http.ases.bot_class.get( "LIKELY_AUTOMATED", asn=["string", "string", "string"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), diff --git a/tests/api_resources/radar/http/ases/test_browser_family.py b/tests/api_resources/radar/http/ases/test_browser_family.py new file mode 100644 index 00000000000..2de13ca3b67 --- /dev/null +++ b/tests/api_resources/radar/http/ases/test_browser_family.py @@ -0,0 +1,147 @@ +# 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.http.ases import BrowserFamilyGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBrowserFamily: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + browser_family = client.radar.http.ases.browser_family.get( + "CHROME", + ) + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + browser_family = client.radar.http.ases.browser_family.get( + "CHROME", + asn=["string", "string", "string"], + bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + continent=["string", "string", "string"], + date_end=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + date_range=["1d", "2d", "7d"], + date_start=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + device_type=["DESKTOP", "MOBILE", "OTHER"], + format="JSON", + http_protocol=["HTTP", "HTTPS"], + http_version=["HTTPv1", "HTTPv2", "HTTPv3"], + ip_version=["IPv4", "IPv6"], + limit=5, + location=["string", "string", "string"], + name=["string", "string", "string"], + os=["WINDOWS", "MACOSX", "IOS"], + tls_version=["TLSv1_0", "TLSv1_1", "TLSv1_2"], + ) + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.radar.http.ases.browser_family.with_raw_response.get( + "CHROME", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + browser_family = response.parse() + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.radar.http.ases.browser_family.with_streaming_response.get( + "CHROME", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + browser_family = response.parse() + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncBrowserFamily: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + browser_family = await async_client.radar.http.ases.browser_family.get( + "CHROME", + ) + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + browser_family = await async_client.radar.http.ases.browser_family.get( + "CHROME", + asn=["string", "string", "string"], + bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + continent=["string", "string", "string"], + date_end=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + date_range=["1d", "2d", "7d"], + date_start=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + device_type=["DESKTOP", "MOBILE", "OTHER"], + format="JSON", + http_protocol=["HTTP", "HTTPS"], + http_version=["HTTPv1", "HTTPv2", "HTTPv3"], + ip_version=["IPv4", "IPv6"], + limit=5, + location=["string", "string", "string"], + name=["string", "string", "string"], + os=["WINDOWS", "MACOSX", "IOS"], + tls_version=["TLSv1_0", "TLSv1_1", "TLSv1_2"], + ) + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.http.ases.browser_family.with_raw_response.get( + "CHROME", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + browser_family = await response.parse() + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.http.ases.browser_family.with_streaming_response.get( + "CHROME", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + browser_family = await response.parse() + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + assert cast(Any, response.is_closed) is True 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 cbf61936f48..6226975cd88 100644 --- a/tests/api_resources/radar/http/ases/test_device_type.py +++ b/tests/api_resources/radar/http/ases/test_device_type.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "DESKTOP", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -96,6 +97,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "DESKTOP", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), 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 e791bb09aa4..743ab8b7787 100644 --- a/tests/api_resources/radar/http/ases/test_http_method.py +++ b/tests/api_resources/radar/http/ases/test_http_method.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "HTTPv1", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -96,6 +97,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "HTTPv1", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), 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 37266961af0..728e7358ecb 100644 --- a/tests/api_resources/radar/http/ases/test_http_protocol.py +++ b/tests/api_resources/radar/http/ases/test_http_protocol.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "HTTP", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -95,6 +96,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "HTTP", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), 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 c69d7d39017..7cc1f35beb9 100644 --- a/tests/api_resources/radar/http/ases/test_ip_version.py +++ b/tests/api_resources/radar/http/ases/test_ip_version.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "IPv4", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -96,6 +97,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "IPv4", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), diff --git a/tests/api_resources/radar/http/ases/test_os.py b/tests/api_resources/radar/http/ases/test_os.py index a197d163aea..6dd25123783 100644 --- a/tests/api_resources/radar/http/ases/test_os.py +++ b/tests/api_resources/radar/http/ases/test_os.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "WINDOWS", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -96,6 +97,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "WINDOWS", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), 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 b785844f314..b7afb152fa9 100644 --- a/tests/api_resources/radar/http/ases/test_tls_version.py +++ b/tests/api_resources/radar/http/ases/test_tls_version.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "TLSv1_0", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -96,6 +97,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "TLSv1_0", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), 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 064a76b14c5..87ccd2b18c3 100644 --- a/tests/api_resources/radar/http/locations/test_bot_class.py +++ b/tests/api_resources/radar/http/locations/test_bot_class.py @@ -30,6 +30,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: bot_class = client.radar.http.locations.bot_class.get( "LIKELY_AUTOMATED", asn=["string", "string", "string"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -95,6 +96,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - bot_class = await async_client.radar.http.locations.bot_class.get( "LIKELY_AUTOMATED", asn=["string", "string", "string"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), diff --git a/tests/api_resources/radar/http/locations/test_browser_family.py b/tests/api_resources/radar/http/locations/test_browser_family.py new file mode 100644 index 00000000000..7dd0326e896 --- /dev/null +++ b/tests/api_resources/radar/http/locations/test_browser_family.py @@ -0,0 +1,147 @@ +# 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.http.locations import BrowserFamilyGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBrowserFamily: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + browser_family = client.radar.http.locations.browser_family.get( + "CHROME", + ) + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + browser_family = client.radar.http.locations.browser_family.get( + "CHROME", + asn=["string", "string", "string"], + bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + continent=["string", "string", "string"], + date_end=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + date_range=["1d", "2d", "7d"], + date_start=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + device_type=["DESKTOP", "MOBILE", "OTHER"], + format="JSON", + http_protocol=["HTTP", "HTTPS"], + http_version=["HTTPv1", "HTTPv2", "HTTPv3"], + ip_version=["IPv4", "IPv6"], + limit=5, + location=["string", "string", "string"], + name=["string", "string", "string"], + os=["WINDOWS", "MACOSX", "IOS"], + tls_version=["TLSv1_0", "TLSv1_1", "TLSv1_2"], + ) + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.radar.http.locations.browser_family.with_raw_response.get( + "CHROME", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + browser_family = response.parse() + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.radar.http.locations.browser_family.with_streaming_response.get( + "CHROME", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + browser_family = response.parse() + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncBrowserFamily: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + browser_family = await async_client.radar.http.locations.browser_family.get( + "CHROME", + ) + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + browser_family = await async_client.radar.http.locations.browser_family.get( + "CHROME", + asn=["string", "string", "string"], + bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + continent=["string", "string", "string"], + date_end=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + date_range=["1d", "2d", "7d"], + date_start=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + device_type=["DESKTOP", "MOBILE", "OTHER"], + format="JSON", + http_protocol=["HTTP", "HTTPS"], + http_version=["HTTPv1", "HTTPv2", "HTTPv3"], + ip_version=["IPv4", "IPv6"], + limit=5, + location=["string", "string", "string"], + name=["string", "string", "string"], + os=["WINDOWS", "MACOSX", "IOS"], + tls_version=["TLSv1_0", "TLSv1_1", "TLSv1_2"], + ) + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.http.locations.browser_family.with_raw_response.get( + "CHROME", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + browser_family = await response.parse() + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.http.locations.browser_family.with_streaming_response.get( + "CHROME", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + browser_family = await response.parse() + assert_matches_type(BrowserFamilyGetResponse, browser_family, path=["response"]) + + assert cast(Any, response.is_closed) is True 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 1fa468dd59c..fb659b5b095 100644 --- a/tests/api_resources/radar/http/locations/test_device_type.py +++ b/tests/api_resources/radar/http/locations/test_device_type.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "DESKTOP", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -96,6 +97,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "DESKTOP", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), 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 972e82a1e61..dd886aa1364 100644 --- a/tests/api_resources/radar/http/locations/test_http_method.py +++ b/tests/api_resources/radar/http/locations/test_http_method.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "HTTPv1", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -96,6 +97,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "HTTPv1", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), 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 944a356a577..def70042abf 100644 --- a/tests/api_resources/radar/http/locations/test_http_protocol.py +++ b/tests/api_resources/radar/http/locations/test_http_protocol.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "HTTP", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -95,6 +96,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "HTTP", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), 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 f26711c76c0..48f4a35d023 100644 --- a/tests/api_resources/radar/http/locations/test_ip_version.py +++ b/tests/api_resources/radar/http/locations/test_ip_version.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "IPv4", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -96,6 +97,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "IPv4", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), diff --git a/tests/api_resources/radar/http/locations/test_os.py b/tests/api_resources/radar/http/locations/test_os.py index a72186e7703..4ca99262ff7 100644 --- a/tests/api_resources/radar/http/locations/test_os.py +++ b/tests/api_resources/radar/http/locations/test_os.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "WINDOWS", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -96,6 +97,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "WINDOWS", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), 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 0be78706192..2b16a0b8c4e 100644 --- a/tests/api_resources/radar/http/locations/test_tls_version.py +++ b/tests/api_resources/radar/http/locations/test_tls_version.py @@ -31,6 +31,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "TLSv1_0", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -96,6 +97,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "TLSv1_0", asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), diff --git a/tests/api_resources/radar/http/test_ases.py b/tests/api_resources/radar/http/test_ases.py index 8e22658cac3..623a65f1555 100644 --- a/tests/api_resources/radar/http/test_ases.py +++ b/tests/api_resources/radar/http/test_ases.py @@ -28,6 +28,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: ase = client.radar.http.ases.get( asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -87,6 +88,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - ase = await async_client.radar.http.ases.get( asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), diff --git a/tests/api_resources/radar/http/test_locations.py b/tests/api_resources/radar/http/test_locations.py index 7f992255f7c..92935c99387 100644 --- a/tests/api_resources/radar/http/test_locations.py +++ b/tests/api_resources/radar/http/test_locations.py @@ -28,6 +28,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: location = client.radar.http.locations.get( asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -87,6 +88,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - location = await async_client.radar.http.locations.get( asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), diff --git a/tests/api_resources/radar/http/test_top.py b/tests/api_resources/radar/http/test_top.py index 4cac74c10b8..db326ab01e8 100644 --- a/tests/api_resources/radar/http/test_top.py +++ b/tests/api_resources/radar/http/test_top.py @@ -31,6 +31,7 @@ def test_method_browser_families_with_all_params(self, client: Cloudflare) -> No top = client.radar.http.top.browser_families( asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -86,6 +87,7 @@ def test_method_browsers_with_all_params(self, client: Cloudflare) -> None: top = client.radar.http.top.browsers( asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -145,6 +147,7 @@ async def test_method_browser_families_with_all_params(self, async_client: Async top = await async_client.radar.http.top.browser_families( asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), @@ -200,6 +203,7 @@ async def test_method_browsers_with_all_params(self, async_client: AsyncCloudfla top = await async_client.radar.http.top.browsers( asn=["string", "string", "string"], bot_class=["LIKELY_AUTOMATED", "LIKELY_HUMAN"], + browser_family=["CHROME", "EDGE", "FIREFOX"], continent=["string", "string", "string"], date_end=[ parse_datetime("2019-12-27T18:11:19.117Z"), diff --git a/tests/api_resources/radar/test_bgp.py b/tests/api_resources/radar/test_bgp.py index b896b31f649..2b50ea81066 100644 --- a/tests/api_resources/radar/test_bgp.py +++ b/tests/api_resources/radar/test_bgp.py @@ -41,7 +41,23 @@ def test_method_timeseries_with_all_params(self, client: Cloudflare) -> None: ], format="JSON", name=["string", "string", "string"], - prefix=["string", "string", "string"], + prefix=[ + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + ], update_type=["ANNOUNCEMENT", "WITHDRAWAL"], ) assert_matches_type(BGPTimeseriesResponse, bgp, path=["response"]) @@ -93,7 +109,23 @@ async def test_method_timeseries_with_all_params(self, async_client: AsyncCloudf ], format="JSON", name=["string", "string", "string"], - prefix=["string", "string", "string"], + prefix=[ + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + { + "location": "query", + "name": "prefix", + "type": "1.1.1.0/24", + }, + ], update_type=["ANNOUNCEMENT", "WITHDRAWAL"], ) assert_matches_type(BGPTimeseriesResponse, bgp, path=["response"]) diff --git a/tests/api_resources/radar/test_http.py b/tests/api_resources/radar/test_http.py new file mode 100644 index 00000000000..4828f727a4f --- /dev/null +++ b/tests/api_resources/radar/test_http.py @@ -0,0 +1,119 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare._utils import parse_datetime +from cloudflare.types.radar import HTTPTimeseriesResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestHTTP: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_timeseries(self, client: Cloudflare) -> None: + http = client.radar.http.timeseries() + assert_matches_type(HTTPTimeseriesResponse, http, path=["response"]) + + @parametrize + def test_method_timeseries_with_all_params(self, client: Cloudflare) -> None: + http = client.radar.http.timeseries( + agg_interval="1h", + asn=["string", "string", "string"], + continent=["string", "string", "string"], + date_end=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + date_range=["1d", "2d", "7d"], + date_start=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + format="JSON", + location=["string", "string", "string"], + name=["string", "string", "string"], + ) + assert_matches_type(HTTPTimeseriesResponse, http, path=["response"]) + + @parametrize + def test_raw_response_timeseries(self, client: Cloudflare) -> None: + response = client.radar.http.with_raw_response.timeseries() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + http = response.parse() + assert_matches_type(HTTPTimeseriesResponse, http, path=["response"]) + + @parametrize + def test_streaming_response_timeseries(self, client: Cloudflare) -> None: + with client.radar.http.with_streaming_response.timeseries() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + http = response.parse() + assert_matches_type(HTTPTimeseriesResponse, http, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncHTTP: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_timeseries(self, async_client: AsyncCloudflare) -> None: + http = await async_client.radar.http.timeseries() + assert_matches_type(HTTPTimeseriesResponse, http, path=["response"]) + + @parametrize + async def test_method_timeseries_with_all_params(self, async_client: AsyncCloudflare) -> None: + http = await async_client.radar.http.timeseries( + agg_interval="1h", + asn=["string", "string", "string"], + continent=["string", "string", "string"], + date_end=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + date_range=["1d", "2d", "7d"], + date_start=[ + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + parse_datetime("2019-12-27T18:11:19.117Z"), + ], + format="JSON", + location=["string", "string", "string"], + name=["string", "string", "string"], + ) + assert_matches_type(HTTPTimeseriesResponse, http, path=["response"]) + + @parametrize + async def test_raw_response_timeseries(self, async_client: AsyncCloudflare) -> None: + response = await async_client.radar.http.with_raw_response.timeseries() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + http = await response.parse() + assert_matches_type(HTTPTimeseriesResponse, http, path=["response"]) + + @parametrize + async def test_streaming_response_timeseries(self, async_client: AsyncCloudflare) -> None: + async with async_client.radar.http.with_streaming_response.timeseries() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + http = await response.parse() + assert_matches_type(HTTPTimeseriesResponse, http, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/rulesets/phases/test_versions.py b/tests/api_resources/rulesets/phases/test_versions.py index 7c88a7ef7f8..f763170399e 100644 --- a/tests/api_resources/rulesets/phases/test_versions.py +++ b/tests/api_resources/rulesets/phases/test_versions.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.rulesets import Ruleset -from cloudflare.types.rulesets.phases import VersionGetResponse +from cloudflare.types.rulesets.phases import VersionGetResponse, VersionListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: "http_request_firewall_custom", account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -35,7 +34,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: "http_request_firewall_custom", account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -48,7 +47,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[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -61,7 +60,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[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -165,7 +164,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "http_request_firewall_custom", account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -174,7 +173,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) "http_request_firewall_custom", account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -187,7 +186,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[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -200,7 +199,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[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], 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 40462f29ea8..8abeef8e3df 100644 --- a/tests/api_resources/rulesets/test_phases.py +++ b/tests/api_resources/rulesets/test_phases.py @@ -84,9 +84,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: ], account_id="string", description="My ruleset to execute managed rulesets", - kind="root", name="My ruleset", - phase="http_request_firewall_custom", ) assert_matches_type(PhaseUpdateResponse, phase, path=["response"]) @@ -269,9 +267,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare ], account_id="string", description="My ruleset to execute managed rulesets", - kind="root", name="My ruleset", - phase="http_request_firewall_custom", ) assert_matches_type(PhaseUpdateResponse, phase, path=["response"]) diff --git a/tests/api_resources/rulesets/test_rules.py b/tests/api_resources/rulesets/test_rules.py index 390e99ca22f..b457e152f24 100644 --- a/tests/api_resources/rulesets/test_rules.py +++ b/tests/api_resources/rulesets/test_rules.py @@ -1010,8 +1010,10 @@ def test_method_create_with_all_params_overload_13(self, client: Cloudflare) -> }, "bic": True, "disable_apps": True, + "disable_rum": True, "disable_zaraz": True, "email_obfuscation": True, + "fonts": True, "hotlink_protection": True, "mirage": True, "opportunistic_encryption": True, @@ -1221,7 +1223,7 @@ def test_method_create_with_all_params_overload_15(self, client: Cloudflare) -> "min_file_size": 0, }, "edge_ttl": { - "default": 1, + "default": 0, "mode": "respect_origin", "status_code_ttl": [ { @@ -1313,6 +1315,235 @@ def test_path_params_create_overload_15(self, client: Cloudflare) -> None: account_id="string", ) + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_overload_16(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_with_all_params_overload_16(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="log_custom_field", + action_parameters={ + "cookie_fields": [{"name": "cookie_name_1"}], + "request_fields": [{"name": "http_request_header_name_1_in_lower_case"}], + "response_fields": [{"name": "http_response_header_name_1_in_lower_case"}], + }, + description="Log custom field 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(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_create_overload_16(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_create_overload_16(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + def test_path_params_create_overload_16(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", + ) + + 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="", + ) + + 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", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_overload_17(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_with_all_params_overload_17(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="ddos_dynamic", + action_parameters={}, + description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", + 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(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_create_overload_17(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_create_overload_17(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + def test_path_params_create_overload_17(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", + ) + + 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="", + ) + + 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", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_overload_18(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_create_with_all_params_overload_18(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="force_connection_close", + action_parameters={}, + description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", + 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(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_create_overload_18(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_create_overload_18(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + def test_path_params_create_overload_18(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", + ) + + 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="", + ) + + 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", + ) + @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_delete(self, client: Cloudflare) -> None: @@ -2553,8 +2784,10 @@ def test_method_edit_with_all_params_overload_13(self, client: Cloudflare) -> No }, "bic": True, "disable_apps": True, + "disable_rum": True, "disable_zaraz": True, "email_obfuscation": True, + "fonts": True, "hotlink_protection": True, "mirage": True, "opportunistic_encryption": True, @@ -2792,7 +3025,7 @@ def test_method_edit_with_all_params_overload_15(self, client: Cloudflare) -> No "min_file_size": 0, }, "edge_ttl": { - "default": 1, + "default": 0, "mode": "respect_origin", "status_code_ttl": [ { @@ -2896,75 +3129,346 @@ def test_path_params_edit_overload_15(self, client: Cloudflare) -> None: account_id="string", ) - -class TestAsyncRules: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", + def test_method_edit_overload_16(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", ) - assert_matches_type(RuleCreateResponse, rule, path=["response"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_method_create_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: - rule = await async_client.rulesets.rules.create( - "2f2feab2026849078ba485f918791bdc", + def test_method_edit_with_all_params_overload_16(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", id="3a03d665bac047339bb530ecb439a90d", - action="block", + action="log_custom_field", action_parameters={ - "response": { - "content": '{\n "success": false,\n "error": "you have been blocked"\n}', - "content_type": "application/json", - "status_code": 400, - } + "cookie_fields": [{"name": "cookie_name_1"}], + "request_fields": [{"name": "http_request_header_name_1_in_lower_case"}], + "response_fields": [{"name": "http_response_header_name_1_in_lower_case"}], }, - description="Block when the IP address is not 1.1.1.1", + description="Log custom field 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"]) + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @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", + def test_raw_response_edit_overload_16(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_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"]) + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @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", + def test_streaming_response_edit_overload_16(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", account_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"]) + rule = response.parse() + assert_matches_type(RuleEditResponse, rule, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare) -> None: + def test_path_params_edit_overload_16(self, client: Cloudflare) -> 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( + client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="", + account_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", + ) + + 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="", + ) + + 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", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_edit_overload_17(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_edit_with_all_params_overload_17(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="ddos_dynamic", + action_parameters={}, + description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", + 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(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_edit_overload_17(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_edit_overload_17(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + def test_path_params_edit_overload_17(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", + ) + + 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", + ) + + 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="", + ) + + 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", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_edit_overload_18(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_edit_with_all_params_overload_18(self, client: Cloudflare) -> None: + rule = client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="force_connection_close", + action_parameters={}, + description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", + 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(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_edit_overload_18(self, client: Cloudflare) -> None: + response = client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_edit_overload_18(self, client: Cloudflare) -> None: + with client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + def test_path_params_edit_overload_18(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", + ) + + 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", + ) + + 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="", + ) + + 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", + ) + + +class TestAsyncRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @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", + 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(reason="TODO: investigate broken test") + @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", + ) + + 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(reason="TODO: investigate broken test") + @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", + ) 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(reason="TODO: investigate broken test") + @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", ) @@ -3889,8 +4393,10 @@ async def test_method_create_with_all_params_overload_13(self, async_client: Asy }, "bic": True, "disable_apps": True, + "disable_rum": True, "disable_zaraz": True, "email_obfuscation": True, + "fonts": True, "hotlink_protection": True, "mirage": True, "opportunistic_encryption": True, @@ -4100,7 +4606,7 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy "min_file_size": 0, }, "edge_ttl": { - "default": 1, + "default": 0, "mode": "respect_origin", "status_code_ttl": [ { @@ -4145,7 +4651,236 @@ async def test_method_create_with_all_params_overload_15(self, async_client: Asy @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_raw_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: + 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", + ) + + 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(reason="TODO: investigate broken test") + @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", + ) 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(reason="TODO: investigate broken test") + @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", + ) + + 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="", + ) + + 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", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_overload_16(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_with_all_params_overload_16(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="log_custom_field", + action_parameters={ + "cookie_fields": [{"name": "cookie_name_1"}], + "request_fields": [{"name": "http_request_header_name_1_in_lower_case"}], + "response_fields": [{"name": "http_response_header_name_1_in_lower_case"}], + }, + description="Log custom field 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(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_create_overload_16(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_create_overload_16(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_create_overload_16(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", + ) + + 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="", + ) + + 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", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_overload_17(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_with_all_params_overload_17(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="ddos_dynamic", + action_parameters={}, + description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", + 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(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_create_overload_17(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.create( + "2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_create_overload_17(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.create( + "2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_create_overload_17(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", + ) + + 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="", + ) + + 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", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_overload_18(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_create_with_all_params_overload_18(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.create( + "2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="force_connection_close", + action_parameters={}, + description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", + 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(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_create_overload_18(self, async_client: AsyncCloudflare) -> None: response = await async_client.rulesets.rules.with_raw_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4158,7 +4893,7 @@ async def test_raw_response_create_overload_15(self, async_client: AsyncCloudfla @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_streaming_response_create_overload_15(self, async_client: AsyncCloudflare) -> None: + async def test_streaming_response_create_overload_18(self, async_client: AsyncCloudflare) -> None: async with async_client.rulesets.rules.with_streaming_response.create( "2f2feab2026849078ba485f918791bdc", account_id="string", @@ -4173,7 +4908,7 @@ async def test_streaming_response_create_overload_15(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize - async def test_path_params_create_overload_15(self, async_client: AsyncCloudflare) -> None: + async def test_path_params_create_overload_18(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( "", @@ -5432,8 +6167,10 @@ async def test_method_edit_with_all_params_overload_13(self, async_client: Async }, "bic": True, "disable_apps": True, + "disable_rum": True, "disable_zaraz": True, "email_obfuscation": True, + "fonts": True, "hotlink_protection": True, "mirage": True, "opportunistic_encryption": True, @@ -5671,7 +6408,7 @@ async def test_method_edit_with_all_params_overload_15(self, async_client: Async "min_file_size": 0, }, "edge_ttl": { - "default": 1, + "default": 0, "mode": "respect_origin", "status_code_ttl": [ { @@ -5774,3 +6511,274 @@ async def test_path_params_edit_overload_15(self, async_client: AsyncCloudflare) ruleset_id="2f2feab2026849078ba485f918791bdc", account_id="string", ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_edit_overload_16(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_edit_with_all_params_overload_16(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="log_custom_field", + action_parameters={ + "cookie_fields": [{"name": "cookie_name_1"}], + "request_fields": [{"name": "http_request_header_name_1_in_lower_case"}], + "response_fields": [{"name": "http_response_header_name_1_in_lower_case"}], + }, + description="Log custom field 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(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_edit_overload_16(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_edit_overload_16(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_edit_overload_16(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", + ) + + 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", + ) + + 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="", + ) + + 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", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_edit_overload_17(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_edit_with_all_params_overload_17(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="ddos_dynamic", + action_parameters={}, + description="Performs a specific action according to a set of internal guidelines defined by Cloudflare.", + 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(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_edit_overload_17(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_edit_overload_17(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_edit_overload_17(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", + ) + + 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", + ) + + 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="", + ) + + 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", + ) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_edit_overload_18(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + ) + assert_matches_type(RuleEditResponse, rule, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_edit_with_all_params_overload_18(self, async_client: AsyncCloudflare) -> None: + rule = await async_client.rulesets.rules.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_id="string", + id="3a03d665bac047339bb530ecb439a90d", + action="force_connection_close", + action_parameters={}, + description="Closes ongoing HTTP connections. This action does not block a request, but it forces the client to reconnect. For HTTP/2 and HTTP/3 connections, the connection will be closed even if it breaks other requests running on the same connection.", + 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(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_edit_overload_18(self, async_client: AsyncCloudflare) -> None: + response = await async_client.rulesets.rules.with_raw_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_edit_overload_18(self, async_client: AsyncCloudflare) -> None: + async with async_client.rulesets.rules.with_streaming_response.edit( + "3a03d665bac047339bb530ecb439a90d", + ruleset_id="2f2feab2026849078ba485f918791bdc", + account_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(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_edit_overload_18(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", + ) + + 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", + ) + + 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="", + ) + + 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", + ) diff --git a/tests/api_resources/rulesets/test_versions.py b/tests/api_resources/rulesets/test_versions.py index 1fd08c4b629..3106292143c 100644 --- a/tests/api_resources/rulesets/test_versions.py +++ b/tests/api_resources/rulesets/test_versions.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.rulesets import Ruleset, VersionGetResponse +from cloudflare.types.rulesets import VersionGetResponse, VersionListResponse 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: "2f2feab2026849078ba485f918791bdc", account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -34,7 +34,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: "2f2feab2026849078ba485f918791bdc", account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -47,7 +47,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[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -60,7 +60,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[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -258,7 +258,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "2f2feab2026849078ba485f918791bdc", account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -267,7 +267,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) "2f2feab2026849078ba485f918791bdc", account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -280,7 +280,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[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -293,7 +293,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[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/storage/test_analytics.py b/tests/api_resources/storage/test_analytics.py index bd9e182261e..d75ef09d287 100644 --- a/tests/api_resources/storage/test_analytics.py +++ b/tests/api_resources/storage/test_analytics.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -23,7 +23,7 @@ def test_method_list(self, client: Cloudflare) -> None: analytics = client.storage.analytics.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Schema, analytics, path=["response"]) + assert_matches_type(Optional[Schema], analytics, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: @@ -39,7 +39,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: "until": parse_datetime("2019-01-02T03:20:00Z"), }, ) - assert_matches_type(Schema, analytics, path=["response"]) + assert_matches_type(Optional[Schema], analytics, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -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" analytics = response.parse() - assert_matches_type(Schema, analytics, path=["response"]) + assert_matches_type(Optional[Schema], analytics, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -61,7 +61,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(Schema, analytics, path=["response"]) + assert_matches_type(Optional[Schema], analytics, path=["response"]) assert cast(Any, response.is_closed) is True @@ -77,7 +77,7 @@ def test_method_stored(self, client: Cloudflare) -> None: analytics = client.storage.analytics.stored( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Components, analytics, path=["response"]) + assert_matches_type(Optional[Components], analytics, path=["response"]) @parametrize def test_method_stored_with_all_params(self, client: Cloudflare) -> None: @@ -93,7 +93,7 @@ def test_method_stored_with_all_params(self, client: Cloudflare) -> None: "until": parse_datetime("2019-01-02T03:20:00Z"), }, ) - assert_matches_type(Components, analytics, path=["response"]) + assert_matches_type(Optional[Components], analytics, path=["response"]) @parametrize def test_raw_response_stored(self, client: Cloudflare) -> None: @@ -104,7 +104,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(Components, analytics, path=["response"]) + assert_matches_type(Optional[Components], analytics, path=["response"]) @parametrize def test_streaming_response_stored(self, client: Cloudflare) -> None: @@ -115,7 +115,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(Components, analytics, path=["response"]) + assert_matches_type(Optional[Components], analytics, path=["response"]) assert cast(Any, response.is_closed) is True @@ -135,7 +135,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: analytics = await async_client.storage.analytics.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Schema, analytics, path=["response"]) + assert_matches_type(Optional[Schema], analytics, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -151,7 +151,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) "until": parse_datetime("2019-01-02T03:20:00Z"), }, ) - assert_matches_type(Schema, analytics, path=["response"]) + assert_matches_type(Optional[Schema], analytics, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -162,7 +162,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(Schema, analytics, path=["response"]) + assert_matches_type(Optional[Schema], analytics, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -173,7 +173,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(Schema, analytics, path=["response"]) + assert_matches_type(Optional[Schema], analytics, path=["response"]) assert cast(Any, response.is_closed) is True @@ -189,7 +189,7 @@ async def test_method_stored(self, async_client: AsyncCloudflare) -> None: analytics = await async_client.storage.analytics.stored( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Components, analytics, path=["response"]) + assert_matches_type(Optional[Components], analytics, path=["response"]) @parametrize async def test_method_stored_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -205,7 +205,7 @@ async def test_method_stored_with_all_params(self, async_client: AsyncCloudflare "until": parse_datetime("2019-01-02T03:20:00Z"), }, ) - assert_matches_type(Components, analytics, path=["response"]) + assert_matches_type(Optional[Components], analytics, path=["response"]) @parametrize async def test_raw_response_stored(self, async_client: AsyncCloudflare) -> None: @@ -216,7 +216,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(Components, analytics, path=["response"]) + assert_matches_type(Optional[Components], analytics, path=["response"]) @parametrize async def test_streaming_response_stored(self, async_client: AsyncCloudflare) -> None: @@ -227,7 +227,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(Components, analytics, path=["response"]) + assert_matches_type(Optional[Components], analytics, 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 19d397230d3..53f68ccb9e1 100644 --- a/tests/api_resources/test_accounts.py +++ b/tests/api_resources/test_accounts.py @@ -10,10 +10,6 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from cloudflare.types.accounts import ( - AccountGetResponse, - AccountUpdateResponse, -) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +23,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_id={}, name="Demo Account", ) - assert_matches_type(AccountUpdateResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: @@ -35,12 +31,13 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: account_id={}, name="Demo Account", settings={ + "abuse_contact_email": "string", "default_nameservers": "cloudflare.standard", "enforce_twofactor": True, "use_account_custom_ns_by_default": True, }, ) - assert_matches_type(AccountUpdateResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -52,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" account = response.parse() - assert_matches_type(AccountUpdateResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -64,7 +61,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = response.parse() - assert_matches_type(AccountUpdateResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) assert cast(Any, response.is_closed) is True @@ -108,7 +105,7 @@ def test_method_get(self, client: Cloudflare) -> None: account = client.accounts.get( account_id={}, ) - assert_matches_type(AccountGetResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -119,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" account = response.parse() - assert_matches_type(AccountGetResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -130,7 +127,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = response.parse() - assert_matches_type(AccountGetResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) assert cast(Any, response.is_closed) is True @@ -144,7 +141,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_id={}, name="Demo Account", ) - assert_matches_type(AccountUpdateResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -152,12 +149,13 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare account_id={}, name="Demo Account", settings={ + "abuse_contact_email": "string", "default_nameservers": "cloudflare.standard", "enforce_twofactor": True, "use_account_custom_ns_by_default": True, }, ) - assert_matches_type(AccountUpdateResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -169,7 +167,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 = await response.parse() - assert_matches_type(AccountUpdateResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -181,7 +179,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = await response.parse() - assert_matches_type(AccountUpdateResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) assert cast(Any, response.is_closed) is True @@ -225,7 +223,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account = await async_client.accounts.get( account_id={}, ) - assert_matches_type(AccountGetResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -236,7 +234,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 = await response.parse() - assert_matches_type(AccountGetResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -247,6 +245,6 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" account = await response.parse() - assert_matches_type(AccountGetResponse, account, path=["response"]) + assert_matches_type(object, account, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_ai_gateway.py b/tests/api_resources/test_ai_gateway.py index 2ea4b31548c..836bd4a6bbb 100644 --- a/tests/api_resources/test_ai_gateway.py +++ b/tests/api_resources/test_ai_gateway.py @@ -28,26 +28,13 @@ class TestAIGateway: def test_method_create(self, client: Cloudflare) -> None: ai_gateway = client.ai_gateway.create( account_id="0d37909e38d3e99c29fa2cd343ac421a", + id="my-gateway", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", - ) - assert_matches_type(AIGatewayCreateResponse, ai_gateway, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Cloudflare) -> None: - ai_gateway = client.ai_gateway.create( - account_id="0d37909e38d3e99c29fa2cd343ac421a", - cache_invalidate_on_update=True, - cache_ttl=0, - collect_logs=True, - name="string", - slug="string", rate_limiting_interval=0, rate_limiting_limit=0, - rate_limiting_technique="string", + rate_limiting_technique="fixed", ) assert_matches_type(AIGatewayCreateResponse, ai_gateway, path=["response"]) @@ -55,11 +42,13 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_create(self, client: Cloudflare) -> None: response = client.ai_gateway.with_raw_response.create( account_id="0d37909e38d3e99c29fa2cd343ac421a", + id="my-gateway", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) assert response.is_closed is True @@ -71,11 +60,13 @@ def test_raw_response_create(self, client: Cloudflare) -> None: def test_streaming_response_create(self, client: Cloudflare) -> None: with client.ai_gateway.with_streaming_response.create( account_id="0d37909e38d3e99c29fa2cd343ac421a", + id="my-gateway", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -90,52 +81,40 @@ def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.ai_gateway.with_raw_response.create( account_id="", + id="my-gateway", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) @parametrize def test_method_update(self, client: Cloudflare) -> None: ai_gateway = client.ai_gateway.update( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", - ) - assert_matches_type(AIGatewayUpdateResponse, ai_gateway, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Cloudflare) -> None: - ai_gateway = client.ai_gateway.update( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="0d37909e38d3e99c29fa2cd343ac421a", - cache_invalidate_on_update=True, - cache_ttl=0, - collect_logs=True, - name="string", - slug="string", rate_limiting_interval=0, rate_limiting_limit=0, - rate_limiting_technique="string", + rate_limiting_technique="fixed", ) assert_matches_type(AIGatewayUpdateResponse, ai_gateway, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.ai_gateway.with_raw_response.update( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) assert response.is_closed is True @@ -146,13 +125,14 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.ai_gateway.with_streaming_response.update( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -166,13 +146,14 @@ 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.ai_gateway.with_raw_response.update( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): @@ -182,8 +163,9 @@ def test_path_params_update(self, client: Cloudflare) -> None: cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) @parametrize @@ -197,7 +179,7 @@ def test_method_list(self, client: Cloudflare) -> None: def test_method_list_with_all_params(self, client: Cloudflare) -> None: ai_gateway = client.ai_gateway.list( account_id="0d37909e38d3e99c29fa2cd343ac421a", - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="my-gateway", order_by="string", page=1, per_page=5, @@ -238,7 +220,7 @@ def test_path_params_list(self, client: Cloudflare) -> None: @parametrize def test_method_delete(self, client: Cloudflare) -> None: ai_gateway = client.ai_gateway.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "string", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) assert_matches_type(AIGatewayDeleteResponse, ai_gateway, path=["response"]) @@ -246,7 +228,7 @@ def test_method_delete(self, client: Cloudflare) -> None: @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.ai_gateway.with_raw_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "string", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) @@ -258,7 +240,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.ai_gateway.with_streaming_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "string", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) as response: assert not response.is_closed @@ -273,7 +255,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.ai_gateway.with_raw_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "string", account_id="", ) @@ -286,7 +268,7 @@ def test_path_params_delete(self, client: Cloudflare) -> None: @parametrize def test_method_get(self, client: Cloudflare) -> None: ai_gateway = client.ai_gateway.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) assert_matches_type(AIGatewayGetResponse, ai_gateway, path=["response"]) @@ -294,7 +276,7 @@ def test_method_get(self, client: Cloudflare) -> None: @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.ai_gateway.with_raw_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) @@ -306,7 +288,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.ai_gateway.with_streaming_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) as response: assert not response.is_closed @@ -321,7 +303,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.ai_gateway.with_raw_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="", ) @@ -339,26 +321,13 @@ class TestAsyncAIGateway: async def test_method_create(self, async_client: AsyncCloudflare) -> None: ai_gateway = await async_client.ai_gateway.create( account_id="0d37909e38d3e99c29fa2cd343ac421a", + id="my-gateway", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", - ) - assert_matches_type(AIGatewayCreateResponse, ai_gateway, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - ai_gateway = await async_client.ai_gateway.create( - account_id="0d37909e38d3e99c29fa2cd343ac421a", - cache_invalidate_on_update=True, - cache_ttl=0, - collect_logs=True, - name="string", - slug="string", rate_limiting_interval=0, rate_limiting_limit=0, - rate_limiting_technique="string", + rate_limiting_technique="fixed", ) assert_matches_type(AIGatewayCreateResponse, ai_gateway, path=["response"]) @@ -366,11 +335,13 @@ 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.ai_gateway.with_raw_response.create( account_id="0d37909e38d3e99c29fa2cd343ac421a", + id="my-gateway", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) assert response.is_closed is True @@ -382,11 +353,13 @@ 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.ai_gateway.with_streaming_response.create( account_id="0d37909e38d3e99c29fa2cd343ac421a", + id="my-gateway", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -401,52 +374,40 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.ai_gateway.with_raw_response.create( account_id="", + id="my-gateway", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: ai_gateway = await async_client.ai_gateway.update( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", - ) - assert_matches_type(AIGatewayUpdateResponse, ai_gateway, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - ai_gateway = await async_client.ai_gateway.update( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - account_id="0d37909e38d3e99c29fa2cd343ac421a", - cache_invalidate_on_update=True, - cache_ttl=0, - collect_logs=True, - name="string", - slug="string", rate_limiting_interval=0, rate_limiting_limit=0, - rate_limiting_technique="string", + rate_limiting_technique="fixed", ) assert_matches_type(AIGatewayUpdateResponse, ai_gateway, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.ai_gateway.with_raw_response.update( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) assert response.is_closed is True @@ -457,13 +418,14 @@ 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.ai_gateway.with_streaming_response.update( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -477,13 +439,14 @@ 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.ai_gateway.with_raw_response.update( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): @@ -493,8 +456,9 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, - name="string", - slug="string", + rate_limiting_interval=0, + rate_limiting_limit=0, + rate_limiting_technique="fixed", ) @parametrize @@ -508,7 +472,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: ai_gateway = await async_client.ai_gateway.list( account_id="0d37909e38d3e99c29fa2cd343ac421a", - id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + id="my-gateway", order_by="string", page=1, per_page=5, @@ -549,7 +513,7 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: ai_gateway = await async_client.ai_gateway.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "string", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) assert_matches_type(AIGatewayDeleteResponse, ai_gateway, path=["response"]) @@ -557,7 +521,7 @@ 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.ai_gateway.with_raw_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "string", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) @@ -569,7 +533,7 @@ 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.ai_gateway.with_streaming_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "string", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) as response: assert not response.is_closed @@ -584,7 +548,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.ai_gateway.with_raw_response.delete( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "string", account_id="", ) @@ -597,7 +561,7 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: ai_gateway = await async_client.ai_gateway.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) assert_matches_type(AIGatewayGetResponse, ai_gateway, path=["response"]) @@ -605,7 +569,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.ai_gateway.with_raw_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) @@ -617,7 +581,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.ai_gateway.with_streaming_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) as response: assert not response.is_closed @@ -632,7 +596,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.ai_gateway.with_raw_response.get( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "my-gateway", account_id="", ) diff --git a/tests/api_resources/test_cache.py b/tests/api_resources/test_cache.py index 2c5dd92732e..d23c8672439 100644 --- a/tests/api_resources/test_cache.py +++ b/tests/api_resources/test_cache.py @@ -28,7 +28,7 @@ def test_method_purge_overload_1(self, client: Cloudflare) -> None: def test_method_purge_with_all_params_overload_1(self, client: Cloudflare) -> None: cache = client.cache.purge( zone_id="string", - tags=["some-tag", "another-tag"], + tags=["a-cache-tag", "another-cache-tag"], ) assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) @@ -212,11 +212,7 @@ def test_method_purge_overload_5(self, client: Cloudflare) -> None: def test_method_purge_with_all_params_overload_5(self, client: Cloudflare) -> None: cache = client.cache.purge( zone_id="string", - files=[ - "http://www.example.com/css/styles.css", - "http://www.example.com/css/styles.css", - "http://www.example.com/css/styles.css", - ], + files=["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"], ) assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) @@ -251,6 +247,69 @@ def test_path_params_purge_overload_5(self, client: Cloudflare) -> None: zone_id="", ) + @parametrize + def test_method_purge_overload_6(self, client: Cloudflare) -> None: + cache = client.cache.purge( + zone_id="string", + ) + assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) + + @parametrize + def test_method_purge_with_all_params_overload_6(self, client: Cloudflare) -> None: + cache = client.cache.purge( + zone_id="string", + files=[ + { + "headers": { + "Accept-Language": "zh-CN", + "CF-Device-Type": "desktop", + "CF-IPCountry": "US", + }, + "url": "http://www.example.com/cat_picture.jpg", + }, + { + "headers": { + "Accept-Language": "en-US", + "CF-Device-Type": "mobile", + "CF-IPCountry": "EU", + }, + "url": "http://www.example.com/dog_picture.jpg", + }, + ], + ) + assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) + + @parametrize + def test_raw_response_purge_overload_6(self, client: Cloudflare) -> None: + response = client.cache.with_raw_response.purge( + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cache = response.parse() + assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) + + @parametrize + def test_streaming_response_purge_overload_6(self, client: Cloudflare) -> None: + with client.cache.with_streaming_response.purge( + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cache = response.parse() + assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_purge_overload_6(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.cache.with_raw_response.purge( + zone_id="", + ) + class TestAsyncCache: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -266,7 +325,7 @@ async def test_method_purge_overload_1(self, async_client: AsyncCloudflare) -> N async def test_method_purge_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None: cache = await async_client.cache.purge( zone_id="string", - tags=["some-tag", "another-tag"], + tags=["a-cache-tag", "another-cache-tag"], ) assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) @@ -450,11 +509,7 @@ async def test_method_purge_overload_5(self, async_client: AsyncCloudflare) -> N async def test_method_purge_with_all_params_overload_5(self, async_client: AsyncCloudflare) -> None: cache = await async_client.cache.purge( zone_id="string", - files=[ - "http://www.example.com/css/styles.css", - "http://www.example.com/css/styles.css", - "http://www.example.com/css/styles.css", - ], + files=["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"], ) assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) @@ -488,3 +543,66 @@ async def test_path_params_purge_overload_5(self, async_client: AsyncCloudflare) await async_client.cache.with_raw_response.purge( zone_id="", ) + + @parametrize + async def test_method_purge_overload_6(self, async_client: AsyncCloudflare) -> None: + cache = await async_client.cache.purge( + zone_id="string", + ) + assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) + + @parametrize + async def test_method_purge_with_all_params_overload_6(self, async_client: AsyncCloudflare) -> None: + cache = await async_client.cache.purge( + zone_id="string", + files=[ + { + "headers": { + "Accept-Language": "zh-CN", + "CF-Device-Type": "desktop", + "CF-IPCountry": "US", + }, + "url": "http://www.example.com/cat_picture.jpg", + }, + { + "headers": { + "Accept-Language": "en-US", + "CF-Device-Type": "mobile", + "CF-IPCountry": "EU", + }, + "url": "http://www.example.com/dog_picture.jpg", + }, + ], + ) + assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) + + @parametrize + async def test_raw_response_purge_overload_6(self, async_client: AsyncCloudflare) -> None: + response = await async_client.cache.with_raw_response.purge( + zone_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + cache = await response.parse() + assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) + + @parametrize + async def test_streaming_response_purge_overload_6(self, async_client: AsyncCloudflare) -> None: + async with async_client.cache.with_streaming_response.purge( + zone_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + cache = await response.parse() + assert_matches_type(Optional[CachePurgeResponse], cache, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_purge_overload_6(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.with_raw_response.purge( + zone_id="", + ) diff --git a/tests/api_resources/test_calls.py b/tests/api_resources/test_calls.py index 09dab34806b..a518aded095 100644 --- a/tests/api_resources/test_calls.py +++ b/tests/api_resources/test_calls.py @@ -10,7 +10,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.calls import CallsApp, CallsAppWithSecret +from cloudflare.types.calls import ( + CallsApp, + CallListResponse, + CallsAppWithSecret, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -126,7 +130,7 @@ def test_method_list(self, client: Cloudflare) -> None: call = client.calls.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SyncSinglePage[CallsApp], call, path=["response"]) + assert_matches_type(SyncSinglePage[CallListResponse], call, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -137,7 +141,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" call = response.parse() - assert_matches_type(SyncSinglePage[CallsApp], call, path=["response"]) + assert_matches_type(SyncSinglePage[CallListResponse], call, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -148,7 +152,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(SyncSinglePage[CallsApp], call, path=["response"]) + assert_matches_type(SyncSinglePage[CallListResponse], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -367,7 +371,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: call = await async_client.calls.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(AsyncSinglePage[CallsApp], call, path=["response"]) + assert_matches_type(AsyncSinglePage[CallListResponse], call, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -378,7 +382,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" call = await response.parse() - assert_matches_type(AsyncSinglePage[CallsApp], call, path=["response"]) + assert_matches_type(AsyncSinglePage[CallListResponse], call, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -389,7 +393,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(AsyncSinglePage[CallsApp], call, path=["response"]) + assert_matches_type(AsyncSinglePage[CallListResponse], call, 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/test_dcv_delegation.py similarity index 67% rename from tests/api_resources/dcv_delegation/test_uuid.py rename to tests/api_resources/test_dcv_delegation.py index a1d65863aa7..0f04ca1a893 100644 --- a/tests/api_resources/dcv_delegation/test_uuid.py +++ b/tests/api_resources/test_dcv_delegation.py @@ -14,85 +14,85 @@ base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestUUID: +class TestDCVDelegation: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_get(self, client: Cloudflare) -> None: - uuid = client.dcv_delegation.uuid.get( + dcv_delegation = client.dcv_delegation.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[DCVDelegationUUID], uuid, path=["response"]) + assert_matches_type(Optional[DCVDelegationUUID], dcv_delegation, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.dcv_delegation.uuid.with_raw_response.get( + response = client.dcv_delegation.with_raw_response.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - uuid = response.parse() - assert_matches_type(Optional[DCVDelegationUUID], uuid, path=["response"]) + dcv_delegation = response.parse() + assert_matches_type(Optional[DCVDelegationUUID], dcv_delegation, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.dcv_delegation.uuid.with_streaming_response.get( + with client.dcv_delegation.with_streaming_response.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - uuid = response.parse() - assert_matches_type(Optional[DCVDelegationUUID], uuid, path=["response"]) + dcv_delegation = response.parse() + assert_matches_type(Optional[DCVDelegationUUID], dcv_delegation, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.dcv_delegation.uuid.with_raw_response.get( + client.dcv_delegation.with_raw_response.get( zone_id="", ) -class TestAsyncUUID: +class TestAsyncDCVDelegation: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - uuid = await async_client.dcv_delegation.uuid.get( + dcv_delegation = await async_client.dcv_delegation.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[DCVDelegationUUID], uuid, path=["response"]) + assert_matches_type(Optional[DCVDelegationUUID], dcv_delegation, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.dcv_delegation.uuid.with_raw_response.get( + response = await async_client.dcv_delegation.with_raw_response.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - uuid = await response.parse() - assert_matches_type(Optional[DCVDelegationUUID], uuid, path=["response"]) + dcv_delegation = await response.parse() + assert_matches_type(Optional[DCVDelegationUUID], dcv_delegation, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.dcv_delegation.uuid.with_streaming_response.get( + async with async_client.dcv_delegation.with_streaming_response.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - uuid = await response.parse() - assert_matches_type(Optional[DCVDelegationUUID], uuid, path=["response"]) + dcv_delegation = await response.parse() + assert_matches_type(Optional[DCVDelegationUUID], dcv_delegation, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.dcv_delegation.uuid.with_raw_response.get( + await async_client.dcv_delegation.with_raw_response.get( zone_id="", ) diff --git a/tests/api_resources/test_filters.py b/tests/api_resources/test_filters.py index e840ceb5eaa..58215dc774b 100644 --- a/tests/api_resources/test_filters.py +++ b/tests/api_resources/test_filters.py @@ -15,6 +15,8 @@ FilterCreateResponse, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,19 +26,22 @@ class TestFilters: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_create(self, client: Cloudflare) -> None: - filter = client.filters.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + filter = client.filters.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.filters.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = client.filters.with_raw_response.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -46,45 +51,50 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.filters.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.filters.with_streaming_response.create( + "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[FilterCreateResponse], filter, path=["response"]) + filter = response.parse() + assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.filters.with_raw_response.create( - "", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.filters.with_raw_response.create( + "", + body={}, + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update(self, client: Cloudflare) -> None: - filter = client.filters.update( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + filter = client.filters.update( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.filters.with_raw_response.update( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = client.filters.with_raw_response.update( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -94,62 +104,69 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.filters.with_streaming_response.update( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.filters.with_streaming_response.update( + "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(FirewallFilter, filter, path=["response"]) + filter = response.parse() + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): - client.filters.with_raw_response.update( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="", - body={}, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.filters.with_raw_response.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.filters.with_raw_response.update( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="", + body={}, + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.filters.with_raw_response.update( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) @parametrize def test_method_list(self, client: Cloudflare) -> None: - filter = client.filters.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + filter = client.filters.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncV4PagePaginationArray[FirewallFilter], filter, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: - filter = client.filters.list( - "023e105f4ecef8ad9ca31a8372d0c353", - id="372e67954025e0ba6aaa6d586b9e0b61", - description="browsers", - expression="php", - page=1, - paused=False, - per_page=5, - ref="FIL-100", - ) + with pytest.warns(DeprecationWarning): + filter = client.filters.list( + "023e105f4ecef8ad9ca31a8372d0c353", + id="372e67954025e0ba6aaa6d586b9e0b61", + description="browsers", + expression="php", + page=1, + paused=False, + per_page=5, + ref="FIL-100", + ) + assert_matches_type(SyncV4PagePaginationArray[FirewallFilter], filter, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.filters.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.filters.with_raw_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -158,38 +175,43 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.filters.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.filters.with_streaming_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(SyncV4PagePaginationArray[FirewallFilter], filter, path=["response"]) + filter = response.parse() + assert_matches_type(SyncV4PagePaginationArray[FirewallFilter], filter, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.filters.with_raw_response.list( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.filters.with_raw_response.list( + "", + ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: - filter = client.filters.delete( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + filter = client.filters.delete( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(FirewallFilter, filter, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.filters.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.filters.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -198,46 +220,51 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.filters.with_streaming_response.delete( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.filters.with_streaming_response.delete( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(FirewallFilter, filter, path=["response"]) + filter = response.parse() + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.filters.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.filters.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.filters.with_raw_response.delete( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.filters.with_raw_response.delete( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) @parametrize def test_method_get(self, client: Cloudflare) -> None: - filter = client.filters.get( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + filter = client.filters.get( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(FirewallFilter, filter, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.filters.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.filters.with_raw_response.get( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -246,31 +273,33 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.filters.with_streaming_response.get( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.filters.with_streaming_response.get( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - filter = response.parse() - assert_matches_type(FirewallFilter, filter, path=["response"]) + filter = response.parse() + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.filters.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.filters.with_raw_response.get( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.filters.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.filters.with_raw_response.get( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) class TestAsyncFilters: @@ -279,19 +308,22 @@ class TestAsyncFilters: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.filters.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + filter = await async_client.filters.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.filters.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.filters.with_raw_response.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -301,45 +333,50 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.filters.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.filters.with_streaming_response.create( + "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[FilterCreateResponse], filter, path=["response"]) + filter = await response.parse() + assert_matches_type(Optional[FilterCreateResponse], filter, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.filters.with_raw_response.create( - "", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.filters.with_raw_response.create( + "", + body={}, + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.filters.update( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + filter = await async_client.filters.update( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(FirewallFilter, filter, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.filters.with_raw_response.update( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.filters.with_raw_response.update( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -349,62 +386,69 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.filters.with_streaming_response.update( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.filters.with_streaming_response.update( + "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(FirewallFilter, filter, path=["response"]) + filter = await response.parse() + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.filters.with_raw_response.update( - "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.update( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.filters.with_raw_response.update( + "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.update( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.filters.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + filter = await async_client.filters.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncV4PagePaginationArray[FirewallFilter], filter, path=["response"]) @parametrize 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, - paused=False, - per_page=5, - ref="FIL-100", - ) + with pytest.warns(DeprecationWarning): + filter = await async_client.filters.list( + "023e105f4ecef8ad9ca31a8372d0c353", + id="372e67954025e0ba6aaa6d586b9e0b61", + description="browsers", + expression="php", + page=1, + paused=False, + per_page=5, + ref="FIL-100", + ) + assert_matches_type(AsyncV4PagePaginationArray[FirewallFilter], filter, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.filters.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.filters.with_raw_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -413,38 +457,43 @@ 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.filters.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.filters.with_streaming_response.list( + "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(AsyncV4PagePaginationArray[FirewallFilter], filter, path=["response"]) + filter = await response.parse() + assert_matches_type(AsyncV4PagePaginationArray[FirewallFilter], filter, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.filters.with_raw_response.list( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.filters.with_raw_response.list( + "", + ) @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.filters.delete( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + filter = await async_client.filters.delete( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(FirewallFilter, filter, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.filters.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.filters.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -453,46 +502,51 @@ 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.filters.with_streaming_response.delete( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.filters.with_streaming_response.delete( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="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(FirewallFilter, filter, path=["response"]) + filter = await response.parse() + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.filters.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.filters.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="", + ) - 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", - ) + 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", + ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: - filter = await async_client.filters.get( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + filter = await async_client.filters.get( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(FirewallFilter, filter, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.filters.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.filters.with_raw_response.get( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -501,28 +555,30 @@ 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.filters.with_streaming_response.get( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.filters.with_streaming_response.get( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="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(FirewallFilter, filter, path=["response"]) + filter = await response.parse() + assert_matches_type(FirewallFilter, filter, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.filters.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b61", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.filters.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.filters.with_raw_response.get( + "372e67954025e0ba6aaa6d586b9e0b61", + zone_identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.filters.with_raw_response.get( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/test_memberships.py b/tests/api_resources/test_memberships.py index c833239e35c..cb5e1358a4c 100644 --- a/tests/api_resources/test_memberships.py +++ b/tests/api_resources/test_memberships.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -29,7 +29,7 @@ def test_method_update(self, client: Cloudflare) -> None: "4536bcfad5faccb111b47003c79917fa", status="accepted", ) - assert_matches_type(MembershipUpdateResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipUpdateResponse], membership, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -41,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" membership = response.parse() - assert_matches_type(MembershipUpdateResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipUpdateResponse], membership, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -53,7 +53,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" membership = response.parse() - assert_matches_type(MembershipUpdateResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipUpdateResponse], membership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -108,7 +108,7 @@ def test_method_delete(self, client: Cloudflare) -> None: membership = client.memberships.delete( "4536bcfad5faccb111b47003c79917fa", ) - assert_matches_type(MembershipDeleteResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: @@ -119,7 +119,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" membership = response.parse() - assert_matches_type(MembershipDeleteResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"]) @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: @@ -130,7 +130,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" membership = response.parse() - assert_matches_type(MembershipDeleteResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -146,7 +146,7 @@ def test_method_get(self, client: Cloudflare) -> None: membership = client.memberships.get( "4536bcfad5faccb111b47003c79917fa", ) - assert_matches_type(MembershipGetResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipGetResponse], membership, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -157,7 +157,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" membership = response.parse() - assert_matches_type(MembershipGetResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipGetResponse], membership, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -168,7 +168,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" membership = response.parse() - assert_matches_type(MembershipGetResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipGetResponse], membership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -189,7 +189,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "4536bcfad5faccb111b47003c79917fa", status="accepted", ) - assert_matches_type(MembershipUpdateResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipUpdateResponse], membership, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -201,7 +201,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" membership = await response.parse() - assert_matches_type(MembershipUpdateResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipUpdateResponse], membership, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -213,7 +213,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" membership = await response.parse() - assert_matches_type(MembershipUpdateResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipUpdateResponse], membership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -268,7 +268,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: membership = await async_client.memberships.delete( "4536bcfad5faccb111b47003c79917fa", ) - assert_matches_type(MembershipDeleteResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -279,7 +279,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" membership = await response.parse() - assert_matches_type(MembershipDeleteResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"]) @parametrize async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: @@ -290,7 +290,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" membership = await response.parse() - assert_matches_type(MembershipDeleteResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -306,7 +306,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: membership = await async_client.memberships.get( "4536bcfad5faccb111b47003c79917fa", ) - assert_matches_type(MembershipGetResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipGetResponse], membership, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -317,7 +317,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" membership = await response.parse() - assert_matches_type(MembershipGetResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipGetResponse], membership, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -328,7 +328,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" membership = await response.parse() - assert_matches_type(MembershipGetResponse, membership, path=["response"]) + assert_matches_type(Optional[MembershipGetResponse], membership, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_page_shield.py b/tests/api_resources/test_page_shield.py index 9e7112a8b9c..2511ba986b2 100644 --- a/tests/api_resources/test_page_shield.py +++ b/tests/api_resources/test_page_shield.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -22,7 +22,7 @@ def test_method_update(self, client: Cloudflare) -> None: page_shield = client.page_shield.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldUpdateResponse, page_shield, path=["response"]) + assert_matches_type(Optional[PageShieldUpdateResponse], page_shield, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: @@ -32,7 +32,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: use_cloudflare_reporting_endpoint=True, use_connection_url_path=True, ) - assert_matches_type(PageShieldUpdateResponse, page_shield, path=["response"]) + assert_matches_type(Optional[PageShieldUpdateResponse], page_shield, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -43,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" page_shield = response.parse() - assert_matches_type(PageShieldUpdateResponse, page_shield, path=["response"]) + assert_matches_type(Optional[PageShieldUpdateResponse], page_shield, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -54,7 +54,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" page_shield = response.parse() - assert_matches_type(PageShieldUpdateResponse, page_shield, path=["response"]) + assert_matches_type(Optional[PageShieldUpdateResponse], page_shield, path=["response"]) assert cast(Any, response.is_closed) is True @@ -70,7 +70,7 @@ def test_method_get(self, client: Cloudflare) -> None: page_shield = client.page_shield.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Setting, page_shield, path=["response"]) + assert_matches_type(Optional[Setting], page_shield, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -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" page_shield = response.parse() - assert_matches_type(Setting, page_shield, path=["response"]) + assert_matches_type(Optional[Setting], page_shield, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -92,7 +92,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(Setting, page_shield, path=["response"]) + assert_matches_type(Optional[Setting], page_shield, path=["response"]) assert cast(Any, response.is_closed) is True @@ -112,7 +112,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: page_shield = await async_client.page_shield.update( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(PageShieldUpdateResponse, page_shield, path=["response"]) + assert_matches_type(Optional[PageShieldUpdateResponse], page_shield, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -122,7 +122,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare use_cloudflare_reporting_endpoint=True, use_connection_url_path=True, ) - assert_matches_type(PageShieldUpdateResponse, page_shield, path=["response"]) + assert_matches_type(Optional[PageShieldUpdateResponse], page_shield, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -133,7 +133,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" page_shield = await response.parse() - assert_matches_type(PageShieldUpdateResponse, page_shield, path=["response"]) + assert_matches_type(Optional[PageShieldUpdateResponse], page_shield, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -144,7 +144,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" page_shield = await response.parse() - assert_matches_type(PageShieldUpdateResponse, page_shield, path=["response"]) + assert_matches_type(Optional[PageShieldUpdateResponse], page_shield, path=["response"]) assert cast(Any, response.is_closed) is True @@ -160,7 +160,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(Setting, page_shield, path=["response"]) + assert_matches_type(Optional[Setting], page_shield, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -171,7 +171,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(Setting, page_shield, path=["response"]) + assert_matches_type(Optional[Setting], page_shield, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -182,7 +182,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(Setting, page_shield, path=["response"]) + assert_matches_type(Optional[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 fbc26716f3e..3a54b5d879f 100644 --- a/tests/api_resources/test_pagerules.py +++ b/tests/api_resources/test_pagerules.py @@ -18,6 +18,8 @@ PageruleUpdateResponse, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,77 +28,82 @@ class TestPagerules: @parametrize def test_method_create(self, client: Cloudflare) -> None: - pagerule = client.pagerules.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: - pagerule = client.pagerules.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", - }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - }, - ], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - "target": "url", - } - ], - priority=0, - status="active", - ) + ], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + priority=0, + status="active", + ) + assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -105,32 +112,52 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.pagerules.with_streaming_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.pagerules.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = response.parse() - assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) + pagerule = response.parse() + assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.create( - zone_id="", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.create( + zone_id="", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.update( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}, {}, {}], targets=[ { @@ -143,118 +170,58 @@ def test_path_params_create(self, client: Cloudflare) -> None: ], ) - @parametrize - def test_method_update(self, client: Cloudflare) -> None: - pagerule = client.pagerules.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: - pagerule = client.pagerules.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", - }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", - }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.update( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - }, - ], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - "target": "url", - } - ], - priority=0, - status="active", - ) - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - "target": "url", - } - ], - ) + ], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + priority=0, + status="active", + ) - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = response.parse() assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) @parametrize - def test_streaming_response_update(self, client: Cloudflare) -> None: - with client.pagerules.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pagerule = response.parse() - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.update( + def test_raw_response_update(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}, {}, {}], targets=[ { @@ -267,9 +234,16 @@ def test_path_params_update(self, client: Cloudflare) -> None: ], ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - client.pagerules.with_raw_response.update( - "", + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pagerule = response.parse() + assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + with client.pagerules.with_streaming_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}, {}, {}], targets=[ @@ -281,31 +255,78 @@ def test_path_params_update(self, client: Cloudflare) -> None: "target": "url", } ], - ) + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pagerule = response.parse() + assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + client.pagerules.with_raw_response.update( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) @parametrize def test_method_list(self, client: Cloudflare) -> None: - pagerule = client.pagerules.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(PageruleListResponse, pagerule, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: - pagerule = client.pagerules.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - direction="desc", - match="any", - order="status", - status="active", - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + direction="desc", + match="any", + order="status", + status="active", + ) + assert_matches_type(PageruleListResponse, pagerule, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -314,38 +335,43 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.pagerules.with_streaming_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.pagerules.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = response.parse() - assert_matches_type(PageruleListResponse, pagerule, path=["response"]) + pagerule = response.parse() + assert_matches_type(PageruleListResponse, pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.list( - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.list( + zone_id="", + ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: - pagerule = client.pagerules.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -354,88 +380,95 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.pagerules.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" + with pytest.warns(DeprecationWarning): + with client.pagerules.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" - pagerule = response.parse() - assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) + pagerule = response.parse() + assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + 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", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - client.pagerules.with_raw_response.delete( - "", + @parametrize + def test_method_edit(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.edit( + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - pagerule = client.pagerules.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - pagerule = client.pagerules.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", - }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - }, - ], - priority=0, - status="active", - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - "target": "url", - } - ], - ) + ], + priority=0, + status="active", + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -444,46 +477,51 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.pagerules.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" + with pytest.warns(DeprecationWarning): + with client.pagerules.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" - pagerule = response.parse() - assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) + pagerule = response.parse() + assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + client.pagerules.with_raw_response.edit( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - client.pagerules.with_raw_response.edit( - "", + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + pagerule = client.pagerules.get( + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - pagerule = client.pagerules.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.pagerules.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.pagerules.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -492,31 +530,33 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.pagerules.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" + with pytest.warns(DeprecationWarning): + with client.pagerules.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" - pagerule = response.parse() - assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) + pagerule = response.parse() + assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.pagerules.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.pagerules.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - client.pagerules.with_raw_response.get( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + client.pagerules.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) class TestAsyncPagerules: @@ -524,77 +564,82 @@ class TestAsyncPagerules: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", - }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - }, - ], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - "target": "url", - } - ], - priority=0, - status="active", - ) + ], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + priority=0, + status="active", + ) + assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -603,32 +648,52 @@ 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.pagerules.with_streaming_response.create( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.with_streaming_response.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = await response.parse() - assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) + pagerule = await response.parse() + assert_matches_type(PageruleCreateResponse, pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.create( - zone_id="", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.create( + zone_id="", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.update( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}, {}, {}], targets=[ { @@ -641,118 +706,58 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: ], ) - @parametrize - async def test_method_update(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", - }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", - }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.update( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - }, - ], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - "target": "url", - } - ], - priority=0, - status="active", - ) - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - "target": "url", - } - ], - ) + ], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + priority=0, + status="active", + ) - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = await response.parse() assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) @parametrize - async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: - async with async_client.pagerules.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[{}, {}, {}], - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", - }, - "target": "url", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pagerule = await response.parse() - assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.update( + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.update( "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}, {}, {}], targets=[ { @@ -765,9 +770,16 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: ], ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - await async_client.pagerules.with_raw_response.update( - "", + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pagerule = await response.parse() + assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.with_streaming_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", actions=[{}, {}, {}], targets=[ @@ -779,31 +791,78 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: "target": "url", } ], - ) + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pagerule = await response.parse() + assert_matches_type(PageruleUpdateResponse, pagerule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.update( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + await async_client.pagerules.with_raw_response.update( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[{}, {}, {}], + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(PageruleListResponse, pagerule, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - direction="desc", - match="any", - order="status", - status="active", - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + direction="desc", + match="any", + order="status", + status="active", + ) + assert_matches_type(PageruleListResponse, pagerule, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -812,38 +871,43 @@ 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.pagerules.with_streaming_response.list( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.with_streaming_response.list( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pagerule = await response.parse() - assert_matches_type(PageruleListResponse, pagerule, path=["response"]) + pagerule = await response.parse() + assert_matches_type(PageruleListResponse, pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.list( - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.list( + zone_id="", + ) @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -852,88 +916,95 @@ 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.pagerules.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" + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.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" - pagerule = await response.parse() - assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) + pagerule = await response.parse() + assert_matches_type(Optional[PageruleDeleteResponse], pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.delete( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.delete( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + 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", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - await async_client.pagerules.with_raw_response.delete( - "", + @parametrize + async def test_method_edit(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.edit( + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - actions=[ - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", - }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + actions=[ + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - }, - { - "name": "forward_url", - "value": { - "type": "temporary", - "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - }, - ], - priority=0, - status="active", - targets=[ - { - "constraint": { - "operator": "matches", - "value": "*example.com/images/*", + { + "name": "forward_url", + "value": { + "type": "temporary", + "url": "http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3", + }, }, - "target": "url", - } - ], - ) + ], + priority=0, + status="active", + targets=[ + { + "constraint": { + "operator": "matches", + "value": "*example.com/images/*", + }, + "target": "url", + } + ], + ) + assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -942,46 +1013,51 @@ 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.pagerules.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" + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.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" - pagerule = await response.parse() - assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) + pagerule = await response.parse() + assert_matches_type(PageruleEditResponse, pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.edit( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + await async_client.pagerules.with_raw_response.edit( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - await async_client.pagerules.with_raw_response.edit( - "", + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + pagerule = await async_client.pagerules.get( + "023e105f4ecef8ad9ca31a8372d0c353", zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - pagerule = await async_client.pagerules.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.pagerules.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.pagerules.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -990,28 +1066,30 @@ 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.pagerules.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" + with pytest.warns(DeprecationWarning): + async with async_client.pagerules.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" - pagerule = await response.parse() - assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) + pagerule = await response.parse() + assert_matches_type(PageruleGetResponse, pagerule, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.pagerules.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - zone_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): - await async_client.pagerules.with_raw_response.get( - "", - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.pagerules.with_raw_response.get( + "023e105f4ecef8ad9ca31a8372d0c353", + zone_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pagerule_id` but received ''"): + await async_client.pagerules.with_raw_response.get( + "", + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/test_rate_limits.py b/tests/api_resources/test_rate_limits.py index 2a58e6b8e02..f03e02cb30c 100644 --- a/tests/api_resources/test_rate_limits.py +++ b/tests/api_resources/test_rate_limits.py @@ -18,6 +18,8 @@ RateLimitDeleteResponse, ) +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,19 +29,22 @@ class TestRateLimits: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_create(self, client: Cloudflare) -> None: - rate_limit = client.rate_limits.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + rate_limit = client.rate_limits.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(RateLimitCreateResponse, rate_limit, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: - response = client.rate_limits.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = client.rate_limits.with_raw_response.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -49,48 +54,55 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: - with client.rate_limits.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.rate_limits.with_streaming_response.create( + "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(RateLimitCreateResponse, rate_limit, path=["response"]) + rate_limit = response.parse() + assert_matches_type(RateLimitCreateResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.rate_limits.with_raw_response.create( - "", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.rate_limits.with_raw_response.create( + "", + body={}, + ) @parametrize def test_method_list(self, client: Cloudflare) -> None: - rate_limit = client.rate_limits.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + rate_limit = client.rate_limits.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Cloudflare) -> None: - rate_limit = client.rate_limits.list( - "023e105f4ecef8ad9ca31a8372d0c353", - page=1, - per_page=1, - ) + with pytest.warns(DeprecationWarning): + rate_limit = client.rate_limits.list( + "023e105f4ecef8ad9ca31a8372d0c353", + page=1, + per_page=1, + ) + assert_matches_type(SyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: - response = client.rate_limits.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.rate_limits.with_raw_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -99,38 +111,43 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: - with client.rate_limits.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.rate_limits.with_streaming_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rate_limit = response.parse() - assert_matches_type(SyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) + rate_limit = response.parse() + assert_matches_type(SyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.rate_limits.with_raw_response.list( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.rate_limits.with_raw_response.list( + "", + ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: - rate_limit = client.rate_limits.delete( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + rate_limit = client.rate_limits.delete( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) @parametrize def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.rate_limits.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.rate_limits.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -139,50 +156,55 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.rate_limits.with_streaming_response.delete( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.rate_limits.with_streaming_response.delete( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rate_limit = response.parse() - assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) + rate_limit = response.parse() + assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.rate_limits.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="", - ) - - 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", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.rate_limits.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="", + ) + + 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", + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_edit(self, client: Cloudflare) -> None: - rate_limit = client.rate_limits.edit( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + rate_limit = client.rate_limits.edit( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(RateLimitEditResponse, rate_limit, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.rate_limits.with_raw_response.edit( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = client.rate_limits.with_raw_response.edit( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -192,50 +214,55 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.rate_limits.with_streaming_response.edit( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.rate_limits.with_streaming_response.edit( + "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(RateLimitEditResponse, rate_limit, path=["response"]) + rate_limit = response.parse() + assert_matches_type(RateLimitEditResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): - client.rate_limits.with_raw_response.edit( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.rate_limits.with_raw_response.edit( + "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.edit( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.rate_limits.with_raw_response.edit( - "", + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + with pytest.warns(DeprecationWarning): + rate_limit = client.rate_limits.get( + "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, ) - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - rate_limit = client.rate_limits.get( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.rate_limits.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = client.rate_limits.with_raw_response.get( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -244,31 +271,33 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.rate_limits.with_streaming_response.get( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.rate_limits.with_streaming_response.get( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - rate_limit = response.parse() - assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) + rate_limit = response.parse() + assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - client.rate_limits.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + client.rate_limits.with_raw_response.get( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.rate_limits.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.rate_limits.with_raw_response.get( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) class TestAsyncRateLimits: @@ -277,19 +306,22 @@ class TestAsyncRateLimits: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: - rate_limit = await async_client.rate_limits.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + rate_limit = await async_client.rate_limits.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(RateLimitCreateResponse, rate_limit, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rate_limits.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.rate_limits.with_raw_response.create( + "023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -299,48 +331,55 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: - async with async_client.rate_limits.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.rate_limits.with_streaming_response.create( + "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(RateLimitCreateResponse, rate_limit, path=["response"]) + rate_limit = await response.parse() + assert_matches_type(RateLimitCreateResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.rate_limits.with_raw_response.create( - "", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.rate_limits.with_raw_response.create( + "", + body={}, + ) @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: - rate_limit = await async_client.rate_limits.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + rate_limit = await async_client.rate_limits.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: - rate_limit = await async_client.rate_limits.list( - "023e105f4ecef8ad9ca31a8372d0c353", - page=1, - per_page=1, - ) + with pytest.warns(DeprecationWarning): + rate_limit = await async_client.rate_limits.list( + "023e105f4ecef8ad9ca31a8372d0c353", + page=1, + per_page=1, + ) + assert_matches_type(AsyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rate_limits.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.rate_limits.with_raw_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -349,38 +388,43 @@ 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.rate_limits.with_streaming_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.rate_limits.with_streaming_response.list( + "023e105f4ecef8ad9ca31a8372d0c353", + ) 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(AsyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) + rate_limit = await response.parse() + assert_matches_type(AsyncV4PagePaginationArray[RateLimit], rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.rate_limits.with_raw_response.list( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.rate_limits.with_raw_response.list( + "", + ) @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - rate_limit = await async_client.rate_limits.delete( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + rate_limit = await async_client.rate_limits.delete( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) @parametrize 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", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.rate_limits.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -389,50 +433,55 @@ 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.rate_limits.with_streaming_response.delete( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.rate_limits.with_streaming_response.delete( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) 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(RateLimitDeleteResponse, rate_limit, path=["response"]) + rate_limit = await response.parse() + assert_matches_type(RateLimitDeleteResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.rate_limits.with_raw_response.delete( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="", - ) - - 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", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.rate_limits.with_raw_response.delete( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="", + ) + + 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", + ) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - rate_limit = await async_client.rate_limits.edit( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + rate_limit = await async_client.rate_limits.edit( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) + assert_matches_type(RateLimitEditResponse, rate_limit, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rate_limits.with_raw_response.edit( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) + with pytest.warns(DeprecationWarning): + response = await async_client.rate_limits.with_raw_response.edit( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -442,50 +491,55 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.rate_limits.with_streaming_response.edit( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.rate_limits.with_streaming_response.edit( + "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(RateLimitEditResponse, rate_limit, path=["response"]) + rate_limit = await response.parse() + assert_matches_type(RateLimitEditResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): - await async_client.rate_limits.with_raw_response.edit( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="", - body={}, - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.rate_limits.with_raw_response.edit( + "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.edit( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + body={}, + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.rate_limits.with_raw_response.edit( - "", + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + with pytest.warns(DeprecationWarning): + rate_limit = await async_client.rate_limits.get( + "372e67954025e0ba6aaa6d586b9e0b59", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - body={}, ) - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - rate_limit = await async_client.rate_limits.get( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.rate_limits.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.rate_limits.with_raw_response.get( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -494,28 +548,30 @@ 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.rate_limits.with_streaming_response.get( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.rate_limits.with_streaming_response.get( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) 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(RateLimitGetResponse, rate_limit, path=["response"]) + rate_limit = await response.parse() + assert_matches_type(RateLimitGetResponse, rate_limit, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): - await async_client.rate_limits.with_raw_response.get( - "372e67954025e0ba6aaa6d586b9e0b59", - zone_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.rate_limits.with_raw_response.get( - "", - zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_identifier` but received ''"): + await async_client.rate_limits.with_raw_response.get( + "372e67954025e0ba6aaa6d586b9e0b59", + zone_identifier="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.rate_limits.with_raw_response.get( + "", + zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", + ) diff --git a/tests/api_resources/test_rulesets.py b/tests/api_resources/test_rulesets.py index ae2f1c54dc7..97d3d27207e 100644 --- a/tests/api_resources/test_rulesets.py +++ b/tests/api_resources/test_rulesets.py @@ -11,8 +11,8 @@ from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.rulesets import ( - Ruleset, RulesetGetResponse, + RulesetListResponse, RulesetCreateResponse, RulesetUpdateResponse, ) @@ -285,7 +285,7 @@ def test_method_list(self, client: Cloudflare) -> None: ruleset = client.rulesets.list( account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -293,7 +293,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: ruleset = client.rulesets.list( account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -305,7 +305,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[Ruleset], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -317,7 +317,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[Ruleset], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -734,7 +734,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: ruleset = await async_client.rulesets.list( account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -742,7 +742,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) ruleset = await async_client.rulesets.list( account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -754,7 +754,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[Ruleset], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -766,7 +766,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[Ruleset], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_user.py b/tests/api_resources/test_user.py index b8fc2776d01..1ffbb87e386 100644 --- a/tests/api_resources/test_user.py +++ b/tests/api_resources/test_user.py @@ -9,7 +9,6 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.user import UserGetResponse, UserEditResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,7 +19,7 @@ class TestUser: @parametrize def test_method_edit(self, client: Cloudflare) -> None: user = client.user.edit() - assert_matches_type(UserEditResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) @parametrize def test_method_edit_with_all_params(self, client: Cloudflare) -> None: @@ -31,7 +30,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: telephone="+1 123-123-1234", zipcode="12345", ) - assert_matches_type(UserEditResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -40,7 +39,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" user = response.parse() - assert_matches_type(UserEditResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -49,14 +48,14 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserEditResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_get(self, client: Cloudflare) -> None: user = client.user.get() - assert_matches_type(UserGetResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -65,7 +64,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" user = response.parse() - assert_matches_type(UserGetResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -74,7 +73,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(UserGetResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -85,7 +84,7 @@ class TestAsyncUser: @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: user = await async_client.user.edit() - assert_matches_type(UserEditResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) @parametrize async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -96,7 +95,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) telephone="+1 123-123-1234", zipcode="12345", ) - assert_matches_type(UserEditResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -105,7 +104,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" user = await response.parse() - assert_matches_type(UserEditResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -114,14 +113,14 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserEditResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: user = await async_client.user.get() - assert_matches_type(UserGetResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -130,7 +129,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" user = await response.parse() - assert_matches_type(UserGetResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -139,6 +138,6 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(UserGetResponse, user, path=["response"]) + assert_matches_type(object, user, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_warp_connector.py b/tests/api_resources/test_warp_connector.py index d94380162cd..7db50a0d321 100644 --- a/tests/api_resources/test_warp_connector.py +++ b/tests/api_resources/test_warp_connector.py @@ -86,6 +86,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: name="blog", page=1, per_page=1, + status="healthy", 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"), @@ -389,6 +390,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) name="blog", page=1, per_page=1, + status="healthy", 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/user/test_invites.py b/tests/api_resources/user/test_invites.py index 73926fbc056..a428b30e8f9 100644 --- a/tests/api_resources/user/test_invites.py +++ b/tests/api_resources/user/test_invites.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.user import Invite, InviteGetResponse, InviteEditResponse +from cloudflare.types.user import Invite base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -49,7 +49,7 @@ def test_method_edit(self, client: Cloudflare) -> None: "4f5f0c14a2a41d5063dd301b2f829f04", status="accepted", ) - assert_matches_type(InviteEditResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: @@ -61,7 +61,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" invite = response.parse() - assert_matches_type(InviteEditResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: @@ -73,7 +73,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = response.parse() - assert_matches_type(InviteEditResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -90,7 +90,7 @@ def test_method_get(self, client: Cloudflare) -> None: invite = client.user.invites.get( "4f5f0c14a2a41d5063dd301b2f829f04", ) - assert_matches_type(InviteGetResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -101,7 +101,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" invite = response.parse() - assert_matches_type(InviteGetResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -112,7 +112,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = response.parse() - assert_matches_type(InviteGetResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -158,7 +158,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: "4f5f0c14a2a41d5063dd301b2f829f04", status="accepted", ) - assert_matches_type(InviteEditResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) @parametrize async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -170,7 +170,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" invite = await response.parse() - assert_matches_type(InviteEditResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) @parametrize async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: @@ -182,7 +182,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = await response.parse() - assert_matches_type(InviteEditResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -199,7 +199,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: invite = await async_client.user.invites.get( "4f5f0c14a2a41d5063dd301b2f829f04", ) - assert_matches_type(InviteGetResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -210,7 +210,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" invite = await response.parse() - assert_matches_type(InviteGetResponse, invite, path=["response"]) + assert_matches_type(object, invite, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -221,7 +221,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = await response.parse() - assert_matches_type(InviteGetResponse, invite, path=["response"]) + assert_matches_type(object, 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 336fa525726..c129ec550be 100644 --- a/tests/api_resources/user/test_organizations.py +++ b/tests/api_resources/user/test_organizations.py @@ -10,11 +10,7 @@ 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 import Organization, OrganizationDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -103,7 +99,7 @@ def test_method_get(self, client: Cloudflare) -> None: organization = client.user.organizations.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OrganizationGetResponse, organization, path=["response"]) + assert_matches_type(object, organization, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -114,7 +110,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" organization = response.parse() - assert_matches_type(OrganizationGetResponse, organization, path=["response"]) + assert_matches_type(object, organization, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -125,7 +121,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = response.parse() - assert_matches_type(OrganizationGetResponse, organization, path=["response"]) + assert_matches_type(object, organization, path=["response"]) assert cast(Any, response.is_closed) is True @@ -221,7 +217,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: organization = await async_client.user.organizations.get( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OrganizationGetResponse, organization, path=["response"]) + assert_matches_type(object, organization, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -232,7 +228,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" organization = await response.parse() - assert_matches_type(OrganizationGetResponse, organization, path=["response"]) + assert_matches_type(object, organization, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -243,7 +239,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" organization = await response.parse() - assert_matches_type(OrganizationGetResponse, organization, path=["response"]) + assert_matches_type(object, organization, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/test_tokens.py b/tests/api_resources/user/test_tokens.py index 608a7beeb51..84f1a588242 100644 --- a/tests/api_resources/user/test_tokens.py +++ b/tests/api_resources/user/test_tokens.py @@ -12,10 +12,8 @@ from cloudflare._utils import parse_datetime from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.user import ( - TokenGetResponse, TokenCreateResponse, TokenDeleteResponse, - TokenUpdateResponse, TokenVerifyResponse, ) @@ -57,7 +55,7 @@ def test_method_create(self, client: Cloudflare) -> None: }, ], ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -67,7 +65,20 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: policies=[ { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -75,7 +86,20 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: }, { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -83,7 +107,20 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: }, { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -99,7 +136,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: expires_on=parse_datetime("2020-01-01T00:00:00Z"), not_before=parse_datetime("2018-07-01T05:20:00Z"), ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -137,7 +174,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(reason="TODO: investigate broken test") @parametrize @@ -175,7 +212,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 @@ -213,7 +250,7 @@ def test_method_update(self, client: Cloudflare) -> None: ], status="active", ) - assert_matches_type(TokenUpdateResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -224,7 +261,20 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: policies=[ { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -232,7 +282,20 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: }, { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -240,7 +303,20 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: }, { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -257,7 +333,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: expires_on=parse_datetime("2020-01-01T00:00:00Z"), not_before=parse_datetime("2018-07-01T05:20:00Z"), ) - assert_matches_type(TokenUpdateResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -297,7 +373,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" token = response.parse() - assert_matches_type(TokenUpdateResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -337,7 +413,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = response.parse() - assert_matches_type(TokenUpdateResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -411,7 +487,7 @@ def test_method_get(self, client: Cloudflare) -> None: token = client.user.tokens.get( {}, ) - assert_matches_type(TokenGetResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -422,7 +498,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" token = response.parse() - assert_matches_type(TokenGetResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -433,14 +509,14 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = response.parse() - assert_matches_type(TokenGetResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_verify(self, client: Cloudflare) -> None: token = client.user.tokens.verify() - assert_matches_type(TokenVerifyResponse, token, path=["response"]) + assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"]) @parametrize def test_raw_response_verify(self, client: Cloudflare) -> None: @@ -449,7 +525,7 @@ def test_raw_response_verify(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(TokenVerifyResponse, token, path=["response"]) + assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"]) @parametrize def test_streaming_response_verify(self, client: Cloudflare) -> None: @@ -458,7 +534,7 @@ def test_streaming_response_verify(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = response.parse() - assert_matches_type(TokenVerifyResponse, token, path=["response"]) + assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -498,7 +574,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: }, ], ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -508,7 +584,20 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare policies=[ { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -516,7 +605,20 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare }, { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -524,7 +626,20 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare }, { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -540,7 +655,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare expires_on=parse_datetime("2020-01-01T00:00:00Z"), not_before=parse_datetime("2018-07-01T05:20:00Z"), ) - assert_matches_type(TokenCreateResponse, token, path=["response"]) + assert_matches_type(Optional[TokenCreateResponse], token, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -578,7 +693,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(reason="TODO: investigate broken test") @parametrize @@ -616,7 +731,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 @@ -654,7 +769,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: ], status="active", ) - assert_matches_type(TokenUpdateResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -665,7 +780,20 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare policies=[ { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -673,7 +801,20 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare }, { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -681,7 +822,20 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare }, { "effect": "allow", - "permission_groups": [{}, {}], + "permission_groups": [ + { + "meta": { + "label": "load_balancer_admin", + "scopes": "com.cloudflare.api.account", + } + }, + { + "meta": { + "label": "fbm_user", + "scopes": "com.cloudflare.api.account", + } + }, + ], "resources": { "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*", "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*", @@ -698,7 +852,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare expires_on=parse_datetime("2020-01-01T00:00:00Z"), not_before=parse_datetime("2018-07-01T05:20:00Z"), ) - assert_matches_type(TokenUpdateResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -738,7 +892,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" token = await response.parse() - assert_matches_type(TokenUpdateResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -778,7 +932,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = await response.parse() - assert_matches_type(TokenUpdateResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -852,7 +1006,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: token = await async_client.user.tokens.get( {}, ) - assert_matches_type(TokenGetResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -863,7 +1017,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" token = await response.parse() - assert_matches_type(TokenGetResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -874,14 +1028,14 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = await response.parse() - assert_matches_type(TokenGetResponse, token, path=["response"]) + assert_matches_type(object, token, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_verify(self, async_client: AsyncCloudflare) -> None: token = await async_client.user.tokens.verify() - assert_matches_type(TokenVerifyResponse, token, path=["response"]) + assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"]) @parametrize async def test_raw_response_verify(self, async_client: AsyncCloudflare) -> None: @@ -890,7 +1044,7 @@ async def test_raw_response_verify(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(TokenVerifyResponse, token, path=["response"]) + assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"]) @parametrize async def test_streaming_response_verify(self, async_client: AsyncCloudflare) -> None: @@ -899,6 +1053,6 @@ async def test_streaming_response_verify(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" token = await response.parse() - assert_matches_type(TokenVerifyResponse, token, path=["response"]) + assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/vectorize/test_indexes.py b/tests/api_resources/vectorize/test_indexes.py index d0a4beb4ea0..a4873ac1510 100644 --- a/tests/api_resources/vectorize/test_indexes.py +++ b/tests/api_resources/vectorize/test_indexes.py @@ -403,7 +403,7 @@ def test_method_insert(self, client: Cloudflare) -> None: index = client.vectorize.indexes.insert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) assert_matches_type(Optional[IndexInsert], index, path=["response"]) @@ -413,7 +413,7 @@ def test_raw_response_insert(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.insert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) assert response.is_closed is True @@ -427,7 +427,7 @@ def test_streaming_response_insert(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.insert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -444,14 +444,14 @@ def test_path_params_insert(self, client: Cloudflare) -> None: client.vectorize.indexes.with_raw_response.insert( "example-index", account_id="", - body={}, + body=b"raw file contents", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): client.vectorize.indexes.with_raw_response.insert( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) @parametrize @@ -529,7 +529,7 @@ def test_method_upsert(self, client: Cloudflare) -> None: index = client.vectorize.indexes.upsert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) assert_matches_type(Optional[IndexUpsert], index, path=["response"]) @@ -539,7 +539,7 @@ def test_raw_response_upsert(self, client: Cloudflare) -> None: response = client.vectorize.indexes.with_raw_response.upsert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) assert response.is_closed is True @@ -553,7 +553,7 @@ def test_streaming_response_upsert(self, client: Cloudflare) -> None: with client.vectorize.indexes.with_streaming_response.upsert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -570,14 +570,14 @@ def test_path_params_upsert(self, client: Cloudflare) -> None: client.vectorize.indexes.with_raw_response.upsert( "example-index", account_id="", - body={}, + body=b"raw file contents", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `index_name` but received ''"): client.vectorize.indexes.with_raw_response.upsert( "", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) @@ -962,7 +962,7 @@ async def test_method_insert(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.insert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) assert_matches_type(Optional[IndexInsert], index, path=["response"]) @@ -972,7 +972,7 @@ async def test_raw_response_insert(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.insert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) assert response.is_closed is True @@ -986,7 +986,7 @@ async def test_streaming_response_insert(self, async_client: AsyncCloudflare) -> async with async_client.vectorize.indexes.with_streaming_response.insert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1003,14 +1003,14 @@ async def test_path_params_insert(self, async_client: AsyncCloudflare) -> None: await async_client.vectorize.indexes.with_raw_response.insert( "example-index", account_id="", - body={}, + body=b"raw file contents", ) 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_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) @parametrize @@ -1088,7 +1088,7 @@ async def test_method_upsert(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.upsert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) assert_matches_type(Optional[IndexUpsert], index, path=["response"]) @@ -1098,7 +1098,7 @@ async def test_raw_response_upsert(self, async_client: AsyncCloudflare) -> None: response = await async_client.vectorize.indexes.with_raw_response.upsert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) assert response.is_closed is True @@ -1112,7 +1112,7 @@ async def test_streaming_response_upsert(self, async_client: AsyncCloudflare) -> async with async_client.vectorize.indexes.with_streaming_response.upsert( "example-index", account_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1129,12 +1129,12 @@ async def test_path_params_upsert(self, async_client: AsyncCloudflare) -> None: await async_client.vectorize.indexes.with_raw_response.upsert( "example-index", account_id="", - body={}, + body=b"raw file contents", ) 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_id="023e105f4ecef8ad9ca31a8372d0c353", - body={}, + body=b"raw file contents", ) diff --git a/tests/api_resources/workers/ai/__init__.py b/tests/api_resources/workers/ai/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/workers/ai/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/workers/ai/models/__init__.py b/tests/api_resources/workers/ai/models/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/workers/ai/models/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/workers/ai/models/test_schema.py b/tests/api_resources/workers/ai/models/test_schema.py new file mode 100644 index 00000000000..5937cee8a64 --- /dev/null +++ b/tests/api_resources/workers/ai/models/test_schema.py @@ -0,0 +1,105 @@ +# 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 TestSchema: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + schema = client.workers.ai.models.schema.get( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="string", + ) + assert_matches_type(object, schema, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.workers.ai.models.schema.with_raw_response.get( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema = response.parse() + assert_matches_type(object, schema, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.workers.ai.models.schema.with_streaming_response.get( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema = response.parse() + assert_matches_type(object, schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.workers.ai.models.schema.with_raw_response.get( + account_id="", + model="string", + ) + + +class TestAsyncSchema: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + schema = await async_client.workers.ai.models.schema.get( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="string", + ) + assert_matches_type(object, schema, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.workers.ai.models.schema.with_raw_response.get( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + schema = await response.parse() + assert_matches_type(object, schema, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.workers.ai.models.schema.with_streaming_response.get( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + model="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + schema = await response.parse() + assert_matches_type(object, schema, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.workers.ai.models.schema.with_raw_response.get( + account_id="", + model="string", + ) diff --git a/tests/api_resources/workers/scripts/test_versions.py b/tests/api_resources/workers/scripts/test_versions.py index 11e2b69000d..1642da69882 100644 --- a/tests/api_resources/workers/scripts/test_versions.py +++ b/tests/api_resources/workers/scripts/test_versions.py @@ -9,6 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination from cloudflare.types.workers.scripts import ( VersionGetResponse, VersionListResponse, @@ -107,7 +108,18 @@ def test_method_list(self, client: Cloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncV4PagePagination[VersionListResponse], version, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + version = client.workers.scripts.versions.list( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + deployable=True, + page=0, + per_page=0, + ) + assert_matches_type(SyncV4PagePagination[VersionListResponse], version, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -119,7 +131,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(Optional[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncV4PagePagination[VersionListResponse], version, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -131,7 +143,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(Optional[VersionListResponse], version, path=["response"]) + assert_matches_type(SyncV4PagePagination[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -299,7 +311,18 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "this-is_my_script-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncV4PagePagination[VersionListResponse], version, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + version = await async_client.workers.scripts.versions.list( + "this-is_my_script-01", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + deployable=True, + page=0, + per_page=0, + ) + assert_matches_type(AsyncV4PagePagination[VersionListResponse], version, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -311,7 +334,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(Optional[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncV4PagePagination[VersionListResponse], version, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -323,7 +346,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(Optional[VersionListResponse], version, path=["response"]) + assert_matches_type(AsyncV4PagePagination[VersionListResponse], version, 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 745e334fc35..d544d4b922b 100644 --- a/tests/api_resources/zero_trust/access/applications/test_cas.py +++ b/tests/api_resources/zero_trust/access/applications/test_cas.py @@ -67,7 +67,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): client.zero_trust.access.applications.cas.with_raw_response.create( "", account_id="string", @@ -189,7 +189,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): client.zero_trust.access.applications.cas.with_raw_response.delete( "", account_id="string", @@ -256,7 +256,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): client.zero_trust.access.applications.cas.with_raw_response.get( "", account_id="string", @@ -327,7 +327,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): await async_client.zero_trust.access.applications.cas.with_raw_response.create( "", account_id="string", @@ -449,7 +449,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): await async_client.zero_trust.access.applications.cas.with_raw_response.delete( "", account_id="string", @@ -516,7 +516,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): await async_client.zero_trust.access.applications.cas.with_raw_response.get( "", account_id="string", 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 88c1920f5e9..767aa03ea30 100644 --- a/tests/api_resources/zero_trust/access/applications/test_policies.py +++ b/tests/api_resources/zero_trust/access/applications/test_policies.py @@ -11,8 +11,11 @@ from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access.applications import ( - Policy, + PolicyGetResponse, + PolicyListResponse, + PolicyCreateResponse, PolicyDeleteResponse, + PolicyUpdateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -35,7 +38,7 @@ def test_method_create(self, client: Cloudflare) -> None: name="Allow devs", account_id="string", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -79,7 +82,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: ], session_duration="24h", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -99,7 +102,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[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -119,14 +122,14 @@ 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[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.create( "", decision="allow", @@ -170,7 +173,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: policy = client.zero_trust.access.applications.policies.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -180,14 +183,14 @@ def test_method_update(self, client: Cloudflare) -> None: name="Allow devs", account_id="string", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: policy = client.zero_trust.access.applications.policies.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -225,14 +228,14 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: ], session_duration="24h", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.zero_trust.access.applications.policies.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -246,14 +249,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" policy = response.parse() - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.zero_trust.access.applications.policies.with_streaming_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -267,17 +270,17 @@ 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(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", + app_id="", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -288,10 +291,10 @@ def test_path_params_update(self, client: Cloudflare) -> None: account_id="string", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.update( "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -305,7 +308,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.zero_trust.access.applications.policies.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -319,7 +322,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -337,7 +340,7 @@ def test_method_list(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) - assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -346,7 +349,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) - assert_matches_type(SyncSinglePage[Policy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -359,7 +362,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[Policy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -372,14 +375,14 @@ 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[Policy], policy, path=["response"]) + assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.list( "", account_id="string", @@ -402,7 +405,7 @@ def test_path_params_list(self, client: Cloudflare) -> None: def test_method_delete(self, client: Cloudflare) -> None: policy = client.zero_trust.access.applications.policies.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @@ -412,7 +415,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_method_delete_with_all_params(self, client: Cloudflare) -> None: policy = client.zero_trust.access.applications.policies.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @@ -422,7 +425,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.access.applications.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) @@ -436,7 +439,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.access.applications.policies.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) as response: assert not response.is_closed @@ -450,31 +453,31 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", + app_id="", account_id="string", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.delete( "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) @@ -483,79 +486,79 @@ def test_path_params_delete(self, client: Cloudflare) -> None: def test_method_get(self, client: Cloudflare) -> None: policy = client.zero_trust.access.applications.policies.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: policy = client.zero_trust.access.applications.policies.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.access.applications.policies.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.access.applications.policies.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", + app_id="", account_id="string", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.get( "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): client.zero_trust.access.applications.policies.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) @@ -577,7 +580,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: name="Allow devs", account_id="string", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -621,7 +624,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare ], session_duration="24h", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -641,7 +644,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[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -661,14 +664,14 @@ 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[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.create( "", decision="allow", @@ -712,7 +715,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: policy = await async_client.zero_trust.access.applications.policies.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -722,14 +725,14 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: name="Allow devs", account_id="string", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: policy = await async_client.zero_trust.access.applications.policies.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -767,14 +770,14 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare ], session_duration="24h", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.applications.policies.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -788,14 +791,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" policy = await response.parse() - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.access.applications.policies.with_streaming_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -809,17 +812,17 @@ 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(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", + app_id="", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -830,10 +833,10 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: account_id="string", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.update( "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -847,7 +850,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.zero_trust.access.applications.policies.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -861,7 +864,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", decision="allow", include=[ {"email": {"email": "test@example.com"}}, @@ -879,7 +882,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) - assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -888,7 +891,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) - assert_matches_type(AsyncSinglePage[Policy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -901,7 +904,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[Policy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -914,14 +917,14 @@ 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[Policy], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.list( "", account_id="string", @@ -944,7 +947,7 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: async def test_method_delete(self, async_client: AsyncCloudflare) -> None: policy = await async_client.zero_trust.access.applications.policies.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @@ -954,7 +957,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare) -> None: policy = await async_client.zero_trust.access.applications.policies.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) @@ -964,7 +967,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.zero_trust.access.applications.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) @@ -978,7 +981,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.zero_trust.access.applications.policies.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) as response: assert not response.is_closed @@ -992,31 +995,31 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", + app_id="", account_id="string", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.delete( "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) @@ -1025,78 +1028,78 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: async def test_method_get(self, async_client: AsyncCloudflare) -> None: policy = await async_client.zero_trust.access.applications.policies.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: policy = await async_client.zero_trust.access.applications.policies.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.applications.policies.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.access.applications.policies.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[Policy], policy, path=["response"]) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid1` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `app_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="", + app_id="", account_id="string", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.get( "", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): await async_client.zero_trust.access.applications.policies.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - uuid1="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + app_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="string", ) 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 6e0b18db5a3..3eafad4f1a6 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,6 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare._utils import parse_datetime from cloudflare.types.zero_trust.access.logs import AccessRequestListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,14 +21,25 @@ class TestAccessRequests: @parametrize def test_method_list(self, client: Cloudflare) -> None: access_request = client.zero_trust.access.logs.access_requests.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[AccessRequestListResponse], access_request, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Cloudflare) -> None: + access_request = client.zero_trust.access.logs.access_requests.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + direction="desc", + limit=0, + since=parse_datetime("2020-07-01T05:20:00Z"), + until=parse_datetime("2020-10-01T05:20:00Z"), ) assert_matches_type(Optional[AccessRequestListResponse], access_request, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.zero_trust.access.logs.access_requests.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -38,7 +50,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.zero_trust.access.logs.access_requests.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" @@ -50,9 +62,9 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.logs.access_requests.with_raw_response.list( - "", + account_id="", ) @@ -62,14 +74,25 @@ class TestAsyncAccessRequests: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: access_request = await async_client.zero_trust.access.logs.access_requests.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[AccessRequestListResponse], access_request, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: + access_request = await async_client.zero_trust.access.logs.access_requests.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + direction="desc", + limit=0, + since=parse_datetime("2020-07-01T05:20:00Z"), + until=parse_datetime("2020-10-01T05:20:00Z"), ) assert_matches_type(Optional[AccessRequestListResponse], access_request, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.logs.access_requests.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -80,7 +103,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.zero_trust.access.logs.access_requests.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" @@ -92,7 +115,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.logs.access_requests.with_raw_response.list( - "", + account_id="", ) diff --git a/tests/api_resources/zero_trust/access/test_applications.py b/tests/api_resources/zero_trust/access/test_applications.py index 3d23e6dc146..299c51d1ce9 100644 --- a/tests/api_resources/zero_trust/access/test_applications.py +++ b/tests/api_resources/zero_trust/access/test_applications.py @@ -11,8 +11,11 @@ from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access import ( - Application, + ApplicationGetResponse, + ApplicationListResponse, + ApplicationCreateResponse, ApplicationDeleteResponse, + ApplicationUpdateResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -29,7 +32,7 @@ def test_method_create_overload_1(self, client: Cloudflare) -> None: type="self_hosted", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -70,14 +73,74 @@ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> N name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -91,7 +154,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -105,7 +168,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -132,7 +195,7 @@ def test_method_create_overload_2(self, client: Cloudflare) -> None: application = client.zero_trust.access.applications.create( account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -153,6 +216,20 @@ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> N ], logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], saas_app={ "auth_type": "saml", "consumer_service_url": "https://example.com", @@ -178,10 +255,56 @@ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> N "sp_entity_id": "example unique name", "sso_endpoint": "https://example.cloudflareaccess.com/cdn-cgi/access/sso/saml/b3f58a2b414e0b51d45c8c2af26fccca0e27c63763c426fa52f98dcf0b3b3bfd", }, + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, tags=["engineers", "engineers", "engineers"], type="saas", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -193,7 +316,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -205,7 +328,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -230,7 +353,7 @@ def test_method_create_overload_3(self, client: Cloudflare) -> None: type="ssh", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -271,14 +394,74 @@ def test_method_create_with_all_params_overload_3(self, client: Cloudflare) -> N name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -292,7 +475,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -306,7 +489,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -335,7 +518,7 @@ def test_method_create_overload_4(self, client: Cloudflare) -> None: type="vnc", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -376,14 +559,74 @@ def test_method_create_with_all_params_overload_4(self, client: Cloudflare) -> N name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -397,7 +640,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -411,7 +654,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -439,7 +682,7 @@ def test_method_create_overload_5(self, client: Cloudflare) -> None: type="app_launcher", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -453,9 +696,69 @@ def test_method_create_with_all_params_overload_5(self, client: Cloudflare) -> N "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -468,7 +771,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -481,7 +784,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -507,7 +810,7 @@ def test_method_create_overload_6(self, client: Cloudflare) -> None: type="warp", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -521,9 +824,69 @@ def test_method_create_with_all_params_overload_6(self, client: Cloudflare) -> N "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -536,7 +899,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -549,7 +912,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -575,7 +938,7 @@ def test_method_create_overload_7(self, client: Cloudflare) -> None: type="biso", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -589,9 +952,69 @@ def test_method_create_with_all_params_overload_7(self, client: Cloudflare) -> N "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -604,7 +1027,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -617,7 +1040,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -642,7 +1065,7 @@ def test_method_create_overload_8(self, client: Cloudflare) -> None: application = client.zero_trust.access.applications.create( account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -653,10 +1076,56 @@ def test_method_create_with_all_params_overload_8(self, client: Cloudflare) -> N domain="https://mybookmark.com", logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, tags=["engineers", "engineers", "engineers"], type="bookmark", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -668,7 +1137,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -680,7 +1149,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -706,7 +1175,7 @@ def test_method_update_overload_1(self, client: Cloudflare) -> None: type="self_hosted", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -748,14 +1217,74 @@ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> N name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -770,7 +1299,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -785,7 +1314,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -815,7 +1344,7 @@ def test_method_update_overload_2(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -837,6 +1366,20 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N ], logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], saas_app={ "auth_type": "saml", "consumer_service_url": "https://example.com", @@ -862,10 +1405,56 @@ def test_method_update_with_all_params_overload_2(self, client: Cloudflare) -> N "sp_entity_id": "example unique name", "sso_endpoint": "https://example.cloudflareaccess.com/cdn-cgi/access/sso/saml/b3f58a2b414e0b51d45c8c2af26fccca0e27c63763c426fa52f98dcf0b3b3bfd", }, + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, tags=["engineers", "engineers", "engineers"], type="saas", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -878,7 +1467,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -891,7 +1480,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -919,7 +1508,7 @@ def test_method_update_overload_3(self, client: Cloudflare) -> None: type="ssh", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -961,14 +1550,74 @@ def test_method_update_with_all_params_overload_3(self, client: Cloudflare) -> N name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -983,7 +1632,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -998,7 +1647,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1030,7 +1679,7 @@ def test_method_update_overload_4(self, client: Cloudflare) -> None: type="vnc", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1072,14 +1721,74 @@ def test_method_update_with_all_params_overload_4(self, client: Cloudflare) -> N name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1094,7 +1803,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1109,7 +1818,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1140,7 +1849,7 @@ def test_method_update_overload_5(self, client: Cloudflare) -> None: type="app_launcher", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1155,9 +1864,69 @@ def test_method_update_with_all_params_overload_5(self, client: Cloudflare) -> N "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1171,7 +1940,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1185,7 +1954,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1214,7 +1983,7 @@ def test_method_update_overload_6(self, client: Cloudflare) -> None: type="warp", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1229,9 +1998,69 @@ def test_method_update_with_all_params_overload_6(self, client: Cloudflare) -> N "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1245,7 +2074,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1259,7 +2088,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1288,7 +2117,7 @@ def test_method_update_overload_7(self, client: Cloudflare) -> None: type="biso", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1303,9 +2132,69 @@ def test_method_update_with_all_params_overload_7(self, client: Cloudflare) -> N "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1319,7 +2208,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1333,7 +2222,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1361,7 +2250,7 @@ def test_method_update_overload_8(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1373,10 +2262,56 @@ def test_method_update_with_all_params_overload_8(self, client: Cloudflare) -> N domain="https://mybookmark.com", logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, tags=["engineers", "engineers", "engineers"], type="bookmark", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1389,7 +2324,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1402,7 +2337,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1427,7 +2362,7 @@ def test_method_list(self, client: Cloudflare) -> None: application = client.zero_trust.access.applications.list( account_id="string", ) - assert_matches_type(SyncSinglePage[Application], application, path=["response"]) + assert_matches_type(SyncSinglePage[ApplicationListResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1435,7 +2370,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: application = client.zero_trust.access.applications.list( account_id="string", ) - assert_matches_type(SyncSinglePage[Application], application, path=["response"]) + assert_matches_type(SyncSinglePage[ApplicationListResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1447,7 +2382,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[Application], application, path=["response"]) + assert_matches_type(SyncSinglePage[ApplicationListResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1459,7 +2394,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[Application], application, path=["response"]) + assert_matches_type(SyncSinglePage[ApplicationListResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1544,7 +2479,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationGetResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1553,7 +2488,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationGetResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1566,7 +2501,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationGetResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1579,7 +2514,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationGetResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1671,7 +2606,7 @@ async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> type="self_hosted", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1712,14 +2647,74 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1733,7 +2728,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1747,7 +2742,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1774,7 +2769,7 @@ async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> application = await async_client.zero_trust.access.applications.create( account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1795,6 +2790,20 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn ], logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], saas_app={ "auth_type": "saml", "consumer_service_url": "https://example.com", @@ -1820,10 +2829,56 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn "sp_entity_id": "example unique name", "sso_endpoint": "https://example.cloudflareaccess.com/cdn-cgi/access/sso/saml/b3f58a2b414e0b51d45c8c2af26fccca0e27c63763c426fa52f98dcf0b3b3bfd", }, + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, tags=["engineers", "engineers", "engineers"], type="saas", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1835,7 +2890,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1847,7 +2902,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1872,7 +2927,7 @@ async def test_method_create_overload_3(self, async_client: AsyncCloudflare) -> type="ssh", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1913,14 +2968,74 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1934,7 +3049,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -1948,7 +3063,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1977,7 +3092,7 @@ async def test_method_create_overload_4(self, async_client: AsyncCloudflare) -> type="vnc", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2018,14 +3133,74 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2039,7 +3214,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2053,7 +3228,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2081,7 +3256,7 @@ async def test_method_create_overload_5(self, async_client: AsyncCloudflare) -> type="app_launcher", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2095,9 +3270,69 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2110,7 +3345,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2123,7 +3358,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2149,7 +3384,7 @@ async def test_method_create_overload_6(self, async_client: AsyncCloudflare) -> type="warp", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2163,9 +3398,69 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2178,7 +3473,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2191,7 +3486,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2217,7 +3512,7 @@ async def test_method_create_overload_7(self, async_client: AsyncCloudflare) -> type="biso", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2231,9 +3526,69 @@ async def test_method_create_with_all_params_overload_7(self, async_client: Asyn "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2246,7 +3601,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2259,7 +3614,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2284,7 +3639,7 @@ async def test_method_create_overload_8(self, async_client: AsyncCloudflare) -> application = await async_client.zero_trust.access.applications.create( account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2295,10 +3650,56 @@ async def test_method_create_with_all_params_overload_8(self, async_client: Asyn domain="https://mybookmark.com", logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, tags=["engineers", "engineers", "engineers"], type="bookmark", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2310,7 +3711,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2322,7 +3723,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationCreateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2348,7 +3749,7 @@ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> type="self_hosted", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2390,14 +3791,74 @@ async def test_method_update_with_all_params_overload_1(self, async_client: Asyn name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2412,7 +3873,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2427,7 +3888,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2457,7 +3918,7 @@ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2479,6 +3940,20 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn ], logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], saas_app={ "auth_type": "saml", "consumer_service_url": "https://example.com", @@ -2504,10 +3979,56 @@ async def test_method_update_with_all_params_overload_2(self, async_client: Asyn "sp_entity_id": "example unique name", "sso_endpoint": "https://example.cloudflareaccess.com/cdn-cgi/access/sso/saml/b3f58a2b414e0b51d45c8c2af26fccca0e27c63763c426fa52f98dcf0b3b3bfd", }, + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, tags=["engineers", "engineers", "engineers"], type="saas", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2520,7 +4041,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2533,7 +4054,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2561,7 +4082,7 @@ async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> type="ssh", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2603,14 +4124,74 @@ async def test_method_update_with_all_params_overload_3(self, async_client: Asyn name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2625,7 +4206,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2640,7 +4221,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2672,7 +4253,7 @@ async def test_method_update_overload_4(self, async_client: AsyncCloudflare) -> type="vnc", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2714,14 +4295,74 @@ async def test_method_update_with_all_params_overload_4(self, async_client: Asyn name="Admin Site", options_preflight_bypass=True, path_cookie_attribute=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], same_site_cookie_attribute="strict", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, self_hosted_domains=["test.example.com/admin", "test.anotherexample.com/staff"], service_auth_401_redirect=True, session_duration="24h", skip_interstitial=True, tags=["engineers", "engineers", "engineers"], ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2736,7 +4377,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2751,7 +4392,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2782,7 +4423,7 @@ async def test_method_update_overload_5(self, async_client: AsyncCloudflare) -> type="app_launcher", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2797,9 +4438,69 @@ async def test_method_update_with_all_params_overload_5(self, async_client: Asyn "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2813,7 +4514,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2827,7 +4528,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2856,7 +4557,7 @@ async def test_method_update_overload_6(self, async_client: AsyncCloudflare) -> type="warp", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2871,9 +4572,69 @@ async def test_method_update_with_all_params_overload_6(self, async_client: Asyn "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2887,7 +4648,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2901,7 +4662,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -2930,7 +4691,7 @@ async def test_method_update_overload_7(self, async_client: AsyncCloudflare) -> type="biso", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2945,9 +4706,69 @@ async def test_method_update_with_all_params_overload_7(self, async_client: Asyn "699d98642c564d2e855e9661899b7252", ], auto_redirect_to_identity=True, + policies=[ + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + { + "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + "precedence": 0, + }, + ], + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, session_duration="24h", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2961,7 +4782,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -2975,7 +4796,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3003,7 +4824,7 @@ async def test_method_update_overload_8(self, async_client: AsyncCloudflare) -> "023e105f4ecef8ad9ca31a8372d0c353", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3015,10 +4836,56 @@ async def test_method_update_with_all_params_overload_8(self, async_client: Asyn domain="https://mybookmark.com", logo_url="https://www.cloudflare.com/img/logo-web-badges/cf-logo-on-white-bg.svg", name="Admin Site", + scim_config={ + "authentication": { + "password": "string", + "scheme": "httpbasic", + "user": "string", + }, + "deactivate_on_delete": True, + "enabled": True, + "idp_uid": "string", + "mappings": [ + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + { + "enabled": True, + "filter": 'title pr or userType eq "Intern"', + "operations": { + "create": True, + "delete": True, + "update": True, + }, + "schema": "urn:ietf:params:scim:schemas:core:2.0:User", + "transform_jsonata": "$merge([$, {'userName': $substringBefore($.userName, '@') & '+test@' & $substringAfter($.userName, '@')}])", + }, + ], + "remote_uri": "string", + }, tags=["engineers", "engineers", "engineers"], type="bookmark", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3031,7 +4898,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3044,7 +4911,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationUpdateResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3069,7 +4936,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: application = await async_client.zero_trust.access.applications.list( account_id="string", ) - assert_matches_type(AsyncSinglePage[Application], application, path=["response"]) + assert_matches_type(AsyncSinglePage[ApplicationListResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3077,7 +4944,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) application = await async_client.zero_trust.access.applications.list( account_id="string", ) - assert_matches_type(AsyncSinglePage[Application], application, path=["response"]) + assert_matches_type(AsyncSinglePage[ApplicationListResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3089,7 +4956,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[Application], application, path=["response"]) + assert_matches_type(AsyncSinglePage[ApplicationListResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3101,7 +4968,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[Application], application, path=["response"]) + assert_matches_type(AsyncSinglePage[ApplicationListResponse], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3186,7 +5053,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationGetResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3195,7 +5062,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - "023e105f4ecef8ad9ca31a8372d0c353", account_id="string", ) - assert_matches_type(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationGetResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3208,7 +5075,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationGetResponse], application, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -3221,7 +5088,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(Optional[Application], application, path=["response"]) + assert_matches_type(Optional[ApplicationGetResponse], 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 f063d8abf85..5cd16fddf4a 100644 --- a/tests/api_resources/zero_trust/access/test_bookmarks.py +++ b/tests/api_resources/zero_trust/access/test_bookmarks.py @@ -25,7 +25,7 @@ class TestBookmarks: def test_method_create(self, client: Cloudflare) -> None: bookmark = client.zero_trust.access.bookmarks.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @@ -34,7 +34,7 @@ def test_method_create(self, client: Cloudflare) -> None: 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", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) @@ -47,7 +47,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: 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", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) as response: assert not response.is_closed @@ -60,17 +60,17 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", body={}, ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.create( "", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) @@ -78,7 +78,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: bookmark = client.zero_trust.access.bookmarks.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @@ -87,7 +87,7 @@ def test_method_update(self, client: Cloudflare) -> None: 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", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) @@ -100,7 +100,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: 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", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) as response: assert not response.is_closed @@ -113,31 +113,31 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", body={}, ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.update( "", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) @parametrize def test_method_list(self, client: Cloudflare) -> None: bookmark = client.zero_trust.access.bookmarks.list( - "699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(SyncSinglePage[Bookmark], bookmark, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.zero_trust.access.bookmarks.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -148,7 +148,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.zero_trust.access.bookmarks.with_streaming_response.list( - "699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -160,16 +160,16 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.list( - "", + account_id="", ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: bookmark = client.zero_trust.access.bookmarks.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) @@ -177,7 +177,7 @@ def test_method_delete(self, client: Cloudflare) -> None: 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", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -189,7 +189,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: 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", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -201,23 +201,23 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @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 ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.delete( "", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) @parametrize def test_method_get(self, client: Cloudflare) -> None: bookmark = client.zero_trust.access.bookmarks.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @@ -225,7 +225,7 @@ def test_method_get(self, client: Cloudflare) -> None: def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.access.bookmarks.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -237,7 +237,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.access.bookmarks.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -249,16 +249,16 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"): client.zero_trust.access.bookmarks.with_raw_response.get( "", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) @@ -269,7 +269,7 @@ class TestAsyncBookmarks: 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", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @@ -278,7 +278,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.zero_trust.access.bookmarks.with_raw_response.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) @@ -291,7 +291,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.zero_trust.access.bookmarks.with_streaming_response.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) as response: assert not response.is_closed @@ -304,17 +304,17 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.create( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", body={}, ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.create( "", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) @@ -322,7 +322,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: 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", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @@ -331,7 +331,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.zero_trust.access.bookmarks.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) @@ -344,7 +344,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.access.bookmarks.with_streaming_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) as response: assert not response.is_closed @@ -357,31 +357,31 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", body={}, ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.update( "", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", body={}, ) @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: bookmark = await async_client.zero_trust.access.bookmarks.list( - "699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(AsyncSinglePage[Bookmark], bookmark, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.bookmarks.with_raw_response.list( - "699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -392,7 +392,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.zero_trust.access.bookmarks.with_streaming_response.list( - "699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -404,16 +404,16 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.list( - "", + account_id="", ) @parametrize 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", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(Optional[BookmarkDeleteResponse], bookmark, path=["response"]) @@ -421,7 +421,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.zero_trust.access.bookmarks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -433,7 +433,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.zero_trust.access.bookmarks.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -445,23 +445,23 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @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 ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.delete( "", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: bookmark = await async_client.zero_trust.access.bookmarks.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) assert_matches_type(Optional[Bookmark], bookmark, path=["response"]) @@ -469,7 +469,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.access.bookmarks.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) assert response.is_closed is True @@ -481,7 +481,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.access.bookmarks.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -493,14 +493,14 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `bookmark_id` but received ''"): await async_client.zero_trust.access.bookmarks.with_raw_response.get( "", - identifier="699d98642c564d2e855e9661899b7252", + account_id="699d98642c564d2e855e9661899b7252", ) diff --git a/tests/api_resources/zero_trust/access/test_certificates.py b/tests/api_resources/zero_trust/access/test_certificates.py index 14d5566332c..cfcd002940d 100644 --- a/tests/api_resources/zero_trust/access/test_certificates.py +++ b/tests/api_resources/zero_trust/access/test_certificates.py @@ -143,7 +143,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): client.zero_trust.access.certificates.with_raw_response.update( "", associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], @@ -268,7 +268,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): client.zero_trust.access.certificates.with_raw_response.delete( "", account_id="string", @@ -335,7 +335,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): client.zero_trust.access.certificates.with_raw_response.get( "", account_id="string", @@ -479,7 +479,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): await async_client.zero_trust.access.certificates.with_raw_response.update( "", associated_hostnames=["admin.example.com", "admin.example.com", "admin.example.com"], @@ -604,7 +604,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): await async_client.zero_trust.access.certificates.with_raw_response.delete( "", account_id="string", @@ -671,7 +671,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `certificate_id` but received ''"): await async_client.zero_trust.access.certificates.with_raw_response.get( "", account_id="string", 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 7c84edab1bc..4677021a7a3 100644 --- a/tests/api_resources/zero_trust/access/test_custom_pages.py +++ b/tests/api_resources/zero_trust/access/test_custom_pages.py @@ -25,7 +25,7 @@ class TestCustomPages: @parametrize def test_method_create(self, client: Cloudflare) -> None: custom_page = client.zero_trust.access.custom_pages.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -35,7 +35,7 @@ def test_method_create(self, client: Cloudflare) -> None: @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: custom_page = client.zero_trust.access.custom_pages.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -46,7 +46,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.zero_trust.access.custom_pages.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -60,7 +60,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.zero_trust.access.custom_pages.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -75,9 +75,9 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.custom_pages.with_raw_response.create( - "", + account_id="", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -87,7 +87,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: custom_page = client.zero_trust.access.custom_pages.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -98,7 +98,7 @@ def test_method_update(self, client: Cloudflare) -> None: def test_method_update_with_all_params(self, client: Cloudflare) -> None: custom_page = client.zero_trust.access.custom_pages.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -110,7 +110,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.access.custom_pages.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -125,7 +125,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.zero_trust.access.custom_pages.with_streaming_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -140,19 +140,19 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.custom_pages.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", custom_html="

Access Denied

", name="string", type="identity_denied", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_page_id` but received ''"): client.zero_trust.access.custom_pages.with_raw_response.update( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -161,14 +161,14 @@ def test_path_params_update(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: custom_page = client.zero_trust.access.custom_pages.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.zero_trust.access.custom_pages.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -179,7 +179,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.zero_trust.access.custom_pages.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" @@ -191,16 +191,16 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.custom_pages.with_raw_response.list( - "", + account_id="", ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: custom_page = client.zero_trust.access.custom_pages.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) @@ -208,7 +208,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.access.custom_pages.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -220,7 +220,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.access.custom_pages.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -232,23 +232,23 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @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 ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.custom_pages.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_page_id` but received ''"): client.zero_trust.access.custom_pages.with_raw_response.delete( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize def test_method_get(self, client: Cloudflare) -> None: custom_page = client.zero_trust.access.custom_pages.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) @@ -256,7 +256,7 @@ def test_method_get(self, client: Cloudflare) -> None: def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.access.custom_pages.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -268,7 +268,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.access.custom_pages.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -280,16 +280,16 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.custom_pages.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_page_id` but received ''"): client.zero_trust.access.custom_pages.with_raw_response.get( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -299,7 +299,7 @@ class TestAsyncCustomPages: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: custom_page = await async_client.zero_trust.access.custom_pages.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -309,7 +309,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: custom_page = await async_client.zero_trust.access.custom_pages.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -320,7 +320,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.zero_trust.access.custom_pages.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -334,7 +334,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.zero_trust.access.custom_pages.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -349,9 +349,9 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.custom_pages.with_raw_response.create( - "", + account_id="", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -361,7 +361,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: custom_page = await async_client.zero_trust.access.custom_pages.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -372,7 +372,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: custom_page = await async_client.zero_trust.access.custom_pages.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -384,7 +384,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.access.custom_pages.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -399,7 +399,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.access.custom_pages.with_streaming_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -414,19 +414,19 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.custom_pages.with_raw_response.update( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", custom_html="

Access Denied

", name="string", type="identity_denied", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_page_id` but received ''"): await async_client.zero_trust.access.custom_pages.with_raw_response.update( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", custom_html="

Access Denied

", name="string", type="identity_denied", @@ -435,14 +435,14 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: custom_page = await async_client.zero_trust.access.custom_pages.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(AsyncSinglePage[CustomPageWithoutHTML], custom_page, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.custom_pages.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -453,7 +453,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.zero_trust.access.custom_pages.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" @@ -465,16 +465,16 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.custom_pages.with_raw_response.list( - "", + account_id="", ) @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: custom_page = await async_client.zero_trust.access.custom_pages.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[CustomPageDeleteResponse], custom_page, path=["response"]) @@ -482,7 +482,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.zero_trust.access.custom_pages.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -494,7 +494,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.zero_trust.access.custom_pages.with_streaming_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -506,23 +506,23 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @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 ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.custom_pages.with_raw_response.delete( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_page_id` but received ''"): await async_client.zero_trust.access.custom_pages.with_raw_response.delete( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: custom_page = await async_client.zero_trust.access.custom_pages.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[CustomPage], custom_page, path=["response"]) @@ -530,7 +530,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.access.custom_pages.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -542,7 +542,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.access.custom_pages.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -554,14 +554,14 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.custom_pages.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `custom_page_id` but received ''"): await async_client.zero_trust.access.custom_pages.with_raw_response.get( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) diff --git a/tests/api_resources/zero_trust/access/test_groups.py b/tests/api_resources/zero_trust/access/test_groups.py index f7be2db9428..c9f83d20c8b 100644 --- a/tests/api_resources/zero_trust/access/test_groups.py +++ b/tests/api_resources/zero_trust/access/test_groups.py @@ -207,7 +207,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.zero_trust.access.groups.with_raw_response.update( "", include=[ @@ -347,7 +347,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.zero_trust.access.groups.with_raw_response.delete( "", account_id="string", @@ -414,7 +414,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): client.zero_trust.access.groups.with_raw_response.get( "", account_id="string", @@ -622,7 +622,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.zero_trust.access.groups.with_raw_response.update( "", include=[ @@ -762,7 +762,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.zero_trust.access.groups.with_raw_response.delete( "", account_id="string", @@ -829,7 +829,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `group_id` but received ''"): await async_client.zero_trust.access.groups.with_raw_response.get( "", account_id="string", diff --git a/tests/api_resources/zero_trust/access/test_keys.py b/tests/api_resources/zero_trust/access/test_keys.py index ccb5129562c..f0b87f16c0f 100644 --- a/tests/api_resources/zero_trust/access/test_keys.py +++ b/tests/api_resources/zero_trust/access/test_keys.py @@ -20,7 +20,7 @@ class TestKeys: @parametrize def test_method_update(self, client: Cloudflare) -> None: key = client.zero_trust.access.keys.update( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", key_rotation_interval_days=30, ) assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) @@ -28,7 +28,7 @@ def test_method_update(self, client: Cloudflare) -> None: @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.zero_trust.access.keys.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", key_rotation_interval_days=30, ) @@ -40,7 +40,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.zero_trust.access.keys.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", key_rotation_interval_days=30, ) as response: assert not response.is_closed @@ -53,23 +53,23 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.keys.with_raw_response.update( - "", + account_id="", key_rotation_interval_days=30, ) @parametrize def test_method_get(self, client: Cloudflare) -> None: key = client.zero_trust.access.keys.get( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.access.keys.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -80,7 +80,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.access.keys.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" @@ -92,22 +92,22 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.keys.with_raw_response.get( - "", + account_id="", ) @parametrize def test_method_rotate(self, client: Cloudflare) -> None: key = client.zero_trust.access.keys.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) @parametrize def test_raw_response_rotate(self, client: Cloudflare) -> None: response = client.zero_trust.access.keys.with_raw_response.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -118,7 +118,7 @@ def test_raw_response_rotate(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_rotate(self, client: Cloudflare) -> None: with client.zero_trust.access.keys.with_streaming_response.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -130,9 +130,9 @@ def test_streaming_response_rotate(self, client: Cloudflare) -> None: @parametrize def test_path_params_rotate(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.keys.with_raw_response.rotate( - "", + account_id="", ) @@ -142,7 +142,7 @@ class TestAsyncKeys: @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: key = await async_client.zero_trust.access.keys.update( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", key_rotation_interval_days=30, ) assert_matches_type(Optional[KeyUpdateResponse], key, path=["response"]) @@ -150,7 +150,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.keys.with_raw_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", key_rotation_interval_days=30, ) @@ -162,7 +162,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.zero_trust.access.keys.with_streaming_response.update( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", key_rotation_interval_days=30, ) as response: assert not response.is_closed @@ -175,23 +175,23 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.keys.with_raw_response.update( - "", + account_id="", key_rotation_interval_days=30, ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: key = await async_client.zero_trust.access.keys.get( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[KeyGetResponse], key, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.keys.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -202,7 +202,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.zero_trust.access.keys.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" @@ -214,22 +214,22 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.keys.with_raw_response.get( - "", + account_id="", ) @parametrize async def test_method_rotate(self, async_client: AsyncCloudflare) -> None: key = await async_client.zero_trust.access.keys.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[KeyRotateResponse], key, path=["response"]) @parametrize async def test_raw_response_rotate(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.keys.with_raw_response.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -240,7 +240,7 @@ async def test_raw_response_rotate(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_rotate(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.access.keys.with_streaming_response.rotate( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -252,7 +252,7 @@ async def test_streaming_response_rotate(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_rotate(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.keys.with_raw_response.rotate( - "", + account_id="", ) diff --git a/tests/api_resources/zero_trust/access/test_policies.py b/tests/api_resources/zero_trust/access/test_policies.py new file mode 100644 index 00000000000..dd11538c159 --- /dev/null +++ b/tests/api_resources/zero_trust/access/test_policies.py @@ -0,0 +1,761 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.access import ( + PolicyGetResponse, + PolicyListResponse, + PolicyCreateResponse, + PolicyDeleteResponse, + PolicyUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPolicies: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + policy = client.zero_trust.access.policies.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + policy = client.zero_trust.access.policies.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + approval_groups=[ + { + "approvals_needed": 1, + "email_addresses": ["test1@cloudflare.com", "test2@cloudflare.com"], + "email_list_uuid": "string", + }, + { + "approvals_needed": 3, + "email_addresses": ["test@cloudflare.com", "test2@cloudflare.com"], + "email_list_uuid": "597147a1-976b-4ef2-9af0-81d5d007fc34", + }, + ], + approval_required=True, + exclude=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + isolation_required=False, + purpose_justification_prompt="Please enter a justification for entering this protected domain.", + purpose_justification_required=True, + require=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + session_duration="24h", + ) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.zero_trust.access.policies.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.zero_trust.access.policies.with_streaming_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.access.policies.with_raw_response.create( + account_id="", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + policy = client.zero_trust.access.policies.update( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + policy = client.zero_trust.access.policies.update( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + approval_groups=[ + { + "approvals_needed": 1, + "email_addresses": ["test1@cloudflare.com", "test2@cloudflare.com"], + "email_list_uuid": "string", + }, + { + "approvals_needed": 3, + "email_addresses": ["test@cloudflare.com", "test2@cloudflare.com"], + "email_list_uuid": "597147a1-976b-4ef2-9af0-81d5d007fc34", + }, + ], + approval_required=True, + exclude=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + isolation_required=False, + purpose_justification_prompt="Please enter a justification for entering this protected domain.", + purpose_justification_required=True, + require=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + session_duration="24h", + ) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.zero_trust.access.policies.with_raw_response.update( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.zero_trust.access.policies.with_streaming_response.update( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.access.policies.with_raw_response.update( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + client.zero_trust.access.policies.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + policy = client.zero_trust.access.policies.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.zero_trust.access.policies.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.zero_trust.access.policies.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(SyncSinglePage[PolicyListResponse], policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.access.policies.with_raw_response.list( + account_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + policy = client.zero_trust.access.policies.delete( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.zero_trust.access.policies.with_raw_response.delete( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.zero_trust.access.policies.with_streaming_response.delete( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.access.policies.with_raw_response.delete( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + client.zero_trust.access.policies.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + policy = client.zero_trust.access.policies.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.zero_trust.access.policies.with_raw_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = response.parse() + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.zero_trust.access.policies.with_streaming_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = response.parse() + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.access.policies.with_raw_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + client.zero_trust.access.policies.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + +class TestAsyncPolicies: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + policy = await async_client.zero_trust.access.policies.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + policy = await async_client.zero_trust.access.policies.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + approval_groups=[ + { + "approvals_needed": 1, + "email_addresses": ["test1@cloudflare.com", "test2@cloudflare.com"], + "email_list_uuid": "string", + }, + { + "approvals_needed": 3, + "email_addresses": ["test@cloudflare.com", "test2@cloudflare.com"], + "email_list_uuid": "597147a1-976b-4ef2-9af0-81d5d007fc34", + }, + ], + approval_required=True, + exclude=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + isolation_required=False, + purpose_justification_prompt="Please enter a justification for entering this protected domain.", + purpose_justification_required=True, + require=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + session_duration="24h", + ) + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.access.policies.with_raw_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.access.policies.with_streaming_response.create( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(Optional[PolicyCreateResponse], policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.access.policies.with_raw_response.create( + account_id="", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + policy = await async_client.zero_trust.access.policies.update( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + policy = await async_client.zero_trust.access.policies.update( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + approval_groups=[ + { + "approvals_needed": 1, + "email_addresses": ["test1@cloudflare.com", "test2@cloudflare.com"], + "email_list_uuid": "string", + }, + { + "approvals_needed": 3, + "email_addresses": ["test@cloudflare.com", "test2@cloudflare.com"], + "email_list_uuid": "597147a1-976b-4ef2-9af0-81d5d007fc34", + }, + ], + approval_required=True, + exclude=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + isolation_required=False, + purpose_justification_prompt="Please enter a justification for entering this protected domain.", + purpose_justification_required=True, + require=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + session_duration="24h", + ) + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.access.policies.with_raw_response.update( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.access.policies.with_streaming_response.update( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(Optional[PolicyUpdateResponse], policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.access.policies.with_raw_response.update( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + await async_client.zero_trust.access.policies.with_raw_response.update( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + decision="allow", + include=[ + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + {"email": {"email": "test@example.com"}}, + ], + name="Allow devs", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + policy = await async_client.zero_trust.access.policies.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.access.policies.with_raw_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.access.policies.with_streaming_response.list( + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(AsyncSinglePage[PolicyListResponse], policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.access.policies.with_raw_response.list( + account_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + policy = await async_client.zero_trust.access.policies.delete( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.access.policies.with_raw_response.delete( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.access.policies.with_streaming_response.delete( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(Optional[PolicyDeleteResponse], policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.access.policies.with_raw_response.delete( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + await async_client.zero_trust.access.policies.with_raw_response.delete( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + policy = await async_client.zero_trust.access.policies.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.access.policies.with_raw_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + policy = await response.parse() + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.access.policies.with_streaming_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + policy = await response.parse() + assert_matches_type(Optional[PolicyGetResponse], policy, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.access.policies.with_raw_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `policy_id` but received ''"): + await async_client.zero_trust.access.policies.with_raw_response.get( + "", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) 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 1eb404eb5ef..6031d72107d 100644 --- a/tests/api_resources/zero_trust/access/test_service_tokens.py +++ b/tests/api_resources/zero_trust/access/test_service_tokens.py @@ -135,7 +135,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_token_id` but received ''"): client.zero_trust.access.service_tokens.with_raw_response.update( "", account_id="string", @@ -257,7 +257,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_token_id` but received ''"): client.zero_trust.access.service_tokens.with_raw_response.delete( "", account_id="string", @@ -275,11 +275,78 @@ def test_path_params_delete(self, client: Cloudflare) -> None: account_id="string", ) + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + service_token = client.zero_trust.access.service_tokens.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="string", + ) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + service_token = client.zero_trust.access.service_tokens.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="string", + ) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.zero_trust.access.service_tokens.with_raw_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service_token = response.parse() + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.zero_trust.access.service_tokens.with_streaming_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service_token = response.parse() + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_token_id` but received ''"): + client.zero_trust.access.service_tokens.with_raw_response.get( + "", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.access.service_tokens.with_raw_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + client.zero_trust.access.service_tokens.with_raw_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="string", + ) + @parametrize def test_method_refresh(self, client: Cloudflare) -> None: service_token = client.zero_trust.access.service_tokens.refresh( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @@ -287,7 +354,7 @@ def test_method_refresh(self, client: Cloudflare) -> None: def test_raw_response_refresh(self, client: Cloudflare) -> None: response = client.zero_trust.access.service_tokens.with_raw_response.refresh( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -299,7 +366,7 @@ def test_raw_response_refresh(self, client: Cloudflare) -> None: def test_streaming_response_refresh(self, client: Cloudflare) -> None: with client.zero_trust.access.service_tokens.with_streaming_response.refresh( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -311,23 +378,23 @@ def test_streaming_response_refresh(self, client: Cloudflare) -> None: @parametrize def test_path_params_refresh(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.service_tokens.with_raw_response.refresh( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_token_id` but received ''"): client.zero_trust.access.service_tokens.with_raw_response.refresh( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize def test_method_rotate(self, client: Cloudflare) -> None: service_token = client.zero_trust.access.service_tokens.rotate( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) @@ -335,7 +402,7 @@ def test_method_rotate(self, client: Cloudflare) -> None: def test_raw_response_rotate(self, client: Cloudflare) -> None: response = client.zero_trust.access.service_tokens.with_raw_response.rotate( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -347,7 +414,7 @@ def test_raw_response_rotate(self, client: Cloudflare) -> None: def test_streaming_response_rotate(self, client: Cloudflare) -> None: with client.zero_trust.access.service_tokens.with_streaming_response.rotate( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -359,16 +426,16 @@ def test_streaming_response_rotate(self, client: Cloudflare) -> None: @parametrize def test_path_params_rotate(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.service_tokens.with_raw_response.rotate( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_token_id` but received ''"): client.zero_trust.access.service_tokens.with_raw_response.rotate( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -488,7 +555,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_token_id` but received ''"): await async_client.zero_trust.access.service_tokens.with_raw_response.update( "", account_id="string", @@ -610,7 +677,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_token_id` but received ''"): await async_client.zero_trust.access.service_tokens.with_raw_response.delete( "", account_id="string", @@ -628,11 +695,78 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: account_id="string", ) + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + service_token = await async_client.zero_trust.access.service_tokens.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="string", + ) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + service_token = await async_client.zero_trust.access.service_tokens.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="string", + ) + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.access.service_tokens.with_raw_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + service_token = await response.parse() + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.access.service_tokens.with_streaming_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + service_token = await response.parse() + assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_token_id` but received ''"): + await async_client.zero_trust.access.service_tokens.with_raw_response.get( + "", + account_id="string", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.access.service_tokens.with_raw_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): + await async_client.zero_trust.access.service_tokens.with_raw_response.get( + "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="string", + ) + @parametrize async def test_method_refresh(self, async_client: AsyncCloudflare) -> None: service_token = await async_client.zero_trust.access.service_tokens.refresh( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[ServiceToken], service_token, path=["response"]) @@ -640,7 +774,7 @@ async def test_method_refresh(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_refresh(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.service_tokens.with_raw_response.refresh( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -652,7 +786,7 @@ async def test_raw_response_refresh(self, async_client: AsyncCloudflare) -> None async def test_streaming_response_refresh(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.access.service_tokens.with_streaming_response.refresh( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -664,23 +798,23 @@ async def test_streaming_response_refresh(self, async_client: AsyncCloudflare) - @parametrize async def test_path_params_refresh(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.service_tokens.with_raw_response.refresh( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_token_id` but received ''"): await async_client.zero_trust.access.service_tokens.with_raw_response.refresh( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize async def test_method_rotate(self, async_client: AsyncCloudflare) -> None: service_token = await async_client.zero_trust.access.service_tokens.rotate( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[ServiceTokenRotateResponse], service_token, path=["response"]) @@ -688,7 +822,7 @@ async def test_method_rotate(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_rotate(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.service_tokens.with_raw_response.rotate( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -700,7 +834,7 @@ async def test_raw_response_rotate(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_rotate(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.access.service_tokens.with_streaming_response.rotate( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -712,14 +846,14 @@ async def test_streaming_response_rotate(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_rotate(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.service_tokens.with_raw_response.rotate( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_token_id` but received ''"): await async_client.zero_trust.access.service_tokens.with_raw_response.rotate( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) diff --git a/tests/api_resources/zero_trust/access/test_tags.py b/tests/api_resources/zero_trust/access/test_tags.py index c81e4b77bcb..9693f511303 100644 --- a/tests/api_resources/zero_trust/access/test_tags.py +++ b/tests/api_resources/zero_trust/access/test_tags.py @@ -21,7 +21,7 @@ class TestTags: @parametrize def test_method_create(self, client: Cloudflare) -> None: tag = client.zero_trust.access.tags.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) assert_matches_type(Optional[Tag], tag, path=["response"]) @@ -29,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: response = client.zero_trust.access.tags.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) @@ -41,7 +41,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: with client.zero_trust.access.tags.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) as response: assert not response.is_closed @@ -54,9 +54,9 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @parametrize def test_path_params_create(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.tags.with_raw_response.create( - "", + account_id="", name="engineers", ) @@ -64,7 +64,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: def test_method_update(self, client: Cloudflare) -> None: tag = client.zero_trust.access.tags.update( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) assert_matches_type(Optional[Tag], tag, path=["response"]) @@ -73,7 +73,7 @@ def test_method_update(self, client: Cloudflare) -> None: def test_raw_response_update(self, client: Cloudflare) -> None: response = client.zero_trust.access.tags.with_raw_response.update( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) @@ -86,7 +86,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: def test_streaming_response_update(self, client: Cloudflare) -> None: with client.zero_trust.access.tags.with_streaming_response.update( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) as response: assert not response.is_closed @@ -99,31 +99,31 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: @parametrize def test_path_params_update(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.tags.with_raw_response.update( "engineers", - identifier="", + account_id="", name="engineers", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag_name` but received ''"): client.zero_trust.access.tags.with_raw_response.update( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - name="", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="engineers", ) @parametrize def test_method_list(self, client: Cloudflare) -> None: tag = client.zero_trust.access.tags.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SyncSinglePage[Tag], tag, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.zero_trust.access.tags.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -134,7 +134,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.zero_trust.access.tags.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" @@ -146,16 +146,16 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.tags.with_raw_response.list( - "", + account_id="", ) @parametrize def test_method_delete(self, client: Cloudflare) -> None: tag = client.zero_trust.access.tags.delete( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) @@ -163,7 +163,7 @@ def test_method_delete(self, client: Cloudflare) -> None: def test_raw_response_delete(self, client: Cloudflare) -> None: response = client.zero_trust.access.tags.with_raw_response.delete( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -175,7 +175,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: def test_streaming_response_delete(self, client: Cloudflare) -> None: with client.zero_trust.access.tags.with_streaming_response.delete( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -187,23 +187,23 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @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 ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.tags.with_raw_response.delete( "engineers", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag_name` but received ''"): client.zero_trust.access.tags.with_raw_response.delete( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize def test_method_get(self, client: Cloudflare) -> None: tag = client.zero_trust.access.tags.get( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[Tag], tag, path=["response"]) @@ -211,7 +211,7 @@ def test_method_get(self, client: Cloudflare) -> None: def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.access.tags.with_raw_response.get( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -223,7 +223,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.access.tags.with_streaming_response.get( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -235,16 +235,16 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.tags.with_raw_response.get( "engineers", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag_name` but received ''"): client.zero_trust.access.tags.with_raw_response.get( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -254,7 +254,7 @@ class TestAsyncTags: @parametrize async def test_method_create(self, async_client: AsyncCloudflare) -> None: tag = await async_client.zero_trust.access.tags.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) assert_matches_type(Optional[Tag], tag, path=["response"]) @@ -262,7 +262,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.tags.with_raw_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) @@ -274,7 +274,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.zero_trust.access.tags.with_streaming_response.create( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) as response: assert not response.is_closed @@ -287,9 +287,9 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.tags.with_raw_response.create( - "", + account_id="", name="engineers", ) @@ -297,7 +297,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: async def test_method_update(self, async_client: AsyncCloudflare) -> None: tag = await async_client.zero_trust.access.tags.update( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) assert_matches_type(Optional[Tag], tag, path=["response"]) @@ -306,7 +306,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.zero_trust.access.tags.with_raw_response.update( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) @@ -319,7 +319,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.access.tags.with_streaming_response.update( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", name="engineers", ) as response: assert not response.is_closed @@ -332,31 +332,31 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.tags.with_raw_response.update( "engineers", - identifier="", + account_id="", name="engineers", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag_name` but received ''"): await async_client.zero_trust.access.tags.with_raw_response.update( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - name="", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + name="engineers", ) @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: tag = await async_client.zero_trust.access.tags.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(AsyncSinglePage[Tag], tag, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.tags.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -367,7 +367,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.zero_trust.access.tags.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" @@ -379,16 +379,16 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.tags.with_raw_response.list( - "", + account_id="", ) @parametrize async def test_method_delete(self, async_client: AsyncCloudflare) -> None: tag = await async_client.zero_trust.access.tags.delete( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[TagDeleteResponse], tag, path=["response"]) @@ -396,7 +396,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.zero_trust.access.tags.with_raw_response.delete( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -408,7 +408,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.zero_trust.access.tags.with_streaming_response.delete( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -420,23 +420,23 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @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 ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.tags.with_raw_response.delete( "engineers", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag_name` but received ''"): await async_client.zero_trust.access.tags.with_raw_response.delete( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: tag = await async_client.zero_trust.access.tags.get( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[Tag], tag, path=["response"]) @@ -444,7 +444,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.access.tags.with_raw_response.get( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -456,7 +456,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.access.tags.with_streaming_response.get( "engineers", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -468,14 +468,14 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.tags.with_raw_response.get( "engineers", - identifier="", + account_id="", ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `name` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `tag_name` but received ''"): await async_client.zero_trust.access.tags.with_raw_response.get( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) diff --git a/tests/api_resources/zero_trust/access/test_users.py b/tests/api_resources/zero_trust/access/test_users.py index 502300c4919..eb05e5be04b 100644 --- a/tests/api_resources/zero_trust/access/test_users.py +++ b/tests/api_resources/zero_trust/access/test_users.py @@ -21,14 +21,14 @@ class TestUsers: @parametrize def test_method_list(self, client: Cloudflare) -> None: user = client.zero_trust.access.users.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SyncSinglePage[AccessUser], user, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: response = client.zero_trust.access.users.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -39,7 +39,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: with client.zero_trust.access.users.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" @@ -51,9 +51,9 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.users.with_raw_response.list( - "", + account_id="", ) @@ -63,14 +63,14 @@ class TestAsyncUsers: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: user = await async_client.zero_trust.access.users.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(AsyncSinglePage[AccessUser], user, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.users.with_raw_response.list( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -81,7 +81,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.access.users.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" @@ -93,7 +93,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.users.with_raw_response.list( - "", + account_id="", ) 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 257192ec0de..55ae6bab3de 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 @@ -22,7 +22,7 @@ class TestActiveSessions: def test_method_list(self, client: Cloudflare) -> None: active_session = client.zero_trust.access.users.active_sessions.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) @@ -30,7 +30,7 @@ def test_method_list(self, client: Cloudflare) -> None: def test_raw_response_list(self, client: Cloudflare) -> None: response = client.zero_trust.access.users.active_sessions.with_raw_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -42,7 +42,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: def test_streaming_response_list(self, client: Cloudflare) -> None: with client.zero_trust.access.users.active_sessions.with_streaming_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -54,24 +54,24 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.users.active_sessions.with_raw_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_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 `user_id` but received ''"): client.zero_trust.access.users.active_sessions.with_raw_response.list( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize def test_method_get(self, client: Cloudflare) -> None: active_session = client.zero_trust.access.users.active_sessions.get( "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + user_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) @@ -79,8 +79,8 @@ def test_method_get(self, client: Cloudflare) -> None: def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.access.users.active_sessions.with_raw_response.get( "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + user_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) assert response.is_closed is True @@ -92,8 +92,8 @@ def test_raw_response_get(self, client: Cloudflare) -> None: def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.access.users.active_sessions.with_streaming_response.get( "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + user_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -105,25 +105,25 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.users.active_sessions.with_raw_response.get( "X1aXj1lFVcqqyoXF", - identifier="", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + user_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - 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 `user_id` but received ''"): client.zero_trust.access.users.active_sessions.with_raw_response.get( "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + user_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `nonce` but received ''"): client.zero_trust.access.users.active_sessions.with_raw_response.get( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + user_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) @@ -134,7 +134,7 @@ class TestAsyncActiveSessions: async def test_method_list(self, async_client: AsyncCloudflare) -> None: active_session = await async_client.zero_trust.access.users.active_sessions.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(AsyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) @@ -142,7 +142,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.users.active_sessions.with_raw_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -154,7 +154,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.access.users.active_sessions.with_streaming_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -166,24 +166,24 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.users.active_sessions.with_raw_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_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 `user_id` but received ''"): await async_client.zero_trust.access.users.active_sessions.with_raw_response.list( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @parametrize async def test_method_get(self, async_client: AsyncCloudflare) -> None: active_session = await async_client.zero_trust.access.users.active_sessions.get( "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + user_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) assert_matches_type(Optional[ActiveSessionGetResponse], active_session, path=["response"]) @@ -191,8 +191,8 @@ 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.access.users.active_sessions.with_raw_response.get( "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + user_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) assert response.is_closed is True @@ -204,8 +204,8 @@ 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.access.users.active_sessions.with_streaming_response.get( "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + user_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -217,23 +217,23 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.users.active_sessions.with_raw_response.get( "X1aXj1lFVcqqyoXF", - identifier="", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="", + user_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - 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 `user_id` but received ''"): await async_client.zero_trust.access.users.active_sessions.with_raw_response.get( "X1aXj1lFVcqqyoXF", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + user_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `nonce` but received ''"): await async_client.zero_trust.access.users.active_sessions.with_raw_response.get( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", - id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", + account_id="023e105f4ecef8ad9ca31a8372d0c353", + user_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) 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 466bb95ca07..d2280ea6572 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 @@ -22,7 +22,7 @@ class TestFailedLogins: def test_method_list(self, client: Cloudflare) -> None: failed_login = client.zero_trust.access.users.failed_logins.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(SyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) @@ -30,7 +30,7 @@ def test_method_list(self, client: Cloudflare) -> None: def test_raw_response_list(self, client: Cloudflare) -> None: response = client.zero_trust.access.users.failed_logins.with_raw_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -42,7 +42,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: def test_streaming_response_list(self, client: Cloudflare) -> None: with client.zero_trust.access.users.failed_logins.with_streaming_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -54,16 +54,16 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: @parametrize def test_path_params_list(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.users.failed_logins.with_raw_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_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 `user_id` but received ''"): client.zero_trust.access.users.failed_logins.with_raw_response.list( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -74,7 +74,7 @@ class TestAsyncFailedLogins: async def test_method_list(self, async_client: AsyncCloudflare) -> None: failed_login = await async_client.zero_trust.access.users.failed_logins.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(AsyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) @@ -82,7 +82,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.access.users.failed_logins.with_raw_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -94,7 +94,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.access.users.failed_logins.with_streaming_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -106,14 +106,14 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N @parametrize async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.users.failed_logins.with_raw_response.list( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_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 `user_id` but received ''"): await async_client.zero_trust.access.users.failed_logins.with_raw_response.list( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) 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 e23146df8d6..6363aec38d0 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 @@ -21,7 +21,7 @@ class TestLastSeenIdentity: def test_method_get(self, client: Cloudflare) -> None: last_seen_identity = client.zero_trust.access.users.last_seen_identity.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) @@ -29,7 +29,7 @@ def test_method_get(self, client: Cloudflare) -> None: def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.access.users.last_seen_identity.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -41,7 +41,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.access.users.last_seen_identity.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -53,16 +53,16 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.access.users.last_seen_identity.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_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 `user_id` but received ''"): client.zero_trust.access.users.last_seen_identity.with_raw_response.get( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) @@ -73,7 +73,7 @@ class TestAsyncLastSeenIdentity: async def test_method_get(self, async_client: AsyncCloudflare) -> None: last_seen_identity = await async_client.zero_trust.access.users.last_seen_identity.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert_matches_type(Optional[Identity], last_seen_identity, path=["response"]) @@ -81,7 +81,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.access.users.last_seen_identity.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) assert response.is_closed is True @@ -93,7 +93,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.access.users.last_seen_identity.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -105,14 +105,14 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.access.users.last_seen_identity.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - identifier="", + account_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 `user_id` but received ''"): await async_client.zero_trust.access.users.last_seen_identity.with_raw_response.get( "", - identifier="023e105f4ecef8ad9ca31a8372d0c353", + account_id="023e105f4ecef8ad9ca31a8372d0c353", ) 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 3f7e10dbbc6..53def98e79c 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 @@ -23,10 +23,11 @@ class TestDevices: def test_method_list(self, client: Cloudflare) -> None: device = client.zero_trust.dex.fleet_status.devices.list( account_id="01a7362d577a6c3019a474fd6f485823", + from_="2023-10-11T00:00:00Z", page=1, per_page=10, - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + source="last_seen", + to="2023-10-11T00:00:00Z", ) assert_matches_type(SyncV4PagePaginationArray[DeviceListResponse], device, path=["response"]) @@ -35,10 +36,11 @@ def test_method_list(self, client: Cloudflare) -> None: def test_method_list_with_all_params(self, client: Cloudflare) -> None: device = client.zero_trust.dex.fleet_status.devices.list( account_id="01a7362d577a6c3019a474fd6f485823", + from_="2023-10-11T00:00:00Z", page=1, per_page=10, - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + source="last_seen", + to="2023-10-11T00:00:00Z", colo="SJC", device_id="cb49c27f-7f97-49c5-b6f3-f7c01ead0fd7", mode="proxy", @@ -54,10 +56,11 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_list(self, client: Cloudflare) -> None: response = client.zero_trust.dex.fleet_status.devices.with_raw_response.list( account_id="01a7362d577a6c3019a474fd6f485823", + from_="2023-10-11T00:00:00Z", page=1, per_page=10, - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + source="last_seen", + to="2023-10-11T00:00:00Z", ) assert response.is_closed is True @@ -70,10 +73,11 @@ def test_raw_response_list(self, client: Cloudflare) -> None: def test_streaming_response_list(self, client: Cloudflare) -> None: with client.zero_trust.dex.fleet_status.devices.with_streaming_response.list( account_id="01a7362d577a6c3019a474fd6f485823", + from_="2023-10-11T00:00:00Z", page=1, per_page=10, - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + source="last_seen", + to="2023-10-11T00:00:00Z", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -89,10 +93,11 @@ def test_path_params_list(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.dex.fleet_status.devices.with_raw_response.list( account_id="", + from_="2023-10-11T00:00:00Z", page=1, per_page=10, - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + source="last_seen", + to="2023-10-11T00:00:00Z", ) @@ -104,10 +109,11 @@ class TestAsyncDevices: async def test_method_list(self, async_client: AsyncCloudflare) -> None: device = await async_client.zero_trust.dex.fleet_status.devices.list( account_id="01a7362d577a6c3019a474fd6f485823", + from_="2023-10-11T00:00:00Z", page=1, per_page=10, - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + source="last_seen", + to="2023-10-11T00:00:00Z", ) assert_matches_type(AsyncV4PagePaginationArray[DeviceListResponse], device, path=["response"]) @@ -116,10 +122,11 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: device = await async_client.zero_trust.dex.fleet_status.devices.list( account_id="01a7362d577a6c3019a474fd6f485823", + from_="2023-10-11T00:00:00Z", page=1, per_page=10, - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + source="last_seen", + to="2023-10-11T00:00:00Z", colo="SJC", device_id="cb49c27f-7f97-49c5-b6f3-f7c01ead0fd7", mode="proxy", @@ -135,10 +142,11 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dex.fleet_status.devices.with_raw_response.list( account_id="01a7362d577a6c3019a474fd6f485823", + from_="2023-10-11T00:00:00Z", page=1, per_page=10, - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + source="last_seen", + to="2023-10-11T00:00:00Z", ) assert response.is_closed is True @@ -151,10 +159,11 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.dex.fleet_status.devices.with_streaming_response.list( account_id="01a7362d577a6c3019a474fd6f485823", + from_="2023-10-11T00:00:00Z", page=1, per_page=10, - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + source="last_seen", + to="2023-10-11T00:00:00Z", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -170,8 +179,9 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.dex.fleet_status.devices.with_raw_response.list( account_id="", + from_="2023-10-11T00:00:00Z", page=1, per_page=10, - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + source="last_seen", + to="2023-10-11T00:00:00Z", ) 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 417e9fe4ec4..73561c37fb5 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 @@ -22,8 +22,8 @@ def test_method_get(self, client: Cloudflare) -> None: percentile = client.zero_trust.dex.http_tests.percentiles.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) assert_matches_type(Optional[HTTPDetailsPercentiles], percentile, path=["response"]) @@ -32,8 +32,8 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: percentile = client.zero_trust.dex.http_tests.percentiles.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", colo="string", device_id=["string", "string", "string"], ) @@ -44,8 +44,8 @@ def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.dex.http_tests.percentiles.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) assert response.is_closed is True @@ -58,8 +58,8 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.dex.http_tests.percentiles.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -75,16 +75,16 @@ def test_path_params_get(self, client: Cloudflare) -> None: client.zero_trust.dex.http_tests.percentiles.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"): client.zero_trust.dex.http_tests.percentiles.with_raw_response.get( "", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) @@ -96,8 +96,8 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: percentile = await async_client.zero_trust.dex.http_tests.percentiles.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) assert_matches_type(Optional[HTTPDetailsPercentiles], percentile, path=["response"]) @@ -106,8 +106,8 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - percentile = await async_client.zero_trust.dex.http_tests.percentiles.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", colo="string", device_id=["string", "string", "string"], ) @@ -118,8 +118,8 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dex.http_tests.percentiles.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) assert response.is_closed is True @@ -132,8 +132,8 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No async with async_client.zero_trust.dex.http_tests.percentiles.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -149,14 +149,14 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.dex.http_tests.percentiles.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"): await async_client.zero_trust.dex.http_tests.percentiles.with_raw_response.get( "", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) diff --git a/tests/api_resources/zero_trust/dex/test_colos.py b/tests/api_resources/zero_trust/dex/test_colos.py index ea3b48d65ae..8e4d0db4399 100644 --- a/tests/api_resources/zero_trust/dex/test_colos.py +++ b/tests/api_resources/zero_trust/dex/test_colos.py @@ -21,8 +21,8 @@ class TestColos: def test_method_list(self, client: Cloudflare) -> None: colo = client.zero_trust.dex.colos.list( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-08-24T20:45:00Z", - time_start="2023-08-20T20:45:00Z", + from_="2023-08-20T20:45:00Z", + to="2023-08-24T20:45:00Z", ) assert_matches_type(SyncSinglePage[object], colo, path=["response"]) @@ -30,8 +30,8 @@ def test_method_list(self, client: Cloudflare) -> None: def test_method_list_with_all_params(self, client: Cloudflare) -> None: colo = client.zero_trust.dex.colos.list( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-08-24T20:45:00Z", - time_start="2023-08-20T20:45:00Z", + from_="2023-08-20T20:45:00Z", + to="2023-08-24T20:45:00Z", sort_by="fleet-status-usage", ) assert_matches_type(SyncSinglePage[object], colo, path=["response"]) @@ -40,8 +40,8 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_list(self, client: Cloudflare) -> None: response = client.zero_trust.dex.colos.with_raw_response.list( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-08-24T20:45:00Z", - time_start="2023-08-20T20:45:00Z", + from_="2023-08-20T20:45:00Z", + to="2023-08-24T20:45:00Z", ) assert response.is_closed is True @@ -53,8 +53,8 @@ def test_raw_response_list(self, client: Cloudflare) -> None: def test_streaming_response_list(self, client: Cloudflare) -> None: with client.zero_trust.dex.colos.with_streaming_response.list( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-08-24T20:45:00Z", - time_start="2023-08-20T20:45:00Z", + from_="2023-08-20T20:45:00Z", + to="2023-08-24T20:45:00Z", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -69,8 +69,8 @@ def test_path_params_list(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.dex.colos.with_raw_response.list( account_id="", - time_end="2023-08-24T20:45:00Z", - time_start="2023-08-20T20:45:00Z", + from_="2023-08-20T20:45:00Z", + to="2023-08-24T20:45:00Z", ) @@ -81,8 +81,8 @@ class TestAsyncColos: async def test_method_list(self, async_client: AsyncCloudflare) -> None: colo = await async_client.zero_trust.dex.colos.list( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-08-24T20:45:00Z", - time_start="2023-08-20T20:45:00Z", + from_="2023-08-20T20:45:00Z", + to="2023-08-24T20:45:00Z", ) assert_matches_type(AsyncSinglePage[object], colo, path=["response"]) @@ -90,8 +90,8 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: colo = await async_client.zero_trust.dex.colos.list( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-08-24T20:45:00Z", - time_start="2023-08-20T20:45:00Z", + from_="2023-08-20T20:45:00Z", + to="2023-08-24T20:45:00Z", sort_by="fleet-status-usage", ) assert_matches_type(AsyncSinglePage[object], colo, path=["response"]) @@ -100,8 +100,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dex.colos.with_raw_response.list( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-08-24T20:45:00Z", - time_start="2023-08-20T20:45:00Z", + from_="2023-08-20T20:45:00Z", + to="2023-08-24T20:45:00Z", ) assert response.is_closed is True @@ -113,8 +113,8 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.dex.colos.with_streaming_response.list( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-08-24T20:45:00Z", - time_start="2023-08-20T20:45:00Z", + from_="2023-08-20T20:45:00Z", + to="2023-08-24T20:45:00Z", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -129,6 +129,6 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.dex.colos.with_raw_response.list( account_id="", - time_end="2023-08-24T20:45:00Z", - time_start="2023-08-20T20:45:00Z", + from_="2023-08-20T20:45:00Z", + to="2023-08-24T20:45:00Z", ) 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 c8810f5404b..db1676eacde 100644 --- a/tests/api_resources/zero_trust/dex/test_fleet_status.py +++ b/tests/api_resources/zero_trust/dex/test_fleet_status.py @@ -65,8 +65,8 @@ def test_path_params_live(self, client: Cloudflare) -> None: def test_method_over_time(self, client: Cloudflare) -> None: fleet_status = client.zero_trust.dex.fleet_status.over_time( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + from_="2023-10-11T00:00:00Z", + to="2023-10-11T00:00:00Z", ) assert fleet_status is None @@ -74,8 +74,8 @@ def test_method_over_time(self, client: Cloudflare) -> None: def test_method_over_time_with_all_params(self, client: Cloudflare) -> None: fleet_status = client.zero_trust.dex.fleet_status.over_time( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + from_="2023-10-11T00:00:00Z", + to="2023-10-11T00:00:00Z", colo="SJC", device_id="cb49c27f-7f97-49c5-b6f3-f7c01ead0fd7", ) @@ -85,8 +85,8 @@ def test_method_over_time_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_over_time(self, client: Cloudflare) -> None: response = client.zero_trust.dex.fleet_status.with_raw_response.over_time( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + from_="2023-10-11T00:00:00Z", + to="2023-10-11T00:00:00Z", ) assert response.is_closed is True @@ -98,8 +98,8 @@ def test_raw_response_over_time(self, client: Cloudflare) -> None: def test_streaming_response_over_time(self, client: Cloudflare) -> None: with client.zero_trust.dex.fleet_status.with_streaming_response.over_time( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + from_="2023-10-11T00:00:00Z", + to="2023-10-11T00:00:00Z", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -114,8 +114,8 @@ def test_path_params_over_time(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.dex.fleet_status.with_raw_response.over_time( account_id="", - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + from_="2023-10-11T00:00:00Z", + to="2023-10-11T00:00:00Z", ) @@ -168,8 +168,8 @@ async def test_path_params_live(self, async_client: AsyncCloudflare) -> None: async def test_method_over_time(self, async_client: AsyncCloudflare) -> None: fleet_status = await async_client.zero_trust.dex.fleet_status.over_time( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + from_="2023-10-11T00:00:00Z", + to="2023-10-11T00:00:00Z", ) assert fleet_status is None @@ -177,8 +177,8 @@ async def test_method_over_time(self, async_client: AsyncCloudflare) -> None: async def test_method_over_time_with_all_params(self, async_client: AsyncCloudflare) -> None: fleet_status = await async_client.zero_trust.dex.fleet_status.over_time( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + from_="2023-10-11T00:00:00Z", + to="2023-10-11T00:00:00Z", colo="SJC", device_id="cb49c27f-7f97-49c5-b6f3-f7c01ead0fd7", ) @@ -188,8 +188,8 @@ async def test_method_over_time_with_all_params(self, async_client: AsyncCloudfl async def test_raw_response_over_time(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dex.fleet_status.with_raw_response.over_time( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + from_="2023-10-11T00:00:00Z", + to="2023-10-11T00:00:00Z", ) assert response.is_closed is True @@ -201,8 +201,8 @@ async def test_raw_response_over_time(self, async_client: AsyncCloudflare) -> No async def test_streaming_response_over_time(self, async_client: AsyncCloudflare) -> None: async with async_client.zero_trust.dex.fleet_status.with_streaming_response.over_time( account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + from_="2023-10-11T00:00:00Z", + to="2023-10-11T00:00:00Z", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -217,6 +217,6 @@ async def test_path_params_over_time(self, async_client: AsyncCloudflare) -> Non with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.dex.fleet_status.with_raw_response.over_time( account_id="", - time_end="2023-10-11T00:00:00Z", - time_start="2023-10-11T00:00:00Z", + from_="2023-10-11T00:00:00Z", + to="2023-10-11T00:00:00Z", ) 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 48a2fa21dfe..2b038de5a40 100644 --- a/tests/api_resources/zero_trust/dex/test_http_tests.py +++ b/tests/api_resources/zero_trust/dex/test_http_tests.py @@ -22,9 +22,9 @@ def test_method_get(self, client: Cloudflare) -> None: http_test = client.zero_trust.dex.http_tests.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert_matches_type(Optional[HTTPDetails], http_test, path=["response"]) @@ -33,9 +33,9 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: http_test = client.zero_trust.dex.http_tests.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", colo="string", device_id=["string", "string", "string"], ) @@ -46,9 +46,9 @@ def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.dex.http_tests.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert response.is_closed is True @@ -61,9 +61,9 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.dex.http_tests.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -79,18 +79,18 @@ def test_path_params_get(self, client: Cloudflare) -> None: client.zero_trust.dex.http_tests.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"): client.zero_trust.dex.http_tests.with_raw_response.get( "", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) @@ -102,9 +102,9 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: http_test = await async_client.zero_trust.dex.http_tests.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert_matches_type(Optional[HTTPDetails], http_test, path=["response"]) @@ -113,9 +113,9 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - http_test = await async_client.zero_trust.dex.http_tests.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", colo="string", device_id=["string", "string", "string"], ) @@ -126,9 +126,9 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dex.http_tests.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert response.is_closed is True @@ -141,9 +141,9 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No async with async_client.zero_trust.dex.http_tests.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -159,16 +159,16 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.dex.http_tests.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"): await async_client.zero_trust.dex.http_tests.with_raw_response.get( "", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) 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 687a44e7675..a5a47a30db8 100644 --- a/tests/api_resources/zero_trust/dex/test_traceroute_tests.py +++ b/tests/api_resources/zero_trust/dex/test_traceroute_tests.py @@ -26,9 +26,9 @@ def test_method_get(self, client: Cloudflare) -> None: traceroute_test = client.zero_trust.dex.traceroute_tests.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert_matches_type(Optional[Traceroute], traceroute_test, path=["response"]) @@ -37,9 +37,9 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: traceroute_test = client.zero_trust.dex.traceroute_tests.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", colo="string", device_id=["string", "string", "string"], ) @@ -50,9 +50,9 @@ def test_raw_response_get(self, client: Cloudflare) -> None: response = client.zero_trust.dex.traceroute_tests.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert response.is_closed is True @@ -65,9 +65,9 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: with client.zero_trust.dex.traceroute_tests.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -83,18 +83,18 @@ def test_path_params_get(self, client: Cloudflare) -> None: client.zero_trust.dex.traceroute_tests.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"): client.zero_trust.dex.traceroute_tests.with_raw_response.get( "", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) @parametrize @@ -103,9 +103,9 @@ def test_method_network_path(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", device_id="string", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert_matches_type(Optional[NetworkPathResponse], traceroute_test, path=["response"]) @@ -115,9 +115,9 @@ def test_raw_response_network_path(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", device_id="string", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert response.is_closed is True @@ -131,9 +131,9 @@ def test_streaming_response_network_path(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", device_id="string", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -150,9 +150,9 @@ def test_path_params_network_path(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", device_id="string", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"): @@ -160,9 +160,9 @@ def test_path_params_network_path(self, client: Cloudflare) -> None: "", account_id="01a7362d577a6c3019a474fd6f485823", device_id="string", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) @parametrize @@ -170,8 +170,8 @@ def test_method_percentiles(self, client: Cloudflare) -> None: traceroute_test = client.zero_trust.dex.traceroute_tests.percentiles( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) assert_matches_type(Optional[TracerouteTestPercentilesResponse], traceroute_test, path=["response"]) @@ -180,8 +180,8 @@ def test_method_percentiles_with_all_params(self, client: Cloudflare) -> None: traceroute_test = client.zero_trust.dex.traceroute_tests.percentiles( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", colo="string", device_id=["string", "string", "string"], ) @@ -192,8 +192,8 @@ def test_raw_response_percentiles(self, client: Cloudflare) -> None: response = client.zero_trust.dex.traceroute_tests.with_raw_response.percentiles( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) assert response.is_closed is True @@ -206,8 +206,8 @@ def test_streaming_response_percentiles(self, client: Cloudflare) -> None: with client.zero_trust.dex.traceroute_tests.with_streaming_response.percentiles( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -223,16 +223,16 @@ def test_path_params_percentiles(self, client: Cloudflare) -> None: client.zero_trust.dex.traceroute_tests.with_raw_response.percentiles( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"): client.zero_trust.dex.traceroute_tests.with_raw_response.percentiles( "", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) @@ -244,9 +244,9 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: traceroute_test = await async_client.zero_trust.dex.traceroute_tests.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert_matches_type(Optional[Traceroute], traceroute_test, path=["response"]) @@ -255,9 +255,9 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - traceroute_test = await async_client.zero_trust.dex.traceroute_tests.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", colo="string", device_id=["string", "string", "string"], ) @@ -268,9 +268,9 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.zero_trust.dex.traceroute_tests.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert response.is_closed is True @@ -283,9 +283,9 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No async with async_client.zero_trust.dex.traceroute_tests.with_streaming_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -301,18 +301,18 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: await async_client.zero_trust.dex.traceroute_tests.with_raw_response.get( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"): await async_client.zero_trust.dex.traceroute_tests.with_raw_response.get( "", account_id="01a7362d577a6c3019a474fd6f485823", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) @parametrize @@ -321,9 +321,9 @@ async def test_method_network_path(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", device_id="string", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert_matches_type(Optional[NetworkPathResponse], traceroute_test, path=["response"]) @@ -333,9 +333,9 @@ async def test_raw_response_network_path(self, async_client: AsyncCloudflare) -> "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", device_id="string", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) assert response.is_closed is True @@ -349,9 +349,9 @@ async def test_streaming_response_network_path(self, async_client: AsyncCloudfla "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", device_id="string", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -368,9 +368,9 @@ async def test_path_params_network_path(self, async_client: AsyncCloudflare) -> "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", device_id="string", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"): @@ -378,9 +378,9 @@ async def test_path_params_network_path(self, async_client: AsyncCloudflare) -> "", account_id="01a7362d577a6c3019a474fd6f485823", device_id="string", + from_="1689520412000", interval="minute", - time_end="1689606812000", - time_start="1689520412000", + to="1689606812000", ) @parametrize @@ -388,8 +388,8 @@ async def test_method_percentiles(self, async_client: AsyncCloudflare) -> None: traceroute_test = await async_client.zero_trust.dex.traceroute_tests.percentiles( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) assert_matches_type(Optional[TracerouteTestPercentilesResponse], traceroute_test, path=["response"]) @@ -398,8 +398,8 @@ async def test_method_percentiles_with_all_params(self, async_client: AsyncCloud traceroute_test = await async_client.zero_trust.dex.traceroute_tests.percentiles( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", colo="string", device_id=["string", "string", "string"], ) @@ -410,8 +410,8 @@ async def test_raw_response_percentiles(self, async_client: AsyncCloudflare) -> response = await async_client.zero_trust.dex.traceroute_tests.with_raw_response.percentiles( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) assert response.is_closed is True @@ -424,8 +424,8 @@ async def test_streaming_response_percentiles(self, async_client: AsyncCloudflar async with async_client.zero_trust.dex.traceroute_tests.with_streaming_response.percentiles( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -441,14 +441,14 @@ async def test_path_params_percentiles(self, async_client: AsyncCloudflare) -> N await async_client.zero_trust.dex.traceroute_tests.with_raw_response.percentiles( "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `test_id` but received ''"): await async_client.zero_trust.dex.traceroute_tests.with_raw_response.percentiles( "", account_id="01a7362d577a6c3019a474fd6f485823", - time_end="2023-09-20T17:00:00Z", - time_start="2023-09-20T17:00:00Z", + from_="2023-09-20T17:00:00Z", + to="2023-09-20T17:00:00Z", ) 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 df7a9832ab3..625c13ce809 100644 --- a/tests/api_resources/zero_trust/dlp/datasets/test_upload.py +++ b/tests/api_resources/zero_trust/dlp/datasets/test_upload.py @@ -73,7 +73,7 @@ def test_method_edit(self, client: Cloudflare) -> None: 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - body={}, + body="string", ) assert_matches_type(Optional[Dataset], upload, path=["response"]) @@ -84,7 +84,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - body={}, + body="string", ) assert response.is_closed is True @@ -99,7 +99,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - body={}, + body="string", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -117,7 +117,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: 0, account_id="", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - body={}, + body="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dataset_id` but received ''"): @@ -125,7 +125,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: 0, account_id="string", dataset_id="", - body={}, + body="string", ) @@ -187,7 +187,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - body={}, + body="string", ) assert_matches_type(Optional[Dataset], upload, path=["response"]) @@ -198,7 +198,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - body={}, + body="string", ) assert response.is_closed is True @@ -213,7 +213,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N 0, account_id="string", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - body={}, + body="string", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -231,7 +231,7 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: 0, account_id="", dataset_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - body={}, + body="string", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dataset_id` but received ''"): @@ -239,5 +239,5 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: 0, account_id="string", dataset_id="", - body={}, + body="string", ) 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 d46c4b8884e..2d5b505ed3c 100644 --- a/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py +++ b/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py @@ -9,9 +9,9 @@ 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 ( ProxyEndpoint, + ProxyEndpointGetResponse, ProxyEndpointDeleteResponse, ) @@ -72,7 +72,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[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @parametrize def test_raw_response_list(self, client: Cloudflare) -> None: @@ -83,7 +83,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[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @parametrize def test_streaming_response_list(self, client: Cloudflare) -> None: @@ -94,7 +94,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[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -217,7 +217,7 @@ def test_method_get(self, client: Cloudflare) -> None: "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -229,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" proxy_endpoint = response.parse() - assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -241,7 +241,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(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -314,7 +314,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[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: @@ -325,7 +325,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[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: @@ -336,7 +336,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[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -459,7 +459,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "ed35569b41ce4d1facfe683550f54086", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -471,7 +471,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(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -483,7 +483,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(Optional[ProxyEndpoint], proxy_endpoint, path=["response"]) + assert_matches_type(Optional[ProxyEndpointGetResponse], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/risk_scoring/integrations/__init__.py b/tests/api_resources/zero_trust/risk_scoring/integrations/__init__.py new file mode 100644 index 00000000000..fd8019a9a1a --- /dev/null +++ b/tests/api_resources/zero_trust/risk_scoring/integrations/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/zero_trust/risk_scoring/integrations/test_references.py b/tests/api_resources/zero_trust/risk_scoring/integrations/test_references.py new file mode 100644 index 00000000000..6f7e3ae07d5 --- /dev/null +++ b/tests/api_resources/zero_trust/risk_scoring/integrations/test_references.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, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.types.zero_trust.risk_scoring.integrations import ReferenceGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestReferences: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + reference = client.zero_trust.risk_scoring.integrations.references.get( + "string", + account_id="string", + ) + assert_matches_type(Optional[ReferenceGetResponse], reference, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.integrations.references.with_raw_response.get( + "string", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reference = response.parse() + assert_matches_type(Optional[ReferenceGetResponse], reference, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.integrations.references.with_streaming_response.get( + "string", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reference = response.parse() + assert_matches_type(Optional[ReferenceGetResponse], reference, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.risk_scoring.integrations.references.with_raw_response.get( + "string", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `reference_id` but received ''"): + client.zero_trust.risk_scoring.integrations.references.with_raw_response.get( + "", + account_id="string", + ) + + +class TestAsyncReferences: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + reference = await async_client.zero_trust.risk_scoring.integrations.references.get( + "string", + account_id="string", + ) + assert_matches_type(Optional[ReferenceGetResponse], reference, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.integrations.references.with_raw_response.get( + "string", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + reference = await response.parse() + assert_matches_type(Optional[ReferenceGetResponse], reference, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.integrations.references.with_streaming_response.get( + "string", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + reference = await response.parse() + assert_matches_type(Optional[ReferenceGetResponse], reference, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.risk_scoring.integrations.references.with_raw_response.get( + "string", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `reference_id` but received ''"): + await async_client.zero_trust.risk_scoring.integrations.references.with_raw_response.get( + "", + account_id="string", + ) diff --git a/tests/api_resources/zero_trust/risk_scoring/test_integrations.py b/tests/api_resources/zero_trust/risk_scoring/test_integrations.py new file mode 100644 index 00000000000..c6fa43d9486 --- /dev/null +++ b/tests/api_resources/zero_trust/risk_scoring/test_integrations.py @@ -0,0 +1,554 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.risk_scoring import ( + IntegrationGetResponse, + IntegrationListResponse, + IntegrationCreateResponse, + IntegrationUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestIntegrations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Cloudflare) -> None: + integration = client.zero_trust.risk_scoring.integrations.create( + account_id="string", + integration_type="Okta", + tenant_url="https://example.com", + ) + assert_matches_type(Optional[IntegrationCreateResponse], integration, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Cloudflare) -> None: + integration = client.zero_trust.risk_scoring.integrations.create( + account_id="string", + integration_type="Okta", + tenant_url="https://example.com", + reference_id="string", + ) + assert_matches_type(Optional[IntegrationCreateResponse], integration, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.integrations.with_raw_response.create( + account_id="string", + integration_type="Okta", + tenant_url="https://example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + integration = response.parse() + assert_matches_type(Optional[IntegrationCreateResponse], integration, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.integrations.with_streaming_response.create( + account_id="string", + integration_type="Okta", + tenant_url="https://example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + integration = response.parse() + assert_matches_type(Optional[IntegrationCreateResponse], integration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.risk_scoring.integrations.with_raw_response.create( + account_id="", + integration_type="Okta", + tenant_url="https://example.com", + ) + + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + integration = client.zero_trust.risk_scoring.integrations.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + active=True, + tenant_url="https://example.com", + ) + assert_matches_type(Optional[IntegrationUpdateResponse], integration, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + integration = client.zero_trust.risk_scoring.integrations.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + active=True, + tenant_url="https://example.com", + reference_id="string", + ) + assert_matches_type(Optional[IntegrationUpdateResponse], integration, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.integrations.with_raw_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + active=True, + tenant_url="https://example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + integration = response.parse() + assert_matches_type(Optional[IntegrationUpdateResponse], integration, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.integrations.with_streaming_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + active=True, + tenant_url="https://example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + integration = response.parse() + assert_matches_type(Optional[IntegrationUpdateResponse], integration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.risk_scoring.integrations.with_raw_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + active=True, + tenant_url="https://example.com", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `integration_id` but received ''"): + client.zero_trust.risk_scoring.integrations.with_raw_response.update( + "", + account_id="string", + active=True, + tenant_url="https://example.com", + ) + + @pytest.mark.skip(reason="bug in prism where it confuses this method with /zt_risk_scoring/{user_id}") + @parametrize + def test_method_list(self, client: Cloudflare) -> None: + integration = client.zero_trust.risk_scoring.integrations.list( + account_id="string", + ) + assert_matches_type(SyncSinglePage[IntegrationListResponse], integration, path=["response"]) + + @pytest.mark.skip(reason="bug in prism where it confuses this method with /zt_risk_scoring/{user_id}") + @parametrize + def test_raw_response_list(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.integrations.with_raw_response.list( + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + integration = response.parse() + assert_matches_type(SyncSinglePage[IntegrationListResponse], integration, path=["response"]) + + @pytest.mark.skip(reason="bug in prism where it confuses this method with /zt_risk_scoring/{user_id}") + @parametrize + def test_streaming_response_list(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.integrations.with_streaming_response.list( + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + integration = response.parse() + assert_matches_type(SyncSinglePage[IntegrationListResponse], integration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="bug in prism where it confuses this method with /zt_risk_scoring/{user_id}") + @parametrize + def test_path_params_list(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.risk_scoring.integrations.with_raw_response.list( + account_id="", + ) + + @parametrize + def test_method_delete(self, client: Cloudflare) -> None: + integration = client.zero_trust.risk_scoring.integrations.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) + assert_matches_type(object, integration, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.integrations.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + integration = response.parse() + assert_matches_type(object, integration, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.integrations.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + integration = response.parse() + assert_matches_type(object, integration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.risk_scoring.integrations.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `integration_id` but received ''"): + client.zero_trust.risk_scoring.integrations.with_raw_response.delete( + "", + account_id="string", + ) + + @parametrize + def test_method_get(self, client: Cloudflare) -> None: + integration = client.zero_trust.risk_scoring.integrations.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) + assert_matches_type(Optional[IntegrationGetResponse], integration, path=["response"]) + + @parametrize + def test_raw_response_get(self, client: Cloudflare) -> None: + response = client.zero_trust.risk_scoring.integrations.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + integration = response.parse() + assert_matches_type(Optional[IntegrationGetResponse], integration, path=["response"]) + + @parametrize + def test_streaming_response_get(self, client: Cloudflare) -> None: + with client.zero_trust.risk_scoring.integrations.with_streaming_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + integration = response.parse() + assert_matches_type(Optional[IntegrationGetResponse], integration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_get(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.zero_trust.risk_scoring.integrations.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `integration_id` but received ''"): + client.zero_trust.risk_scoring.integrations.with_raw_response.get( + "", + account_id="string", + ) + + +class TestAsyncIntegrations: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncCloudflare) -> None: + integration = await async_client.zero_trust.risk_scoring.integrations.create( + account_id="string", + integration_type="Okta", + tenant_url="https://example.com", + ) + assert_matches_type(Optional[IntegrationCreateResponse], integration, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: + integration = await async_client.zero_trust.risk_scoring.integrations.create( + account_id="string", + integration_type="Okta", + tenant_url="https://example.com", + reference_id="string", + ) + assert_matches_type(Optional[IntegrationCreateResponse], integration, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.integrations.with_raw_response.create( + account_id="string", + integration_type="Okta", + tenant_url="https://example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + integration = await response.parse() + assert_matches_type(Optional[IntegrationCreateResponse], integration, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.integrations.with_streaming_response.create( + account_id="string", + integration_type="Okta", + tenant_url="https://example.com", + ) 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[IntegrationCreateResponse], integration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.risk_scoring.integrations.with_raw_response.create( + account_id="", + integration_type="Okta", + tenant_url="https://example.com", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + integration = await async_client.zero_trust.risk_scoring.integrations.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + active=True, + tenant_url="https://example.com", + ) + assert_matches_type(Optional[IntegrationUpdateResponse], integration, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + integration = await async_client.zero_trust.risk_scoring.integrations.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + active=True, + tenant_url="https://example.com", + reference_id="string", + ) + assert_matches_type(Optional[IntegrationUpdateResponse], integration, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.integrations.with_raw_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + active=True, + tenant_url="https://example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + integration = await response.parse() + assert_matches_type(Optional[IntegrationUpdateResponse], integration, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.integrations.with_streaming_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + active=True, + tenant_url="https://example.com", + ) 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[IntegrationUpdateResponse], integration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.risk_scoring.integrations.with_raw_response.update( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + active=True, + tenant_url="https://example.com", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `integration_id` but received ''"): + await async_client.zero_trust.risk_scoring.integrations.with_raw_response.update( + "", + account_id="string", + active=True, + tenant_url="https://example.com", + ) + + @pytest.mark.skip(reason="bug in prism where it confuses this method with /zt_risk_scoring/{user_id}") + @parametrize + async def test_method_list(self, async_client: AsyncCloudflare) -> None: + integration = await async_client.zero_trust.risk_scoring.integrations.list( + account_id="string", + ) + assert_matches_type(AsyncSinglePage[IntegrationListResponse], integration, path=["response"]) + + @pytest.mark.skip(reason="bug in prism where it confuses this method with /zt_risk_scoring/{user_id}") + @parametrize + async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.integrations.with_raw_response.list( + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + integration = await response.parse() + assert_matches_type(AsyncSinglePage[IntegrationListResponse], integration, path=["response"]) + + @pytest.mark.skip(reason="bug in prism where it confuses this method with /zt_risk_scoring/{user_id}") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.integrations.with_streaming_response.list( + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + integration = await response.parse() + assert_matches_type(AsyncSinglePage[IntegrationListResponse], integration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="bug in prism where it confuses this method with /zt_risk_scoring/{user_id}") + @parametrize + async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.risk_scoring.integrations.with_raw_response.list( + account_id="", + ) + + @parametrize + async def test_method_delete(self, async_client: AsyncCloudflare) -> None: + integration = await async_client.zero_trust.risk_scoring.integrations.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) + assert_matches_type(object, integration, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.integrations.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + integration = await response.parse() + assert_matches_type(object, integration, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.integrations.with_streaming_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + integration = await response.parse() + assert_matches_type(object, integration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.risk_scoring.integrations.with_raw_response.delete( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `integration_id` but received ''"): + await async_client.zero_trust.risk_scoring.integrations.with_raw_response.delete( + "", + account_id="string", + ) + + @parametrize + async def test_method_get(self, async_client: AsyncCloudflare) -> None: + integration = await async_client.zero_trust.risk_scoring.integrations.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) + assert_matches_type(Optional[IntegrationGetResponse], integration, path=["response"]) + + @parametrize + async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: + response = await async_client.zero_trust.risk_scoring.integrations.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + integration = await response.parse() + assert_matches_type(Optional[IntegrationGetResponse], integration, path=["response"]) + + @parametrize + async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: + async with async_client.zero_trust.risk_scoring.integrations.with_streaming_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + ) 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[IntegrationGetResponse], integration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.zero_trust.risk_scoring.integrations.with_raw_response.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `integration_id` but received ''"): + await async_client.zero_trust.risk_scoring.integrations.with_raw_response.get( + "", + account_id="string", + ) diff --git a/tests/api_resources/zero_trust/test_identity_providers.py b/tests/api_resources/zero_trust/test_identity_providers.py index 7204c198113..3977deba608 100644 --- a/tests/api_resources/zero_trust/test_identity_providers.py +++ b/tests/api_resources/zero_trust/test_identity_providers.py @@ -1307,7 +1307,7 @@ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_1(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -1409,7 +1409,7 @@ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_2(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -1507,7 +1507,7 @@ def test_streaming_response_update_overload_3(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_3(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -1605,7 +1605,7 @@ def test_streaming_response_update_overload_4(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_4(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -1705,7 +1705,7 @@ def test_streaming_response_update_overload_5(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_5(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -1806,7 +1806,7 @@ def test_streaming_response_update_overload_6(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_6(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -1904,7 +1904,7 @@ def test_streaming_response_update_overload_7(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_7(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -2008,7 +2008,7 @@ def test_streaming_response_update_overload_8(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_8(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -2110,7 +2110,7 @@ def test_streaming_response_update_overload_9(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_9(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -2211,7 +2211,7 @@ def test_streaming_response_update_overload_10(self, client: Cloudflare) -> None @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_10(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -2312,7 +2312,7 @@ def test_streaming_response_update_overload_11(self, client: Cloudflare) -> None @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_11(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -2428,7 +2428,7 @@ def test_streaming_response_update_overload_12(self, client: Cloudflare) -> None @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_12(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -2526,7 +2526,7 @@ def test_streaming_response_update_overload_13(self, client: Cloudflare) -> None @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_13(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -2621,7 +2621,7 @@ def test_streaming_response_update_overload_14(self, client: Cloudflare) -> None @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update_overload_14(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -2752,7 +2752,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.delete( "", account_id="string", @@ -2819,7 +2819,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): client.zero_trust.identity_providers.with_raw_response.get( "", account_id="string", @@ -4126,7 +4126,7 @@ async def test_streaming_response_update_overload_1(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -4228,7 +4228,7 @@ async def test_streaming_response_update_overload_2(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -4326,7 +4326,7 @@ async def test_streaming_response_update_overload_3(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_3(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -4424,7 +4424,7 @@ async def test_streaming_response_update_overload_4(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_4(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -4524,7 +4524,7 @@ async def test_streaming_response_update_overload_5(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_5(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -4625,7 +4625,7 @@ async def test_streaming_response_update_overload_6(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_6(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -4723,7 +4723,7 @@ async def test_streaming_response_update_overload_7(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_7(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -4827,7 +4827,7 @@ async def test_streaming_response_update_overload_8(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_8(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -4929,7 +4929,7 @@ async def test_streaming_response_update_overload_9(self, async_client: AsyncClo @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_9(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -5030,7 +5030,7 @@ async def test_streaming_response_update_overload_10(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_10(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -5131,7 +5131,7 @@ async def test_streaming_response_update_overload_11(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_11(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -5247,7 +5247,7 @@ async def test_streaming_response_update_overload_12(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_12(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -5345,7 +5345,7 @@ async def test_streaming_response_update_overload_13(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_13(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -5440,7 +5440,7 @@ async def test_streaming_response_update_overload_14(self, async_client: AsyncCl @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update_overload_14(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.update( "", config={}, @@ -5571,7 +5571,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.delete( "", account_id="string", @@ -5638,7 +5638,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `uuid` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `identity_provider_id` but received ''"): await async_client.zero_trust.identity_providers.with_raw_response.get( "", account_id="string", diff --git a/tests/api_resources/zero_trust/test_seats.py b/tests/api_resources/zero_trust/test_seats.py index c609d0ab5a2..639cbee067f 100644 --- a/tests/api_resources/zero_trust/test_seats.py +++ b/tests/api_resources/zero_trust/test_seats.py @@ -21,19 +21,22 @@ class TestSeats: @parametrize def test_method_edit(self, client: Cloudflare) -> None: seat = client.zero_trust.seats.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", body=[ { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, ], ) @@ -43,19 +46,22 @@ def test_method_edit(self, client: Cloudflare) -> None: @parametrize def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.zero_trust.seats.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", body=[ { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, ], ) @@ -69,19 +75,22 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: @parametrize def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.zero_trust.seats.with_streaming_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", body=[ { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, ], ) as response: @@ -96,21 +105,24 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.zero_trust.seats.with_raw_response.edit( - "", + account_id="", body=[ { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, ], ) @@ -123,19 +135,22 @@ class TestAsyncSeats: @parametrize async def test_method_edit(self, async_client: AsyncCloudflare) -> None: seat = await async_client.zero_trust.seats.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", body=[ { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, ], ) @@ -145,19 +160,22 @@ 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.zero_trust.seats.with_raw_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", body=[ { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, ], ) @@ -171,19 +189,22 @@ 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.zero_trust.seats.with_streaming_response.edit( - "023e105f4ecef8ad9ca31a8372d0c353", + account_id="699d98642c564d2e855e9661899b7252", body=[ { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, ], ) as response: @@ -198,21 +219,24 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N @pytest.mark.skip(reason="TODO: investigate broken test") @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 ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.zero_trust.seats.with_raw_response.edit( - "", + account_id="", body=[ { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, { "access_seat": False, "gateway_seat": False, + "seat_uid": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", }, ], ) diff --git a/tests/api_resources/zero_trust/test_tunnels.py b/tests/api_resources/zero_trust/test_tunnels.py index ee77b47c681..c00bfff850e 100644 --- a/tests/api_resources/zero_trust/test_tunnels.py +++ b/tests/api_resources/zero_trust/test_tunnels.py @@ -89,6 +89,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: name="blog", page=1, per_page=1, + status="healthy", tun_types="cfd_tunnel,warp_connector", uuid="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", was_active_at=parse_datetime("2009-11-10T23:00:00Z"), @@ -349,6 +350,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) name="blog", page=1, per_page=1, + status="healthy", tun_types="cfd_tunnel,warp_connector", uuid="f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", was_active_at=parse_datetime("2009-11-10T23:00:00Z"), diff --git a/tests/api_resources/zones/test_dns_settings.py b/tests/api_resources/zones/test_dns_settings.py deleted file mode 100644 index d9df4b018c9..00000000000 --- a/tests/api_resources/zones/test_dns_settings.py +++ /dev/null @@ -1,196 +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 DNSSetting - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestDNSSettings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - dns_setting = client.zones.dns_settings.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @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(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.zones.dns_settings.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dns_setting = response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.zones.dns_settings.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dns_setting = response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.dns_settings.with_raw_response.edit( - zone_id="", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - dns_setting = client.zones.dns_settings.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.zones.dns_settings.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dns_setting = response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.zones.dns_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" - - dns_setting = response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - client.zones.dns_settings.with_raw_response.get( - zone_id="", - ) - - -class TestAsyncDNSSettings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - 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(Optional[DNSSetting], dns_setting, path=["response"]) - - @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(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.dns_settings.with_raw_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dns_setting = await response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.dns_settings.with_streaming_response.edit( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - dns_setting = await response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.dns_settings.with_raw_response.edit( - zone_id="", - ) - - @parametrize - 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(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.zones.dns_settings.with_raw_response.get( - zone_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - dns_setting = await response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.zones.dns_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" - - dns_setting = await response.parse() - assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"): - await async_client.zones.dns_settings.with_raw_response.get( - zone_id="", - ) diff --git a/tests/test_client.py b/tests/test_client.py index e16d2dc4612..ebfafa47bf1 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -372,6 +372,7 @@ def test_validate_headers(self) -> None: assert request.headers.get("X-Auth-Key") == api_key client2 = Cloudflare(base_url=base_url, api_key=None, api_email=None, _strict_response_validation=True) + with pytest.raises( TypeError, match="Could not resolve authentication method. Expected one of api_email, api_key, api_token or user_service_key to be set. Or for one of the `X-Auth-Email`, `X-Auth-Key`, `Authorization` or `X-Auth-User-Service-Key` headers to be explicitly omitted", @@ -1142,6 +1143,7 @@ def test_validate_headers(self) -> None: assert request.headers.get("X-Auth-Key") == api_key client2 = AsyncCloudflare(base_url=base_url, api_key=None, api_email=None, _strict_response_validation=True) + with pytest.raises( TypeError, match="Could not resolve authentication method. Expected one of api_email, api_key, api_token or user_service_key to be set. Or for one of the `X-Auth-Email`, `X-Auth-Key`, `Authorization` or `X-Auth-User-Service-Key` headers to be explicitly omitted", diff --git a/tests/test_models.py b/tests/test_models.py index 3e07792f3b5..799673b5caa 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -31,7 +31,7 @@ class NestedModel(BaseModel): # mismatched types m = NestedModel.construct(nested="hello!") - assert m.nested == "hello!" + assert cast(Any, m.nested) == "hello!" def test_optional_nested_model() -> None: @@ -48,7 +48,7 @@ class NestedModel(BaseModel): # mismatched types m3 = NestedModel.construct(nested={"foo"}) assert isinstance(cast(Any, m3.nested), set) - assert m3.nested == {"foo"} + assert cast(Any, m3.nested) == {"foo"} def test_list_nested_model() -> None: @@ -323,7 +323,7 @@ class Model(BaseModel): assert len(m.items) == 2 assert isinstance(m.items[0], Submodel1) assert m.items[0].level == -1 - assert m.items[1] == 156 + assert cast(Any, m.items[1]) == 156 def test_union_of_lists() -> None: @@ -355,7 +355,7 @@ class Model(BaseModel): assert len(m.items) == 2 assert isinstance(m.items[0], SubModel1) assert m.items[0].level == -1 - assert m.items[1] == 156 + assert cast(Any, m.items[1]) == 156 def test_dict_of_union() -> None: diff --git a/tests/test_transform.py b/tests/test_transform.py index 15abb39172e..bc21b7cdb00 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -260,20 +260,22 @@ class MyModel(BaseModel): @parametrize @pytest.mark.asyncio async def test_pydantic_model_to_dictionary(use_async: bool) -> None: - assert await transform(MyModel(foo="hi!"), Any, use_async) == {"foo": "hi!"} - assert await transform(MyModel.construct(foo="hi!"), Any, use_async) == {"foo": "hi!"} + assert cast(Any, await transform(MyModel(foo="hi!"), Any, use_async)) == {"foo": "hi!"} + assert cast(Any, await transform(MyModel.construct(foo="hi!"), Any, use_async)) == {"foo": "hi!"} @parametrize @pytest.mark.asyncio async def test_pydantic_empty_model(use_async: bool) -> None: - assert await transform(MyModel.construct(), Any, use_async) == {} + assert cast(Any, await transform(MyModel.construct(), Any, use_async)) == {} @parametrize @pytest.mark.asyncio async def test_pydantic_unknown_field(use_async: bool) -> None: - assert await transform(MyModel.construct(my_untyped_field=True), Any, use_async) == {"my_untyped_field": True} + assert cast(Any, await transform(MyModel.construct(my_untyped_field=True), Any, use_async)) == { + "my_untyped_field": True + } @parametrize @@ -285,7 +287,7 @@ async def test_pydantic_mismatched_types(use_async: bool) -> None: params = await transform(model, Any, use_async) else: params = await transform(model, Any, use_async) - assert params == {"foo": True} + assert cast(Any, params) == {"foo": True} @parametrize @@ -297,7 +299,7 @@ async def test_pydantic_mismatched_object_type(use_async: bool) -> None: params = await transform(model, Any, use_async) else: params = await transform(model, Any, use_async) - assert params == {"foo": {"hello": "world"}} + assert cast(Any, params) == {"foo": {"hello": "world"}} class ModelNestedObjects(BaseModel): @@ -309,7 +311,7 @@ class ModelNestedObjects(BaseModel): async def test_pydantic_nested_objects(use_async: bool) -> None: model = ModelNestedObjects.construct(nested={"foo": "stainless"}) assert isinstance(model.nested, MyModel) - assert await transform(model, Any, use_async) == {"nested": {"foo": "stainless"}} + assert cast(Any, await transform(model, Any, use_async)) == {"nested": {"foo": "stainless"}} class ModelWithDefaultField(BaseModel): @@ -325,19 +327,19 @@ async def test_pydantic_default_field(use_async: bool) -> None: model = ModelWithDefaultField.construct() assert model.with_none_default is None assert model.with_str_default == "foo" - assert await transform(model, Any, use_async) == {} + assert cast(Any, await transform(model, Any, use_async)) == {} # should be included when the default value is explicitly given model = ModelWithDefaultField.construct(with_none_default=None, with_str_default="foo") assert model.with_none_default is None assert model.with_str_default == "foo" - assert await transform(model, Any, use_async) == {"with_none_default": None, "with_str_default": "foo"} + assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": None, "with_str_default": "foo"} # should be included when a non-default value is explicitly given model = ModelWithDefaultField.construct(with_none_default="bar", with_str_default="baz") assert model.with_none_default == "bar" assert model.with_str_default == "baz" - assert await transform(model, Any, use_async) == {"with_none_default": "bar", "with_str_default": "baz"} + assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": "bar", "with_str_default": "baz"} class TypedDictIterableUnion(TypedDict):