diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00569c3040a..80950ba264f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,5 +21,19 @@ jobs: - run: | go build ./... + test: + name: test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup go + uses: actions/setup-go@v5 + + - name: Bootstrap + run: ./scripts/bootstrap + + - name: Run tests + run: ./scripts/test - diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 5b90a3ac598..5e1530a500b 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -10,7 +10,7 @@ jobs: if: github.repository == 'cloudflare/cloudflare-go' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check release environment run: | diff --git a/.gitignore b/.gitignore index 57e05f99669..104dbfdc829 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ codegen.log +Brewfile.lock.json .idea/ diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 656a2ef17d0..bfc26f9c4e0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.1.0" + ".": "2.2.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 860345bb66e..b162e099397 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1,2 @@ -configured_endpoints: 1266 +configured_endpoints: 1274 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-07ec76fab00de3d6227209faf0af1ed586cde9e2f243c13d3db555da20f13d99.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 922b1ee8e3d..d3d4fcfec0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,142 @@ # Changelog +## 2.2.0 (2024-05-08) + +Full Changelog: [v2.1.0...v2.2.0](https://github.com/cloudflare/cloudflare-go/compare/v2.1.0...v2.2.0) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([#1840](https://github.com/cloudflare/cloudflare-go/issues/1840)) ([70fd793](https://github.com/cloudflare/cloudflare-go/commit/70fd7937e7f47cc109becb1dc470e45b8837c19c)) +* **api:** OpenAPI spec update via Stainless API ([#1842](https://github.com/cloudflare/cloudflare-go/issues/1842)) ([09c26b2](https://github.com/cloudflare/cloudflare-go/commit/09c26b26e4d7375816e3c113d7ca34cac0330738)) +* **api:** OpenAPI spec update via Stainless API ([#1843](https://github.com/cloudflare/cloudflare-go/issues/1843)) ([7b8a09a](https://github.com/cloudflare/cloudflare-go/commit/7b8a09ab66847e43bce0c5945ec078cd4cba9e8e)) +* **api:** OpenAPI spec update via Stainless API ([#1846](https://github.com/cloudflare/cloudflare-go/issues/1846)) ([b8d823d](https://github.com/cloudflare/cloudflare-go/commit/b8d823ddb4d720f83e3d5eddb06a03f401c0e7b3)) +* **api:** OpenAPI spec update via Stainless API ([#1847](https://github.com/cloudflare/cloudflare-go/issues/1847)) ([80de1e4](https://github.com/cloudflare/cloudflare-go/commit/80de1e41bfa32404558211fe940994a04d756f77)) +* **api:** OpenAPI spec update via Stainless API ([#1848](https://github.com/cloudflare/cloudflare-go/issues/1848)) ([5639725](https://github.com/cloudflare/cloudflare-go/commit/563972540c6f58689b233ebc86d56d8b4bed12af)) +* **api:** OpenAPI spec update via Stainless API ([#1849](https://github.com/cloudflare/cloudflare-go/issues/1849)) ([c2df704](https://github.com/cloudflare/cloudflare-go/commit/c2df704abb15398046ed887063c607e0e1ee5c1c)) +* **api:** OpenAPI spec update via Stainless API ([#1850](https://github.com/cloudflare/cloudflare-go/issues/1850)) ([df733af](https://github.com/cloudflare/cloudflare-go/commit/df733af7c9ebc0f25242f833b73eac89672427ef)) +* **api:** OpenAPI spec update via Stainless API ([#1851](https://github.com/cloudflare/cloudflare-go/issues/1851)) ([edc969b](https://github.com/cloudflare/cloudflare-go/commit/edc969b06ea5a130fed665f129f93c20c38677c1)) +* **api:** OpenAPI spec update via Stainless API ([#1853](https://github.com/cloudflare/cloudflare-go/issues/1853)) ([996eeec](https://github.com/cloudflare/cloudflare-go/commit/996eeec918c0a8f129096d0d7134634c39ec174c)) +* **api:** OpenAPI spec update via Stainless API ([#1854](https://github.com/cloudflare/cloudflare-go/issues/1854)) ([aa70500](https://github.com/cloudflare/cloudflare-go/commit/aa705007ed526f28ae9f18866850405ca59c29d3)) +* **api:** OpenAPI spec update via Stainless API ([#1855](https://github.com/cloudflare/cloudflare-go/issues/1855)) ([1fa8a1c](https://github.com/cloudflare/cloudflare-go/commit/1fa8a1ce2c22332eac846b93fa08049e00a3fe20)) +* **api:** OpenAPI spec update via Stainless API ([#1856](https://github.com/cloudflare/cloudflare-go/issues/1856)) ([e1b6ec9](https://github.com/cloudflare/cloudflare-go/commit/e1b6ec936b95eda66bc2cb39244d802441286072)) +* **api:** OpenAPI spec update via Stainless API ([#1857](https://github.com/cloudflare/cloudflare-go/issues/1857)) ([a7d2733](https://github.com/cloudflare/cloudflare-go/commit/a7d27336921cc72a8c0e35e374d74a5d6416159b)) +* **api:** OpenAPI spec update via Stainless API ([#1858](https://github.com/cloudflare/cloudflare-go/issues/1858)) ([ee3b21e](https://github.com/cloudflare/cloudflare-go/commit/ee3b21ec7b9e00cf033160c5179ea66de2bf0d37)) +* **api:** OpenAPI spec update via Stainless API ([#1859](https://github.com/cloudflare/cloudflare-go/issues/1859)) ([1fb5075](https://github.com/cloudflare/cloudflare-go/commit/1fb50751f2ad67e840f7e1dc8860fcef0622f29f)) +* **api:** OpenAPI spec update via Stainless API ([#1860](https://github.com/cloudflare/cloudflare-go/issues/1860)) ([1f57de4](https://github.com/cloudflare/cloudflare-go/commit/1f57de4f37dbb9626d115bd2b55a4e36bd0d0eed)) +* **api:** OpenAPI spec update via Stainless API ([#1862](https://github.com/cloudflare/cloudflare-go/issues/1862)) ([de62d6c](https://github.com/cloudflare/cloudflare-go/commit/de62d6c1179a4edfe129b8da642cb09e5904ad25)) +* **api:** OpenAPI spec update via Stainless API ([#1863](https://github.com/cloudflare/cloudflare-go/issues/1863)) ([eea4b41](https://github.com/cloudflare/cloudflare-go/commit/eea4b41517d42813f342ce912054e090ec2dde96)) +* **api:** OpenAPI spec update via Stainless API ([#1864](https://github.com/cloudflare/cloudflare-go/issues/1864)) ([8baf2a6](https://github.com/cloudflare/cloudflare-go/commit/8baf2a6f4c7fc725ea449b61a70148fa0a33eb5d)) +* **api:** OpenAPI spec update via Stainless API ([#1866](https://github.com/cloudflare/cloudflare-go/issues/1866)) ([692ea51](https://github.com/cloudflare/cloudflare-go/commit/692ea51f083239638d0e645dcdaa68cd635fd2ab)) +* **api:** OpenAPI spec update via Stainless API ([#1867](https://github.com/cloudflare/cloudflare-go/issues/1867)) ([a31112e](https://github.com/cloudflare/cloudflare-go/commit/a31112e4396b99a92e784aafb21bc83ccba2179f)) +* **api:** OpenAPI spec update via Stainless API ([#1868](https://github.com/cloudflare/cloudflare-go/issues/1868)) ([f41dd89](https://github.com/cloudflare/cloudflare-go/commit/f41dd89520d881dedc1872a6d5ae84fdd3b79711)) +* **api:** OpenAPI spec update via Stainless API ([#1869](https://github.com/cloudflare/cloudflare-go/issues/1869)) ([c89613a](https://github.com/cloudflare/cloudflare-go/commit/c89613a0d3186e992a57cde82a53b3e7027a8ba1)) +* **api:** OpenAPI spec update via Stainless API ([#1870](https://github.com/cloudflare/cloudflare-go/issues/1870)) ([2d5e060](https://github.com/cloudflare/cloudflare-go/commit/2d5e060d799b77969f6890fd2324f7db9e3ce0bd)) +* **api:** OpenAPI spec update via Stainless API ([#1871](https://github.com/cloudflare/cloudflare-go/issues/1871)) ([fd8fd26](https://github.com/cloudflare/cloudflare-go/commit/fd8fd26282357d55f7a067b29a8e0123ed5df900)) +* **api:** OpenAPI spec update via Stainless API ([#1872](https://github.com/cloudflare/cloudflare-go/issues/1872)) ([3fb734c](https://github.com/cloudflare/cloudflare-go/commit/3fb734cd0c92a815795e38a6a5144a737e8726a9)) +* **api:** OpenAPI spec update via Stainless API ([#1873](https://github.com/cloudflare/cloudflare-go/issues/1873)) ([daca4b8](https://github.com/cloudflare/cloudflare-go/commit/daca4b817d88059421ac8ed8319e541a57380eac)) +* **api:** OpenAPI spec update via Stainless API ([#1874](https://github.com/cloudflare/cloudflare-go/issues/1874)) ([fcf413b](https://github.com/cloudflare/cloudflare-go/commit/fcf413bb5fb8470299bae8c4a69a7ec8dca95d17)) +* **api:** OpenAPI spec update via Stainless API ([#1875](https://github.com/cloudflare/cloudflare-go/issues/1875)) ([6e45fb6](https://github.com/cloudflare/cloudflare-go/commit/6e45fb6e93d5766e5781863b675e3a4974601695)) +* **api:** OpenAPI spec update via Stainless API ([#1876](https://github.com/cloudflare/cloudflare-go/issues/1876)) ([b66804f](https://github.com/cloudflare/cloudflare-go/commit/b66804f8ee31f6987dfe46a4825ce8fcc85bd9e2)) +* **api:** OpenAPI spec update via Stainless API ([#1877](https://github.com/cloudflare/cloudflare-go/issues/1877)) ([e1bbcc9](https://github.com/cloudflare/cloudflare-go/commit/e1bbcc922af4acde86f3b56b6c4a2bca9bfe2b7f)) +* **api:** OpenAPI spec update via Stainless API ([#1878](https://github.com/cloudflare/cloudflare-go/issues/1878)) ([a6cc625](https://github.com/cloudflare/cloudflare-go/commit/a6cc625a042488117455561ae3fc6f2a1a62cdaf)) +* **api:** OpenAPI spec update via Stainless API ([#1879](https://github.com/cloudflare/cloudflare-go/issues/1879)) ([0d8323b](https://github.com/cloudflare/cloudflare-go/commit/0d8323b76a282143ff2a2f7d968e0c6e21934450)) +* **api:** OpenAPI spec update via Stainless API ([#1880](https://github.com/cloudflare/cloudflare-go/issues/1880)) ([826316c](https://github.com/cloudflare/cloudflare-go/commit/826316c99ed6b55fbd48028f8847d736a7e3c67e)) +* **api:** OpenAPI spec update via Stainless API ([#1881](https://github.com/cloudflare/cloudflare-go/issues/1881)) ([26a4ef1](https://github.com/cloudflare/cloudflare-go/commit/26a4ef142906925bda190ca656470899d1a2dbbb)) +* **api:** OpenAPI spec update via Stainless API ([#1882](https://github.com/cloudflare/cloudflare-go/issues/1882)) ([213386a](https://github.com/cloudflare/cloudflare-go/commit/213386acb8dfaadb310e8046083ef147495de1be)) +* **api:** OpenAPI spec update via Stainless API ([#1883](https://github.com/cloudflare/cloudflare-go/issues/1883)) ([af2c259](https://github.com/cloudflare/cloudflare-go/commit/af2c259b1dfa2ef4387ba787721c440abf722e36)) +* **api:** OpenAPI spec update via Stainless API ([#1885](https://github.com/cloudflare/cloudflare-go/issues/1885)) ([a436f5e](https://github.com/cloudflare/cloudflare-go/commit/a436f5e745750644dbbd03b53ac491607fce25eb)) +* **api:** OpenAPI spec update via Stainless API ([#1888](https://github.com/cloudflare/cloudflare-go/issues/1888)) ([57e8e6d](https://github.com/cloudflare/cloudflare-go/commit/57e8e6d58da80a2dde5f621d74059908b4017768)) +* **api:** OpenAPI spec update via Stainless API ([#1889](https://github.com/cloudflare/cloudflare-go/issues/1889)) ([c0be306](https://github.com/cloudflare/cloudflare-go/commit/c0be306fd8fb63ce02c7e9fbfafddc97b767b39f)) +* **api:** OpenAPI spec update via Stainless API ([#1890](https://github.com/cloudflare/cloudflare-go/issues/1890)) ([278feb2](https://github.com/cloudflare/cloudflare-go/commit/278feb23418e1974670ce173ec6ebc97be15cd6e)) +* **api:** OpenAPI spec update via Stainless API ([#1891](https://github.com/cloudflare/cloudflare-go/issues/1891)) ([2cff27f](https://github.com/cloudflare/cloudflare-go/commit/2cff27f6a857961d5f94027aff420f41c576efb1)) +* **api:** OpenAPI spec update via Stainless API ([#1892](https://github.com/cloudflare/cloudflare-go/issues/1892)) ([fa7b98a](https://github.com/cloudflare/cloudflare-go/commit/fa7b98ab4532ba420924456504fe6fc94fd3f0b6)) +* **api:** OpenAPI spec update via Stainless API ([#1894](https://github.com/cloudflare/cloudflare-go/issues/1894)) ([3cc9b87](https://github.com/cloudflare/cloudflare-go/commit/3cc9b874efa61b14547bf052bff81e8e42fc100a)) +* **api:** OpenAPI spec update via Stainless API ([#1895](https://github.com/cloudflare/cloudflare-go/issues/1895)) ([2941913](https://github.com/cloudflare/cloudflare-go/commit/2941913d15d28648fc952ac574c615277b86ce93)) +* **api:** OpenAPI spec update via Stainless API ([#1896](https://github.com/cloudflare/cloudflare-go/issues/1896)) ([1cce5eb](https://github.com/cloudflare/cloudflare-go/commit/1cce5eb5123acad23e466ab898226a0dc201d96e)) +* **api:** OpenAPI spec update via Stainless API ([#1897](https://github.com/cloudflare/cloudflare-go/issues/1897)) ([8d66bd0](https://github.com/cloudflare/cloudflare-go/commit/8d66bd019da1e6f39944c5203bcd3f1cbce0dafe)) +* **api:** OpenAPI spec update via Stainless API ([#1898](https://github.com/cloudflare/cloudflare-go/issues/1898)) ([9ce240b](https://github.com/cloudflare/cloudflare-go/commit/9ce240b192d7732ac2f69d7700efda1b731c846f)) +* **api:** OpenAPI spec update via Stainless API ([#1899](https://github.com/cloudflare/cloudflare-go/issues/1899)) ([0afd266](https://github.com/cloudflare/cloudflare-go/commit/0afd2663ec41fccea421cbad7e2f43e71ee0aaee)) +* **api:** OpenAPI spec update via Stainless API ([#1900](https://github.com/cloudflare/cloudflare-go/issues/1900)) ([ed983c5](https://github.com/cloudflare/cloudflare-go/commit/ed983c50704eab5085fc5b98a32811352452d107)) +* **api:** OpenAPI spec update via Stainless API ([#1902](https://github.com/cloudflare/cloudflare-go/issues/1902)) ([7fa905b](https://github.com/cloudflare/cloudflare-go/commit/7fa905b981baaca160edaa67208af517a37f1902)) +* **api:** OpenAPI spec update via Stainless API ([#1904](https://github.com/cloudflare/cloudflare-go/issues/1904)) ([ba91f41](https://github.com/cloudflare/cloudflare-go/commit/ba91f415500e7c54c7ba4d3577cf16c3fa5c7aec)) +* **api:** OpenAPI spec update via Stainless API ([#1905](https://github.com/cloudflare/cloudflare-go/issues/1905)) ([685462c](https://github.com/cloudflare/cloudflare-go/commit/685462c64a343e7fc48a84e5fbac276b802ad87a)) +* **api:** OpenAPI spec update via Stainless API ([#1906](https://github.com/cloudflare/cloudflare-go/issues/1906)) ([22b6349](https://github.com/cloudflare/cloudflare-go/commit/22b6349e0d7c83d31644c2fd98d6a7080c626c3f)) +* **api:** OpenAPI spec update via Stainless API ([#1907](https://github.com/cloudflare/cloudflare-go/issues/1907)) ([1d233d2](https://github.com/cloudflare/cloudflare-go/commit/1d233d25733b913506d8835c23ff367c9968c78a)) +* **api:** OpenAPI spec update via Stainless API ([#1908](https://github.com/cloudflare/cloudflare-go/issues/1908)) ([2a88d76](https://github.com/cloudflare/cloudflare-go/commit/2a88d765c8f143eecd8a12ea18b468876ef11673)) +* **api:** OpenAPI spec update via Stainless API ([#1909](https://github.com/cloudflare/cloudflare-go/issues/1909)) ([11023d8](https://github.com/cloudflare/cloudflare-go/commit/11023d8e319dcc3281c1cae785d5a5d1de4c6a48)) +* **api:** OpenAPI spec update via Stainless API ([#1910](https://github.com/cloudflare/cloudflare-go/issues/1910)) ([7a42345](https://github.com/cloudflare/cloudflare-go/commit/7a423454dcc878c055549f942c49148d78edd661)) +* **api:** OpenAPI spec update via Stainless API ([#1911](https://github.com/cloudflare/cloudflare-go/issues/1911)) ([b51a8e2](https://github.com/cloudflare/cloudflare-go/commit/b51a8e25b8eb25679b285aebc311df9c82d555d1)) +* **api:** OpenAPI spec update via Stainless API ([#1912](https://github.com/cloudflare/cloudflare-go/issues/1912)) ([1ca418c](https://github.com/cloudflare/cloudflare-go/commit/1ca418c9eba6abf032ace448fdebac2967b57204)) +* **api:** OpenAPI spec update via Stainless API ([#1913](https://github.com/cloudflare/cloudflare-go/issues/1913)) ([fa9e05d](https://github.com/cloudflare/cloudflare-go/commit/fa9e05d044453f62628f0cf447ded615af5b0c06)) +* **api:** OpenAPI spec update via Stainless API ([#1914](https://github.com/cloudflare/cloudflare-go/issues/1914)) ([7c54539](https://github.com/cloudflare/cloudflare-go/commit/7c54539b04741a68c187b7d84822b719c65e18b2)) +* **api:** OpenAPI spec update via Stainless API ([#1915](https://github.com/cloudflare/cloudflare-go/issues/1915)) ([23742c3](https://github.com/cloudflare/cloudflare-go/commit/23742c3ac032893a12b7319d457ff0ed2995f6c2)) +* **api:** OpenAPI spec update via Stainless API ([#1916](https://github.com/cloudflare/cloudflare-go/issues/1916)) ([45a7df6](https://github.com/cloudflare/cloudflare-go/commit/45a7df6f2bec4fcc90ea054c002d925ae70a76e8)) +* **api:** OpenAPI spec update via Stainless API ([#1917](https://github.com/cloudflare/cloudflare-go/issues/1917)) ([13723cb](https://github.com/cloudflare/cloudflare-go/commit/13723cbed4a51bf1f0f3939383e0532b962b9891)) +* **api:** OpenAPI spec update via Stainless API ([#1918](https://github.com/cloudflare/cloudflare-go/issues/1918)) ([d2945a8](https://github.com/cloudflare/cloudflare-go/commit/d2945a88489c9dd16c95a92ae6e005fd00374be8)) +* **api:** OpenAPI spec update via Stainless API ([#1919](https://github.com/cloudflare/cloudflare-go/issues/1919)) ([ce25fff](https://github.com/cloudflare/cloudflare-go/commit/ce25fff2934f388f401c3ddbe13eacba4a495603)) +* **api:** OpenAPI spec update via Stainless API ([#1920](https://github.com/cloudflare/cloudflare-go/issues/1920)) ([faa8286](https://github.com/cloudflare/cloudflare-go/commit/faa828610cafcc3114b17e78253a5380606f2140)) +* **api:** OpenAPI spec update via Stainless API ([#1922](https://github.com/cloudflare/cloudflare-go/issues/1922)) ([27e33d6](https://github.com/cloudflare/cloudflare-go/commit/27e33d69f5790412c65284363e941fdca6e28795)) +* **api:** OpenAPI spec update via Stainless API ([#1923](https://github.com/cloudflare/cloudflare-go/issues/1923)) ([f3f59a8](https://github.com/cloudflare/cloudflare-go/commit/f3f59a80efcde43c52e189f592ca5ca0a8442f7a)) +* **api:** OpenAPI spec update via Stainless API ([#1924](https://github.com/cloudflare/cloudflare-go/issues/1924)) ([ae81799](https://github.com/cloudflare/cloudflare-go/commit/ae817994ea52c0921a2ab588e4ffd88f736fb50f)) +* **api:** OpenAPI spec update via Stainless API ([#1925](https://github.com/cloudflare/cloudflare-go/issues/1925)) ([14af5b2](https://github.com/cloudflare/cloudflare-go/commit/14af5b255965475fbd82f6e6ca3fd57b757c2449)) +* **api:** OpenAPI spec update via Stainless API ([#1926](https://github.com/cloudflare/cloudflare-go/issues/1926)) ([c54229e](https://github.com/cloudflare/cloudflare-go/commit/c54229ee081f621eda59819d7caca62bb5bd50cd)) +* **api:** OpenAPI spec update via Stainless API ([#1927](https://github.com/cloudflare/cloudflare-go/issues/1927)) ([8a91755](https://github.com/cloudflare/cloudflare-go/commit/8a91755ab1be8a757e7e791e64b93360bf1885cc)) +* **api:** OpenAPI spec update via Stainless API ([#1928](https://github.com/cloudflare/cloudflare-go/issues/1928)) ([5d85f84](https://github.com/cloudflare/cloudflare-go/commit/5d85f848409036d34fd976d64402a228c7a32c5a)) +* **api:** OpenAPI spec update via Stainless API ([#1929](https://github.com/cloudflare/cloudflare-go/issues/1929)) ([702d17d](https://github.com/cloudflare/cloudflare-go/commit/702d17dea9050b80d0089dbf89c7ccc106998ece)) +* **api:** OpenAPI spec update via Stainless API ([#1930](https://github.com/cloudflare/cloudflare-go/issues/1930)) ([4ffb758](https://github.com/cloudflare/cloudflare-go/commit/4ffb75853cbdb0a677a3278dc4fd34333de196f2)) +* **api:** OpenAPI spec update via Stainless API ([#1931](https://github.com/cloudflare/cloudflare-go/issues/1931)) ([1b28fd4](https://github.com/cloudflare/cloudflare-go/commit/1b28fd4f92990771c889e3a97566e03695a9f3f9)) +* **api:** OpenAPI spec update via Stainless API ([#1932](https://github.com/cloudflare/cloudflare-go/issues/1932)) ([438210c](https://github.com/cloudflare/cloudflare-go/commit/438210cee9277f8d32fb03a13202aee50021922e)) +* **api:** OpenAPI spec update via Stainless API ([#1933](https://github.com/cloudflare/cloudflare-go/issues/1933)) ([9b5abc3](https://github.com/cloudflare/cloudflare-go/commit/9b5abc3ce18318def6ee61eca3bd6512458c97a0)) +* **api:** OpenAPI spec update via Stainless API ([#1934](https://github.com/cloudflare/cloudflare-go/issues/1934)) ([3f43810](https://github.com/cloudflare/cloudflare-go/commit/3f438107105c7de83ffa5999f5a622c417b8644e)) +* **api:** OpenAPI spec update via Stainless API ([#1935](https://github.com/cloudflare/cloudflare-go/issues/1935)) ([97ce462](https://github.com/cloudflare/cloudflare-go/commit/97ce462c0bc8062a0fa8ed1d5e7bd3a33e44d856)) +* **api:** OpenAPI spec update via Stainless API ([#1936](https://github.com/cloudflare/cloudflare-go/issues/1936)) ([6bf1a33](https://github.com/cloudflare/cloudflare-go/commit/6bf1a33522dad00d200ad2508469798cffe9f587)) +* **api:** OpenAPI spec update via Stainless API ([#1937](https://github.com/cloudflare/cloudflare-go/issues/1937)) ([b36f46d](https://github.com/cloudflare/cloudflare-go/commit/b36f46df1010d485f141c04b448e07c4191cd926)) +* **api:** OpenAPI spec update via Stainless API ([#1940](https://github.com/cloudflare/cloudflare-go/issues/1940)) ([48003b3](https://github.com/cloudflare/cloudflare-go/commit/48003b339edc4b5dd4ad34b9e82eb84d767899f7)) +* **api:** OpenAPI spec update via Stainless API ([#1941](https://github.com/cloudflare/cloudflare-go/issues/1941)) ([b911f69](https://github.com/cloudflare/cloudflare-go/commit/b911f69569446e0247a8d5fadabf0bbc63e5f9ac)) +* **api:** OpenAPI spec update via Stainless API ([#1942](https://github.com/cloudflare/cloudflare-go/issues/1942)) ([24ed50d](https://github.com/cloudflare/cloudflare-go/commit/24ed50dab5a21187b7894e5b2e2754d28591a8eb)) +* **api:** OpenAPI spec update via Stainless API ([#1943](https://github.com/cloudflare/cloudflare-go/issues/1943)) ([dc821a6](https://github.com/cloudflare/cloudflare-go/commit/dc821a682b9876d894220c9cc309a0d58ec86e70)) +* **api:** OpenAPI spec update via Stainless API ([#1947](https://github.com/cloudflare/cloudflare-go/issues/1947)) ([b96b046](https://github.com/cloudflare/cloudflare-go/commit/b96b046488283635fb880a7e7cafe0faa8a0379a)) +* **api:** OpenAPI spec update via Stainless API ([#1948](https://github.com/cloudflare/cloudflare-go/issues/1948)) ([cda1d98](https://github.com/cloudflare/cloudflare-go/commit/cda1d9890aa6f5a1bc8857cf859b94231cc67e06)) +* **api:** OpenAPI spec update via Stainless API ([#1950](https://github.com/cloudflare/cloudflare-go/issues/1950)) ([fb2ff25](https://github.com/cloudflare/cloudflare-go/commit/fb2ff25aeb8cca13bcc444b33fccb5875e340b7f)) +* **api:** OpenAPI spec update via Stainless API ([#1951](https://github.com/cloudflare/cloudflare-go/issues/1951)) ([6a198de](https://github.com/cloudflare/cloudflare-go/commit/6a198dedd36c9b8e13e8175f134e88a5e3308ace)) +* **api:** OpenAPI spec update via Stainless API ([#1952](https://github.com/cloudflare/cloudflare-go/issues/1952)) ([77ff8dc](https://github.com/cloudflare/cloudflare-go/commit/77ff8dc903f942c194f34424bc053e0a2e1d2fdf)) +* **api:** OpenAPI spec update via Stainless API ([#1953](https://github.com/cloudflare/cloudflare-go/issues/1953)) ([9bbf92c](https://github.com/cloudflare/cloudflare-go/commit/9bbf92c162395a833ab59264b890301e9ebd5d6d)) +* **api:** OpenAPI spec update via Stainless API ([#1954](https://github.com/cloudflare/cloudflare-go/issues/1954)) ([ef1504c](https://github.com/cloudflare/cloudflare-go/commit/ef1504ccaf174b491a2b17ef4f836c20e6932398)) +* **api:** OpenAPI spec update via Stainless API ([#1955](https://github.com/cloudflare/cloudflare-go/issues/1955)) ([ecbc2ad](https://github.com/cloudflare/cloudflare-go/commit/ecbc2adec50da77990bfa2afe3b2ead175fb95cc)) +* **api:** OpenAPI spec update via Stainless API ([#1957](https://github.com/cloudflare/cloudflare-go/issues/1957)) ([324465c](https://github.com/cloudflare/cloudflare-go/commit/324465c09cb501a272bee2a4175e93ee38464819)) +* **api:** update via SDK Studio ([#1844](https://github.com/cloudflare/cloudflare-go/issues/1844)) ([e1ec709](https://github.com/cloudflare/cloudflare-go/commit/e1ec709087a2b01a555b7a85aa8a188e79d7595d)) +* **api:** update via SDK Studio ([#1852](https://github.com/cloudflare/cloudflare-go/issues/1852)) ([f7060f8](https://github.com/cloudflare/cloudflare-go/commit/f7060f8bc683ccc1207d84424de855352ea8c9fc)) +* **api:** update via SDK Studio ([#1865](https://github.com/cloudflare/cloudflare-go/issues/1865)) ([202f084](https://github.com/cloudflare/cloudflare-go/commit/202f0843e5f0686ab738d98dcaa65ed86a62260d)) +* **api:** update via SDK Studio ([#1886](https://github.com/cloudflare/cloudflare-go/issues/1886)) ([b04a64c](https://github.com/cloudflare/cloudflare-go/commit/b04a64c0984553582ce096496bb160edd4b25b57)) +* **api:** update via SDK Studio ([#1893](https://github.com/cloudflare/cloudflare-go/issues/1893)) ([fb652db](https://github.com/cloudflare/cloudflare-go/commit/fb652dbfcf915fc7f2525d2af16b48a0022c8245)) +* **api:** update via SDK Studio ([#1901](https://github.com/cloudflare/cloudflare-go/issues/1901)) ([febb26e](https://github.com/cloudflare/cloudflare-go/commit/febb26e50b012e7463dbd0911fed2d388833f21f)) +* **api:** update via SDK Studio ([#1903](https://github.com/cloudflare/cloudflare-go/issues/1903)) ([94fd2fa](https://github.com/cloudflare/cloudflare-go/commit/94fd2fa0767c6ec5cbbbc4aa25a20eb5a981f1af)) +* **api:** update via SDK Studio ([#1945](https://github.com/cloudflare/cloudflare-go/issues/1945)) ([9f18a22](https://github.com/cloudflare/cloudflare-go/commit/9f18a22274939cf453e908245f1bb7fe94dd5994)) +* **api:** update via SDK Studio ([#1946](https://github.com/cloudflare/cloudflare-go/issues/1946)) ([036568e](https://github.com/cloudflare/cloudflare-go/commit/036568e03b1bebb9c5c3c0632010dcc8cc49d7c6)) +* **api:** update via SDK Studio ([#1949](https://github.com/cloudflare/cloudflare-go/issues/1949)) ([08c17df](https://github.com/cloudflare/cloudflare-go/commit/08c17df90d716163b7dea414815f6b466cdbc622)) +* **api:** update via SDK Studio ([#1958](https://github.com/cloudflare/cloudflare-go/issues/1958)) ([539d2ee](https://github.com/cloudflare/cloudflare-go/commit/539d2ee8194a058818b55d063adc1a5fed86bba9)) +* **api:** update via SDK Studio ([#1960](https://github.com/cloudflare/cloudflare-go/issues/1960)) ([4298c46](https://github.com/cloudflare/cloudflare-go/commit/4298c4699360f7cd4303babf3795e348e4cd1634)) +* **api:** update via SDK Studio ([#1961](https://github.com/cloudflare/cloudflare-go/issues/1961)) ([493200d](https://github.com/cloudflare/cloudflare-go/commit/493200df97b38fa36e0dc36500d006de8c229e6c)) +* **api:** update via SDK Studio ([#1962](https://github.com/cloudflare/cloudflare-go/issues/1962)) ([a70e598](https://github.com/cloudflare/cloudflare-go/commit/a70e598fcca1774a21514c0bb5767cf76947eb8d)) +* **api:** update via SDK Studio ([#1963](https://github.com/cloudflare/cloudflare-go/issues/1963)) ([515ec56](https://github.com/cloudflare/cloudflare-go/commit/515ec56470e963778eed62ddc973dd680b5a32f0)) +* **api:** update via SDK Studio ([#1964](https://github.com/cloudflare/cloudflare-go/issues/1964)) ([7a0993d](https://github.com/cloudflare/cloudflare-go/commit/7a0993dcdfe1753b05827f80925c65ecfdbb9662)) +* **api:** update via SDK Studio ([#1965](https://github.com/cloudflare/cloudflare-go/issues/1965)) ([e1341b8](https://github.com/cloudflare/cloudflare-go/commit/e1341b8e899474285e897e9b03a53534d9f37fc9)) +* **api:** update via SDK Studio ([#1966](https://github.com/cloudflare/cloudflare-go/issues/1966)) ([069c7fe](https://github.com/cloudflare/cloudflare-go/commit/069c7fe233d9fddb80ae85d1135025b7ff38a41f)) +* **api:** update via SDK Studio ([#1967](https://github.com/cloudflare/cloudflare-go/issues/1967)) ([04a6457](https://github.com/cloudflare/cloudflare-go/commit/04a64571ffd56f49a6956fbc27106c38b78c7efb)) +* **api:** update via SDK Studio ([#1968](https://github.com/cloudflare/cloudflare-go/issues/1968)) ([3c5fbcb](https://github.com/cloudflare/cloudflare-go/commit/3c5fbcb6d03e6b1e5f32e0b1a14fa68b0c289736)) +* **api:** update via SDK Studio ([#1969](https://github.com/cloudflare/cloudflare-go/issues/1969)) ([3c696e7](https://github.com/cloudflare/cloudflare-go/commit/3c696e75a3ac72e9703125b7da1321d6ae66ec4a)) +* **api:** update via SDK Studio ([#1970](https://github.com/cloudflare/cloudflare-go/issues/1970)) ([c4160d3](https://github.com/cloudflare/cloudflare-go/commit/c4160d3e54622f5917bff90121b49a5e74be7814)) +* **api:** update via SDK Studio ([#1971](https://github.com/cloudflare/cloudflare-go/issues/1971)) ([d0005c2](https://github.com/cloudflare/cloudflare-go/commit/d0005c25a5a6aed3c230ded6501327f8b9582100)) +* **api:** update via SDK Studio ([#1972](https://github.com/cloudflare/cloudflare-go/issues/1972)) ([abb726f](https://github.com/cloudflare/cloudflare-go/commit/abb726f32974abc8780a9a8aa3f423b290915649)) +* **api:** update via SDK Studio ([#1973](https://github.com/cloudflare/cloudflare-go/issues/1973)) ([3789b4c](https://github.com/cloudflare/cloudflare-go/commit/3789b4c159b264b859e37a1559bb8d948b929d4c)) +* **api:** update via SDK Studio ([#1976](https://github.com/cloudflare/cloudflare-go/issues/1976)) ([95f5df8](https://github.com/cloudflare/cloudflare-go/commit/95f5df84be86634d9b2942a5692ba24e65b99736)) +* **api:** update via SDK Studio ([#1977](https://github.com/cloudflare/cloudflare-go/issues/1977)) ([3943c86](https://github.com/cloudflare/cloudflare-go/commit/3943c86d41ec4502ba6903c8c4d8fb0cb2b0812d)) + + +### Chores + +* rebuild project due to oas spec rename ([#1884](https://github.com/cloudflare/cloudflare-go/issues/1884)) ([59cd9f9](https://github.com/cloudflare/cloudflare-go/commit/59cd9f9bf4a2cd6f5a7b747c1b098839f41d84cc)) + ## 2.1.0 (2024-04-23) Full Changelog: [v2.0.0...v2.1.0](https://github.com/cloudflare/cloudflare-go/compare/v2.0.0...v2.1.0) diff --git a/README.md b/README.md index 677ae4dd7ca..d90f4b57a83 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Or to pin the version: ```sh -go get -u 'github.com/cloudflare/cloudflare-go/v2@v2.1.0' +go get -u 'github.com/cloudflare/cloudflare-go/v2@v2.2.0' ``` @@ -57,7 +57,7 @@ func main() { ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }), Name: cloudflare.F("example.com"), - Type: cloudflare.F(zones.ZoneNewParamsTypeFull), + Type: cloudflare.F(zones.TypeFull), }) if err != nil { panic(err.Error()) diff --git a/accounts/account.go b/accounts/account.go index 2c5c9edd162..02c84b6b0ad 100644 --- a/accounts/account.go +++ b/accounts/account.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/accounts/account_test.go b/accounts/account_test.go index 498f9e3410f..dd676ac759c 100644 --- a/accounts/account_test.go +++ b/accounts/account_test.go @@ -15,7 +15,6 @@ import ( ) func TestAccountUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestAccountUpdateWithOptionalParams(t *testing.T) { } func TestAccountListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -78,7 +76,6 @@ func TestAccountListWithOptionalParams(t *testing.T) { } func TestAccountGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/accounts/aliases.go b/accounts/aliases.go index a4796e48384..d5ea651b2d1 100644 --- a/accounts/aliases.go +++ b/accounts/aliases.go @@ -4,7 +4,7 @@ package accounts import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/accounts/member.go b/accounts/member.go index 6143a705171..5d4a833b983 100644 --- a/accounts/member.go +++ b/accounts/member.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // MemberService contains methods and other services that help with interacting @@ -38,7 +38,7 @@ func NewMemberService(opts ...option.RequestOption) (r *MemberService) { func (r *MemberService) New(ctx context.Context, params MemberNewParams, opts ...option.RequestOption) (res *UserWithInviteCode, err error) { opts = append(r.Options[:], opts...) var env MemberNewResponseEnvelope - path := fmt.Sprintf("accounts/%v/members", params.AccountID) + path := fmt.Sprintf("accounts/%s/members", params.AccountID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return @@ -51,7 +51,7 @@ func (r *MemberService) New(ctx context.Context, params MemberNewParams, opts .. func (r *MemberService) Update(ctx context.Context, memberID string, params MemberUpdateParams, opts ...option.RequestOption) (res *shared.Member, err error) { opts = append(r.Options[:], opts...) var env MemberUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%v/members/%s", params.AccountID, memberID) + path := fmt.Sprintf("accounts/%s/members/%s", params.AccountID, memberID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -65,7 +65,7 @@ func (r *MemberService) List(ctx context.Context, params MemberListParams, opts var raw *http.Response opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) - path := fmt.Sprintf("accounts/%v/members", params.AccountID) + path := fmt.Sprintf("accounts/%s/members", params.AccountID) cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...) if err != nil { return nil, err @@ -84,10 +84,10 @@ func (r *MemberService) ListAutoPaging(ctx context.Context, params MemberListPar } // Remove a member from an account. -func (r *MemberService) Delete(ctx context.Context, memberID string, params MemberDeleteParams, opts ...option.RequestOption) (res *MemberDeleteResponse, err error) { +func (r *MemberService) Delete(ctx context.Context, memberID string, body MemberDeleteParams, opts ...option.RequestOption) (res *MemberDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env MemberDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%v/members/%s", params.AccountID, memberID) + path := fmt.Sprintf("accounts/%s/members/%s", body.AccountID, memberID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -100,7 +100,7 @@ func (r *MemberService) Delete(ctx context.Context, memberID string, params Memb func (r *MemberService) Get(ctx context.Context, memberID string, query MemberGetParams, opts ...option.RequestOption) (res *shared.Member, err error) { opts = append(r.Options[:], opts...) var env MemberGetResponseEnvelope - path := fmt.Sprintf("accounts/%v/members/%s", query.AccountID, memberID) + path := fmt.Sprintf("accounts/%s/members/%s", query.AccountID, memberID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) if err != nil { return @@ -109,6 +109,22 @@ func (r *MemberService) Get(ctx context.Context, memberID string, query MemberGe return } +// Whether the user is a member of the organization or has an inivitation pending. +type Status string + +const ( + StatusMember Status = "member" + StatusInvited Status = "invited" +) + +func (r Status) IsKnown() bool { + switch r { + case StatusMember, StatusInvited: + return true + } + return false +} + type UserWithInviteCode struct { // Membership identifier tag. ID string `json:"id,required"` @@ -322,7 +338,7 @@ func (r memberDeleteResponseJSON) RawJSON() string { } type MemberNewParams struct { - AccountID param.Field[interface{}] `path:"account_id,required"` + AccountID param.Field[string] `path:"account_id,required"` // The contact email address of the user. Email param.Field[string] `json:"email,required"` // Array of roles associated with this member. @@ -393,8 +409,8 @@ func (r MemberNewResponseEnvelopeSuccess) IsKnown() bool { } type MemberUpdateParams struct { - AccountID param.Field[interface{}] `path:"account_id,required"` - Member shared.MemberParam `json:"member,required"` + AccountID param.Field[string] `path:"account_id,required"` + Member shared.MemberParam `json:"member,required"` } func (r MemberUpdateParams) MarshalJSON() (data []byte, err error) { @@ -445,7 +461,7 @@ func (r MemberUpdateResponseEnvelopeSuccess) IsKnown() bool { } type MemberListParams struct { - AccountID param.Field[interface{}] `path:"account_id,required"` + AccountID param.Field[string] `path:"account_id,required"` // Direction to order results. Direction param.Field[MemberListParamsDirection] `query:"direction"` // Field to order results by. @@ -518,12 +534,7 @@ func (r MemberListParamsStatus) IsKnown() bool { } type MemberDeleteParams struct { - AccountID param.Field[interface{}] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r MemberDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) + AccountID param.Field[string] `path:"account_id,required"` } type MemberDeleteResponseEnvelope struct { @@ -570,7 +581,7 @@ func (r MemberDeleteResponseEnvelopeSuccess) IsKnown() bool { } type MemberGetParams struct { - AccountID param.Field[interface{}] `path:"account_id,required"` + AccountID param.Field[string] `path:"account_id,required"` } type MemberGetResponseEnvelope struct { diff --git a/accounts/member_test.go b/accounts/member_test.go index f5ddc86ec77..04f69a2567e 100644 --- a/accounts/member_test.go +++ b/accounts/member_test.go @@ -10,13 +10,12 @@ import ( "github.com/cloudflare/cloudflare-go/v2" "github.com/cloudflare/cloudflare-go/v2/accounts" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) func TestMemberNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -30,7 +29,7 @@ func TestMemberNewWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Accounts.Members.New(context.TODO(), accounts.MemberNewParams{ - AccountID: cloudflare.F[any](map[string]interface{}{}), + AccountID: cloudflare.F("string"), Email: cloudflare.F("user@example.com"), Roles: cloudflare.F([]string{"3536bcfad5faccb999b47003c79917fb", "3536bcfad5faccb999b47003c79917fb", "3536bcfad5faccb999b47003c79917fb"}), Status: cloudflare.F(accounts.MemberNewParamsStatusAccepted), @@ -45,7 +44,7 @@ func TestMemberNewWithOptionalParams(t *testing.T) { } func TestMemberUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -62,7 +61,7 @@ func TestMemberUpdate(t *testing.T) { context.TODO(), "4536bcfad5faccb111b47003c79917fa", accounts.MemberUpdateParams{ - AccountID: cloudflare.F[any](map[string]interface{}{}), + AccountID: cloudflare.F("string"), Member: shared.MemberParam{ Roles: cloudflare.F([]shared.MemberRoleParam{{ ID: cloudflare.F("3536bcfad5faccb999b47003c79917fb"), @@ -84,7 +83,6 @@ func TestMemberUpdate(t *testing.T) { } func TestMemberListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -98,7 +96,7 @@ func TestMemberListWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Accounts.Members.List(context.TODO(), accounts.MemberListParams{ - AccountID: cloudflare.F[any](map[string]interface{}{}), + AccountID: cloudflare.F("string"), Direction: cloudflare.F(accounts.MemberListParamsDirectionDesc), Order: cloudflare.F(accounts.MemberListParamsOrderStatus), Page: cloudflare.F(1.000000), @@ -115,7 +113,6 @@ func TestMemberListWithOptionalParams(t *testing.T) { } func TestMemberDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -132,8 +129,7 @@ func TestMemberDelete(t *testing.T) { context.TODO(), "4536bcfad5faccb111b47003c79917fa", accounts.MemberDeleteParams{ - AccountID: cloudflare.F[any](map[string]interface{}{}), - Body: map[string]interface{}{}, + AccountID: cloudflare.F("string"), }, ) if err != nil { @@ -146,7 +142,6 @@ func TestMemberDelete(t *testing.T) { } func TestMemberGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -163,7 +158,7 @@ func TestMemberGet(t *testing.T) { context.TODO(), "4536bcfad5faccb111b47003c79917fa", accounts.MemberGetParams{ - AccountID: cloudflare.F[any](map[string]interface{}{}), + AccountID: cloudflare.F("string"), }, ) if err != nil { diff --git a/accounts/role.go b/accounts/role.go index 7f17cfabe52..51db4d4a858 100644 --- a/accounts/role.go +++ b/accounts/role.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -39,8 +39,8 @@ func (r *RoleService) List(ctx context.Context, query RoleListParams, opts ...op var raw *http.Response opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) - path := fmt.Sprintf("accounts/%v/roles", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + path := fmt.Sprintf("accounts/%s/roles", query.AccountID) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -61,7 +61,7 @@ func (r *RoleService) ListAutoPaging(ctx context.Context, query RoleListParams, func (r *RoleService) Get(ctx context.Context, roleID interface{}, query RoleGetParams, opts ...option.RequestOption) (res *RoleGetResponseUnion, err error) { opts = append(r.Options[:], opts...) var env RoleGetResponseEnvelope - path := fmt.Sprintf("accounts/%v/roles/%v", query.AccountID, roleID) + path := fmt.Sprintf("accounts/%s/roles/%v", query.AccountID, roleID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) if err != nil { return @@ -87,11 +87,11 @@ func init() { } type RoleListParams struct { - AccountID param.Field[interface{}] `path:"account_id,required"` + AccountID param.Field[string] `path:"account_id,required"` } type RoleGetParams struct { - AccountID param.Field[interface{}] `path:"account_id,required"` + AccountID param.Field[string] `path:"account_id,required"` } type RoleGetResponseEnvelope struct { diff --git a/accounts/role_test.go b/accounts/role_test.go index 27a107f5a39..0856e760663 100644 --- a/accounts/role_test.go +++ b/accounts/role_test.go @@ -15,7 +15,6 @@ import ( ) func TestRoleList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -29,7 +28,7 @@ func TestRoleList(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Accounts.Roles.List(context.TODO(), accounts.RoleListParams{ - AccountID: cloudflare.F[any](map[string]interface{}{}), + AccountID: cloudflare.F("string"), }) if err != nil { var apierr *cloudflare.Error @@ -41,7 +40,6 @@ func TestRoleList(t *testing.T) { } func TestRoleGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -58,7 +56,7 @@ func TestRoleGet(t *testing.T) { context.TODO(), map[string]interface{}{}, accounts.RoleGetParams{ - AccountID: cloudflare.F[any](map[string]interface{}{}), + AccountID: cloudflare.F("string"), }, ) if err != nil { diff --git a/acm/aliases.go b/acm/aliases.go index 7276335dd9e..d172c7f973e 100644 --- a/acm/aliases.go +++ b/acm/aliases.go @@ -4,7 +4,7 @@ package acm import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/acm/totaltls.go b/acm/totaltls.go index 67c685dd2ac..d29d7a8c614 100644 --- a/acm/totaltls.go +++ b/acm/totaltls.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // TotalTLSService contains methods and other services that help with interacting @@ -57,9 +57,25 @@ func (r *TotalTLSService) Get(ctx context.Context, query TotalTLSGetParams, opts return } +// The Certificate Authority that Total TLS certificates will be issued through. +type CertificateAuthority string + +const ( + CertificateAuthorityGoogle CertificateAuthority = "google" + CertificateAuthorityLetsEncrypt CertificateAuthority = "lets_encrypt" +) + +func (r CertificateAuthority) IsKnown() bool { + switch r { + case CertificateAuthorityGoogle, CertificateAuthorityLetsEncrypt: + return true + } + return false +} + type TotalTLSNewResponse struct { // The Certificate Authority that Total TLS certificates will be issued through. - CertificateAuthority TotalTLSNewResponseCertificateAuthority `json:"certificate_authority"` + CertificateAuthority CertificateAuthority `json:"certificate_authority"` // If enabled, Total TLS will order a hostname specific TLS certificate for any // proxied A, AAAA, or CNAME record in your zone. Enabled bool `json:"enabled"` @@ -86,22 +102,6 @@ func (r totalTLSNewResponseJSON) RawJSON() string { return r.raw } -// The Certificate Authority that Total TLS certificates will be issued through. -type TotalTLSNewResponseCertificateAuthority string - -const ( - TotalTLSNewResponseCertificateAuthorityGoogle TotalTLSNewResponseCertificateAuthority = "google" - TotalTLSNewResponseCertificateAuthorityLetsEncrypt TotalTLSNewResponseCertificateAuthority = "lets_encrypt" -) - -func (r TotalTLSNewResponseCertificateAuthority) IsKnown() bool { - switch r { - case TotalTLSNewResponseCertificateAuthorityGoogle, TotalTLSNewResponseCertificateAuthorityLetsEncrypt: - return true - } - return false -} - // The validity period in days for the certificates ordered via Total TLS. type TotalTLSNewResponseValidityDays int64 @@ -119,7 +119,7 @@ func (r TotalTLSNewResponseValidityDays) IsKnown() bool { type TotalTLSGetResponse struct { // The Certificate Authority that Total TLS certificates will be issued through. - CertificateAuthority TotalTLSGetResponseCertificateAuthority `json:"certificate_authority"` + CertificateAuthority CertificateAuthority `json:"certificate_authority"` // If enabled, Total TLS will order a hostname specific TLS certificate for any // proxied A, AAAA, or CNAME record in your zone. Enabled bool `json:"enabled"` @@ -146,22 +146,6 @@ func (r totalTLSGetResponseJSON) RawJSON() string { return r.raw } -// The Certificate Authority that Total TLS certificates will be issued through. -type TotalTLSGetResponseCertificateAuthority string - -const ( - TotalTLSGetResponseCertificateAuthorityGoogle TotalTLSGetResponseCertificateAuthority = "google" - TotalTLSGetResponseCertificateAuthorityLetsEncrypt TotalTLSGetResponseCertificateAuthority = "lets_encrypt" -) - -func (r TotalTLSGetResponseCertificateAuthority) IsKnown() bool { - switch r { - case TotalTLSGetResponseCertificateAuthorityGoogle, TotalTLSGetResponseCertificateAuthorityLetsEncrypt: - return true - } - return false -} - // The validity period in days for the certificates ordered via Total TLS. type TotalTLSGetResponseValidityDays int64 @@ -184,35 +168,19 @@ type TotalTLSNewParams struct { // proxied A, AAAA, or CNAME record in your zone. Enabled param.Field[bool] `json:"enabled,required"` // The Certificate Authority that Total TLS certificates will be issued through. - CertificateAuthority param.Field[TotalTLSNewParamsCertificateAuthority] `json:"certificate_authority"` + CertificateAuthority param.Field[CertificateAuthority] `json:"certificate_authority"` } func (r TotalTLSNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The Certificate Authority that Total TLS certificates will be issued through. -type TotalTLSNewParamsCertificateAuthority string - -const ( - TotalTLSNewParamsCertificateAuthorityGoogle TotalTLSNewParamsCertificateAuthority = "google" - TotalTLSNewParamsCertificateAuthorityLetsEncrypt TotalTLSNewParamsCertificateAuthority = "lets_encrypt" -) - -func (r TotalTLSNewParamsCertificateAuthority) IsKnown() bool { - switch r { - case TotalTLSNewParamsCertificateAuthorityGoogle, TotalTLSNewParamsCertificateAuthorityLetsEncrypt: - return true - } - return false -} - type TotalTLSNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result TotalTLSNewResponse `json:"result,required"` // Whether the API call was successful Success TotalTLSNewResponseEnvelopeSuccess `json:"success,required"` + Result TotalTLSNewResponse `json:"result"` JSON totalTLSNewResponseEnvelopeJSON `json:"-"` } @@ -221,8 +189,8 @@ type TotalTLSNewResponseEnvelope struct { type totalTLSNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -258,9 +226,9 @@ type TotalTLSGetParams struct { type TotalTLSGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result TotalTLSGetResponse `json:"result,required"` // Whether the API call was successful Success TotalTLSGetResponseEnvelopeSuccess `json:"success,required"` + Result TotalTLSGetResponse `json:"result"` JSON totalTLSGetResponseEnvelopeJSON `json:"-"` } @@ -269,8 +237,8 @@ type TotalTLSGetResponseEnvelope struct { type totalTLSGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/acm/totaltls_test.go b/acm/totaltls_test.go index cd4e02e4d13..4dd85e14508 100644 --- a/acm/totaltls_test.go +++ b/acm/totaltls_test.go @@ -15,7 +15,6 @@ import ( ) func TestTotalTLSNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -31,7 +30,7 @@ func TestTotalTLSNewWithOptionalParams(t *testing.T) { _, err := client.ACM.TotalTLS.New(context.TODO(), acm.TotalTLSNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Enabled: cloudflare.F(true), - CertificateAuthority: cloudflare.F(acm.TotalTLSNewParamsCertificateAuthorityGoogle), + CertificateAuthority: cloudflare.F(acm.CertificateAuthorityGoogle), }) if err != nil { var apierr *cloudflare.Error @@ -43,7 +42,6 @@ func TestTotalTLSNewWithOptionalParams(t *testing.T) { } func TestTotalTLSGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/addressing/addressmap.go b/addressing/addressmap.go index 3655b59b763..e1df0209c8f 100644 --- a/addressing/addressmap.go +++ b/addressing/addressmap.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AddressMapService contains methods and other services that help with interacting @@ -58,7 +58,7 @@ func (r *AddressMapService) List(ctx context.Context, query AddressMapListParams opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/addressing/address_maps", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -77,10 +77,10 @@ func (r *AddressMapService) ListAutoPaging(ctx context.Context, query AddressMap // Delete a particular address map owned by the account. An Address Map must be // disabled before it can be deleted. -func (r *AddressMapService) Delete(ctx context.Context, addressMapID string, params AddressMapDeleteParams, opts ...option.RequestOption) (res *[]AddressMapDeleteResponse, err error) { +func (r *AddressMapService) Delete(ctx context.Context, addressMapID string, body AddressMapDeleteParams, opts ...option.RequestOption) (res *[]AddressMapDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env AddressMapDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s", params.AccountID, addressMapID) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s", body.AccountID, addressMapID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -130,7 +130,7 @@ type AddressMap struct { // handshake from a client without an SNI, it will respond with the default SNI on // those IPs. The default SNI can be any valid zone or subdomain owned by the // account. - DefaultSni string `json:"default_sni,nullable"` + DefaultSNI string `json:"default_sni,nullable"` // An optional description field which may be used to describe the types of IPs or // zones on the map. Description string `json:"description,nullable"` @@ -147,7 +147,7 @@ type addressMapJSON struct { CanDelete apijson.Field CanModifyIPs apijson.Field CreatedAt apijson.Field - DefaultSni apijson.Field + DefaultSNI apijson.Field Description apijson.Field Enabled apijson.Field ModifiedAt apijson.Field @@ -163,6 +163,22 @@ func (r addressMapJSON) RawJSON() string { return r.raw } +// The type of the membership. +type Kind string + +const ( + KindZone Kind = "zone" + KindAccount Kind = "account" +) + +func (r Kind) IsKnown() bool { + switch r { + case KindZone, KindAccount: + return true + } + return false +} + type AddressMapNewResponse struct { // Identifier ID string `json:"id"` @@ -178,7 +194,7 @@ type AddressMapNewResponse struct { // handshake from a client without an SNI, it will respond with the default SNI on // those IPs. The default SNI can be any valid zone or subdomain owned by the // account. - DefaultSni string `json:"default_sni,nullable"` + DefaultSNI string `json:"default_sni,nullable"` // An optional description field which may be used to describe the types of IPs or // zones on the map. Description string `json:"description,nullable"` @@ -201,7 +217,7 @@ type addressMapNewResponseJSON struct { CanDelete apijson.Field CanModifyIPs apijson.Field CreatedAt apijson.Field - DefaultSni apijson.Field + DefaultSNI apijson.Field Description apijson.Field Enabled apijson.Field IPs apijson.Field @@ -250,8 +266,8 @@ type AddressMapNewResponseMembership struct { // Identifier Identifier string `json:"identifier"` // The type of the membership. - Kind AddressMapNewResponseMembershipsKind `json:"kind"` - JSON addressMapNewResponseMembershipJSON `json:"-"` + Kind Kind `json:"kind"` + JSON addressMapNewResponseMembershipJSON `json:"-"` } // addressMapNewResponseMembershipJSON contains the JSON metadata for the struct @@ -273,22 +289,6 @@ func (r addressMapNewResponseMembershipJSON) RawJSON() string { return r.raw } -// The type of the membership. -type AddressMapNewResponseMembershipsKind string - -const ( - AddressMapNewResponseMembershipsKindZone AddressMapNewResponseMembershipsKind = "zone" - AddressMapNewResponseMembershipsKindAccount AddressMapNewResponseMembershipsKind = "account" -) - -func (r AddressMapNewResponseMembershipsKind) IsKnown() bool { - switch r { - case AddressMapNewResponseMembershipsKindZone, AddressMapNewResponseMembershipsKindAccount: - return true - } - return false -} - type AddressMapDeleteResponse = interface{} type AddressMapGetResponse struct { @@ -306,7 +306,7 @@ type AddressMapGetResponse struct { // handshake from a client without an SNI, it will respond with the default SNI on // those IPs. The default SNI can be any valid zone or subdomain owned by the // account. - DefaultSni string `json:"default_sni,nullable"` + DefaultSNI string `json:"default_sni,nullable"` // An optional description field which may be used to describe the types of IPs or // zones on the map. Description string `json:"description,nullable"` @@ -329,7 +329,7 @@ type addressMapGetResponseJSON struct { CanDelete apijson.Field CanModifyIPs apijson.Field CreatedAt apijson.Field - DefaultSni apijson.Field + DefaultSNI apijson.Field Description apijson.Field Enabled apijson.Field IPs apijson.Field @@ -378,8 +378,8 @@ type AddressMapGetResponseMembership struct { // Identifier Identifier string `json:"identifier"` // The type of the membership. - Kind AddressMapGetResponseMembershipsKind `json:"kind"` - JSON addressMapGetResponseMembershipJSON `json:"-"` + Kind Kind `json:"kind"` + JSON addressMapGetResponseMembershipJSON `json:"-"` } // addressMapGetResponseMembershipJSON contains the JSON metadata for the struct @@ -401,22 +401,6 @@ func (r addressMapGetResponseMembershipJSON) RawJSON() string { return r.raw } -// The type of the membership. -type AddressMapGetResponseMembershipsKind string - -const ( - AddressMapGetResponseMembershipsKindZone AddressMapGetResponseMembershipsKind = "zone" - AddressMapGetResponseMembershipsKindAccount AddressMapGetResponseMembershipsKind = "account" -) - -func (r AddressMapGetResponseMembershipsKind) IsKnown() bool { - switch r { - case AddressMapGetResponseMembershipsKindZone, AddressMapGetResponseMembershipsKindAccount: - return true - } - return false -} - type AddressMapNewParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` @@ -483,11 +467,6 @@ type AddressMapListParams struct { type AddressMapDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r AddressMapDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type AddressMapDeleteResponseEnvelope struct { @@ -574,7 +553,7 @@ type AddressMapEditParams struct { // handshake from a client without an SNI, it will respond with the default SNI on // those IPs. The default SNI can be any valid zone or subdomain owned by the // account. - DefaultSni param.Field[string] `json:"default_sni"` + DefaultSNI param.Field[string] `json:"default_sni"` // An optional description field which may be used to describe the types of IPs or // zones on the map. Description param.Field[string] `json:"description"` diff --git a/addressing/addressmap_test.go b/addressing/addressmap_test.go index 301c5faef90..c55a6b76aa9 100644 --- a/addressing/addressmap_test.go +++ b/addressing/addressmap_test.go @@ -15,7 +15,6 @@ import ( ) func TestAddressMapNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestAddressMapNewWithOptionalParams(t *testing.T) { } func TestAddressMapList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestAddressMapList(t *testing.T) { } func TestAddressMapDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -87,7 +84,6 @@ func TestAddressMapDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -100,7 +96,6 @@ func TestAddressMapDelete(t *testing.T) { } func TestAddressMapEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -118,7 +113,7 @@ func TestAddressMapEditWithOptionalParams(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - DefaultSni: cloudflare.F("*.example.com"), + DefaultSNI: cloudflare.F("*.example.com"), Description: cloudflare.F("My Ecommerce zones"), Enabled: cloudflare.F(true), }, @@ -133,7 +128,6 @@ func TestAddressMapEditWithOptionalParams(t *testing.T) { } func TestAddressMapGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/addressing/addressmapaccount.go b/addressing/addressmapaccount.go index 2ab86460176..e462f4ff768 100644 --- a/addressing/addressmapaccount.go +++ b/addressing/addressmapaccount.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AddressMapAccountService contains methods and other services that help with @@ -37,7 +37,7 @@ func (r *AddressMapAccountService) Update(ctx context.Context, addressMapID stri opts = append(r.Options[:], opts...) var env AddressMapAccountUpdateResponseEnvelope path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/accounts/%s", params.AccountID, addressMapID, params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return } @@ -46,10 +46,10 @@ func (r *AddressMapAccountService) Update(ctx context.Context, addressMapID stri } // Remove an account as a member of a particular address map. -func (r *AddressMapAccountService) Delete(ctx context.Context, addressMapID string, params AddressMapAccountDeleteParams, opts ...option.RequestOption) (res *[]AddressMapAccountDeleteResponse, err error) { +func (r *AddressMapAccountService) Delete(ctx context.Context, addressMapID string, body AddressMapAccountDeleteParams, opts ...option.RequestOption) (res *[]AddressMapAccountDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env AddressMapAccountDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/accounts/%s", params.AccountID, addressMapID, params.AccountID) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/accounts/%s", body.AccountID, addressMapID, body.AccountID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -151,11 +151,6 @@ func (r addressMapAccountUpdateResponseEnvelopeResultInfoJSON) RawJSON() string type AddressMapAccountDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r AddressMapAccountDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type AddressMapAccountDeleteResponseEnvelope struct { diff --git a/addressing/addressmapaccount_test.go b/addressing/addressmapaccount_test.go index 697d6f70988..34d004a551b 100644 --- a/addressing/addressmapaccount_test.go +++ b/addressing/addressmapaccount_test.go @@ -15,7 +15,6 @@ import ( ) func TestAddressMapAccountUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestAddressMapAccountUpdate(t *testing.T) { } func TestAddressMapAccountDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -64,7 +62,6 @@ func TestAddressMapAccountDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", addressing.AddressMapAccountDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/addressing/addressmapip.go b/addressing/addressmapip.go index b9ac5a9d040..8bc0f75a628 100644 --- a/addressing/addressmapip.go +++ b/addressing/addressmapip.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AddressMapIPService contains methods and other services that help with @@ -37,7 +37,7 @@ func (r *AddressMapIPService) Update(ctx context.Context, addressMapID string, i opts = append(r.Options[:], opts...) var env AddressMapIPUpdateResponseEnvelope path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/ips/%s", params.AccountID, addressMapID, ipAddress) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return } @@ -46,10 +46,10 @@ func (r *AddressMapIPService) Update(ctx context.Context, addressMapID string, i } // Remove an IP from a particular address map. -func (r *AddressMapIPService) Delete(ctx context.Context, addressMapID string, ipAddress string, params AddressMapIPDeleteParams, opts ...option.RequestOption) (res *[]AddressMapIPDeleteResponse, err error) { +func (r *AddressMapIPService) Delete(ctx context.Context, addressMapID string, ipAddress string, body AddressMapIPDeleteParams, opts ...option.RequestOption) (res *[]AddressMapIPDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env AddressMapIPDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/ips/%s", params.AccountID, addressMapID, ipAddress) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/ips/%s", body.AccountID, addressMapID, ipAddress) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -151,11 +151,6 @@ func (r addressMapIPUpdateResponseEnvelopeResultInfoJSON) RawJSON() string { type AddressMapIPDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r AddressMapIPDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type AddressMapIPDeleteResponseEnvelope struct { diff --git a/addressing/addressmapip_test.go b/addressing/addressmapip_test.go index 4f0c3ebe7d3..d40fd7754a5 100644 --- a/addressing/addressmapip_test.go +++ b/addressing/addressmapip_test.go @@ -15,7 +15,6 @@ import ( ) func TestAddressMapIPUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestAddressMapIPUpdate(t *testing.T) { } func TestAddressMapIPDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -66,7 +64,6 @@ func TestAddressMapIPDelete(t *testing.T) { "192.0.2.1", addressing.AddressMapIPDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/addressing/addressmapzone.go b/addressing/addressmapzone.go index ab7b8f9cfbd..e1feaf2a6f6 100644 --- a/addressing/addressmapzone.go +++ b/addressing/addressmapzone.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AddressMapZoneService contains methods and other services that help with @@ -37,7 +37,7 @@ func (r *AddressMapZoneService) Update(ctx context.Context, addressMapID string, opts = append(r.Options[:], opts...) var env AddressMapZoneUpdateResponseEnvelope path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/zones/%s", params.AccountID, addressMapID, params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return } @@ -46,10 +46,10 @@ func (r *AddressMapZoneService) Update(ctx context.Context, addressMapID string, } // Remove a zone as a member of a particular address map. -func (r *AddressMapZoneService) Delete(ctx context.Context, addressMapID string, params AddressMapZoneDeleteParams, opts ...option.RequestOption) (res *[]AddressMapZoneDeleteResponse, err error) { +func (r *AddressMapZoneService) Delete(ctx context.Context, addressMapID string, body AddressMapZoneDeleteParams, opts ...option.RequestOption) (res *[]AddressMapZoneDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env AddressMapZoneDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/zones/%s", params.AccountID, addressMapID, params.ZoneID) + path := fmt.Sprintf("accounts/%s/addressing/address_maps/%s/zones/%s", body.AccountID, addressMapID, body.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -155,11 +155,6 @@ type AddressMapZoneDeleteParams struct { ZoneID param.Field[string] `path:"zone_id,required"` // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r AddressMapZoneDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type AddressMapZoneDeleteResponseEnvelope struct { diff --git a/addressing/addressmapzone_test.go b/addressing/addressmapzone_test.go index 4268fa43c9d..61f98daf39d 100644 --- a/addressing/addressmapzone_test.go +++ b/addressing/addressmapzone_test.go @@ -15,7 +15,6 @@ import ( ) func TestAddressMapZoneUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestAddressMapZoneUpdate(t *testing.T) { } func TestAddressMapZoneDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -66,7 +64,6 @@ func TestAddressMapZoneDelete(t *testing.T) { addressing.AddressMapZoneDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/addressing/aliases.go b/addressing/aliases.go index 89ec357fd18..986aa91a27d 100644 --- a/addressing/aliases.go +++ b/addressing/aliases.go @@ -4,7 +4,7 @@ package addressing import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/addressing/loadocument.go b/addressing/loadocument.go index 85aac0bcbcb..2d819b564b7 100644 --- a/addressing/loadocument.go +++ b/addressing/loadocument.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // LOADocumentService contains methods and other services that help with diff --git a/addressing/loadocument_test.go b/addressing/loadocument_test.go index efe065c41fa..b3f6647cb60 100644 --- a/addressing/loadocument_test.go +++ b/addressing/loadocument_test.go @@ -15,7 +15,7 @@ import ( ) func TestLOADocumentNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/addressing/loadocumentdownload_test.go b/addressing/loadocumentdownload_test.go index 478f5fa5b2b..3f20aacbdba 100644 --- a/addressing/loadocumentdownload_test.go +++ b/addressing/loadocumentdownload_test.go @@ -15,7 +15,6 @@ import ( ) func TestLOADocumentDownloadGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/addressing/prefix.go b/addressing/prefix.go index 4977ca211ca..f480eb577fc 100644 --- a/addressing/prefix.go +++ b/addressing/prefix.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PrefixService contains methods and other services that help with interacting @@ -56,7 +56,7 @@ func (r *PrefixService) List(ctx context.Context, query PrefixListParams, opts . opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/addressing/prefixes", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -74,10 +74,10 @@ func (r *PrefixService) ListAutoPaging(ctx context.Context, query PrefixListPara } // Delete an unapproved prefix owned by the account. -func (r *PrefixService) Delete(ctx context.Context, prefixID string, params PrefixDeleteParams, opts ...option.RequestOption) (res *[]PrefixDeleteResponse, err error) { +func (r *PrefixService) Delete(ctx context.Context, prefixID string, body PrefixDeleteParams, opts ...option.RequestOption) (res *[]PrefixDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env PrefixDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s", params.AccountID, prefixID) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s", body.AccountID, prefixID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -239,11 +239,6 @@ type PrefixListParams struct { type PrefixDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r PrefixDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type PrefixDeleteResponseEnvelope struct { diff --git a/addressing/prefix_test.go b/addressing/prefix_test.go index 7cee67a6a5d..d0d41b621b2 100644 --- a/addressing/prefix_test.go +++ b/addressing/prefix_test.go @@ -15,7 +15,6 @@ import ( ) func TestPrefixNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestPrefixNew(t *testing.T) { } func TestPrefixList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -70,7 +68,6 @@ func TestPrefixList(t *testing.T) { } func TestPrefixDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -88,7 +85,6 @@ func TestPrefixDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", addressing.PrefixDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -101,7 +97,6 @@ func TestPrefixDelete(t *testing.T) { } func TestPrefixEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -132,7 +127,6 @@ func TestPrefixEdit(t *testing.T) { } func TestPrefixGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/addressing/prefixbgpbinding.go b/addressing/prefixbgpbinding.go index 1004efd6e03..e1f0a20de55 100644 --- a/addressing/prefixbgpbinding.go +++ b/addressing/prefixbgpbinding.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PrefixBGPBindingService contains methods and other services that help with @@ -60,7 +60,7 @@ func (r *PrefixBGPBindingService) List(ctx context.Context, prefixID string, que opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bindings", query.AccountID, prefixID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -179,34 +179,6 @@ func (r ServiceBindingProvisioningState) IsKnown() bool { return false } -type ServiceBindingParam struct { - // IP Prefix in Classless Inter-Domain Routing format. - CIDR param.Field[string] `json:"cidr"` - // Status of a Service Binding's deployment to the Cloudflare network - Provisioning param.Field[ServiceBindingProvisioningParam] `json:"provisioning"` - // Identifier - ServiceID param.Field[string] `json:"service_id"` - // Name of a service running on the Cloudflare network - ServiceName param.Field[string] `json:"service_name"` -} - -func (r ServiceBindingParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ServiceBindingParam) implementsWorkersBindingUnionParam() {} - -// Status of a Service Binding's deployment to the Cloudflare network -type ServiceBindingProvisioningParam struct { - // When a binding has been deployed to a majority of Cloudflare datacenters, the - // binding will become active and can be used with its associated service. - State param.Field[ServiceBindingProvisioningState] `json:"state"` -} - -func (r ServiceBindingProvisioningParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type PrefixBGPBindingDeleteResponse struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/addressing/prefixbgpbinding_test.go b/addressing/prefixbgpbinding_test.go index fad3e9995e6..eedb9e668b8 100644 --- a/addressing/prefixbgpbinding_test.go +++ b/addressing/prefixbgpbinding_test.go @@ -15,7 +15,6 @@ import ( ) func TestPrefixBGPBindingNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestPrefixBGPBindingNewWithOptionalParams(t *testing.T) { } func TestPrefixBGPBindingList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +75,6 @@ func TestPrefixBGPBindingList(t *testing.T) { } func TestPrefixBGPBindingDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -108,7 +105,6 @@ func TestPrefixBGPBindingDelete(t *testing.T) { } func TestPrefixBGPBindingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/addressing/prefixbgpprefix.go b/addressing/prefixbgpprefix.go index 69a3dad3509..a6db712d333 100644 --- a/addressing/prefixbgpprefix.go +++ b/addressing/prefixbgpprefix.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PrefixBGPPrefixService contains methods and other services that help with @@ -43,7 +43,7 @@ func (r *PrefixBGPPrefixService) List(ctx context.Context, prefixID string, quer opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/bgp/prefixes", query.AccountID, prefixID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/addressing/prefixbgpprefix_test.go b/addressing/prefixbgpprefix_test.go index 7ff53960935..239aa144238 100644 --- a/addressing/prefixbgpprefix_test.go +++ b/addressing/prefixbgpprefix_test.go @@ -15,7 +15,6 @@ import ( ) func TestPrefixBGPPrefixList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestPrefixBGPPrefixList(t *testing.T) { } func TestPrefixBGPPrefixEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -79,7 +77,6 @@ func TestPrefixBGPPrefixEditWithOptionalParams(t *testing.T) { } func TestPrefixBGPPrefixGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/addressing/prefixbgpstatus.go b/addressing/prefixbgpstatus.go index 0a68c435f37..31d42e75fcb 100644 --- a/addressing/prefixbgpstatus.go +++ b/addressing/prefixbgpstatus.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PrefixBGPStatusService contains methods and other services that help with diff --git a/addressing/prefixbgpstatus_test.go b/addressing/prefixbgpstatus_test.go index cf9b5f4fc9b..9071cb5db57 100644 --- a/addressing/prefixbgpstatus_test.go +++ b/addressing/prefixbgpstatus_test.go @@ -15,7 +15,6 @@ import ( ) func TestPrefixBGPStatusEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestPrefixBGPStatusEdit(t *testing.T) { } func TestPrefixBGPStatusGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/addressing/prefixdelegation.go b/addressing/prefixdelegation.go index cfed1b68bd9..d5d5ddc1afe 100644 --- a/addressing/prefixdelegation.go +++ b/addressing/prefixdelegation.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PrefixDelegationService contains methods and other services that help with @@ -53,7 +53,7 @@ func (r *PrefixDelegationService) List(ctx context.Context, prefixID string, que opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/delegations", query.AccountID, prefixID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -71,10 +71,10 @@ func (r *PrefixDelegationService) ListAutoPaging(ctx context.Context, prefixID s } // Delete an account delegation for a given IP prefix. -func (r *PrefixDelegationService) Delete(ctx context.Context, prefixID string, delegationID string, params PrefixDelegationDeleteParams, opts ...option.RequestOption) (res *PrefixDelegationDeleteResponse, err error) { +func (r *PrefixDelegationService) Delete(ctx context.Context, prefixID string, delegationID string, body PrefixDelegationDeleteParams, opts ...option.RequestOption) (res *PrefixDelegationDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env PrefixDelegationDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/delegations/%s", params.AccountID, prefixID, delegationID) + path := fmt.Sprintf("accounts/%s/addressing/prefixes/%s/delegations/%s", body.AccountID, prefixID, delegationID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -203,11 +203,6 @@ type PrefixDelegationListParams struct { type PrefixDelegationDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r PrefixDelegationDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type PrefixDelegationDeleteResponseEnvelope struct { diff --git a/addressing/prefixdelegation_test.go b/addressing/prefixdelegation_test.go index 670d919c955..eb543832a6f 100644 --- a/addressing/prefixdelegation_test.go +++ b/addressing/prefixdelegation_test.go @@ -15,7 +15,6 @@ import ( ) func TestPrefixDelegationNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestPrefixDelegationNew(t *testing.T) { } func TestPrefixDelegationList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +75,6 @@ func TestPrefixDelegationList(t *testing.T) { } func TestPrefixDelegationDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -96,7 +93,6 @@ func TestPrefixDelegationDelete(t *testing.T) { "d933b1530bc56c9953cf8ce166da8004", addressing.PrefixDelegationDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/addressing/service.go b/addressing/service.go index 65fb1797859..f3094982f57 100644 --- a/addressing/service.go +++ b/addressing/service.go @@ -40,7 +40,7 @@ func (r *ServiceService) List(ctx context.Context, query ServiceListParams, opts opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/addressing/services", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/addressing/service_test.go b/addressing/service_test.go index bc4ff9ba62c..d4ed51063bb 100644 --- a/addressing/service_test.go +++ b/addressing/service_test.go @@ -15,7 +15,6 @@ import ( ) func TestServiceList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/ai_gateway/aigateway.go b/ai_gateway/aigateway.go new file mode 100644 index 00000000000..ea3a649b379 --- /dev/null +++ b/ai_gateway/aigateway.go @@ -0,0 +1,487 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package ai_gateway + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-go/v2/internal/apijson" + "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" + "github.com/cloudflare/cloudflare-go/v2/internal/pagination" + "github.com/cloudflare/cloudflare-go/v2/internal/param" + "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" + "github.com/cloudflare/cloudflare-go/v2/option" +) + +// AIGatewayService contains methods and other services that help with interacting +// with the cloudflare API. Note, unlike clients, this service does not read +// variables from the environment automatically. You should not instantiate this +// service directly, and instead use the [NewAIGatewayService] method instead. +type AIGatewayService struct { + Options []option.RequestOption + Logs *LogService +} + +// NewAIGatewayService generates a new service that applies the given options to +// each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewAIGatewayService(opts ...option.RequestOption) (r *AIGatewayService) { + r = &AIGatewayService{} + r.Options = opts + r.Logs = NewLogService(opts...) + return +} + +// Create a new Gateway +func (r *AIGatewayService) New(ctx context.Context, params AIGatewayNewParams, opts ...option.RequestOption) (res *AIGatewayNewResponse, err error) { + opts = append(r.Options[:], opts...) + var env AIGatewayNewResponseEnvelope + path := fmt.Sprintf("accounts/%s/ai-gateway/gateways", params.AccountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Update a Gateway +func (r *AIGatewayService) Update(ctx context.Context, id string, params AIGatewayUpdateParams, opts ...option.RequestOption) (res *AIGatewayUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env AIGatewayUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/ai-gateway/gateways/%s", params.AccountID, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// List Gateway's +func (r *AIGatewayService) List(ctx context.Context, params AIGatewayListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[AIGatewayListResponse], err error) { + var raw *http.Response + opts = append(r.Options, opts...) + opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) + path := fmt.Sprintf("accounts/%s/ai-gateway/gateways", params.AccountID) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...) + if err != nil { + return nil, err + } + err = cfg.Execute() + if err != nil { + return nil, err + } + res.SetPageConfig(cfg, raw) + return res, nil +} + +// List Gateway's +func (r *AIGatewayService) ListAutoPaging(ctx context.Context, params AIGatewayListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[AIGatewayListResponse] { + return pagination.NewV4PagePaginationArrayAutoPager(r.List(ctx, params, opts...)) +} + +// Delete a Gateway +func (r *AIGatewayService) Delete(ctx context.Context, id string, body AIGatewayDeleteParams, opts ...option.RequestOption) (res *AIGatewayDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env AIGatewayDeleteResponseEnvelope + path := fmt.Sprintf("accounts/%s/ai-gateway/gateways/%s", body.AccountID, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Fetch a Gateway +func (r *AIGatewayService) Get(ctx context.Context, id string, query AIGatewayGetParams, opts ...option.RequestOption) (res *AIGatewayGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env AIGatewayGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/ai-gateway/gateways/%s", query.AccountID, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type AIGatewayNewResponse struct { + Task AIGatewayNewResponseTask `json:"task,required"` + JSON aiGatewayNewResponseJSON `json:"-"` +} + +// aiGatewayNewResponseJSON contains the JSON metadata for the struct +// [AIGatewayNewResponse] +type aiGatewayNewResponseJSON struct { + Task apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIGatewayNewResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r aiGatewayNewResponseJSON) RawJSON() string { + return r.raw +} + +type AIGatewayNewResponseTask struct { + ID string `json:"id,required" format:"uuid"` + CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"` + CacheTTL int64 `json:"cache_ttl,required"` + CollectLogs bool `json:"collect_logs,required"` + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + ModifiedAt time.Time `json:"modified_at,required" format:"date-time"` + Name string `json:"name,required"` + Slug string `json:"slug,required"` + RateLimitingInterval int64 `json:"rate_limiting_interval"` + RateLimitingLimit int64 `json:"rate_limiting_limit"` + RateLimitingTechnique string `json:"rate_limiting_technique"` + JSON aiGatewayNewResponseTaskJSON `json:"-"` +} + +// aiGatewayNewResponseTaskJSON contains the JSON metadata for the struct +// [AIGatewayNewResponseTask] +type aiGatewayNewResponseTaskJSON struct { + ID apijson.Field + CacheInvalidateOnUpdate apijson.Field + CacheTTL apijson.Field + CollectLogs apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + Name apijson.Field + Slug apijson.Field + RateLimitingInterval apijson.Field + RateLimitingLimit apijson.Field + RateLimitingTechnique apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIGatewayNewResponseTask) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r aiGatewayNewResponseTaskJSON) RawJSON() string { + return r.raw +} + +type AIGatewayUpdateResponse struct { + ID string `json:"id,required" format:"uuid"` + CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"` + CacheTTL int64 `json:"cache_ttl,required"` + CollectLogs bool `json:"collect_logs,required"` + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + ModifiedAt time.Time `json:"modified_at,required" format:"date-time"` + Name string `json:"name,required"` + Slug string `json:"slug,required"` + RateLimitingInterval int64 `json:"rate_limiting_interval"` + RateLimitingLimit int64 `json:"rate_limiting_limit"` + RateLimitingTechnique string `json:"rate_limiting_technique"` + JSON aiGatewayUpdateResponseJSON `json:"-"` +} + +// aiGatewayUpdateResponseJSON contains the JSON metadata for the struct +// [AIGatewayUpdateResponse] +type aiGatewayUpdateResponseJSON struct { + ID apijson.Field + CacheInvalidateOnUpdate apijson.Field + CacheTTL apijson.Field + CollectLogs apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + Name apijson.Field + Slug apijson.Field + RateLimitingInterval apijson.Field + RateLimitingLimit apijson.Field + RateLimitingTechnique apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIGatewayUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r aiGatewayUpdateResponseJSON) RawJSON() string { + return r.raw +} + +type AIGatewayListResponse struct { + ID string `json:"id,required" format:"uuid"` + CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"` + CacheTTL int64 `json:"cache_ttl,required"` + CollectLogs bool `json:"collect_logs,required"` + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + ModifiedAt time.Time `json:"modified_at,required" format:"date-time"` + Name string `json:"name,required"` + Slug string `json:"slug,required"` + RateLimitingInterval int64 `json:"rate_limiting_interval"` + RateLimitingLimit int64 `json:"rate_limiting_limit"` + RateLimitingTechnique string `json:"rate_limiting_technique"` + JSON aiGatewayListResponseJSON `json:"-"` +} + +// aiGatewayListResponseJSON contains the JSON metadata for the struct +// [AIGatewayListResponse] +type aiGatewayListResponseJSON struct { + ID apijson.Field + CacheInvalidateOnUpdate apijson.Field + CacheTTL apijson.Field + CollectLogs apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + Name apijson.Field + Slug apijson.Field + RateLimitingInterval apijson.Field + RateLimitingLimit apijson.Field + RateLimitingTechnique apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIGatewayListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r aiGatewayListResponseJSON) RawJSON() string { + return r.raw +} + +type AIGatewayDeleteResponse struct { + ID string `json:"id,required" format:"uuid"` + CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"` + CacheTTL int64 `json:"cache_ttl,required"` + CollectLogs bool `json:"collect_logs,required"` + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + ModifiedAt time.Time `json:"modified_at,required" format:"date-time"` + Name string `json:"name,required"` + Slug string `json:"slug,required"` + RateLimitingInterval int64 `json:"rate_limiting_interval"` + RateLimitingLimit int64 `json:"rate_limiting_limit"` + RateLimitingTechnique string `json:"rate_limiting_technique"` + JSON aiGatewayDeleteResponseJSON `json:"-"` +} + +// aiGatewayDeleteResponseJSON contains the JSON metadata for the struct +// [AIGatewayDeleteResponse] +type aiGatewayDeleteResponseJSON struct { + ID apijson.Field + CacheInvalidateOnUpdate apijson.Field + CacheTTL apijson.Field + CollectLogs apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + Name apijson.Field + Slug apijson.Field + RateLimitingInterval apijson.Field + RateLimitingLimit apijson.Field + RateLimitingTechnique apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIGatewayDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r aiGatewayDeleteResponseJSON) RawJSON() string { + return r.raw +} + +type AIGatewayGetResponse struct { + ID string `json:"id,required" format:"uuid"` + CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update,required"` + CacheTTL int64 `json:"cache_ttl,required"` + CollectLogs bool `json:"collect_logs,required"` + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + ModifiedAt time.Time `json:"modified_at,required" format:"date-time"` + Name string `json:"name,required"` + Slug string `json:"slug,required"` + RateLimitingInterval int64 `json:"rate_limiting_interval"` + RateLimitingLimit int64 `json:"rate_limiting_limit"` + RateLimitingTechnique string `json:"rate_limiting_technique"` + JSON aiGatewayGetResponseJSON `json:"-"` +} + +// aiGatewayGetResponseJSON contains the JSON metadata for the struct +// [AIGatewayGetResponse] +type aiGatewayGetResponseJSON struct { + ID apijson.Field + CacheInvalidateOnUpdate apijson.Field + CacheTTL apijson.Field + CollectLogs apijson.Field + CreatedAt apijson.Field + ModifiedAt apijson.Field + Name apijson.Field + Slug apijson.Field + RateLimitingInterval apijson.Field + RateLimitingLimit apijson.Field + RateLimitingTechnique apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIGatewayGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r aiGatewayGetResponseJSON) RawJSON() string { + return r.raw +} + +type AIGatewayNewParams struct { + AccountID param.Field[string] `path:"account_id,required"` + CacheInvalidateOnUpdate param.Field[bool] `json:"cache_invalidate_on_update,required"` + CacheTTL param.Field[int64] `json:"cache_ttl,required"` + CollectLogs param.Field[bool] `json:"collect_logs,required"` + Name param.Field[string] `json:"name,required"` + Slug param.Field[string] `json:"slug,required"` + RateLimitingInterval param.Field[int64] `json:"rate_limiting_interval"` + RateLimitingLimit param.Field[int64] `json:"rate_limiting_limit"` + RateLimitingTechnique param.Field[string] `json:"rate_limiting_technique"` +} + +func (r AIGatewayNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AIGatewayNewResponseEnvelope struct { + Result AIGatewayNewResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON aiGatewayNewResponseEnvelopeJSON `json:"-"` +} + +// aiGatewayNewResponseEnvelopeJSON contains the JSON metadata for the struct +// [AIGatewayNewResponseEnvelope] +type aiGatewayNewResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIGatewayNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r aiGatewayNewResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type AIGatewayUpdateParams struct { + AccountID param.Field[string] `path:"account_id,required"` + CacheInvalidateOnUpdate param.Field[bool] `json:"cache_invalidate_on_update,required"` + CacheTTL param.Field[int64] `json:"cache_ttl,required"` + CollectLogs param.Field[bool] `json:"collect_logs,required"` + Name param.Field[string] `json:"name,required"` + Slug param.Field[string] `json:"slug,required"` + RateLimitingInterval param.Field[int64] `json:"rate_limiting_interval"` + RateLimitingLimit param.Field[int64] `json:"rate_limiting_limit"` + RateLimitingTechnique param.Field[string] `json:"rate_limiting_technique"` +} + +func (r AIGatewayUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type AIGatewayUpdateResponseEnvelope struct { + Result AIGatewayUpdateResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON aiGatewayUpdateResponseEnvelopeJSON `json:"-"` +} + +// aiGatewayUpdateResponseEnvelopeJSON contains the JSON metadata for the struct +// [AIGatewayUpdateResponseEnvelope] +type aiGatewayUpdateResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIGatewayUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r aiGatewayUpdateResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type AIGatewayListParams struct { + AccountID param.Field[string] `path:"account_id,required"` + ID param.Field[string] `query:"id" format:"uuid"` + // Order By Column Name + OrderBy param.Field[string] `query:"order_by"` + Page param.Field[int64] `query:"page"` + PerPage param.Field[int64] `query:"per_page"` +} + +// URLQuery serializes [AIGatewayListParams]'s query parameters as `url.Values`. +func (r AIGatewayListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type AIGatewayDeleteParams struct { + AccountID param.Field[string] `path:"account_id,required"` +} + +type AIGatewayDeleteResponseEnvelope struct { + Result AIGatewayDeleteResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON aiGatewayDeleteResponseEnvelopeJSON `json:"-"` +} + +// aiGatewayDeleteResponseEnvelopeJSON contains the JSON metadata for the struct +// [AIGatewayDeleteResponseEnvelope] +type aiGatewayDeleteResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIGatewayDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r aiGatewayDeleteResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type AIGatewayGetParams struct { + AccountID param.Field[string] `path:"account_id,required"` +} + +type AIGatewayGetResponseEnvelope struct { + Result AIGatewayGetResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON aiGatewayGetResponseEnvelopeJSON `json:"-"` +} + +// aiGatewayGetResponseEnvelopeJSON contains the JSON metadata for the struct +// [AIGatewayGetResponseEnvelope] +type aiGatewayGetResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *AIGatewayGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r aiGatewayGetResponseEnvelopeJSON) RawJSON() string { + return r.raw +} diff --git a/ai_gateway/aigateway_test.go b/ai_gateway/aigateway_test.go new file mode 100644 index 00000000000..92eefac7516 --- /dev/null +++ b/ai_gateway/aigateway_test.go @@ -0,0 +1,172 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package ai_gateway_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-go/v2" + "github.com/cloudflare/cloudflare-go/v2/ai_gateway" + "github.com/cloudflare/cloudflare-go/v2/internal/testutil" + "github.com/cloudflare/cloudflare-go/v2/option" +) + +func TestAIGatewayNewWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.AIGateway.New(context.TODO(), ai_gateway.AIGatewayNewParams{ + AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), + CacheInvalidateOnUpdate: cloudflare.F(true), + CacheTTL: cloudflare.F(int64(0)), + CollectLogs: cloudflare.F(true), + Name: cloudflare.F("string"), + Slug: cloudflare.F("string"), + RateLimitingInterval: cloudflare.F(int64(0)), + RateLimitingLimit: cloudflare.F(int64(0)), + RateLimitingTechnique: cloudflare.F("string"), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestAIGatewayUpdateWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.AIGateway.Update( + context.TODO(), + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ai_gateway.AIGatewayUpdateParams{ + AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), + CacheInvalidateOnUpdate: cloudflare.F(true), + CacheTTL: cloudflare.F(int64(0)), + CollectLogs: cloudflare.F(true), + Name: cloudflare.F("string"), + Slug: cloudflare.F("string"), + RateLimitingInterval: cloudflare.F(int64(0)), + RateLimitingLimit: cloudflare.F(int64(0)), + RateLimitingTechnique: cloudflare.F("string"), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestAIGatewayListWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.AIGateway.List(context.TODO(), ai_gateway.AIGatewayListParams{ + AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), + ID: cloudflare.F("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"), + OrderBy: cloudflare.F("string"), + Page: cloudflare.F(int64(1)), + PerPage: cloudflare.F(int64(5)), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestAIGatewayDelete(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.AIGateway.Delete( + context.TODO(), + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ai_gateway.AIGatewayDeleteParams{ + AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestAIGatewayGet(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.AIGateway.Get( + context.TODO(), + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ai_gateway.AIGatewayGetParams{ + AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/ai_gateway/aliases.go b/ai_gateway/aliases.go new file mode 100644 index 00000000000..237b96aeae0 --- /dev/null +++ b/ai_gateway/aliases.go @@ -0,0 +1,155 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package ai_gateway + +import ( + "github.com/cloudflare/cloudflare-go/v2/internal/apierror" + "github.com/cloudflare/cloudflare-go/v2/shared" +) + +type Error = apierror.Error + +// This is an alias to an internal type. +type ASN = shared.ASN + +// This is an alias to an internal type. +type ASNParam = shared.ASNParam + +// This is an alias to an internal type. +type AuditLog = shared.AuditLog + +// This is an alias to an internal type. +type AuditLogAction = shared.AuditLogAction + +// This is an alias to an internal type. +type AuditLogActor = shared.AuditLogActor + +// The type of actor, whether a User, Cloudflare Admin, or an Automated System. +// +// This is an alias to an internal type. +type AuditLogActorType = shared.AuditLogActorType + +// This is an alias to an internal value. +const AuditLogActorTypeUser = shared.AuditLogActorTypeUser + +// This is an alias to an internal value. +const AuditLogActorTypeAdmin = shared.AuditLogActorTypeAdmin + +// This is an alias to an internal value. +const AuditLogActorTypeCloudflare = shared.AuditLogActorTypeCloudflare + +// This is an alias to an internal type. +type AuditLogOwner = shared.AuditLogOwner + +// This is an alias to an internal type. +type AuditLogResource = shared.AuditLogResource + +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + +// A Cloudflare Tunnel that connects your origin to Cloudflare's edge. +// +// This is an alias to an internal type. +type CloudflareTunnel = shared.CloudflareTunnel + +// This is an alias to an internal type. +type CloudflareTunnelConnection = shared.CloudflareTunnelConnection + +// The type of tunnel. +// +// This is an alias to an internal type. +type CloudflareTunnelTunType = shared.CloudflareTunnelTunType + +// This is an alias to an internal value. +const CloudflareTunnelTunTypeCfdTunnel = shared.CloudflareTunnelTunTypeCfdTunnel + +// This is an alias to an internal value. +const CloudflareTunnelTunTypeWARPConnector = shared.CloudflareTunnelTunTypeWARPConnector + +// This is an alias to an internal value. +const CloudflareTunnelTunTypeIPSec = shared.CloudflareTunnelTunTypeIPSec + +// This is an alias to an internal value. +const CloudflareTunnelTunTypeGRE = shared.CloudflareTunnelTunTypeGRE + +// This is an alias to an internal value. +const CloudflareTunnelTunTypeCNI = shared.CloudflareTunnelTunTypeCNI + +// This is an alias to an internal type. +type ErrorData = shared.ErrorData + +// This is an alias to an internal type. +type Member = shared.Member + +// This is an alias to an internal type. +type MemberRole = shared.MemberRole + +// This is an alias to an internal type. +type MemberRolesPermissions = shared.MemberRolesPermissions + +// This is an alias to an internal type. +type MemberUser = shared.MemberUser + +// This is an alias to an internal type. +type MemberParam = shared.MemberParam + +// This is an alias to an internal type. +type MemberRoleParam = shared.MemberRoleParam + +// This is an alias to an internal type. +type MemberRolesPermissionsParam = shared.MemberRolesPermissionsParam + +// This is an alias to an internal type. +type MemberUserParam = shared.MemberUserParam + +// This is an alias to an internal type. +type Permission = shared.Permission + +// This is an alias to an internal type. +type PermissionGrant = shared.PermissionGrant + +// This is an alias to an internal type. +type PermissionGrantParam = shared.PermissionGrantParam + +// This is an alias to an internal type. +type ResponseInfo = shared.ResponseInfo + +// This is an alias to an internal type. +type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/ai_gateway/log.go b/ai_gateway/log.go new file mode 100644 index 00000000000..861b54e67e2 --- /dev/null +++ b/ai_gateway/log.go @@ -0,0 +1,163 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package ai_gateway + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-go/v2/internal/apijson" + "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" + "github.com/cloudflare/cloudflare-go/v2/internal/param" + "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" + "github.com/cloudflare/cloudflare-go/v2/option" +) + +// LogService contains methods and other services that help with interacting with +// the cloudflare API. Note, unlike clients, this service does not read variables +// from the environment automatically. You should not instantiate this service +// directly, and instead use the [NewLogService] method instead. +type LogService struct { + Options []option.RequestOption +} + +// NewLogService generates a new service that applies the given options to each +// request. These options are applied after the parent client's options (if there +// is one), and before any request-specific options. +func NewLogService(opts ...option.RequestOption) (r *LogService) { + r = &LogService{} + r.Options = opts + return +} + +// List Gateway Logs +func (r *LogService) Get(ctx context.Context, id string, params LogGetParams, opts ...option.RequestOption) (res *[]LogGetResponse, err error) { + opts = append(r.Options[:], opts...) + var env LogGetResponseEnvelope + path := fmt.Sprintf("accounts/%s/ai-gateway/gateways/%s/logs", params.AccountID, id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type LogGetResponse struct { + ID string `json:"id,required" format:"uuid"` + Cached bool `json:"cached,required"` + CreatedAt time.Time `json:"created_at,required" format:"date-time"` + Duration int64 `json:"duration,required"` + Model string `json:"model,required"` + Path string `json:"path,required"` + Provider string `json:"provider,required"` + Request string `json:"request,required"` + Response string `json:"response,required"` + Success bool `json:"success,required"` + TokensIn int64 `json:"tokens_in,required"` + TokensOut int64 `json:"tokens_out,required"` + JSON logGetResponseJSON `json:"-"` +} + +// logGetResponseJSON contains the JSON metadata for the struct [LogGetResponse] +type logGetResponseJSON struct { + ID apijson.Field + Cached apijson.Field + CreatedAt apijson.Field + Duration apijson.Field + Model apijson.Field + Path apijson.Field + Provider apijson.Field + Request apijson.Field + Response apijson.Field + Success apijson.Field + TokensIn apijson.Field + TokensOut apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *LogGetResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r logGetResponseJSON) RawJSON() string { + return r.raw +} + +type LogGetParams struct { + AccountID param.Field[string] `path:"account_id,required"` + Cached param.Field[bool] `query:"cached"` + Direction param.Field[LogGetParamsDirection] `query:"direction"` + EndDate param.Field[time.Time] `query:"end_date" format:"date-time"` + OrderBy param.Field[LogGetParamsOrderBy] `query:"order_by"` + Page param.Field[int64] `query:"page"` + PerPage param.Field[int64] `query:"per_page"` + Search param.Field[string] `query:"search"` + StartDate param.Field[time.Time] `query:"start_date" format:"date-time"` + Success param.Field[bool] `query:"success"` +} + +// URLQuery serializes [LogGetParams]'s query parameters as `url.Values`. +func (r LogGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type LogGetParamsDirection string + +const ( + LogGetParamsDirectionAsc LogGetParamsDirection = "asc" + LogGetParamsDirectionDesc LogGetParamsDirection = "desc" +) + +func (r LogGetParamsDirection) IsKnown() bool { + switch r { + case LogGetParamsDirectionAsc, LogGetParamsDirectionDesc: + return true + } + return false +} + +type LogGetParamsOrderBy string + +const ( + LogGetParamsOrderByCreatedAt LogGetParamsOrderBy = "created_at" + LogGetParamsOrderByProvider LogGetParamsOrderBy = "provider" +) + +func (r LogGetParamsOrderBy) IsKnown() bool { + switch r { + case LogGetParamsOrderByCreatedAt, LogGetParamsOrderByProvider: + return true + } + return false +} + +type LogGetResponseEnvelope struct { + Result []LogGetResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON logGetResponseEnvelopeJSON `json:"-"` +} + +// logGetResponseEnvelopeJSON contains the JSON metadata for the struct +// [LogGetResponseEnvelope] +type logGetResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *LogGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r logGetResponseEnvelopeJSON) RawJSON() string { + return r.raw +} diff --git a/ai_gateway/log_test.go b/ai_gateway/log_test.go new file mode 100644 index 00000000000..8620ea1d397 --- /dev/null +++ b/ai_gateway/log_test.go @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package ai_gateway_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/cloudflare/cloudflare-go/v2" + "github.com/cloudflare/cloudflare-go/v2/ai_gateway" + "github.com/cloudflare/cloudflare-go/v2/internal/testutil" + "github.com/cloudflare/cloudflare-go/v2/option" +) + +func TestLogGetWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.AIGateway.Logs.Get( + context.TODO(), + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ai_gateway.LogGetParams{ + AccountID: cloudflare.F("0d37909e38d3e99c29fa2cd343ac421a"), + Cached: cloudflare.F(true), + Direction: cloudflare.F(ai_gateway.LogGetParamsDirectionAsc), + EndDate: cloudflare.F(time.Now()), + OrderBy: cloudflare.F(ai_gateway.LogGetParamsOrderByCreatedAt), + Page: cloudflare.F(int64(1)), + PerPage: cloudflare.F(int64(5)), + Search: cloudflare.F("string"), + StartDate: cloudflare.F(time.Now()), + Success: cloudflare.F(true), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/alerting/aliases.go b/alerting/aliases.go index c6270ab5d1d..582d2dfbdb6 100644 --- a/alerting/aliases.go +++ b/alerting/aliases.go @@ -4,7 +4,7 @@ package alerting import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/alerting/availablealert.go b/alerting/availablealert.go index c836f1eee4a..d106c8d9410 100644 --- a/alerting/availablealert.go +++ b/alerting/availablealert.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/alerting/availablealert_test.go b/alerting/availablealert_test.go index 236231c2070..6805acf5c62 100644 --- a/alerting/availablealert_test.go +++ b/alerting/availablealert_test.go @@ -15,7 +15,6 @@ import ( ) func TestAvailableAlertList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/alerting/destinationeligible.go b/alerting/destinationeligible.go index 15b7b3bb43d..9838012ca8f 100644 --- a/alerting/destinationeligible.go +++ b/alerting/destinationeligible.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/alerting/destinationeligible_test.go b/alerting/destinationeligible_test.go index b17253b6861..7d9afb69025 100644 --- a/alerting/destinationeligible_test.go +++ b/alerting/destinationeligible_test.go @@ -15,7 +15,6 @@ import ( ) func TestDestinationEligibleGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/alerting/destinationpagerduty.go b/alerting/destinationpagerduty.go index a177defba23..a9e3f47abb3 100644 --- a/alerting/destinationpagerduty.go +++ b/alerting/destinationpagerduty.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/alerting/destinationpagerduty_test.go b/alerting/destinationpagerduty_test.go index a11b279f02d..63f12175b25 100644 --- a/alerting/destinationpagerduty_test.go +++ b/alerting/destinationpagerduty_test.go @@ -15,7 +15,6 @@ import ( ) func TestDestinationPagerdutyNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -41,7 +40,6 @@ func TestDestinationPagerdutyNew(t *testing.T) { } func TestDestinationPagerdutyDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -67,7 +65,6 @@ func TestDestinationPagerdutyDelete(t *testing.T) { } func TestDestinationPagerdutyGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -93,7 +90,6 @@ func TestDestinationPagerdutyGet(t *testing.T) { } func TestDestinationPagerdutyLink(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/alerting/destinationwebhook.go b/alerting/destinationwebhook.go index 060e9ede6ea..362dd8c8018 100644 --- a/alerting/destinationwebhook.go +++ b/alerting/destinationwebhook.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -68,7 +68,7 @@ func (r *DestinationWebhookService) List(ctx context.Context, query DestinationW opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/alerting/v3/destinations/webhooks", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/alerting/destinationwebhook_test.go b/alerting/destinationwebhook_test.go index e4cad3a9718..df44b9de16a 100644 --- a/alerting/destinationwebhook_test.go +++ b/alerting/destinationwebhook_test.go @@ -15,7 +15,6 @@ import ( ) func TestDestinationWebhookNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestDestinationWebhookNewWithOptionalParams(t *testing.T) { } func TestDestinationWebhookUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +75,6 @@ func TestDestinationWebhookUpdateWithOptionalParams(t *testing.T) { } func TestDestinationWebhookList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -103,7 +100,6 @@ func TestDestinationWebhookList(t *testing.T) { } func TestDestinationWebhookDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -133,7 +129,6 @@ func TestDestinationWebhookDelete(t *testing.T) { } func TestDestinationWebhookGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/alerting/history_test.go b/alerting/history_test.go index e1b46503f98..5a24b9606db 100644 --- a/alerting/history_test.go +++ b/alerting/history_test.go @@ -16,7 +16,6 @@ import ( ) func TestHistoryListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/alerting/policy.go b/alerting/policy.go index cddd12190f8..4f79212b5f1 100644 --- a/alerting/policy.go +++ b/alerting/policy.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -67,7 +67,7 @@ func (r *PolicyService) List(ctx context.Context, query PolicyListParams, opts . opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/alerting/v3/policies", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -110,9 +110,68 @@ func (r *PolicyService) Get(ctx context.Context, policyID string, query PolicyGe return } -type Mechanism map[string][]Mechanism +type Mechanism map[string][]MechanismItem -type MechanismParam map[string][]MechanismParam +type MechanismItem struct { + // UUID + ID MechanismItemIDUnion `json:"id"` + JSON mechanismItemJSON `json:"-"` +} + +// mechanismItemJSON contains the JSON metadata for the struct [MechanismItem] +type mechanismItemJSON struct { + ID apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *MechanismItem) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r mechanismItemJSON) RawJSON() string { + return r.raw +} + +// UUID +// +// Union satisfied by [shared.UnionString] or [shared.UnionString]. +type MechanismItemIDUnion interface { + ImplementsAlertingMechanismItemIDUnion() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*MechanismItemIDUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + apijson.UnionVariant{ + TypeFilter: gjson.String, + Type: reflect.TypeOf(shared.UnionString("")), + }, + ) +} + +type MechanismParam map[string][]MechanismItemParam + +type MechanismItemParam struct { + // UUID + ID param.Field[MechanismItemIDUnionParam] `json:"id"` +} + +func (r MechanismItemParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// UUID +// +// Satisfied by [shared.UnionString], [shared.UnionString]. +type MechanismItemIDUnionParam interface { + ImplementsAlertingMechanismItemIDUnionParam() +} type Policy struct { // The unique identifier of a notification policy @@ -233,30 +292,6 @@ func (r PolicyAlertType) IsKnown() bool { return false } -type PolicyParam struct { - // Refers to which event will trigger a Notification dispatch. You can use the - // endpoint to get available alert types which then will give you a list of - // possible values. - AlertType param.Field[PolicyAlertType] `json:"alert_type"` - // Optional description for the Notification policy. - Description param.Field[string] `json:"description"` - // Whether or not the Notification policy is enabled. - Enabled param.Field[bool] `json:"enabled"` - // Optional filters that allow you to be alerted only on a subset of events for - // that alert type based on some criteria. This is only available for select alert - // types. See alert type documentation for more details. - Filters param.Field[PolicyFilterParam] `json:"filters"` - // List of IDs that will be used when dispatching a notification. IDs for email - // type will be the email address. - Mechanisms param.Field[MechanismParam] `json:"mechanisms"` - // Name of the policy. - Name param.Field[string] `json:"name"` -} - -func (r PolicyParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - // Optional filters that allow you to be alerted only on a subset of events for // that alert type based on some criteria. This is only available for select alert // types. See alert type documentation for more details. diff --git a/alerting/policy_test.go b/alerting/policy_test.go index e42ad6ac6a8..bde33e8de5b 100644 --- a/alerting/policy_test.go +++ b/alerting/policy_test.go @@ -10,13 +10,12 @@ import ( "github.com/cloudflare/cloudflare-go/v2" "github.com/cloudflare/cloudflare-go/v2/alerting" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) func TestPolicyNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -34,14 +33,14 @@ func TestPolicyNewWithOptionalParams(t *testing.T) { AlertType: cloudflare.F(alerting.PolicyNewParamsAlertTypeUniversalSSLEventType), Enabled: cloudflare.F(true), Mechanisms: cloudflare.F(alerting.MechanismParam{ - "email": []alerting.MechanismParam{{ - ID: cloudflare.F[alerting.MechanismIDUnionParam](shared.UnionString("test@example.com")), + "email": []alerting.MechanismItemParam{{ + ID: cloudflare.F[alerting.MechanismItemIDUnionParam](shared.UnionString("test@example.com")), }}, - "pagerduty": []alerting.MechanismParam{{ - ID: cloudflare.F[alerting.MechanismIDUnionParam](shared.UnionString("e8133a15-00a4-4d69-aec1-32f70c51f6e5")), + "pagerduty": []alerting.MechanismItemParam{{ + ID: cloudflare.F[alerting.MechanismItemIDUnionParam](shared.UnionString("e8133a15-00a4-4d69-aec1-32f70c51f6e5")), }}, - "webhooks": []alerting.MechanismParam{{ - ID: cloudflare.F[alerting.MechanismIDUnionParam](shared.UnionString("14cc1190-5d2b-4b98-a696-c424cb2ad05f")), + "webhooks": []alerting.MechanismItemParam{{ + ID: cloudflare.F[alerting.MechanismItemIDUnionParam](shared.UnionString("14cc1190-5d2b-4b98-a696-c424cb2ad05f")), }}, }), Name: cloudflare.F("SSL Notification Event Policy"), @@ -99,7 +98,6 @@ func TestPolicyNewWithOptionalParams(t *testing.T) { } func TestPolicyUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -163,14 +161,14 @@ func TestPolicyUpdateWithOptionalParams(t *testing.T) { Zones: cloudflare.F([]string{"string", "string", "string"}), }), Mechanisms: cloudflare.F(alerting.MechanismParam{ - "email": []alerting.MechanismParam{{ - ID: cloudflare.F[alerting.MechanismIDUnionParam](shared.UnionString("test@example.com")), + "email": []alerting.MechanismItemParam{{ + ID: cloudflare.F[alerting.MechanismItemIDUnionParam](shared.UnionString("test@example.com")), }}, - "pagerduty": []alerting.MechanismParam{{ - ID: cloudflare.F[alerting.MechanismIDUnionParam](shared.UnionString("e8133a15-00a4-4d69-aec1-32f70c51f6e5")), + "pagerduty": []alerting.MechanismItemParam{{ + ID: cloudflare.F[alerting.MechanismItemIDUnionParam](shared.UnionString("e8133a15-00a4-4d69-aec1-32f70c51f6e5")), }}, - "webhooks": []alerting.MechanismParam{{ - ID: cloudflare.F[alerting.MechanismIDUnionParam](shared.UnionString("14cc1190-5d2b-4b98-a696-c424cb2ad05f")), + "webhooks": []alerting.MechanismItemParam{{ + ID: cloudflare.F[alerting.MechanismItemIDUnionParam](shared.UnionString("14cc1190-5d2b-4b98-a696-c424cb2ad05f")), }}, }), Name: cloudflare.F("SSL Notification Event Policy"), @@ -186,7 +184,6 @@ func TestPolicyUpdateWithOptionalParams(t *testing.T) { } func TestPolicyList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -212,7 +209,6 @@ func TestPolicyList(t *testing.T) { } func TestPolicyDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -242,7 +238,6 @@ func TestPolicyDelete(t *testing.T) { } func TestPolicyGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/aliases.go b/aliases.go index 51c3d9713bc..0f192d59585 100644 --- a/aliases.go +++ b/aliases.go @@ -4,7 +4,7 @@ package cloudflare import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/api.md b/api.md index 4c8a70def28..7cd8220911b 100644 --- a/api.md +++ b/api.md @@ -1,20 +1,25 @@ # Shared Params Types -- shared.ASNParam -- shared.MemberParam -- shared.PermissionGrantParam +- shared.ASNParam +- shared.CertificateCA +- shared.CertificateRequestType +- shared.MemberParam +- shared.PermissionGrantParam +- shared.SortDirection # Shared Response Types -- shared.ASN -- shared.AuditLog -- shared.CloudflareTunnel -- shared.ErrorData -- shared.Member -- shared.Permission -- shared.PermissionGrant -- shared.ResponseInfo -- shared.Role +- shared.ASN +- shared.AuditLog +- shared.CertificateCA +- shared.CertificateRequestType +- shared.CloudflareTunnel +- shared.ErrorData +- shared.Member +- shared.Permission +- shared.PermissionGrant +- shared.ResponseInfo +- shared.Role # Accounts @@ -39,6 +44,7 @@ Methods: Response Types: +- accounts.Status - accounts.UserWithInviteCode - accounts.MemberListResponse - accounts.MemberDeleteResponse @@ -46,10 +52,10 @@ Response Types: Methods: - client.Accounts.Members.New(ctx context.Context, params accounts.MemberNewParams) (accounts.UserWithInviteCode, error) -- client.Accounts.Members.Update(ctx context.Context, memberID string, params accounts.MemberUpdateParams) (shared.Member, error) +- client.Accounts.Members.Update(ctx context.Context, memberID string, params accounts.MemberUpdateParams) (shared.Member, error) - client.Accounts.Members.List(ctx context.Context, params accounts.MemberListParams) (pagination.V4PagePaginationArray[accounts.MemberListResponse], error) -- client.Accounts.Members.Delete(ctx context.Context, memberID string, params accounts.MemberDeleteParams) (accounts.MemberDeleteResponse, error) -- client.Accounts.Members.Get(ctx context.Context, memberID string, query accounts.MemberGetParams) (shared.Member, error) +- client.Accounts.Members.Delete(ctx context.Context, memberID string, body accounts.MemberDeleteParams) (accounts.MemberDeleteResponse, error) +- client.Accounts.Members.Get(ctx context.Context, memberID string, query accounts.MemberGetParams) (shared.Member, error) ## Roles @@ -59,7 +65,7 @@ Response Types: Methods: -- client.Accounts.Roles.List(ctx context.Context, query accounts.RoleListParams) (pagination.SinglePage[shared.Role], error) +- client.Accounts.Roles.List(ctx context.Context, query accounts.RoleListParams) (pagination.SinglePage[shared.Role], error) - client.Accounts.Roles.Get(ctx context.Context, roleID interface{}, query accounts.RoleGetParams) (accounts.RoleGetResponseUnion, error) # OriginCACertificates @@ -75,7 +81,7 @@ Methods: - client.OriginCACertificates.New(ctx context.Context, body origin_ca_certificates.OriginCACertificateNewParams) (origin_ca_certificates.OriginCACertificateNewResponseUnion, error) - client.OriginCACertificates.List(ctx context.Context, query origin_ca_certificates.OriginCACertificateListParams) (pagination.SinglePage[origin_ca_certificates.OriginCACertificate], error) -- client.OriginCACertificates.Delete(ctx context.Context, certificateID string, body origin_ca_certificates.OriginCACertificateDeleteParams) (origin_ca_certificates.OriginCACertificateDeleteResponse, error) +- client.OriginCACertificates.Delete(ctx context.Context, certificateID string) (origin_ca_certificates.OriginCACertificateDeleteResponse, error) - client.OriginCACertificates.Get(ctx context.Context, certificateID string) (origin_ca_certificates.OriginCACertificateGetResponseUnion, error) # IPs @@ -103,7 +109,7 @@ Methods: - client.Memberships.Update(ctx context.Context, membershipID string, body memberships.MembershipUpdateParams) (memberships.MembershipUpdateResponseUnion, error) - client.Memberships.List(ctx context.Context, query memberships.MembershipListParams) (pagination.V4PagePaginationArray[memberships.Membership], error) -- client.Memberships.Delete(ctx context.Context, membershipID string, body memberships.MembershipDeleteParams) (memberships.MembershipDeleteResponse, error) +- client.Memberships.Delete(ctx context.Context, membershipID string) (memberships.MembershipDeleteResponse, error) - client.Memberships.Get(ctx context.Context, membershipID string) (memberships.MembershipGetResponseUnion, error) # User @@ -122,7 +128,7 @@ Methods: Methods: -- client.User.AuditLogs.List(ctx context.Context, query user.AuditLogListParams) (pagination.V4PagePaginationArray[shared.AuditLog], error) +- client.User.AuditLogs.List(ctx context.Context, query user.AuditLogListParams) (pagination.V4PagePaginationArray[shared.AuditLog], error) ## Billing @@ -171,7 +177,7 @@ Response Types: Methods: - client.User.Organizations.List(ctx context.Context, query user.OrganizationListParams) (pagination.V4PagePaginationArray[user.Organization], error) -- client.User.Organizations.Delete(ctx context.Context, organizationID string, body user.OrganizationDeleteParams) (user.OrganizationDeleteResponse, error) +- client.User.Organizations.Delete(ctx context.Context, organizationID string) (user.OrganizationDeleteResponse, error) - client.User.Organizations.Get(ctx context.Context, organizationID string) (user.OrganizationGetResponseUnion, error) ## Subscriptions @@ -196,7 +202,7 @@ Response Types: Methods: - client.User.Subscriptions.Update(ctx context.Context, identifier string, body user.SubscriptionUpdateParams) (user.SubscriptionUpdateResponseUnion, error) -- client.User.Subscriptions.Delete(ctx context.Context, identifier string, body user.SubscriptionDeleteParams) (user.SubscriptionDeleteResponse, error) +- client.User.Subscriptions.Delete(ctx context.Context, identifier string) (user.SubscriptionDeleteResponse, error) - client.User.Subscriptions.Edit(ctx context.Context, identifier string, body user.SubscriptionEditParams) (user.SubscriptionEditResponseUnion, error) - client.User.Subscriptions.Get(ctx context.Context) ([]user.Subscription, error) @@ -210,7 +216,6 @@ Params Types: Response Types: -- user.Policy - user.TokenNewResponse - user.TokenUpdateResponseUnion - user.TokenListResponse @@ -223,7 +228,7 @@ Methods: - client.User.Tokens.New(ctx context.Context, body user.TokenNewParams) (user.TokenNewResponse, error) - client.User.Tokens.Update(ctx context.Context, tokenID interface{}, body user.TokenUpdateParams) (user.TokenUpdateResponseUnion, error) - client.User.Tokens.List(ctx context.Context, query user.TokenListParams) (pagination.V4PagePaginationArray[user.TokenListResponse], error) -- client.User.Tokens.Delete(ctx context.Context, tokenID interface{}, body user.TokenDeleteParams) (user.TokenDeleteResponse, error) +- client.User.Tokens.Delete(ctx context.Context, tokenID interface{}) (user.TokenDeleteResponse, error) - client.User.Tokens.Get(ctx context.Context, tokenID interface{}) (user.TokenGetResponseUnion, error) - client.User.Tokens.Verify(ctx context.Context) (user.TokenVerifyResponse, error) @@ -249,6 +254,10 @@ Methods: # Zones +Params Types: + +- zones.Type + Response Types: - zones.Zone @@ -893,13 +902,13 @@ Methods: Response Types: -- zones.CustomNameserverUpdateResponseUnion -- zones.CustomNameserverGetResponseUnion +- zones.CustomNameserverUpdateResponse +- zones.CustomNameserverGetResponse Methods: -- client.Zones.CustomNameservers.Update(ctx context.Context, params zones.CustomNameserverUpdateParams) (zones.CustomNameserverUpdateResponseUnion, error) -- client.Zones.CustomNameservers.Get(ctx context.Context, query zones.CustomNameserverGetParams) (zones.CustomNameserverGetResponseUnion, error) +- client.Zones.CustomNameservers.Update(ctx context.Context, params zones.CustomNameserverUpdateParams) ([]zones.CustomNameserverUpdateResponse, error) +- client.Zones.CustomNameservers.Get(ctx context.Context, query zones.CustomNameserverGetParams) ([]zones.CustomNameserverGetResponse, error) ## Holds @@ -943,7 +952,9 @@ Params Types: - load_balancers.OriginSteeringParam - load_balancers.RandomSteeringParam - load_balancers.RulesParam +- load_balancers.SessionAffinity - load_balancers.SessionAffinityAttributesParam +- load_balancers.SteeringPolicy Response Types: @@ -961,7 +972,9 @@ Response Types: - load_balancers.OriginSteering - load_balancers.RandomSteering - load_balancers.Rules +- load_balancers.SessionAffinity - load_balancers.SessionAffinityAttributes +- load_balancers.SteeringPolicy - load_balancers.LoadBalancerDeleteResponse Methods: @@ -969,7 +982,7 @@ Methods: - client.LoadBalancers.New(ctx context.Context, params load_balancers.LoadBalancerNewParams) (load_balancers.LoadBalancer, error) - client.LoadBalancers.Update(ctx context.Context, loadBalancerID string, params load_balancers.LoadBalancerUpdateParams) (load_balancers.LoadBalancer, error) - client.LoadBalancers.List(ctx context.Context, query load_balancers.LoadBalancerListParams) (pagination.SinglePage[load_balancers.LoadBalancer], error) -- client.LoadBalancers.Delete(ctx context.Context, loadBalancerID string, params load_balancers.LoadBalancerDeleteParams) (load_balancers.LoadBalancerDeleteResponse, error) +- client.LoadBalancers.Delete(ctx context.Context, loadBalancerID string, body load_balancers.LoadBalancerDeleteParams) (load_balancers.LoadBalancerDeleteResponse, error) - client.LoadBalancers.Edit(ctx context.Context, loadBalancerID string, params load_balancers.LoadBalancerEditParams) (load_balancers.LoadBalancer, error) - client.LoadBalancers.Get(ctx context.Context, loadBalancerID string, query load_balancers.LoadBalancerGetParams) (load_balancers.LoadBalancer, error) @@ -985,7 +998,7 @@ Methods: - client.LoadBalancers.Monitors.New(ctx context.Context, params load_balancers.MonitorNewParams) (load_balancers.Monitor, error) - client.LoadBalancers.Monitors.Update(ctx context.Context, monitorID string, params load_balancers.MonitorUpdateParams) (load_balancers.Monitor, error) - client.LoadBalancers.Monitors.List(ctx context.Context, query load_balancers.MonitorListParams) (pagination.SinglePage[load_balancers.Monitor], error) -- client.LoadBalancers.Monitors.Delete(ctx context.Context, monitorID string, params load_balancers.MonitorDeleteParams) (load_balancers.MonitorDeleteResponse, error) +- client.LoadBalancers.Monitors.Delete(ctx context.Context, monitorID string, body load_balancers.MonitorDeleteParams) (load_balancers.MonitorDeleteResponse, error) - client.LoadBalancers.Monitors.Edit(ctx context.Context, monitorID string, params load_balancers.MonitorEditParams) (load_balancers.Monitor, error) - client.LoadBalancers.Monitors.Get(ctx context.Context, monitorID string, query load_balancers.MonitorGetParams) (load_balancers.Monitor, error) @@ -1021,7 +1034,7 @@ Methods: - client.LoadBalancers.Pools.New(ctx context.Context, params load_balancers.PoolNewParams) (load_balancers.Pool, error) - client.LoadBalancers.Pools.Update(ctx context.Context, poolID string, params load_balancers.PoolUpdateParams) (load_balancers.Pool, error) - client.LoadBalancers.Pools.List(ctx context.Context, params load_balancers.PoolListParams) (pagination.SinglePage[load_balancers.Pool], error) -- client.LoadBalancers.Pools.Delete(ctx context.Context, poolID string, params load_balancers.PoolDeleteParams) (load_balancers.PoolDeleteResponse, error) +- client.LoadBalancers.Pools.Delete(ctx context.Context, poolID string, body load_balancers.PoolDeleteParams) (load_balancers.PoolDeleteResponse, error) - client.LoadBalancers.Pools.Edit(ctx context.Context, poolID string, params load_balancers.PoolEditParams) (load_balancers.Pool, error) - client.LoadBalancers.Pools.Get(ctx context.Context, poolID string, query load_balancers.PoolGetParams) (load_balancers.Pool, error) @@ -1095,6 +1108,7 @@ Response Types: - cache.CacheReserve - cache.CacheReserveClear +- cache.State - cache.CacheReserveClearResponse - cache.CacheReserveEditResponse - cache.CacheReserveGetResponse @@ -1117,7 +1131,7 @@ Response Types: Methods: -- client.Cache.SmartTieredCache.Delete(ctx context.Context, params cache.SmartTieredCacheDeleteParams) (cache.SmartTieredCacheDeleteResponseUnion, error) +- client.Cache.SmartTieredCache.Delete(ctx context.Context, body cache.SmartTieredCacheDeleteParams) (cache.SmartTieredCacheDeleteResponseUnion, error) - client.Cache.SmartTieredCache.Edit(ctx context.Context, params cache.SmartTieredCacheEditParams) (cache.SmartTieredCacheEditResponseUnion, error) - client.Cache.SmartTieredCache.Get(ctx context.Context, query cache.SmartTieredCacheGetParams) (cache.SmartTieredCacheGetResponseUnion, error) @@ -1132,7 +1146,7 @@ Response Types: Methods: -- client.Cache.Variants.Delete(ctx context.Context, params cache.VariantDeleteParams) (cache.CacheVariant, error) +- client.Cache.Variants.Delete(ctx context.Context, body cache.VariantDeleteParams) (cache.CacheVariant, error) - client.Cache.Variants.Edit(ctx context.Context, params cache.VariantEditParams) (cache.VariantEditResponse, error) - client.Cache.Variants.Get(ctx context.Context, query cache.VariantGetParams) (cache.VariantGetResponse, error) @@ -1166,10 +1180,14 @@ Methods: Params Types: - ssl.HostParam +- ssl.RequestValidity Response Types: - ssl.Host +- ssl.RequestValidity +- ssl.Status +- ssl.ValidationMethod - ssl.CertificatePackListResponse - ssl.CertificatePackDeleteResponse - ssl.CertificatePackEditResponse @@ -1178,7 +1196,7 @@ Response Types: Methods: - client.SSL.CertificatePacks.List(ctx context.Context, params ssl.CertificatePackListParams) (pagination.SinglePage[ssl.CertificatePackListResponse], error) -- client.SSL.CertificatePacks.Delete(ctx context.Context, certificatePackID string, params ssl.CertificatePackDeleteParams) (ssl.CertificatePackDeleteResponse, error) +- client.SSL.CertificatePacks.Delete(ctx context.Context, certificatePackID string, body ssl.CertificatePackDeleteParams) (ssl.CertificatePackDeleteResponse, error) - client.SSL.CertificatePacks.Edit(ctx context.Context, certificatePackID string, params ssl.CertificatePackEditParams) (ssl.CertificatePackEditResponse, error) - client.SSL.CertificatePacks.Get(ctx context.Context, certificatePackID string, query ssl.CertificatePackGetParams) (ssl.CertificatePackGetResponseUnion, error) @@ -1255,15 +1273,20 @@ Methods: - client.Subscriptions.New(ctx context.Context, identifier string, body subscriptions.SubscriptionNewParams) (subscriptions.SubscriptionNewResponseUnion, error) - client.Subscriptions.Update(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body subscriptions.SubscriptionUpdateParams) (subscriptions.SubscriptionUpdateResponseUnion, error) - client.Subscriptions.List(ctx context.Context, accountIdentifier string) (pagination.SinglePage[user.Subscription], error) -- client.Subscriptions.Delete(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body subscriptions.SubscriptionDeleteParams) (subscriptions.SubscriptionDeleteResponse, error) +- client.Subscriptions.Delete(ctx context.Context, accountIdentifier string, subscriptionIdentifier string) (subscriptions.SubscriptionDeleteResponse, error) - client.Subscriptions.Get(ctx context.Context, identifier string) (subscriptions.SubscriptionGetResponseUnion, error) # ACM ## TotalTLS +Params Types: + +- acm.CertificateAuthority + Response Types: +- acm.CertificateAuthority - acm.TotalTLSNewResponse - acm.TotalTLSGetResponse @@ -1311,10 +1334,6 @@ Methods: # RatePlans -Params Types: - -- rate_plans.RatePlanParam - Response Types: - rate_plans.RatePlan @@ -1367,6 +1386,7 @@ Response Types: - custom_certificates.CustomCertificate - custom_certificates.GeoRestrictions +- custom_certificates.Status - custom_certificates.CustomCertificateNewResponseUnion - custom_certificates.CustomCertificateDeleteResponse - custom_certificates.CustomCertificateEditResponseUnion @@ -1376,7 +1396,7 @@ Methods: - client.CustomCertificates.New(ctx context.Context, params custom_certificates.CustomCertificateNewParams) (custom_certificates.CustomCertificateNewResponseUnion, error) - client.CustomCertificates.List(ctx context.Context, params custom_certificates.CustomCertificateListParams) (pagination.V4PagePaginationArray[custom_certificates.CustomCertificate], error) -- client.CustomCertificates.Delete(ctx context.Context, customCertificateID string, params custom_certificates.CustomCertificateDeleteParams) (custom_certificates.CustomCertificateDeleteResponse, error) +- client.CustomCertificates.Delete(ctx context.Context, customCertificateID string, body custom_certificates.CustomCertificateDeleteParams) (custom_certificates.CustomCertificateDeleteResponse, error) - client.CustomCertificates.Edit(ctx context.Context, customCertificateID string, params custom_certificates.CustomCertificateEditParams) (custom_certificates.CustomCertificateEditResponseUnion, error) - client.CustomCertificates.Get(ctx context.Context, customCertificateID string, query custom_certificates.CustomCertificateGetParams) (custom_certificates.CustomCertificateGetResponseUnion, error) @@ -1409,7 +1429,7 @@ Methods: - client.CustomHostnames.New(ctx context.Context, params custom_hostnames.CustomHostnameNewParams) (custom_hostnames.CustomHostnameNewResponse, error) - client.CustomHostnames.List(ctx context.Context, params custom_hostnames.CustomHostnameListParams) (pagination.V4PagePaginationArray[custom_hostnames.CustomHostnameListResponse], error) -- client.CustomHostnames.Delete(ctx context.Context, customHostnameID string, params custom_hostnames.CustomHostnameDeleteParams) (custom_hostnames.CustomHostnameDeleteResponse, error) +- client.CustomHostnames.Delete(ctx context.Context, customHostnameID string, body custom_hostnames.CustomHostnameDeleteParams) (custom_hostnames.CustomHostnameDeleteResponse, error) - client.CustomHostnames.Edit(ctx context.Context, customHostnameID string, params custom_hostnames.CustomHostnameEditParams) (custom_hostnames.CustomHostnameEditResponse, error) - client.CustomHostnames.Get(ctx context.Context, customHostnameID string, query custom_hostnames.CustomHostnameGetParams) (custom_hostnames.CustomHostnameGetResponse, error) @@ -1424,7 +1444,7 @@ Response Types: Methods: - client.CustomHostnames.FallbackOrigin.Update(ctx context.Context, params custom_hostnames.FallbackOriginUpdateParams) (custom_hostnames.FallbackOriginUpdateResponseUnion, error) -- client.CustomHostnames.FallbackOrigin.Delete(ctx context.Context, params custom_hostnames.FallbackOriginDeleteParams) (custom_hostnames.FallbackOriginDeleteResponseUnion, error) +- client.CustomHostnames.FallbackOrigin.Delete(ctx context.Context, body custom_hostnames.FallbackOriginDeleteParams) (custom_hostnames.FallbackOriginDeleteResponseUnion, error) - client.CustomHostnames.FallbackOrigin.Get(ctx context.Context, query custom_hostnames.FallbackOriginGetParams) (custom_hostnames.FallbackOriginGetResponseUnion, error) # CustomNameservers @@ -1432,15 +1452,14 @@ Methods: Response Types: - custom_nameservers.CustomNameserver -- custom_nameservers.CustomNameserverDeleteResponseUnion +- custom_nameservers.CustomNameserverDeleteResponse Methods: - client.CustomNameservers.New(ctx context.Context, params custom_nameservers.CustomNameserverNewParams) (custom_nameservers.CustomNameserver, error) -- client.CustomNameservers.Delete(ctx context.Context, customNSID string, params custom_nameservers.CustomNameserverDeleteParams) (custom_nameservers.CustomNameserverDeleteResponseUnion, error) +- client.CustomNameservers.Delete(ctx context.Context, customNSID string, body custom_nameservers.CustomNameserverDeleteParams) ([]custom_nameservers.CustomNameserverDeleteResponse, error) - client.CustomNameservers.Availabilty(ctx context.Context, query custom_nameservers.CustomNameserverAvailabiltyParams) ([]string, error) - client.CustomNameservers.Get(ctx context.Context, query custom_nameservers.CustomNameserverGetParams) ([]custom_nameservers.CustomNameserver, error) -- client.CustomNameservers.Verify(ctx context.Context, params custom_nameservers.CustomNameserverVerifyParams) ([]custom_nameservers.CustomNameserver, error) # DNS @@ -1514,7 +1533,7 @@ Methods: - client.DNS.Records.New(ctx context.Context, params dns.RecordNewParams) (dns.Record, error) - client.DNS.Records.Update(ctx context.Context, dnsRecordID string, params dns.RecordUpdateParams) (dns.Record, error) - client.DNS.Records.List(ctx context.Context, params dns.RecordListParams) (pagination.V4PagePaginationArray[dns.Record], error) -- client.DNS.Records.Delete(ctx context.Context, dnsRecordID string, params dns.RecordDeleteParams) (dns.RecordDeleteResponse, error) +- client.DNS.Records.Delete(ctx context.Context, dnsRecordID string, body dns.RecordDeleteParams) (dns.RecordDeleteResponse, error) - client.DNS.Records.Edit(ctx context.Context, dnsRecordID string, params dns.RecordEditParams) (dns.Record, error) - client.DNS.Records.Export(ctx context.Context, query dns.RecordExportParams) (string, error) - client.DNS.Records.Get(ctx context.Context, dnsRecordID string, query dns.RecordGetParams) (dns.Record, error) @@ -1564,12 +1583,20 @@ Methods: - client.DNS.Firewall.New(ctx context.Context, params dns.FirewallNewParams) (dns.Firewall, error) - client.DNS.Firewall.List(ctx context.Context, params dns.FirewallListParams) (pagination.V4PagePaginationArray[dns.Firewall], error) -- client.DNS.Firewall.Delete(ctx context.Context, dnsFirewallID string, params dns.FirewallDeleteParams) (dns.FirewallDeleteResponse, error) +- client.DNS.Firewall.Delete(ctx context.Context, dnsFirewallID string, body dns.FirewallDeleteParams) (dns.FirewallDeleteResponse, error) - client.DNS.Firewall.Edit(ctx context.Context, dnsFirewallID string, params dns.FirewallEditParams) (dns.Firewall, error) - client.DNS.Firewall.Get(ctx context.Context, dnsFirewallID string, query dns.FirewallGetParams) (dns.Firewall, error) ### Analytics +Params Types: + +- dns.Delta + +Response Types: + +- dns.Delta + #### Reports Methods: @@ -1591,7 +1618,7 @@ Response Types: Methods: -- client.DNSSEC.Delete(ctx context.Context, params dnssec.DNSSECDeleteParams) (dnssec.DNSSECDeleteResponseUnion, error) +- client.DNSSEC.Delete(ctx context.Context, body dnssec.DNSSECDeleteParams) (dnssec.DNSSECDeleteResponseUnion, error) - client.DNSSEC.Edit(ctx context.Context, params dnssec.DNSSECEditParams) (dnssec.DNSSEC, error) - client.DNSSEC.Get(ctx context.Context, query dnssec.DNSSECGetParams) (dnssec.DNSSEC, error) @@ -1681,17 +1708,13 @@ Methods: - client.Filters.New(ctx context.Context, zoneIdentifier string, body filters.FilterNewParams) ([]filters.FirewallFilter, error) - client.Filters.Update(ctx context.Context, zoneIdentifier string, id string, body filters.FilterUpdateParams) (filters.FirewallFilter, error) - client.Filters.List(ctx context.Context, zoneIdentifier string, query filters.FilterListParams) (pagination.V4PagePaginationArray[filters.FirewallFilter], error) -- client.Filters.Delete(ctx context.Context, zoneIdentifier string, id string, body filters.FilterDeleteParams) (filters.FirewallFilter, error) +- client.Filters.Delete(ctx context.Context, zoneIdentifier string, id string) (filters.FirewallFilter, error) - client.Filters.Get(ctx context.Context, zoneIdentifier string, id string) (filters.FirewallFilter, error) # Firewall ## Lockdowns -Params Types: - -- firewall.ConfigurationUnionParam - Response Types: - firewall.Configuration @@ -1706,7 +1729,7 @@ Methods: - client.Firewall.Lockdowns.New(ctx context.Context, zoneIdentifier string, body firewall.LockdownNewParams) (firewall.Lockdown, error) - client.Firewall.Lockdowns.Update(ctx context.Context, zoneIdentifier string, id string, body firewall.LockdownUpdateParams) (firewall.Lockdown, error) - client.Firewall.Lockdowns.List(ctx context.Context, zoneIdentifier string, query firewall.LockdownListParams) (pagination.V4PagePaginationArray[firewall.Lockdown], error) -- client.Firewall.Lockdowns.Delete(ctx context.Context, zoneIdentifier string, id string, body firewall.LockdownDeleteParams) (firewall.LockdownDeleteResponse, error) +- client.Firewall.Lockdowns.Delete(ctx context.Context, zoneIdentifier string, id string) (firewall.LockdownDeleteResponse, error) - client.Firewall.Lockdowns.Get(ctx context.Context, zoneIdentifier string, id string) (firewall.Lockdown, error) ## Rules @@ -1722,7 +1745,7 @@ Methods: - client.Firewall.Rules.New(ctx context.Context, zoneIdentifier string, body firewall.RuleNewParams) ([]firewall.FirewallRule, error) - client.Firewall.Rules.Update(ctx context.Context, zoneIdentifier string, id string, body firewall.RuleUpdateParams) (firewall.FirewallRule, error) - client.Firewall.Rules.List(ctx context.Context, zoneIdentifier string, query firewall.RuleListParams) (pagination.V4PagePaginationArray[firewall.FirewallRule], error) -- client.Firewall.Rules.Delete(ctx context.Context, zoneIdentifier string, id string, body firewall.RuleDeleteParams) (firewall.FirewallRule, error) +- client.Firewall.Rules.Delete(ctx context.Context, zoneIdentifier string, id string) (firewall.FirewallRule, error) - client.Firewall.Rules.Edit(ctx context.Context, zoneIdentifier string, id string, body firewall.RuleEditParams) ([]firewall.FirewallRule, error) - client.Firewall.Rules.Get(ctx context.Context, zoneIdentifier string, params firewall.RuleGetParams) (firewall.FirewallRule, error) @@ -1748,7 +1771,7 @@ Methods: - client.Firewall.AccessRules.New(ctx context.Context, params firewall.AccessRuleNewParams) (firewall.AccessRuleNewResponseUnion, error) - client.Firewall.AccessRules.List(ctx context.Context, params firewall.AccessRuleListParams) (pagination.V4PagePaginationArray[firewall.AccessRuleListResponse], error) -- client.Firewall.AccessRules.Delete(ctx context.Context, identifier interface{}, params firewall.AccessRuleDeleteParams) (firewall.AccessRuleDeleteResponse, error) +- client.Firewall.AccessRules.Delete(ctx context.Context, identifier interface{}, body firewall.AccessRuleDeleteParams) (firewall.AccessRuleDeleteResponse, error) - client.Firewall.AccessRules.Edit(ctx context.Context, identifier interface{}, params firewall.AccessRuleEditParams) (firewall.AccessRuleEditResponseUnion, error) - client.Firewall.AccessRules.Get(ctx context.Context, identifier interface{}, query firewall.AccessRuleGetParams) (firewall.AccessRuleGetResponseUnion, error) @@ -1767,7 +1790,7 @@ Methods: - client.Firewall.UARules.New(ctx context.Context, zoneIdentifier string, body firewall.UARuleNewParams) (firewall.UARuleNewResponseUnion, error) - client.Firewall.UARules.Update(ctx context.Context, zoneIdentifier string, id string, body firewall.UARuleUpdateParams) (firewall.UARuleUpdateResponseUnion, error) - client.Firewall.UARules.List(ctx context.Context, zoneIdentifier string, query firewall.UARuleListParams) (pagination.V4PagePaginationArray[firewall.UARuleListResponse], error) -- client.Firewall.UARules.Delete(ctx context.Context, zoneIdentifier string, id string, body firewall.UARuleDeleteParams) (firewall.UARuleDeleteResponse, error) +- client.Firewall.UARules.Delete(ctx context.Context, zoneIdentifier string, id string) (firewall.UARuleDeleteResponse, error) - client.Firewall.UARules.Get(ctx context.Context, zoneIdentifier string, id string) (firewall.UARuleGetResponseUnion, error) ## WAF @@ -1787,7 +1810,7 @@ Methods: - client.Firewall.WAF.Overrides.New(ctx context.Context, zoneIdentifier string, body firewall.WAFOverrideNewParams) (firewall.Override, error) - client.Firewall.WAF.Overrides.Update(ctx context.Context, zoneIdentifier string, id string, body firewall.WAFOverrideUpdateParams) (firewall.Override, error) - client.Firewall.WAF.Overrides.List(ctx context.Context, zoneIdentifier string, query firewall.WAFOverrideListParams) (pagination.V4PagePaginationArray[firewall.Override], error) -- client.Firewall.WAF.Overrides.Delete(ctx context.Context, zoneIdentifier string, id string, body firewall.WAFOverrideDeleteParams) (firewall.WAFOverrideDeleteResponse, error) +- client.Firewall.WAF.Overrides.Delete(ctx context.Context, zoneIdentifier string, id string) (firewall.WAFOverrideDeleteResponse, error) - client.Firewall.WAF.Overrides.Get(ctx context.Context, zoneIdentifier string, id string) (firewall.Override, error) ### Packages @@ -1854,7 +1877,7 @@ Methods: - client.Healthchecks.New(ctx context.Context, params healthchecks.HealthcheckNewParams) (healthchecks.Healthcheck, error) - client.Healthchecks.Update(ctx context.Context, healthcheckID string, params healthchecks.HealthcheckUpdateParams) (healthchecks.Healthcheck, error) - client.Healthchecks.List(ctx context.Context, params healthchecks.HealthcheckListParams) (pagination.SinglePage[healthchecks.Healthcheck], error) -- client.Healthchecks.Delete(ctx context.Context, healthcheckID string, params healthchecks.HealthcheckDeleteParams) (healthchecks.HealthcheckDeleteResponse, error) +- client.Healthchecks.Delete(ctx context.Context, healthcheckID string, body healthchecks.HealthcheckDeleteParams) (healthchecks.HealthcheckDeleteResponse, error) - client.Healthchecks.Edit(ctx context.Context, healthcheckID string, params healthchecks.HealthcheckEditParams) (healthchecks.Healthcheck, error) - client.Healthchecks.Get(ctx context.Context, healthcheckID string, query healthchecks.HealthcheckGetParams) (healthchecks.Healthcheck, error) @@ -1867,7 +1890,7 @@ Response Types: Methods: - client.Healthchecks.Previews.New(ctx context.Context, params healthchecks.PreviewNewParams) (healthchecks.Healthcheck, error) -- client.Healthchecks.Previews.Delete(ctx context.Context, healthcheckID string, params healthchecks.PreviewDeleteParams) (healthchecks.PreviewDeleteResponse, error) +- client.Healthchecks.Previews.Delete(ctx context.Context, healthcheckID string, body healthchecks.PreviewDeleteParams) (healthchecks.PreviewDeleteResponse, error) - client.Healthchecks.Previews.Get(ctx context.Context, healthcheckID string, query healthchecks.PreviewGetParams) (healthchecks.Healthcheck, error) # KeylessCertificates @@ -1886,7 +1909,7 @@ Methods: - client.KeylessCertificates.New(ctx context.Context, params keyless_certificates.KeylessCertificateNewParams) (keyless_certificates.KeylessCertificate, error) - client.KeylessCertificates.List(ctx context.Context, query keyless_certificates.KeylessCertificateListParams) (pagination.SinglePage[keyless_certificates.KeylessCertificate], error) -- client.KeylessCertificates.Delete(ctx context.Context, keylessCertificateID string, params keyless_certificates.KeylessCertificateDeleteParams) (keyless_certificates.KeylessCertificateDeleteResponse, error) +- client.KeylessCertificates.Delete(ctx context.Context, keylessCertificateID string, body keyless_certificates.KeylessCertificateDeleteParams) (keyless_certificates.KeylessCertificateDeleteResponse, error) - client.KeylessCertificates.Edit(ctx context.Context, keylessCertificateID string, params keyless_certificates.KeylessCertificateEditParams) (keyless_certificates.KeylessCertificate, error) - client.KeylessCertificates.Get(ctx context.Context, keylessCertificateID string, query keyless_certificates.KeylessCertificateGetParams) (keyless_certificates.KeylessCertificate, error) @@ -1938,7 +1961,7 @@ Methods: - client.Logpush.Jobs.New(ctx context.Context, params logpush.JobNewParams) (logpush.LogpushJob, error) - client.Logpush.Jobs.Update(ctx context.Context, jobID int64, params logpush.JobUpdateParams) (logpush.LogpushJob, error) - client.Logpush.Jobs.List(ctx context.Context, query logpush.JobListParams) (pagination.SinglePage[logpush.LogpushJob], error) -- client.Logpush.Jobs.Delete(ctx context.Context, jobID int64, params logpush.JobDeleteParams) (logpush.JobDeleteResponse, error) +- client.Logpush.Jobs.Delete(ctx context.Context, jobID int64, body logpush.JobDeleteParams) (logpush.JobDeleteResponse, error) - client.Logpush.Jobs.Get(ctx context.Context, jobID int64, query logpush.JobGetParams) (logpush.LogpushJob, error) ## Ownership @@ -1999,7 +2022,7 @@ Response Types: Methods: - client.Logs.Control.Cmb.Config.New(ctx context.Context, params logs.ControlCmbConfigNewParams) (logs.CmbConfig, error) -- client.Logs.Control.Cmb.Config.Delete(ctx context.Context, params logs.ControlCmbConfigDeleteParams) (logs.ControlCmbConfigDeleteResponse, error) +- client.Logs.Control.Cmb.Config.Delete(ctx context.Context, body logs.ControlCmbConfigDeleteParams) (logs.ControlCmbConfigDeleteResponse, error) - client.Logs.Control.Cmb.Config.Get(ctx context.Context, query logs.ControlCmbConfigGetParams) (logs.CmbConfig, error) ## RayID @@ -2045,7 +2068,7 @@ Methods: - client.OriginTLSClientAuth.New(ctx context.Context, params origin_tls_client_auth.OriginTLSClientAuthNewParams) (origin_tls_client_auth.OriginTLSClientAuthNewResponseUnion, error) - client.OriginTLSClientAuth.List(ctx context.Context, query origin_tls_client_auth.OriginTLSClientAuthListParams) (pagination.SinglePage[origin_tls_client_auth.ZoneAuthenticatedOriginPull], error) -- client.OriginTLSClientAuth.Delete(ctx context.Context, certificateID string, params origin_tls_client_auth.OriginTLSClientAuthDeleteParams) (origin_tls_client_auth.OriginTLSClientAuthDeleteResponseUnion, error) +- client.OriginTLSClientAuth.Delete(ctx context.Context, certificateID string, body origin_tls_client_auth.OriginTLSClientAuthDeleteParams) (origin_tls_client_auth.OriginTLSClientAuthDeleteResponseUnion, error) - client.OriginTLSClientAuth.Get(ctx context.Context, certificateID string, query origin_tls_client_auth.OriginTLSClientAuthGetParams) (origin_tls_client_auth.OriginTLSClientAuthGetResponseUnion, error) ## Hostnames @@ -2063,7 +2086,6 @@ Methods: Response Types: -- origin_tls_client_auth.Certificate - origin_tls_client_auth.HostnameCertificateNewResponse - origin_tls_client_auth.HostnameCertificateDeleteResponse - origin_tls_client_auth.HostnameCertificateGetResponse @@ -2072,7 +2094,7 @@ Methods: - client.OriginTLSClientAuth.Hostnames.Certificates.New(ctx context.Context, params origin_tls_client_auth.HostnameCertificateNewParams) (origin_tls_client_auth.HostnameCertificateNewResponse, error) - client.OriginTLSClientAuth.Hostnames.Certificates.List(ctx context.Context, query origin_tls_client_auth.HostnameCertificateListParams) (pagination.SinglePage[origin_tls_client_auth.AuthenticatedOriginPull], error) -- client.OriginTLSClientAuth.Hostnames.Certificates.Delete(ctx context.Context, certificateID string, params origin_tls_client_auth.HostnameCertificateDeleteParams) (origin_tls_client_auth.HostnameCertificateDeleteResponse, error) +- client.OriginTLSClientAuth.Hostnames.Certificates.Delete(ctx context.Context, certificateID string, body origin_tls_client_auth.HostnameCertificateDeleteParams) (origin_tls_client_auth.HostnameCertificateDeleteResponse, error) - client.OriginTLSClientAuth.Hostnames.Certificates.Get(ctx context.Context, certificateID string, query origin_tls_client_auth.HostnameCertificateGetParams) (origin_tls_client_auth.HostnameCertificateGetResponse, error) ## Settings @@ -2110,7 +2132,7 @@ Methods: - client.Pagerules.New(ctx context.Context, params pagerules.PageruleNewParams) (pagerules.PageruleNewResponseUnion, error) - client.Pagerules.Update(ctx context.Context, pageruleID string, params pagerules.PageruleUpdateParams) (pagerules.PageruleUpdateResponseUnion, error) - client.Pagerules.List(ctx context.Context, params pagerules.PageruleListParams) ([]pagerules.PageRule, error) -- client.Pagerules.Delete(ctx context.Context, pageruleID string, params pagerules.PageruleDeleteParams) (pagerules.PageruleDeleteResponse, error) +- client.Pagerules.Delete(ctx context.Context, pageruleID string, body pagerules.PageruleDeleteParams) (pagerules.PageruleDeleteResponse, error) - client.Pagerules.Edit(ctx context.Context, pageruleID string, params pagerules.PageruleEditParams) (pagerules.PageruleEditResponseUnion, error) - client.Pagerules.Get(ctx context.Context, pageruleID string, query pagerules.PageruleGetParams) (pagerules.PageruleGetResponseUnion, error) @@ -2126,10 +2148,6 @@ Methods: # RateLimits -Params Types: - -- rate_limits.Action - Response Types: - rate_limits.Action @@ -2144,7 +2162,7 @@ Methods: - client.RateLimits.New(ctx context.Context, zoneIdentifier string, body rate_limits.RateLimitNewParams) (rate_limits.RateLimitNewResponseUnion, error) - client.RateLimits.List(ctx context.Context, zoneIdentifier string, query rate_limits.RateLimitListParams) (pagination.V4PagePaginationArray[rate_limits.RateLimit], error) -- client.RateLimits.Delete(ctx context.Context, zoneIdentifier string, id string, body rate_limits.RateLimitDeleteParams) (rate_limits.RateLimitDeleteResponse, error) +- client.RateLimits.Delete(ctx context.Context, zoneIdentifier string, id string) (rate_limits.RateLimitDeleteResponse, error) - client.RateLimits.Edit(ctx context.Context, zoneIdentifier string, id string, body rate_limits.RateLimitEditParams) (rate_limits.RateLimitEditResponseUnion, error) - client.RateLimits.Get(ctx context.Context, zoneIdentifier string, id string) (rate_limits.RateLimitGetResponseUnion, error) @@ -2173,7 +2191,7 @@ Methods: - client.SecondaryDNS.Incoming.New(ctx context.Context, params secondary_dns.IncomingNewParams) (secondary_dns.IncomingNewResponse, error) - client.SecondaryDNS.Incoming.Update(ctx context.Context, params secondary_dns.IncomingUpdateParams) (secondary_dns.IncomingUpdateResponse, error) -- client.SecondaryDNS.Incoming.Delete(ctx context.Context, params secondary_dns.IncomingDeleteParams) (secondary_dns.IncomingDeleteResponse, error) +- client.SecondaryDNS.Incoming.Delete(ctx context.Context, body secondary_dns.IncomingDeleteParams) (secondary_dns.IncomingDeleteResponse, error) - client.SecondaryDNS.Incoming.Get(ctx context.Context, query secondary_dns.IncomingGetParams) (secondary_dns.IncomingGetResponse, error) ## Outgoing @@ -2191,7 +2209,7 @@ Methods: - client.SecondaryDNS.Outgoing.New(ctx context.Context, params secondary_dns.OutgoingNewParams) (secondary_dns.OutgoingNewResponse, error) - client.SecondaryDNS.Outgoing.Update(ctx context.Context, params secondary_dns.OutgoingUpdateParams) (secondary_dns.OutgoingUpdateResponse, error) -- client.SecondaryDNS.Outgoing.Delete(ctx context.Context, params secondary_dns.OutgoingDeleteParams) (secondary_dns.OutgoingDeleteResponse, error) +- client.SecondaryDNS.Outgoing.Delete(ctx context.Context, body secondary_dns.OutgoingDeleteParams) (secondary_dns.OutgoingDeleteResponse, error) - client.SecondaryDNS.Outgoing.Disable(ctx context.Context, params secondary_dns.OutgoingDisableParams) (secondary_dns.DisableTransfer, error) - client.SecondaryDNS.Outgoing.Enable(ctx context.Context, params secondary_dns.OutgoingEnableParams) (secondary_dns.EnableTransfer, error) - client.SecondaryDNS.Outgoing.ForceNotify(ctx context.Context, params secondary_dns.OutgoingForceNotifyParams) (string, error) @@ -2219,7 +2237,7 @@ Methods: - client.SecondaryDNS.ACLs.New(ctx context.Context, params secondary_dns.ACLNewParams) (secondary_dns.ACL, error) - client.SecondaryDNS.ACLs.Update(ctx context.Context, aclID string, params secondary_dns.ACLUpdateParams) (secondary_dns.ACL, error) - client.SecondaryDNS.ACLs.List(ctx context.Context, query secondary_dns.ACLListParams) (pagination.SinglePage[secondary_dns.ACL], error) -- client.SecondaryDNS.ACLs.Delete(ctx context.Context, aclID string, params secondary_dns.ACLDeleteParams) (secondary_dns.ACLDeleteResponse, error) +- client.SecondaryDNS.ACLs.Delete(ctx context.Context, aclID string, body secondary_dns.ACLDeleteParams) (secondary_dns.ACLDeleteResponse, error) - client.SecondaryDNS.ACLs.Get(ctx context.Context, aclID string, query secondary_dns.ACLGetParams) (secondary_dns.ACL, error) ## Peers @@ -2238,7 +2256,7 @@ Methods: - client.SecondaryDNS.Peers.New(ctx context.Context, params secondary_dns.PeerNewParams) (secondary_dns.Peer, error) - client.SecondaryDNS.Peers.Update(ctx context.Context, peerID string, params secondary_dns.PeerUpdateParams) (secondary_dns.Peer, error) - client.SecondaryDNS.Peers.List(ctx context.Context, query secondary_dns.PeerListParams) (pagination.SinglePage[secondary_dns.Peer], error) -- client.SecondaryDNS.Peers.Delete(ctx context.Context, peerID string, params secondary_dns.PeerDeleteParams) (secondary_dns.PeerDeleteResponse, error) +- client.SecondaryDNS.Peers.Delete(ctx context.Context, peerID string, body secondary_dns.PeerDeleteParams) (secondary_dns.PeerDeleteResponse, error) - client.SecondaryDNS.Peers.Get(ctx context.Context, peerID string, query secondary_dns.PeerGetParams) (secondary_dns.Peer, error) ## TSIGs @@ -2257,7 +2275,7 @@ Methods: - client.SecondaryDNS.TSIGs.New(ctx context.Context, params secondary_dns.TSIGNewParams) (secondary_dns.TSIG, error) - client.SecondaryDNS.TSIGs.Update(ctx context.Context, tsigID string, params secondary_dns.TSIGUpdateParams) (secondary_dns.TSIG, error) - client.SecondaryDNS.TSIGs.List(ctx context.Context, query secondary_dns.TSIGListParams) (pagination.SinglePage[secondary_dns.TSIG], error) -- client.SecondaryDNS.TSIGs.Delete(ctx context.Context, tsigID string, params secondary_dns.TSIGDeleteParams) (secondary_dns.TSIGDeleteResponse, error) +- client.SecondaryDNS.TSIGs.Delete(ctx context.Context, tsigID string, body secondary_dns.TSIGDeleteParams) (secondary_dns.TSIGDeleteResponse, error) - client.SecondaryDNS.TSIGs.Get(ctx context.Context, tsigID string, query secondary_dns.TSIGGetParams) (secondary_dns.TSIG, error) # WaitingRooms @@ -2280,7 +2298,7 @@ Methods: - client.WaitingRooms.New(ctx context.Context, params waiting_rooms.WaitingRoomNewParams) (waiting_rooms.WaitingRoom, error) - client.WaitingRooms.Update(ctx context.Context, waitingRoomID string, params waiting_rooms.WaitingRoomUpdateParams) (waiting_rooms.WaitingRoom, error) - client.WaitingRooms.List(ctx context.Context, params waiting_rooms.WaitingRoomListParams) (pagination.SinglePage[waiting_rooms.WaitingRoom], error) -- client.WaitingRooms.Delete(ctx context.Context, waitingRoomID string, params waiting_rooms.WaitingRoomDeleteParams) (waiting_rooms.WaitingRoomDeleteResponse, error) +- client.WaitingRooms.Delete(ctx context.Context, waitingRoomID string, body waiting_rooms.WaitingRoomDeleteParams) (waiting_rooms.WaitingRoomDeleteResponse, error) - client.WaitingRooms.Edit(ctx context.Context, waitingRoomID string, params waiting_rooms.WaitingRoomEditParams) (waiting_rooms.WaitingRoom, error) - client.WaitingRooms.Get(ctx context.Context, waitingRoomID string, query waiting_rooms.WaitingRoomGetParams) (waiting_rooms.WaitingRoom, error) @@ -2306,7 +2324,7 @@ Methods: - client.WaitingRooms.Events.New(ctx context.Context, waitingRoomID string, params waiting_rooms.EventNewParams) (waiting_rooms.Event, error) - client.WaitingRooms.Events.Update(ctx context.Context, waitingRoomID string, eventID string, params waiting_rooms.EventUpdateParams) (waiting_rooms.Event, error) - client.WaitingRooms.Events.List(ctx context.Context, waitingRoomID string, params waiting_rooms.EventListParams) (pagination.SinglePage[waiting_rooms.Event], error) -- client.WaitingRooms.Events.Delete(ctx context.Context, waitingRoomID string, eventID string, params waiting_rooms.EventDeleteParams) (waiting_rooms.EventDeleteResponse, error) +- client.WaitingRooms.Events.Delete(ctx context.Context, waitingRoomID string, eventID string, body waiting_rooms.EventDeleteParams) (waiting_rooms.EventDeleteResponse, error) - client.WaitingRooms.Events.Edit(ctx context.Context, waitingRoomID string, eventID string, params waiting_rooms.EventEditParams) (waiting_rooms.Event, error) - client.WaitingRooms.Events.Get(ctx context.Context, waitingRoomID string, eventID string, query waiting_rooms.EventGetParams) (waiting_rooms.Event, error) @@ -2335,7 +2353,7 @@ Methods: - client.WaitingRooms.Rules.New(ctx context.Context, waitingRoomID string, params waiting_rooms.RuleNewParams) ([]waiting_rooms.WaitingRoomRule, error) - client.WaitingRooms.Rules.Update(ctx context.Context, waitingRoomID string, params waiting_rooms.RuleUpdateParams) ([]waiting_rooms.WaitingRoomRule, error) - client.WaitingRooms.Rules.List(ctx context.Context, waitingRoomID string, query waiting_rooms.RuleListParams) (pagination.SinglePage[waiting_rooms.WaitingRoomRule], error) -- client.WaitingRooms.Rules.Delete(ctx context.Context, waitingRoomID string, ruleID string, params waiting_rooms.RuleDeleteParams) ([]waiting_rooms.WaitingRoomRule, error) +- client.WaitingRooms.Rules.Delete(ctx context.Context, waitingRoomID string, ruleID string, body waiting_rooms.RuleDeleteParams) ([]waiting_rooms.WaitingRoomRule, error) - client.WaitingRooms.Rules.Edit(ctx context.Context, waitingRoomID string, ruleID string, params waiting_rooms.RuleEditParams) ([]waiting_rooms.WaitingRoomRule, error) ## Statuses @@ -2352,7 +2370,6 @@ Methods: Response Types: -- waiting_rooms.Setting - waiting_rooms.SettingUpdateResponse - waiting_rooms.SettingEditResponse - waiting_rooms.SettingGetResponse @@ -2367,10 +2384,6 @@ Methods: ## Hostnames -Params Types: - -- web3.HostnameParam - Response Types: - web3.Hostname @@ -2380,7 +2393,7 @@ Methods: - client.Web3.Hostnames.New(ctx context.Context, zoneIdentifier string, body web3.HostnameNewParams) (web3.Hostname, error) - client.Web3.Hostnames.List(ctx context.Context, zoneIdentifier string) (pagination.SinglePage[web3.Hostname], error) -- client.Web3.Hostnames.Delete(ctx context.Context, zoneIdentifier string, identifier string, body web3.HostnameDeleteParams) (web3.HostnameDeleteResponse, error) +- client.Web3.Hostnames.Delete(ctx context.Context, zoneIdentifier string, identifier string) (web3.HostnameDeleteResponse, error) - client.Web3.Hostnames.Edit(ctx context.Context, zoneIdentifier string, identifier string, body web3.HostnameEditParams) (web3.Hostname, error) - client.Web3.Hostnames.Get(ctx context.Context, zoneIdentifier string, identifier string) (web3.Hostname, error) @@ -2412,7 +2425,7 @@ Methods: - client.Web3.Hostnames.IPFSUniversalPaths.ContentLists.Entries.New(ctx context.Context, zoneIdentifier string, identifier string, body web3.HostnameIPFSUniversalPathContentListEntryNewParams) (web3.HostnameIPFSUniversalPathContentListEntryNewResponse, error) - client.Web3.Hostnames.IPFSUniversalPaths.ContentLists.Entries.Update(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string, body web3.HostnameIPFSUniversalPathContentListEntryUpdateParams) (web3.HostnameIPFSUniversalPathContentListEntryUpdateResponse, error) - client.Web3.Hostnames.IPFSUniversalPaths.ContentLists.Entries.List(ctx context.Context, zoneIdentifier string, identifier string) (web3.HostnameIPFSUniversalPathContentListEntryListResponse, error) -- client.Web3.Hostnames.IPFSUniversalPaths.ContentLists.Entries.Delete(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string, body web3.HostnameIPFSUniversalPathContentListEntryDeleteParams) (web3.HostnameIPFSUniversalPathContentListEntryDeleteResponse, error) +- client.Web3.Hostnames.IPFSUniversalPaths.ContentLists.Entries.Delete(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string) (web3.HostnameIPFSUniversalPathContentListEntryDeleteResponse, error) - client.Web3.Hostnames.IPFSUniversalPaths.ContentLists.Entries.Get(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string) (web3.HostnameIPFSUniversalPathContentListEntryGetResponse, error) # Workers @@ -2478,10 +2491,6 @@ Methods: ### Schedules -Params Types: - -- workers.ScheduleParam - Response Types: - workers.Schedule @@ -2509,7 +2518,7 @@ Response Types: Methods: - client.Workers.Scripts.Tail.New(ctx context.Context, scriptName string, params workers.ScriptTailNewParams) (workers.ScriptTailNewResponse, error) -- client.Workers.Scripts.Tail.Delete(ctx context.Context, scriptName string, id string, params workers.ScriptTailDeleteParams) (workers.ScriptTailDeleteResponse, error) +- client.Workers.Scripts.Tail.Delete(ctx context.Context, scriptName string, id string, body workers.ScriptTailDeleteParams) (workers.ScriptTailDeleteResponse, error) - client.Workers.Scripts.Tail.Get(ctx context.Context, scriptName string, query workers.ScriptTailGetParams) (workers.ScriptTailGetResponse, error) ### Content @@ -2579,7 +2588,7 @@ Methods: - client.Workers.Domains.Update(ctx context.Context, params workers.DomainUpdateParams) (workers.Domain, error) - client.Workers.Domains.List(ctx context.Context, params workers.DomainListParams) (pagination.SinglePage[workers.Domain], error) -- client.Workers.Domains.Delete(ctx context.Context, domainID string, params workers.DomainDeleteParams) error +- client.Workers.Domains.Delete(ctx context.Context, domainID string, body workers.DomainDeleteParams) error - client.Workers.Domains.Get(ctx context.Context, domainID string, query workers.DomainGetParams) (workers.Domain, error) ## Subdomains @@ -2609,7 +2618,7 @@ Methods: - client.KV.Namespaces.New(ctx context.Context, params kv.NamespaceNewParams) (kv.Namespace, error) - client.KV.Namespaces.Update(ctx context.Context, namespaceID string, params kv.NamespaceUpdateParams) (kv.NamespaceUpdateResponseUnion, error) - client.KV.Namespaces.List(ctx context.Context, params kv.NamespaceListParams) (pagination.V4PagePaginationArray[kv.Namespace], error) -- client.KV.Namespaces.Delete(ctx context.Context, namespaceID string, params kv.NamespaceDeleteParams) (kv.NamespaceDeleteResponseUnion, error) +- client.KV.Namespaces.Delete(ctx context.Context, namespaceID string, body kv.NamespaceDeleteParams) (kv.NamespaceDeleteResponseUnion, error) ### Bulk @@ -2621,7 +2630,7 @@ Response Types: Methods: - client.KV.Namespaces.Bulk.Update(ctx context.Context, namespaceID string, params kv.NamespaceBulkUpdateParams) (kv.NamespaceBulkUpdateResponseUnion, error) -- client.KV.Namespaces.Bulk.Delete(ctx context.Context, namespaceID string, params kv.NamespaceBulkDeleteParams) (kv.NamespaceBulkDeleteResponseUnion, error) +- client.KV.Namespaces.Bulk.Delete(ctx context.Context, namespaceID string, body kv.NamespaceBulkDeleteParams) (kv.NamespaceBulkDeleteResponseUnion, error) ### Keys @@ -2653,7 +2662,7 @@ Response Types: Methods: - client.KV.Namespaces.Values.Update(ctx context.Context, namespaceID string, keyName string, params kv.NamespaceValueUpdateParams) (kv.NamespaceValueUpdateResponseUnion, error) -- client.KV.Namespaces.Values.Delete(ctx context.Context, namespaceID string, keyName string, params kv.NamespaceValueDeleteParams) (kv.NamespaceValueDeleteResponseUnion, error) +- client.KV.Namespaces.Values.Delete(ctx context.Context, namespaceID string, keyName string, body kv.NamespaceValueDeleteParams) (kv.NamespaceValueDeleteResponseUnion, error) - client.KV.Namespaces.Values.Get(ctx context.Context, namespaceID string, keyName string, query kv.NamespaceValueGetParams) (string, error) # DurableObjects @@ -2692,7 +2701,7 @@ Methods: - client.Queues.New(ctx context.Context, params queues.QueueNewParams) (queues.QueueCreated, error) - client.Queues.Update(ctx context.Context, queueID string, params queues.QueueUpdateParams) (queues.QueueUpdated, error) - client.Queues.List(ctx context.Context, query queues.QueueListParams) (pagination.SinglePage[queues.Queue], error) -- client.Queues.Delete(ctx context.Context, queueID string, params queues.QueueDeleteParams) (queues.QueueDeleteResponseUnion, error) +- client.Queues.Delete(ctx context.Context, queueID string, body queues.QueueDeleteParams) (queues.QueueDeleteResponseUnion, error) - client.Queues.Get(ctx context.Context, queueID string, query queues.QueueGetParams) (queues.Queue, error) ## Consumers @@ -2708,7 +2717,7 @@ Methods: - client.Queues.Consumers.New(ctx context.Context, queueID string, params queues.ConsumerNewParams) (queues.ConsumerNewResponse, error) - client.Queues.Consumers.Update(ctx context.Context, queueID string, consumerID string, params queues.ConsumerUpdateParams) (queues.ConsumerUpdateResponse, error) -- client.Queues.Consumers.Delete(ctx context.Context, queueID string, consumerID string, params queues.ConsumerDeleteParams) (queues.ConsumerDeleteResponseUnion, error) +- client.Queues.Consumers.Delete(ctx context.Context, queueID string, consumerID string, body queues.ConsumerDeleteParams) (queues.ConsumerDeleteResponseUnion, error) - client.Queues.Consumers.Get(ctx context.Context, queueID string, query queues.ConsumerGetParams) ([]queues.Consumer, error) ## Messages @@ -2754,10 +2763,6 @@ Methods: ## Policies -Params Types: - -- page_shield.PolicyParam - Response Types: - page_shield.Policy @@ -2795,8 +2800,15 @@ Methods: # Rulesets +Params Types: + +- rulesets.Kind +- rulesets.Phase + Response Types: +- rulesets.Kind +- rulesets.Phase - rulesets.Ruleset - rulesets.RulesetNewResponse - rulesets.RulesetUpdateResponse @@ -2819,8 +2831,8 @@ Response Types: Methods: -- client.Rulesets.Phases.Update(ctx context.Context, rulesetPhase rulesets.PhaseUpdateParamsRulesetPhase, params rulesets.PhaseUpdateParams) (rulesets.PhaseUpdateResponse, error) -- client.Rulesets.Phases.Get(ctx context.Context, rulesetPhase rulesets.PhaseGetParamsRulesetPhase, query rulesets.PhaseGetParams) (rulesets.PhaseGetResponse, error) +- client.Rulesets.Phases.Update(ctx context.Context, rulesetPhase rulesets.Phase, params rulesets.PhaseUpdateParams) (rulesets.PhaseUpdateResponse, error) +- client.Rulesets.Phases.Get(ctx context.Context, rulesetPhase rulesets.Phase, query rulesets.PhaseGetParams) (rulesets.PhaseGetResponse, error) ### Versions @@ -2830,8 +2842,8 @@ Response Types: Methods: -- client.Rulesets.Phases.Versions.List(ctx context.Context, rulesetPhase rulesets.PhaseVersionListParamsRulesetPhase, query rulesets.PhaseVersionListParams) (pagination.SinglePage[rulesets.Ruleset], error) -- client.Rulesets.Phases.Versions.Get(ctx context.Context, rulesetPhase rulesets.PhaseVersionGetParamsRulesetPhase, rulesetVersion string, query rulesets.PhaseVersionGetParams) (rulesets.PhaseVersionGetResponse, error) +- client.Rulesets.Phases.Versions.List(ctx context.Context, rulesetPhase rulesets.Phase, query rulesets.PhaseVersionListParams) (pagination.SinglePage[rulesets.Ruleset], error) +- client.Rulesets.Phases.Versions.Get(ctx context.Context, rulesetPhase rulesets.Phase, rulesetVersion string, query rulesets.PhaseVersionGetParams) (rulesets.PhaseVersionGetResponse, error) ## Rules @@ -2989,7 +3001,7 @@ Methods: - client.Spectrum.Apps.New(ctx context.Context, zone string, body spectrum.AppNewParams) (spectrum.AppNewResponse, error) - client.Spectrum.Apps.Update(ctx context.Context, zone string, appID string, body spectrum.AppUpdateParams) (spectrum.AppUpdateResponse, error) - client.Spectrum.Apps.List(ctx context.Context, zone string, query spectrum.AppListParams) (pagination.V4PagePaginationArray[spectrum.AppListResponse], error) -- client.Spectrum.Apps.Delete(ctx context.Context, zone string, appID string, body spectrum.AppDeleteParams) (spectrum.AppDeleteResponse, error) +- client.Spectrum.Apps.Delete(ctx context.Context, zone string, appID string) (spectrum.AppDeleteResponse, error) - client.Spectrum.Apps.Get(ctx context.Context, zone string, appID string) (spectrum.AppGetResponseUnion, error) # Addressing @@ -3009,6 +3021,7 @@ Methods: Response Types: - addressing.AddressMap +- addressing.Kind - addressing.AddressMapNewResponse - addressing.AddressMapDeleteResponse - addressing.AddressMapGetResponse @@ -3017,7 +3030,7 @@ Methods: - client.Addressing.AddressMaps.New(ctx context.Context, params addressing.AddressMapNewParams) (addressing.AddressMapNewResponse, error) - client.Addressing.AddressMaps.List(ctx context.Context, query addressing.AddressMapListParams) (pagination.SinglePage[addressing.AddressMap], error) -- client.Addressing.AddressMaps.Delete(ctx context.Context, addressMapID string, params addressing.AddressMapDeleteParams) ([]addressing.AddressMapDeleteResponse, error) +- client.Addressing.AddressMaps.Delete(ctx context.Context, addressMapID string, body addressing.AddressMapDeleteParams) ([]addressing.AddressMapDeleteResponse, error) - client.Addressing.AddressMaps.Edit(ctx context.Context, addressMapID string, params addressing.AddressMapEditParams) (addressing.AddressMap, error) - client.Addressing.AddressMaps.Get(ctx context.Context, addressMapID string, query addressing.AddressMapGetParams) (addressing.AddressMapGetResponse, error) @@ -3031,7 +3044,7 @@ Response Types: Methods: - client.Addressing.AddressMaps.Accounts.Update(ctx context.Context, addressMapID string, params addressing.AddressMapAccountUpdateParams) ([]addressing.AddressMapAccountUpdateResponse, error) -- client.Addressing.AddressMaps.Accounts.Delete(ctx context.Context, addressMapID string, params addressing.AddressMapAccountDeleteParams) ([]addressing.AddressMapAccountDeleteResponse, error) +- client.Addressing.AddressMaps.Accounts.Delete(ctx context.Context, addressMapID string, body addressing.AddressMapAccountDeleteParams) ([]addressing.AddressMapAccountDeleteResponse, error) ### IPs @@ -3043,7 +3056,7 @@ Response Types: Methods: - client.Addressing.AddressMaps.IPs.Update(ctx context.Context, addressMapID string, ipAddress string, params addressing.AddressMapIPUpdateParams) ([]addressing.AddressMapIPUpdateResponse, error) -- client.Addressing.AddressMaps.IPs.Delete(ctx context.Context, addressMapID string, ipAddress string, params addressing.AddressMapIPDeleteParams) ([]addressing.AddressMapIPDeleteResponse, error) +- client.Addressing.AddressMaps.IPs.Delete(ctx context.Context, addressMapID string, ipAddress string, body addressing.AddressMapIPDeleteParams) ([]addressing.AddressMapIPDeleteResponse, error) ### Zones @@ -3055,7 +3068,7 @@ Response Types: Methods: - client.Addressing.AddressMaps.Zones.Update(ctx context.Context, addressMapID string, params addressing.AddressMapZoneUpdateParams) ([]addressing.AddressMapZoneUpdateResponse, error) -- client.Addressing.AddressMaps.Zones.Delete(ctx context.Context, addressMapID string, params addressing.AddressMapZoneDeleteParams) ([]addressing.AddressMapZoneDeleteResponse, error) +- client.Addressing.AddressMaps.Zones.Delete(ctx context.Context, addressMapID string, body addressing.AddressMapZoneDeleteParams) ([]addressing.AddressMapZoneDeleteResponse, error) ## LOADocuments @@ -3088,7 +3101,7 @@ Methods: - client.Addressing.Prefixes.New(ctx context.Context, params addressing.PrefixNewParams) (addressing.Prefix, error) - client.Addressing.Prefixes.List(ctx context.Context, query addressing.PrefixListParams) (pagination.SinglePage[addressing.Prefix], error) -- client.Addressing.Prefixes.Delete(ctx context.Context, prefixID string, params addressing.PrefixDeleteParams) ([]addressing.PrefixDeleteResponse, error) +- client.Addressing.Prefixes.Delete(ctx context.Context, prefixID string, body addressing.PrefixDeleteParams) ([]addressing.PrefixDeleteResponse, error) - client.Addressing.Prefixes.Edit(ctx context.Context, prefixID string, params addressing.PrefixEditParams) (addressing.Prefix, error) - client.Addressing.Prefixes.Get(ctx context.Context, prefixID string, query addressing.PrefixGetParams) (addressing.Prefix, error) @@ -3096,10 +3109,6 @@ Methods: #### Bindings -Params Types: - -- addressing.ServiceBindingParam - Response Types: - addressing.ServiceBinding @@ -3147,13 +3156,13 @@ Methods: - client.Addressing.Prefixes.Delegations.New(ctx context.Context, prefixID string, params addressing.PrefixDelegationNewParams) (addressing.Delegations, error) - client.Addressing.Prefixes.Delegations.List(ctx context.Context, prefixID string, query addressing.PrefixDelegationListParams) (pagination.SinglePage[addressing.Delegations], error) -- client.Addressing.Prefixes.Delegations.Delete(ctx context.Context, prefixID string, delegationID string, params addressing.PrefixDelegationDeleteParams) (addressing.PrefixDelegationDeleteResponse, error) +- client.Addressing.Prefixes.Delegations.Delete(ctx context.Context, prefixID string, delegationID string, body addressing.PrefixDelegationDeleteParams) (addressing.PrefixDelegationDeleteResponse, error) # AuditLogs Methods: -- client.AuditLogs.List(ctx context.Context, params audit_logs.AuditLogListParams) (pagination.V4PagePaginationArray[shared.AuditLog], error) +- client.AuditLogs.List(ctx context.Context, params audit_logs.AuditLogListParams) (pagination.V4PagePaginationArray[shared.AuditLog], error) # Billing @@ -3208,7 +3217,7 @@ Methods: - client.Images.V1.New(ctx context.Context, params images.V1NewParams) (images.Image, error) - client.Images.V1.List(ctx context.Context, params images.V1ListParams) (pagination.V4PagePagination[images.V1ListResponse], error) -- client.Images.V1.Delete(ctx context.Context, imageID string, params images.V1DeleteParams) (images.V1DeleteResponseUnion, error) +- client.Images.V1.Delete(ctx context.Context, imageID string, body images.V1DeleteParams) (images.V1DeleteResponseUnion, error) - client.Images.V1.Edit(ctx context.Context, imageID string, params images.V1EditParams) (images.Image, error) - client.Images.V1.Get(ctx context.Context, imageID string, query images.V1GetParams) (images.Image, error) @@ -3251,7 +3260,7 @@ Methods: - client.Images.V1.Variants.New(ctx context.Context, params images.V1VariantNewParams) (images.V1VariantNewResponse, error) - client.Images.V1.Variants.List(ctx context.Context, query images.V1VariantListParams) (images.Variant, error) -- client.Images.V1.Variants.Delete(ctx context.Context, variantID string, params images.V1VariantDeleteParams) (images.V1VariantDeleteResponseUnion, error) +- client.Images.V1.Variants.Delete(ctx context.Context, variantID string, body images.V1VariantDeleteParams) (images.V1VariantDeleteResponseUnion, error) - client.Images.V1.Variants.Edit(ctx context.Context, variantID string, params images.V1VariantEditParams) (images.V1VariantEditResponse, error) - client.Images.V1.Variants.Get(ctx context.Context, variantID string, query images.V1VariantGetParams) (images.V1VariantGetResponse, error) @@ -3287,7 +3296,7 @@ Methods: Methods: -- client.Intel.ASN.Get(ctx context.Context, asn shared.ASNParam, query intel.ASNGetParams) (shared.ASN, error) +- client.Intel.ASN.Get(ctx context.Context, asn shared.ASNParam, query intel.ASNGetParams) (shared.ASN, error) ### Subnets @@ -3297,14 +3306,10 @@ Response Types: Methods: -- client.Intel.ASN.Subnets.Get(ctx context.Context, asn shared.ASNParam, query intel.ASNSubnetGetParams) (intel.ASNSubnetGetResponse, error) +- client.Intel.ASN.Subnets.Get(ctx context.Context, asn shared.ASNParam, query intel.ASNSubnetGetParams) (intel.ASNSubnetGetResponse, error) ## DNS -Params Types: - -- intel.DNSParam - Response Types: - intel.DNS @@ -3378,11 +3383,11 @@ Methods: Response Types: -- intel.Whois +- intel.WhoisGetResponse Methods: -- client.Intel.Whois.Get(ctx context.Context, params intel.WhoisGetParams) (intel.Whois, error) +- client.Intel.Whois.Get(ctx context.Context, params intel.WhoisGetParams) (intel.WhoisGetResponse, error) ## IndicatorFeeds @@ -3396,11 +3401,21 @@ Response Types: Methods: - client.Intel.IndicatorFeeds.New(ctx context.Context, params intel.IndicatorFeedNewParams) (intel.IndicatorFeedNewResponse, error) -- client.Intel.IndicatorFeeds.Update(ctx context.Context, feedID int64, params intel.IndicatorFeedUpdateParams) (intel.IndicatorFeedUpdateResponse, error) +- client.Intel.IndicatorFeeds.Update(ctx context.Context, feedID int64, params intel.IndicatorFeedUpdateParams) (intel.IndicatorFeedUpdateResponse, error) - client.Intel.IndicatorFeeds.List(ctx context.Context, query intel.IndicatorFeedListParams) (pagination.SinglePage[intel.IndicatorFeedListResponse], error) - client.Intel.IndicatorFeeds.Data(ctx context.Context, feedID int64, query intel.IndicatorFeedDataParams) (string, error) - client.Intel.IndicatorFeeds.Get(ctx context.Context, feedID int64, query intel.IndicatorFeedGetParams) (intel.IndicatorFeedGetResponse, error) +### Snapshots + +Response Types: + +- intel.IndicatorFeedSnapshotUpdateResponse + +Methods: + +- client.Intel.IndicatorFeeds.Snapshots.Update(ctx context.Context, feedID int64, params intel.IndicatorFeedSnapshotUpdateParams) (intel.IndicatorFeedSnapshotUpdateResponse, error) + ### Permissions Response Types: @@ -3437,14 +3452,12 @@ Methods: Params Types: -- intel.IssueClassParam - intel.IssueType -- intel.ProductParam - intel.SeverityQueryParam -- intel.SubjectParam Response Types: +- intel.IssueType - intel.AttackSurfaceReportIssueListResponse - intel.AttackSurfaceReportIssueClassResponse - intel.AttackSurfaceReportIssueDismissResponseUnion @@ -3502,7 +3515,7 @@ Methods: - client.MagicTransit.GRETunnels.New(ctx context.Context, params magic_transit.GRETunnelNewParams) (magic_transit.GRETunnelNewResponse, error) - client.MagicTransit.GRETunnels.Update(ctx context.Context, tunnelIdentifier string, params magic_transit.GRETunnelUpdateParams) (magic_transit.GRETunnelUpdateResponse, error) - client.MagicTransit.GRETunnels.List(ctx context.Context, query magic_transit.GRETunnelListParams) (magic_transit.GRETunnelListResponse, error) -- client.MagicTransit.GRETunnels.Delete(ctx context.Context, tunnelIdentifier string, params magic_transit.GRETunnelDeleteParams) (magic_transit.GRETunnelDeleteResponse, error) +- client.MagicTransit.GRETunnels.Delete(ctx context.Context, tunnelIdentifier string, body magic_transit.GRETunnelDeleteParams) (magic_transit.GRETunnelDeleteResponse, error) - client.MagicTransit.GRETunnels.Get(ctx context.Context, tunnelIdentifier string, query magic_transit.GRETunnelGetParams) (magic_transit.GRETunnelGetResponse, error) ## IPSECTunnels @@ -3522,7 +3535,7 @@ Methods: - client.MagicTransit.IPSECTunnels.New(ctx context.Context, params magic_transit.IPSECTunnelNewParams) (magic_transit.IPSECTunnelNewResponse, error) - client.MagicTransit.IPSECTunnels.Update(ctx context.Context, tunnelIdentifier string, params magic_transit.IPSECTunnelUpdateParams) (magic_transit.IPSECTunnelUpdateResponse, error) - client.MagicTransit.IPSECTunnels.List(ctx context.Context, query magic_transit.IPSECTunnelListParams) (magic_transit.IPSECTunnelListResponse, error) -- client.MagicTransit.IPSECTunnels.Delete(ctx context.Context, tunnelIdentifier string, params magic_transit.IPSECTunnelDeleteParams) (magic_transit.IPSECTunnelDeleteResponse, error) +- client.MagicTransit.IPSECTunnels.Delete(ctx context.Context, tunnelIdentifier string, body magic_transit.IPSECTunnelDeleteParams) (magic_transit.IPSECTunnelDeleteResponse, error) - client.MagicTransit.IPSECTunnels.Get(ctx context.Context, tunnelIdentifier string, query magic_transit.IPSECTunnelGetParams) (magic_transit.IPSECTunnelGetResponse, error) - client.MagicTransit.IPSECTunnels.PSKGenerate(ctx context.Context, tunnelIdentifier string, params magic_transit.IPSECTunnelPSKGenerateParams) (magic_transit.IPSECTunnelPSKGenerateResponse, error) @@ -3530,14 +3543,10 @@ Methods: Params Types: -- magic_transit.ColoNameParam -- magic_transit.ColoRegionParam - magic_transit.ScopeParam Response Types: -- magic_transit.ColoName -- magic_transit.ColoRegion - magic_transit.Scope - magic_transit.RouteNewResponse - magic_transit.RouteUpdateResponse @@ -3551,8 +3560,8 @@ Methods: - client.MagicTransit.Routes.New(ctx context.Context, params magic_transit.RouteNewParams) (magic_transit.RouteNewResponse, error) - client.MagicTransit.Routes.Update(ctx context.Context, routeIdentifier string, params magic_transit.RouteUpdateParams) (magic_transit.RouteUpdateResponse, error) - client.MagicTransit.Routes.List(ctx context.Context, query magic_transit.RouteListParams) (magic_transit.RouteListResponse, error) -- client.MagicTransit.Routes.Delete(ctx context.Context, routeIdentifier string, params magic_transit.RouteDeleteParams) (magic_transit.RouteDeleteResponse, error) -- client.MagicTransit.Routes.Empty(ctx context.Context, params magic_transit.RouteEmptyParams) (magic_transit.RouteEmptyResponse, error) +- client.MagicTransit.Routes.Delete(ctx context.Context, routeIdentifier string, body magic_transit.RouteDeleteParams) (magic_transit.RouteDeleteResponse, error) +- client.MagicTransit.Routes.Empty(ctx context.Context, body magic_transit.RouteEmptyParams) (magic_transit.RouteEmptyResponse, error) - client.MagicTransit.Routes.Get(ctx context.Context, routeIdentifier string, query magic_transit.RouteGetParams) (magic_transit.RouteGetResponse, error) ## Sites @@ -3571,14 +3580,13 @@ Methods: - client.MagicTransit.Sites.New(ctx context.Context, params magic_transit.SiteNewParams) (magic_transit.Site, error) - client.MagicTransit.Sites.Update(ctx context.Context, siteID string, params magic_transit.SiteUpdateParams) (magic_transit.Site, error) - client.MagicTransit.Sites.List(ctx context.Context, params magic_transit.SiteListParams) (pagination.SinglePage[magic_transit.Site], error) -- client.MagicTransit.Sites.Delete(ctx context.Context, siteID string, params magic_transit.SiteDeleteParams) (magic_transit.Site, error) +- client.MagicTransit.Sites.Delete(ctx context.Context, siteID string, body magic_transit.SiteDeleteParams) (magic_transit.Site, error) - client.MagicTransit.Sites.Get(ctx context.Context, siteID string, query magic_transit.SiteGetParams) (magic_transit.Site, error) ### ACLs Params Types: -- magic_transit.ACLParam - magic_transit.ACLConfigurationParam - magic_transit.AllowedProtocol - magic_transit.SubnetUnionParam @@ -3595,7 +3603,7 @@ Methods: - client.MagicTransit.Sites.ACLs.New(ctx context.Context, siteID string, params magic_transit.SiteACLNewParams) (magic_transit.ACL, error) - client.MagicTransit.Sites.ACLs.Update(ctx context.Context, siteID string, aclIdentifier string, params magic_transit.SiteACLUpdateParams) (magic_transit.ACL, error) - client.MagicTransit.Sites.ACLs.List(ctx context.Context, siteID string, query magic_transit.SiteACLListParams) (pagination.SinglePage[magic_transit.ACL], error) -- client.MagicTransit.Sites.ACLs.Delete(ctx context.Context, siteID string, aclIdentifier string, params magic_transit.SiteACLDeleteParams) (magic_transit.ACL, error) +- client.MagicTransit.Sites.ACLs.Delete(ctx context.Context, siteID string, aclIdentifier string, body magic_transit.SiteACLDeleteParams) (magic_transit.ACL, error) - client.MagicTransit.Sites.ACLs.Get(ctx context.Context, siteID string, aclIdentifier string, query magic_transit.SiteACLGetParams) (magic_transit.ACL, error) ### LANs @@ -3622,7 +3630,7 @@ Methods: - client.MagicTransit.Sites.LANs.New(ctx context.Context, siteID string, params magic_transit.SiteLANNewParams) ([]magic_transit.LAN, error) - client.MagicTransit.Sites.LANs.Update(ctx context.Context, siteID string, lanID string, params magic_transit.SiteLANUpdateParams) (magic_transit.LAN, error) - client.MagicTransit.Sites.LANs.List(ctx context.Context, siteID string, query magic_transit.SiteLANListParams) (pagination.SinglePage[magic_transit.LAN], error) -- client.MagicTransit.Sites.LANs.Delete(ctx context.Context, siteID string, lanID string, params magic_transit.SiteLANDeleteParams) (magic_transit.LAN, error) +- client.MagicTransit.Sites.LANs.Delete(ctx context.Context, siteID string, lanID string, body magic_transit.SiteLANDeleteParams) (magic_transit.LAN, error) - client.MagicTransit.Sites.LANs.Get(ctx context.Context, siteID string, lanID string, query magic_transit.SiteLANGetParams) (magic_transit.LAN, error) ### WANs @@ -3641,17 +3649,13 @@ Methods: - client.MagicTransit.Sites.WANs.New(ctx context.Context, siteID string, params magic_transit.SiteWANNewParams) ([]magic_transit.WAN, error) - client.MagicTransit.Sites.WANs.Update(ctx context.Context, siteID string, wanID string, params magic_transit.SiteWANUpdateParams) (magic_transit.WAN, error) - client.MagicTransit.Sites.WANs.List(ctx context.Context, siteID string, query magic_transit.SiteWANListParams) (pagination.SinglePage[magic_transit.WAN], error) -- client.MagicTransit.Sites.WANs.Delete(ctx context.Context, siteID string, wanID string, params magic_transit.SiteWANDeleteParams) (magic_transit.WAN, error) +- client.MagicTransit.Sites.WANs.Delete(ctx context.Context, siteID string, wanID string, body magic_transit.SiteWANDeleteParams) (magic_transit.WAN, error) - client.MagicTransit.Sites.WANs.Get(ctx context.Context, siteID string, wanID string, query magic_transit.SiteWANGetParams) (magic_transit.WAN, error) # MagicNetworkMonitoring ## Configs -Params Types: - -- magic_network_monitoring.ConfigurationParam - Response Types: - magic_network_monitoring.Configuration @@ -3660,7 +3664,7 @@ Methods: - client.MagicNetworkMonitoring.Configs.New(ctx context.Context, params magic_network_monitoring.ConfigNewParams) (magic_network_monitoring.Configuration, error) - client.MagicNetworkMonitoring.Configs.Update(ctx context.Context, params magic_network_monitoring.ConfigUpdateParams) (magic_network_monitoring.Configuration, error) -- client.MagicNetworkMonitoring.Configs.Delete(ctx context.Context, params magic_network_monitoring.ConfigDeleteParams) (magic_network_monitoring.Configuration, error) +- client.MagicNetworkMonitoring.Configs.Delete(ctx context.Context, body magic_network_monitoring.ConfigDeleteParams) (magic_network_monitoring.Configuration, error) - client.MagicNetworkMonitoring.Configs.Edit(ctx context.Context, params magic_network_monitoring.ConfigEditParams) (magic_network_monitoring.Configuration, error) - client.MagicNetworkMonitoring.Configs.Get(ctx context.Context, query magic_network_monitoring.ConfigGetParams) (magic_network_monitoring.Configuration, error) @@ -3681,7 +3685,7 @@ Methods: - client.MagicNetworkMonitoring.Rules.New(ctx context.Context, params magic_network_monitoring.RuleNewParams) (magic_network_monitoring.MagicNetworkMonitoringRule, error) - client.MagicNetworkMonitoring.Rules.Update(ctx context.Context, params magic_network_monitoring.RuleUpdateParams) (magic_network_monitoring.MagicNetworkMonitoringRule, error) - client.MagicNetworkMonitoring.Rules.List(ctx context.Context, query magic_network_monitoring.RuleListParams) (pagination.SinglePage[magic_network_monitoring.MagicNetworkMonitoringRule], error) -- client.MagicNetworkMonitoring.Rules.Delete(ctx context.Context, ruleID string, params magic_network_monitoring.RuleDeleteParams) (magic_network_monitoring.MagicNetworkMonitoringRule, error) +- client.MagicNetworkMonitoring.Rules.Delete(ctx context.Context, ruleID string, body magic_network_monitoring.RuleDeleteParams) (magic_network_monitoring.MagicNetworkMonitoringRule, error) - client.MagicNetworkMonitoring.Rules.Edit(ctx context.Context, ruleID string, params magic_network_monitoring.RuleEditParams) (magic_network_monitoring.MagicNetworkMonitoringRule, error) - client.MagicNetworkMonitoring.Rules.Get(ctx context.Context, ruleID string, query magic_network_monitoring.RuleGetParams) (magic_network_monitoring.MagicNetworkMonitoringRule, error) @@ -3706,7 +3710,7 @@ Methods: - client.MTLSCertificates.New(ctx context.Context, params mtls_certificates.MTLSCertificateNewParams) (mtls_certificates.MTLSCertificateNewResponse, error) - client.MTLSCertificates.List(ctx context.Context, query mtls_certificates.MTLSCertificateListParams) (pagination.SinglePage[mtls_certificates.MTLSCertificate], error) -- client.MTLSCertificates.Delete(ctx context.Context, mtlsCertificateID string, params mtls_certificates.MTLSCertificateDeleteParams) (mtls_certificates.MTLSCertificate, error) +- client.MTLSCertificates.Delete(ctx context.Context, mtlsCertificateID string, body mtls_certificates.MTLSCertificateDeleteParams) (mtls_certificates.MTLSCertificate, error) - client.MTLSCertificates.Get(ctx context.Context, mtlsCertificateID string, query mtls_certificates.MTLSCertificateGetParams) (mtls_certificates.MTLSCertificate, error) ## Associations @@ -3743,7 +3747,7 @@ Methods: - client.Pages.Projects.New(ctx context.Context, params pages.ProjectNewParams) (pages.ProjectNewResponseUnion, error) - client.Pages.Projects.List(ctx context.Context, query pages.ProjectListParams) (pagination.SinglePage[pages.Deployment], error) -- client.Pages.Projects.Delete(ctx context.Context, projectName string, params pages.ProjectDeleteParams) (pages.ProjectDeleteResponse, error) +- client.Pages.Projects.Delete(ctx context.Context, projectName string, body pages.ProjectDeleteParams) (pages.ProjectDeleteResponse, error) - client.Pages.Projects.Edit(ctx context.Context, projectName string, params pages.ProjectEditParams) (pages.ProjectEditResponseUnion, error) - client.Pages.Projects.Get(ctx context.Context, projectName string, query pages.ProjectGetParams) (pages.Project, error) - client.Pages.Projects.PurgeBuildCache(ctx context.Context, projectName string, body pages.ProjectPurgeBuildCacheParams) (pages.ProjectPurgeBuildCacheResponse, error) @@ -3758,7 +3762,7 @@ Methods: - client.Pages.Projects.Deployments.New(ctx context.Context, projectName string, params pages.ProjectDeploymentNewParams) (pages.Deployment, error) - client.Pages.Projects.Deployments.List(ctx context.Context, projectName string, params pages.ProjectDeploymentListParams) (pagination.SinglePage[pages.Deployment], error) -- client.Pages.Projects.Deployments.Delete(ctx context.Context, projectName string, deploymentID string, params pages.ProjectDeploymentDeleteParams) (pages.ProjectDeploymentDeleteResponse, error) +- client.Pages.Projects.Deployments.Delete(ctx context.Context, projectName string, deploymentID string, body pages.ProjectDeploymentDeleteParams) (pages.ProjectDeploymentDeleteResponse, error) - client.Pages.Projects.Deployments.Get(ctx context.Context, projectName string, deploymentID string, query pages.ProjectDeploymentGetParams) (pages.Deployment, error) - client.Pages.Projects.Deployments.Retry(ctx context.Context, projectName string, deploymentID string, params pages.ProjectDeploymentRetryParams) (pages.Deployment, error) - client.Pages.Projects.Deployments.Rollback(ctx context.Context, projectName string, deploymentID string, params pages.ProjectDeploymentRollbackParams) (pages.Deployment, error) @@ -3789,7 +3793,7 @@ Methods: - client.Pages.Projects.Domains.New(ctx context.Context, projectName string, params pages.ProjectDomainNewParams) (pages.ProjectDomainNewResponseUnion, error) - client.Pages.Projects.Domains.List(ctx context.Context, projectName string, query pages.ProjectDomainListParams) (pagination.SinglePage[pages.ProjectDomainListResponse], error) -- client.Pages.Projects.Domains.Delete(ctx context.Context, projectName string, domainName string, params pages.ProjectDomainDeleteParams) (pages.ProjectDomainDeleteResponse, error) +- client.Pages.Projects.Domains.Delete(ctx context.Context, projectName string, domainName string, body pages.ProjectDomainDeleteParams) (pages.ProjectDomainDeleteResponse, error) - client.Pages.Projects.Domains.Edit(ctx context.Context, projectName string, domainName string, params pages.ProjectDomainEditParams) (pages.ProjectDomainEditResponseUnion, error) - client.Pages.Projects.Domains.Get(ctx context.Context, projectName string, domainName string, query pages.ProjectDomainGetParams) (pages.ProjectDomainGetResponseUnion, error) @@ -3886,7 +3890,7 @@ Methods: - client.Rules.Lists.New(ctx context.Context, params rules.ListNewParams) (rules.ListsList, error) - client.Rules.Lists.Update(ctx context.Context, listID string, params rules.ListUpdateParams) (rules.ListsList, error) - client.Rules.Lists.List(ctx context.Context, query rules.ListListParams) (pagination.SinglePage[rules.ListsList], error) -- client.Rules.Lists.Delete(ctx context.Context, listID string, params rules.ListDeleteParams) (rules.ListDeleteResponse, error) +- client.Rules.Lists.Delete(ctx context.Context, listID string, body rules.ListDeleteParams) (rules.ListDeleteResponse, error) - client.Rules.Lists.Get(ctx context.Context, listID string, query rules.ListGetParams) (rules.ListsList, error) ### BulkOperations @@ -3904,7 +3908,6 @@ Methods: Response Types: - rules.ListCursor -- rules.ListItem - rules.ListItemNewResponse - rules.ListItemUpdateResponse - rules.ListItemListResponse @@ -3916,7 +3919,7 @@ Methods: - client.Rules.Lists.Items.New(ctx context.Context, listID string, params rules.ListItemNewParams) (rules.ListItemNewResponse, error) - client.Rules.Lists.Items.Update(ctx context.Context, listID string, params rules.ListItemUpdateParams) (rules.ListItemUpdateResponse, error) - client.Rules.Lists.Items.List(ctx context.Context, listID string, params rules.ListItemListParams) (pagination.CursorPagination[rules.ListItemListResponse], error) -- client.Rules.Lists.Items.Delete(ctx context.Context, listID string, params rules.ListItemDeleteParams) (rules.ListItemDeleteResponse, error) +- client.Rules.Lists.Items.Delete(ctx context.Context, listID string, body rules.ListItemDeleteParams) (rules.ListItemDeleteResponse, error) - client.Rules.Lists.Items.Get(ctx context.Context, accountIdentifier string, listID string, itemID string) (rules.ListItemGetResponseUnion, error) # Storage @@ -3948,7 +3951,7 @@ Methods: - client.Stream.New(ctx context.Context, params stream.StreamNewParams) error - client.Stream.List(ctx context.Context, params stream.StreamListParams) (pagination.SinglePage[stream.Video], error) -- client.Stream.Delete(ctx context.Context, identifier string, params stream.StreamDeleteParams) error +- client.Stream.Delete(ctx context.Context, identifier string, body stream.StreamDeleteParams) error - client.Stream.Get(ctx context.Context, identifier string, query stream.StreamGetParams) (stream.Video, error) ## AudioTracks @@ -4012,7 +4015,7 @@ Response Types: Methods: - client.Stream.Keys.New(ctx context.Context, params stream.KeyNewParams) (stream.Keys, error) -- client.Stream.Keys.Delete(ctx context.Context, identifier string, params stream.KeyDeleteParams) (stream.KeyDeleteResponseUnion, error) +- client.Stream.Keys.Delete(ctx context.Context, identifier string, body stream.KeyDeleteParams) (stream.KeyDeleteResponseUnion, error) - client.Stream.Keys.Get(ctx context.Context, query stream.KeyGetParams) ([]stream.KeyGetResponse, error) ## LiveInputs @@ -4027,7 +4030,7 @@ Methods: - client.Stream.LiveInputs.New(ctx context.Context, params stream.LiveInputNewParams) (stream.LiveInput, error) - client.Stream.LiveInputs.Update(ctx context.Context, liveInputIdentifier string, params stream.LiveInputUpdateParams) (stream.LiveInput, error) - client.Stream.LiveInputs.List(ctx context.Context, params stream.LiveInputListParams) (stream.LiveInputListResponse, error) -- client.Stream.LiveInputs.Delete(ctx context.Context, liveInputIdentifier string, params stream.LiveInputDeleteParams) error +- client.Stream.LiveInputs.Delete(ctx context.Context, liveInputIdentifier string, body stream.LiveInputDeleteParams) error - client.Stream.LiveInputs.Get(ctx context.Context, liveInputIdentifier string, query stream.LiveInputGetParams) (stream.LiveInput, error) ### Outputs @@ -4041,7 +4044,7 @@ Methods: - client.Stream.LiveInputs.Outputs.New(ctx context.Context, liveInputIdentifier string, params stream.LiveInputOutputNewParams) (stream.Output, error) - client.Stream.LiveInputs.Outputs.Update(ctx context.Context, liveInputIdentifier string, outputIdentifier string, params stream.LiveInputOutputUpdateParams) (stream.Output, error) - client.Stream.LiveInputs.Outputs.List(ctx context.Context, liveInputIdentifier string, query stream.LiveInputOutputListParams) (pagination.SinglePage[stream.Output], error) -- client.Stream.LiveInputs.Outputs.Delete(ctx context.Context, liveInputIdentifier string, outputIdentifier string, params stream.LiveInputOutputDeleteParams) error +- client.Stream.LiveInputs.Outputs.Delete(ctx context.Context, liveInputIdentifier string, outputIdentifier string, body stream.LiveInputOutputDeleteParams) error ## Watermarks @@ -4054,7 +4057,7 @@ Methods: - client.Stream.Watermarks.New(ctx context.Context, params stream.WatermarkNewParams) (stream.Watermark, error) - client.Stream.Watermarks.List(ctx context.Context, query stream.WatermarkListParams) (pagination.SinglePage[stream.Watermark], error) -- client.Stream.Watermarks.Delete(ctx context.Context, identifier string, params stream.WatermarkDeleteParams) (stream.WatermarkDeleteResponseUnion, error) +- client.Stream.Watermarks.Delete(ctx context.Context, identifier string, body stream.WatermarkDeleteParams) (stream.WatermarkDeleteResponseUnion, error) - client.Stream.Watermarks.Get(ctx context.Context, identifier string, query stream.WatermarkGetParams) (stream.Watermark, error) ## Webhooks @@ -4068,7 +4071,7 @@ Response Types: Methods: - client.Stream.Webhooks.Update(ctx context.Context, params stream.WebhookUpdateParams) (stream.WebhookUpdateResponseUnion, error) -- client.Stream.Webhooks.Delete(ctx context.Context, params stream.WebhookDeleteParams) (stream.WebhookDeleteResponseUnion, error) +- client.Stream.Webhooks.Delete(ctx context.Context, body stream.WebhookDeleteParams) (stream.WebhookDeleteResponseUnion, error) - client.Stream.Webhooks.Get(ctx context.Context, query stream.WebhookGetParams) (stream.WebhookGetResponseUnion, error) ## Captions @@ -4086,7 +4089,7 @@ Methods: Methods: - client.Stream.Captions.Language.Update(ctx context.Context, identifier string, language string, params stream.CaptionLanguageUpdateParams) (stream.Caption, error) -- client.Stream.Captions.Language.Delete(ctx context.Context, identifier string, language string, params stream.CaptionLanguageDeleteParams) (string, error) +- client.Stream.Captions.Language.Delete(ctx context.Context, identifier string, language string, body stream.CaptionLanguageDeleteParams) (string, error) - client.Stream.Captions.Language.Get(ctx context.Context, identifier string, language string, query stream.CaptionLanguageGetParams) (stream.Caption, error) #### Vtt @@ -4197,7 +4200,6 @@ Methods: Params Types: - alerting.MechanismParam -- alerting.PolicyParam - alerting.PolicyFilterParam Response Types: @@ -4289,7 +4291,7 @@ Methods: - client.WARPConnector.New(ctx context.Context, params warp_connector.WARPConnectorNewParams) (warp_connector.WARPConnectorNewResponse, error) - client.WARPConnector.List(ctx context.Context, params warp_connector.WARPConnectorListParams) (pagination.V4PagePaginationArray[warp_connector.WARPConnectorListResponse], error) -- client.WARPConnector.Delete(ctx context.Context, tunnelID string, params warp_connector.WARPConnectorDeleteParams) (warp_connector.WARPConnectorDeleteResponse, error) +- client.WARPConnector.Delete(ctx context.Context, tunnelID string, body warp_connector.WARPConnectorDeleteParams) (warp_connector.WARPConnectorDeleteResponse, error) - client.WARPConnector.Edit(ctx context.Context, tunnelID string, params warp_connector.WARPConnectorEditParams) (warp_connector.WARPConnectorEditResponse, error) - client.WARPConnector.Get(ctx context.Context, tunnelID string, query warp_connector.WARPConnectorGetParams) (warp_connector.WARPConnectorGetResponse, error) - client.WARPConnector.Token(ctx context.Context, tunnelID string, query warp_connector.WARPConnectorTokenParams) (warp_connector.WARPConnectorTokenResponseUnion, error) @@ -4420,7 +4422,7 @@ Methods: - client.ZeroTrust.Devices.Networks.New(ctx context.Context, params zero_trust.DeviceNetworkNewParams) (zero_trust.DeviceNetwork, error) - client.ZeroTrust.Devices.Networks.Update(ctx context.Context, networkID string, params zero_trust.DeviceNetworkUpdateParams) (zero_trust.DeviceNetwork, error) - client.ZeroTrust.Devices.Networks.List(ctx context.Context, query zero_trust.DeviceNetworkListParams) (pagination.SinglePage[zero_trust.DeviceNetwork], error) -- client.ZeroTrust.Devices.Networks.Delete(ctx context.Context, networkID string, params zero_trust.DeviceNetworkDeleteParams) ([]zero_trust.DeviceNetwork, error) +- client.ZeroTrust.Devices.Networks.Delete(ctx context.Context, networkID string, body zero_trust.DeviceNetworkDeleteParams) ([]zero_trust.DeviceNetwork, error) - client.ZeroTrust.Devices.Networks.Get(ctx context.Context, networkID string, query zero_trust.DeviceNetworkGetParams) (zero_trust.DeviceNetwork, error) ### Policies @@ -4436,7 +4438,7 @@ Methods: - client.ZeroTrust.Devices.Policies.New(ctx context.Context, params zero_trust.DevicePolicyNewParams) (zero_trust.SettingsPolicy, error) - client.ZeroTrust.Devices.Policies.List(ctx context.Context, query zero_trust.DevicePolicyListParams) (pagination.SinglePage[zero_trust.SettingsPolicy], error) -- client.ZeroTrust.Devices.Policies.Delete(ctx context.Context, policyID string, params zero_trust.DevicePolicyDeleteParams) ([]zero_trust.SettingsPolicy, error) +- client.ZeroTrust.Devices.Policies.Delete(ctx context.Context, policyID string, body zero_trust.DevicePolicyDeleteParams) ([]zero_trust.SettingsPolicy, error) - client.ZeroTrust.Devices.Policies.Edit(ctx context.Context, policyID string, params zero_trust.DevicePolicyEditParams) (zero_trust.SettingsPolicy, error) - client.ZeroTrust.Devices.Policies.Get(ctx context.Context, policyID string, query zero_trust.DevicePolicyGetParams) (zero_trust.SettingsPolicy, error) @@ -4547,7 +4549,7 @@ Methods: - client.ZeroTrust.Devices.Posture.New(ctx context.Context, params zero_trust.DevicePostureNewParams) (zero_trust.DevicePostureRule, error) - client.ZeroTrust.Devices.Posture.Update(ctx context.Context, ruleID string, params zero_trust.DevicePostureUpdateParams) (zero_trust.DevicePostureRule, error) - client.ZeroTrust.Devices.Posture.List(ctx context.Context, query zero_trust.DevicePostureListParams) (pagination.SinglePage[zero_trust.DevicePostureRule], error) -- client.ZeroTrust.Devices.Posture.Delete(ctx context.Context, ruleID string, params zero_trust.DevicePostureDeleteParams) (zero_trust.DevicePostureDeleteResponse, error) +- client.ZeroTrust.Devices.Posture.Delete(ctx context.Context, ruleID string, body zero_trust.DevicePostureDeleteParams) (zero_trust.DevicePostureDeleteResponse, error) - client.ZeroTrust.Devices.Posture.Get(ctx context.Context, ruleID string, query zero_trust.DevicePostureGetParams) (zero_trust.DevicePostureRule, error) #### Integrations @@ -4561,7 +4563,7 @@ Methods: - client.ZeroTrust.Devices.Posture.Integrations.New(ctx context.Context, params zero_trust.DevicePostureIntegrationNewParams) (zero_trust.Integration, error) - client.ZeroTrust.Devices.Posture.Integrations.List(ctx context.Context, query zero_trust.DevicePostureIntegrationListParams) (pagination.SinglePage[zero_trust.Integration], error) -- client.ZeroTrust.Devices.Posture.Integrations.Delete(ctx context.Context, integrationID string, params zero_trust.DevicePostureIntegrationDeleteParams) (zero_trust.DevicePostureIntegrationDeleteResponseUnion, error) +- client.ZeroTrust.Devices.Posture.Integrations.Delete(ctx context.Context, integrationID string, body zero_trust.DevicePostureIntegrationDeleteParams) (zero_trust.DevicePostureIntegrationDeleteResponseUnion, error) - client.ZeroTrust.Devices.Posture.Integrations.Edit(ctx context.Context, integrationID string, params zero_trust.DevicePostureIntegrationEditParams) (zero_trust.Integration, error) - client.ZeroTrust.Devices.Posture.Integrations.Get(ctx context.Context, integrationID string, query zero_trust.DevicePostureIntegrationGetParams) (zero_trust.Integration, error) @@ -4719,34 +4721,34 @@ Response Types: Params Types: -- zero_trust.AllowedHeadershParam -- zero_trust.AllowedIdpshParam -- zero_trust.AllowedMethodsh -- zero_trust.AllowedOriginshParam +- zero_trust.AllowedHeadersParam +- zero_trust.AllowedIdPsParam +- zero_trust.AllowedMethods +- zero_trust.AllowedOriginsParam - zero_trust.AppIDUnionParam - zero_trust.ApplicationUnionParam +- zero_trust.ApplicationType - zero_trust.CORSHeadersParam -- zero_trust.CustomPageshParam - zero_trust.SaaSAppNameFormat - zero_trust.SaaSAppNameIDFormat - zero_trust.SaaSAppSourceParam - zero_trust.SAMLSaaSAppParam -- zero_trust.SelfHostedDomainshParam +- zero_trust.SelfHostedDomainsParam Response Types: -- zero_trust.AllowedHeadersh -- zero_trust.AllowedIdpsh -- zero_trust.AllowedMethodsh -- zero_trust.AllowedOriginsh +- zero_trust.AllowedHeaders +- zero_trust.AllowedIdPs +- zero_trust.AllowedMethods +- zero_trust.AllowedOrigins - zero_trust.Application +- zero_trust.ApplicationType - zero_trust.CORSHeaders -- zero_trust.CustomPagesh - zero_trust.SaaSAppNameFormat - zero_trust.SaaSAppNameIDFormat - zero_trust.SaaSAppSource - zero_trust.SAMLSaaSApp -- zero_trust.SelfHostedDomainsh +- zero_trust.SelfHostedDomains - zero_trust.AccessApplicationDeleteResponse - zero_trust.AccessApplicationRevokeTokensResponse @@ -4791,7 +4793,6 @@ Methods: Params Types: - zero_trust.ApprovalGroupParam -- zero_trust.PolicyParam Response Types: @@ -4886,7 +4887,7 @@ Methods: - client.ZeroTrust.Access.Bookmarks.New(ctx context.Context, identifier string, uuid string, body zero_trust.AccessBookmarkNewParams) (zero_trust.Bookmark, error) - client.ZeroTrust.Access.Bookmarks.Update(ctx context.Context, identifier string, uuid string, body zero_trust.AccessBookmarkUpdateParams) (zero_trust.Bookmark, error) - client.ZeroTrust.Access.Bookmarks.List(ctx context.Context, identifier string) (pagination.SinglePage[zero_trust.Bookmark], error) -- client.ZeroTrust.Access.Bookmarks.Delete(ctx context.Context, identifier string, uuid string, body zero_trust.AccessBookmarkDeleteParams) (zero_trust.AccessBookmarkDeleteResponse, error) +- client.ZeroTrust.Access.Bookmarks.Delete(ctx context.Context, identifier string, uuid string) (zero_trust.AccessBookmarkDeleteResponse, error) - client.ZeroTrust.Access.Bookmarks.Get(ctx context.Context, identifier string, uuid string) (zero_trust.Bookmark, error) ### Keys @@ -5116,7 +5117,7 @@ Methods: - client.ZeroTrust.Tunnels.New(ctx context.Context, params zero_trust.TunnelNewParams) (zero_trust.TunnelNewResponse, error) - client.ZeroTrust.Tunnels.List(ctx context.Context, params zero_trust.TunnelListParams) (pagination.V4PagePaginationArray[zero_trust.TunnelListResponse], error) -- client.ZeroTrust.Tunnels.Delete(ctx context.Context, tunnelID string, params zero_trust.TunnelDeleteParams) (zero_trust.TunnelDeleteResponse, error) +- client.ZeroTrust.Tunnels.Delete(ctx context.Context, tunnelID string, body zero_trust.TunnelDeleteParams) (zero_trust.TunnelDeleteResponse, error) - client.ZeroTrust.Tunnels.Edit(ctx context.Context, tunnelID string, params zero_trust.TunnelEditParams) (zero_trust.TunnelEditResponse, error) - client.ZeroTrust.Tunnels.Get(ctx context.Context, tunnelID string, query zero_trust.TunnelGetParams) (zero_trust.TunnelGetResponse, error) @@ -5141,7 +5142,7 @@ Response Types: Methods: -- client.ZeroTrust.Tunnels.Connections.Delete(ctx context.Context, tunnelID string, params zero_trust.TunnelConnectionDeleteParams) (zero_trust.TunnelConnectionDeleteResponseUnion, error) +- client.ZeroTrust.Tunnels.Connections.Delete(ctx context.Context, tunnelID string, body zero_trust.TunnelConnectionDeleteParams) (zero_trust.TunnelConnectionDeleteResponseUnion, error) - client.ZeroTrust.Tunnels.Connections.Get(ctx context.Context, tunnelID string, query zero_trust.TunnelConnectionGetParams) ([]zero_trust.Client, error) ### Token @@ -5264,7 +5265,7 @@ Methods: - client.ZeroTrust.DLP.Profiles.Custom.New(ctx context.Context, params zero_trust.DLPProfileCustomNewParams) ([]zero_trust.CustomProfile, error) - client.ZeroTrust.DLP.Profiles.Custom.Update(ctx context.Context, profileID string, params zero_trust.DLPProfileCustomUpdateParams) (zero_trust.CustomProfile, error) -- client.ZeroTrust.DLP.Profiles.Custom.Delete(ctx context.Context, profileID string, params zero_trust.DLPProfileCustomDeleteParams) (zero_trust.DLPProfileCustomDeleteResponseUnion, error) +- client.ZeroTrust.DLP.Profiles.Custom.Delete(ctx context.Context, profileID string, body zero_trust.DLPProfileCustomDeleteParams) (zero_trust.DLPProfileCustomDeleteResponseUnion, error) - client.ZeroTrust.DLP.Profiles.Custom.Get(ctx context.Context, profileID string, query zero_trust.DLPProfileCustomGetParams) (zero_trust.CustomProfile, error) #### Predefined @@ -5380,7 +5381,7 @@ Methods: - client.ZeroTrust.Gateway.Lists.New(ctx context.Context, params zero_trust.GatewayListNewParams) (zero_trust.GatewayListNewResponse, error) - client.ZeroTrust.Gateway.Lists.Update(ctx context.Context, listID string, params zero_trust.GatewayListUpdateParams) (zero_trust.GatewayList, error) - client.ZeroTrust.Gateway.Lists.List(ctx context.Context, query zero_trust.GatewayListListParams) (pagination.SinglePage[zero_trust.GatewayList], error) -- client.ZeroTrust.Gateway.Lists.Delete(ctx context.Context, listID string, params zero_trust.GatewayListDeleteParams) (zero_trust.GatewayListDeleteResponseUnion, error) +- client.ZeroTrust.Gateway.Lists.Delete(ctx context.Context, listID string, body zero_trust.GatewayListDeleteParams) (zero_trust.GatewayListDeleteResponseUnion, error) - client.ZeroTrust.Gateway.Lists.Edit(ctx context.Context, listID string, params zero_trust.GatewayListEditParams) (zero_trust.GatewayList, error) - client.ZeroTrust.Gateway.Lists.Get(ctx context.Context, listID string, query zero_trust.GatewayListGetParams) (zero_trust.GatewayList, error) @@ -5407,7 +5408,7 @@ Methods: - client.ZeroTrust.Gateway.Locations.New(ctx context.Context, params zero_trust.GatewayLocationNewParams) (zero_trust.Location, error) - client.ZeroTrust.Gateway.Locations.Update(ctx context.Context, locationID string, params zero_trust.GatewayLocationUpdateParams) (zero_trust.Location, error) - client.ZeroTrust.Gateway.Locations.List(ctx context.Context, query zero_trust.GatewayLocationListParams) (pagination.SinglePage[zero_trust.Location], error) -- client.ZeroTrust.Gateway.Locations.Delete(ctx context.Context, locationID string, params zero_trust.GatewayLocationDeleteParams) (zero_trust.GatewayLocationDeleteResponseUnion, error) +- client.ZeroTrust.Gateway.Locations.Delete(ctx context.Context, locationID string, body zero_trust.GatewayLocationDeleteParams) (zero_trust.GatewayLocationDeleteResponseUnion, error) - client.ZeroTrust.Gateway.Locations.Get(ctx context.Context, locationID string, query zero_trust.GatewayLocationGetParams) (zero_trust.Location, error) ### Logging @@ -5441,7 +5442,7 @@ Methods: - client.ZeroTrust.Gateway.ProxyEndpoints.New(ctx context.Context, params zero_trust.GatewayProxyEndpointNewParams) (zero_trust.ProxyEndpoint, error) - client.ZeroTrust.Gateway.ProxyEndpoints.List(ctx context.Context, query zero_trust.GatewayProxyEndpointListParams) (pagination.SinglePage[zero_trust.ProxyEndpoint], error) -- client.ZeroTrust.Gateway.ProxyEndpoints.Delete(ctx context.Context, proxyEndpointID string, params zero_trust.GatewayProxyEndpointDeleteParams) (zero_trust.GatewayProxyEndpointDeleteResponseUnion, error) +- client.ZeroTrust.Gateway.ProxyEndpoints.Delete(ctx context.Context, proxyEndpointID string, body zero_trust.GatewayProxyEndpointDeleteParams) (zero_trust.GatewayProxyEndpointDeleteResponseUnion, error) - client.ZeroTrust.Gateway.ProxyEndpoints.Edit(ctx context.Context, proxyEndpointID string, params zero_trust.GatewayProxyEndpointEditParams) (zero_trust.ProxyEndpoint, error) - client.ZeroTrust.Gateway.ProxyEndpoints.Get(ctx context.Context, proxyEndpointID string, query zero_trust.GatewayProxyEndpointGetParams) (zero_trust.ProxyEndpoint, error) @@ -5470,17 +5471,13 @@ Methods: - client.ZeroTrust.Gateway.Rules.New(ctx context.Context, params zero_trust.GatewayRuleNewParams) (zero_trust.GatewayRule, error) - client.ZeroTrust.Gateway.Rules.Update(ctx context.Context, ruleID string, params zero_trust.GatewayRuleUpdateParams) (zero_trust.GatewayRule, error) - client.ZeroTrust.Gateway.Rules.List(ctx context.Context, query zero_trust.GatewayRuleListParams) (pagination.SinglePage[zero_trust.GatewayRule], error) -- client.ZeroTrust.Gateway.Rules.Delete(ctx context.Context, ruleID string, params zero_trust.GatewayRuleDeleteParams) (zero_trust.GatewayRuleDeleteResponseUnion, error) +- client.ZeroTrust.Gateway.Rules.Delete(ctx context.Context, ruleID string, body zero_trust.GatewayRuleDeleteParams) (zero_trust.GatewayRuleDeleteResponseUnion, error) - client.ZeroTrust.Gateway.Rules.Get(ctx context.Context, ruleID string, query zero_trust.GatewayRuleGetParams) (zero_trust.GatewayRule, error) ## Networks ### Routes -Params Types: - -- zero_trust.RouteParam - Response Types: - zero_trust.Route @@ -5520,7 +5517,7 @@ Methods: - client.ZeroTrust.Networks.VirtualNetworks.New(ctx context.Context, params zero_trust.NetworkVirtualNetworkNewParams) (zero_trust.NetworkVirtualNetworkNewResponseUnion, error) - client.ZeroTrust.Networks.VirtualNetworks.List(ctx context.Context, params zero_trust.NetworkVirtualNetworkListParams) (pagination.SinglePage[zero_trust.VirtualNetwork], error) -- client.ZeroTrust.Networks.VirtualNetworks.Delete(ctx context.Context, virtualNetworkID string, params zero_trust.NetworkVirtualNetworkDeleteParams) (zero_trust.NetworkVirtualNetworkDeleteResponseUnion, error) +- client.ZeroTrust.Networks.VirtualNetworks.Delete(ctx context.Context, virtualNetworkID string, body zero_trust.NetworkVirtualNetworkDeleteParams) (zero_trust.NetworkVirtualNetworkDeleteResponseUnion, error) - client.ZeroTrust.Networks.VirtualNetworks.Edit(ctx context.Context, virtualNetworkID string, params zero_trust.NetworkVirtualNetworkEditParams) (zero_trust.NetworkVirtualNetworkEditResponseUnion, error) ## RiskScoring @@ -6476,6 +6473,7 @@ Response Types: - radar.HTTPSummaryHTTPVersionResponse - radar.HTTPSummaryIPVersionResponse - radar.HTTPSummaryOSResponse +- radar.HTTPSummaryPostQuantumResponse - radar.HTTPSummaryTLSVersionResponse Methods: @@ -6486,6 +6484,7 @@ Methods: - client.Radar.HTTP.Summary.HTTPVersion(ctx context.Context, query radar.HTTPSummaryHTTPVersionParams) (radar.HTTPSummaryHTTPVersionResponse, error) - client.Radar.HTTP.Summary.IPVersion(ctx context.Context, query radar.HTTPSummaryIPVersionParams) (radar.HTTPSummaryIPVersionResponse, error) - client.Radar.HTTP.Summary.OS(ctx context.Context, query radar.HTTPSummaryOSParams) (radar.HTTPSummaryOSResponse, error) +- client.Radar.HTTP.Summary.PostQuantum(ctx context.Context, query radar.HTTPSummaryPostQuantumParams) (radar.HTTPSummaryPostQuantumResponse, error) - client.Radar.HTTP.Summary.TLSVersion(ctx context.Context, query radar.HTTPSummaryTLSVersionParams) (radar.HTTPSummaryTLSVersionResponse, error) ### TimeseriesGroups @@ -6500,6 +6499,7 @@ Response Types: - radar.HTTPTimeseriesGroupHTTPVersionResponse - radar.HTTPTimeseriesGroupIPVersionResponse - radar.HTTPTimeseriesGroupOSResponse +- radar.HTTPTimeseriesGroupPostQuantumResponse - radar.HTTPTimeseriesGroupTLSVersionResponse Methods: @@ -6512,6 +6512,7 @@ Methods: - client.Radar.HTTP.TimeseriesGroups.HTTPVersion(ctx context.Context, query radar.HTTPTimeseriesGroupHTTPVersionParams) (radar.HTTPTimeseriesGroupHTTPVersionResponse, error) - client.Radar.HTTP.TimeseriesGroups.IPVersion(ctx context.Context, query radar.HTTPTimeseriesGroupIPVersionParams) (radar.HTTPTimeseriesGroupIPVersionResponse, error) - client.Radar.HTTP.TimeseriesGroups.OS(ctx context.Context, query radar.HTTPTimeseriesGroupOSParams) (radar.HTTPTimeseriesGroupOSResponse, error) +- client.Radar.HTTP.TimeseriesGroups.PostQuantum(ctx context.Context, query radar.HTTPTimeseriesGroupPostQuantumParams) (radar.HTTPTimeseriesGroupPostQuantumResponse, error) - client.Radar.HTTP.TimeseriesGroups.TLSVersion(ctx context.Context, query radar.HTTPTimeseriesGroupTLSVersionParams) (radar.HTTPTimeseriesGroupTLSVersionResponse, error) ## Quality @@ -6636,43 +6637,20 @@ Response Types: - speed.LabeledRegion - speed.LighthouseReport - speed.Trend -- speed.SpeedDeleteResponse - -Methods: - -- client.Speed.Delete(ctx context.Context, url string, params speed.SpeedDeleteParams) (speed.SpeedDeleteResponse, error) -- client.Speed.ScheduleGet(ctx context.Context, url string, params speed.SpeedScheduleGetParams) (speed.Schedule, error) -- client.Speed.TrendsList(ctx context.Context, url string, params speed.SpeedTrendsListParams) (speed.Trend, error) - -## Tests - -Response Types: - -- speed.Test -- speed.TestListResponse -- speed.TestDeleteResponse - -Methods: - -- client.Speed.Tests.New(ctx context.Context, url string, params speed.TestNewParams) (speed.Test, error) -- client.Speed.Tests.List(ctx context.Context, url string, params speed.TestListParams) (speed.TestListResponse, error) -- client.Speed.Tests.Delete(ctx context.Context, url string, params speed.TestDeleteParams) (speed.TestDeleteResponse, error) -- client.Speed.Tests.Get(ctx context.Context, url string, testID string, query speed.TestGetParams) (speed.Test, error) ## Schedule -Params Types: - -- speed.ScheduleParam - Response Types: - speed.Schedule - speed.ScheduleNewResponse +- speed.ScheduleDeleteResponse Methods: - client.Speed.Schedule.New(ctx context.Context, url string, params speed.ScheduleNewParams) (speed.ScheduleNewResponse, error) +- client.Speed.Schedule.Delete(ctx context.Context, url string, params speed.ScheduleDeleteParams) (speed.ScheduleDeleteResponse, error) +- client.Speed.Schedule.Get(ctx context.Context, url string, params speed.ScheduleGetParams) (speed.Schedule, error) ## Availabilities @@ -6693,6 +6671,22 @@ Response Types: Methods: - client.Speed.Pages.List(ctx context.Context, query speed.PageListParams) (pagination.SinglePage[speed.PageListResponse], error) +- client.Speed.Pages.Trend(ctx context.Context, url string, params speed.PageTrendParams) (speed.Trend, error) + +### Tests + +Response Types: + +- speed.Test +- speed.PageTestListResponse +- speed.PageTestDeleteResponse + +Methods: + +- client.Speed.Pages.Tests.New(ctx context.Context, url string, params speed.PageTestNewParams) (speed.Test, error) +- client.Speed.Pages.Tests.List(ctx context.Context, url string, params speed.PageTestListParams) (speed.PageTestListResponse, error) +- client.Speed.Pages.Tests.Delete(ctx context.Context, url string, params speed.PageTestDeleteParams) (speed.PageTestDeleteResponse, error) +- client.Speed.Pages.Tests.Get(ctx context.Context, url string, testID string, query speed.PageTestGetParams) (speed.Test, error) # DCVDelegation @@ -6734,20 +6728,20 @@ Methods: Response Types: - snippets.Snippet -- snippets.SnippetDeleteResponseUnion +- snippets.SnippetDeleteResponse Methods: -- client.Snippets.Update(ctx context.Context, zoneIdentifier string, snippetName string, body snippets.SnippetUpdateParams) (snippets.Snippet, error) -- client.Snippets.List(ctx context.Context, zoneIdentifier string) (pagination.SinglePage[snippets.Snippet], error) -- client.Snippets.Delete(ctx context.Context, zoneIdentifier string, snippetName string) (snippets.SnippetDeleteResponseUnion, error) -- client.Snippets.Get(ctx context.Context, zoneIdentifier string, snippetName string) (snippets.Snippet, error) +- client.Snippets.Update(ctx context.Context, snippetName string, params snippets.SnippetUpdateParams) (snippets.Snippet, error) +- client.Snippets.List(ctx context.Context, query snippets.SnippetListParams) (pagination.SinglePage[snippets.Snippet], error) +- client.Snippets.Delete(ctx context.Context, snippetName string, body snippets.SnippetDeleteParams) (snippets.SnippetDeleteResponse, error) +- client.Snippets.Get(ctx context.Context, snippetName string, query snippets.SnippetGetParams) (snippets.Snippet, error) ## Content Methods: -- client.Snippets.Content.Get(ctx context.Context, zoneIdentifier string, snippetName string) (http.Response, error) +- client.Snippets.Content.Get(ctx context.Context, snippetName string, query snippets.ContentGetParams) (http.Response, error) ## Rules @@ -6758,8 +6752,8 @@ Response Types: Methods: -- client.Snippets.Rules.Update(ctx context.Context, zoneIdentifier string, body snippets.RuleUpdateParams) ([]snippets.RuleUpdateResponse, error) -- client.Snippets.Rules.List(ctx context.Context, zoneIdentifier string) (pagination.SinglePage[snippets.RuleListResponse], error) +- client.Snippets.Rules.Update(ctx context.Context, params snippets.RuleUpdateParams) ([]snippets.RuleUpdateResponse, error) +- client.Snippets.Rules.List(ctx context.Context, query snippets.RuleListParams) (pagination.SinglePage[snippets.RuleListResponse], error) # Calls @@ -6787,14 +6781,14 @@ Response Types: - cloudforce_one.Quota - cloudforce_one.RequestConstants - cloudforce_one.RequestTypes -- cloudforce_one.RequestDeleteResponseUnion +- cloudforce_one.RequestDeleteResponse Methods: - client.CloudforceOne.Requests.New(ctx context.Context, accountIdentifier string, body cloudforce_one.RequestNewParams) (cloudforce_one.Item, error) - client.CloudforceOne.Requests.Update(ctx context.Context, accountIdentifier string, requestIdentifier string, body cloudforce_one.RequestUpdateParams) (cloudforce_one.Item, error) - client.CloudforceOne.Requests.List(ctx context.Context, accountIdentifier string, body cloudforce_one.RequestListParams) (pagination.V4PagePaginationArray[cloudforce_one.ListItem], error) -- client.CloudforceOne.Requests.Delete(ctx context.Context, accountIdentifier string, requestIdentifier string) (cloudforce_one.RequestDeleteResponseUnion, error) +- client.CloudforceOne.Requests.Delete(ctx context.Context, accountIdentifier string, requestIdentifier string) (cloudforce_one.RequestDeleteResponse, error) - client.CloudforceOne.Requests.Constants(ctx context.Context, accountIdentifier string) (cloudforce_one.RequestConstants, error) - client.CloudforceOne.Requests.Get(ctx context.Context, accountIdentifier string, requestIdentifier string) (cloudforce_one.Item, error) - client.CloudforceOne.Requests.Quota(ctx context.Context, accountIdentifier string) (cloudforce_one.Quota, error) @@ -6805,13 +6799,13 @@ Methods: Response Types: - cloudforce_one.Message -- cloudforce_one.RequestMessageDeleteResponseUnion +- cloudforce_one.RequestMessageDeleteResponse Methods: - client.CloudforceOne.Requests.Message.New(ctx context.Context, accountIdentifier string, requestIdentifier string, body cloudforce_one.RequestMessageNewParams) (cloudforce_one.Message, error) - client.CloudforceOne.Requests.Message.Update(ctx context.Context, accountIdentifier string, requestIdentifier string, messageIdentifer int64, body cloudforce_one.RequestMessageUpdateParams) (cloudforce_one.Message, error) -- client.CloudforceOne.Requests.Message.Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, messageIdentifer int64) (cloudforce_one.RequestMessageDeleteResponseUnion, error) +- client.CloudforceOne.Requests.Message.Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, messageIdentifer int64) (cloudforce_one.RequestMessageDeleteResponse, error) - client.CloudforceOne.Requests.Message.Get(ctx context.Context, accountIdentifier string, requestIdentifier string, body cloudforce_one.RequestMessageGetParams) ([]cloudforce_one.Message, error) ### Priority @@ -6825,13 +6819,13 @@ Response Types: - cloudforce_one.Label - cloudforce_one.Priority -- cloudforce_one.RequestPriorityDeleteResponseUnion +- cloudforce_one.RequestPriorityDeleteResponse Methods: - client.CloudforceOne.Requests.Priority.New(ctx context.Context, accountIdentifier string, body cloudforce_one.RequestPriorityNewParams) (cloudforce_one.Priority, error) - client.CloudforceOne.Requests.Priority.Update(ctx context.Context, accountIdentifier string, priorityIdentifer string, body cloudforce_one.RequestPriorityUpdateParams) (cloudforce_one.Item, error) -- client.CloudforceOne.Requests.Priority.Delete(ctx context.Context, accountIdentifier string, priorityIdentifer string) (cloudforce_one.RequestPriorityDeleteResponseUnion, error) +- client.CloudforceOne.Requests.Priority.Delete(ctx context.Context, accountIdentifier string, priorityIdentifer string) (cloudforce_one.RequestPriorityDeleteResponse, error) - client.CloudforceOne.Requests.Priority.Get(ctx context.Context, accountIdentifier string, priorityIdentifer string) (cloudforce_one.Item, error) - client.CloudforceOne.Requests.Priority.Quota(ctx context.Context, accountIdentifier string) (cloudforce_one.Quota, error) @@ -6860,3 +6854,31 @@ Methods: - client.EventNotifications.R2.Configuration.Queues.Update(ctx context.Context, bucketName string, queueID string, params event_notifications.R2ConfigurationQueueUpdateParams) (event_notifications.R2ConfigurationQueueUpdateResponse, error) - client.EventNotifications.R2.Configuration.Queues.Delete(ctx context.Context, bucketName string, queueID string, body event_notifications.R2ConfigurationQueueDeleteParams) (event_notifications.R2ConfigurationQueueDeleteResponseUnion, error) + +# AIGateway + +Response Types: + +- ai_gateway.AIGatewayNewResponse +- ai_gateway.AIGatewayUpdateResponse +- ai_gateway.AIGatewayListResponse +- ai_gateway.AIGatewayDeleteResponse +- ai_gateway.AIGatewayGetResponse + +Methods: + +- client.AIGateway.New(ctx context.Context, params ai_gateway.AIGatewayNewParams) (ai_gateway.AIGatewayNewResponse, error) +- client.AIGateway.Update(ctx context.Context, id string, params ai_gateway.AIGatewayUpdateParams) (ai_gateway.AIGatewayUpdateResponse, error) +- client.AIGateway.List(ctx context.Context, params ai_gateway.AIGatewayListParams) (pagination.V4PagePaginationArray[ai_gateway.AIGatewayListResponse], error) +- client.AIGateway.Delete(ctx context.Context, id string, body ai_gateway.AIGatewayDeleteParams) (ai_gateway.AIGatewayDeleteResponse, error) +- client.AIGateway.Get(ctx context.Context, id string, query ai_gateway.AIGatewayGetParams) (ai_gateway.AIGatewayGetResponse, error) + +## Logs + +Response Types: + +- ai_gateway.LogGetResponse + +Methods: + +- client.AIGateway.Logs.Get(ctx context.Context, id string, params ai_gateway.LogGetParams) ([]ai_gateway.LogGetResponse, error) diff --git a/argo/aliases.go b/argo/aliases.go index d2d5ea03ec5..20804e99df6 100644 --- a/argo/aliases.go +++ b/argo/aliases.go @@ -4,7 +4,7 @@ package argo import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/argo/smartrouting.go b/argo/smartrouting.go index 35fea9775b0..d652fadebed 100644 --- a/argo/smartrouting.go +++ b/argo/smartrouting.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/argo/smartrouting_test.go b/argo/smartrouting_test.go index 128ab4279c7..437e11c1641 100644 --- a/argo/smartrouting_test.go +++ b/argo/smartrouting_test.go @@ -15,7 +15,6 @@ import ( ) func TestSmartRoutingEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSmartRoutingEdit(t *testing.T) { } func TestSmartRoutingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/argo/tieredcaching.go b/argo/tieredcaching.go index 1d146682416..061b25474c3 100644 --- a/argo/tieredcaching.go +++ b/argo/tieredcaching.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/argo/tieredcaching_test.go b/argo/tieredcaching_test.go index 1912a7806d3..a016e4d3cec 100644 --- a/argo/tieredcaching_test.go +++ b/argo/tieredcaching_test.go @@ -15,7 +15,6 @@ import ( ) func TestTieredCachingEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestTieredCachingEdit(t *testing.T) { } func TestTieredCachingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/audit_logs/aliases.go b/audit_logs/aliases.go index d995027d8cb..56baddd2837 100644 --- a/audit_logs/aliases.go +++ b/audit_logs/aliases.go @@ -4,7 +4,7 @@ package audit_logs import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/audit_logs/auditlog.go b/audit_logs/auditlog.go index d203c9f73ec..f15dc8a207a 100644 --- a/audit_logs/auditlog.go +++ b/audit_logs/auditlog.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AuditLogService contains methods and other services that help with interacting diff --git a/audit_logs/auditlog_test.go b/audit_logs/auditlog_test.go index ee7487991f8..37216ea8dd6 100644 --- a/audit_logs/auditlog_test.go +++ b/audit_logs/auditlog_test.go @@ -16,7 +16,6 @@ import ( ) func TestAuditLogListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/billing/aliases.go b/billing/aliases.go index 8fccb49406b..e00d02c091a 100644 --- a/billing/aliases.go +++ b/billing/aliases.go @@ -4,7 +4,7 @@ package billing import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/billing/profile.go b/billing/profile.go index 1e8861be59e..8218a24bba0 100644 --- a/billing/profile.go +++ b/billing/profile.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/billing/profile_test.go b/billing/profile_test.go index d938c8f3151..50709fd1bae 100644 --- a/billing/profile_test.go +++ b/billing/profile_test.go @@ -14,7 +14,6 @@ import ( ) func TestProfileGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/bot_management/aliases.go b/bot_management/aliases.go index 56cf5711b19..38cdc57343b 100644 --- a/bot_management/aliases.go +++ b/bot_management/aliases.go @@ -4,7 +4,7 @@ package bot_management import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/bot_management/botmanagement.go b/bot_management/botmanagement.go index a1f392c1425..ff991afe8bb 100644 --- a/bot_management/botmanagement.go +++ b/bot_management/botmanagement.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -796,11 +796,11 @@ func (r BotManagementUpdateParamsBodySBFMLikelyAutomated) IsKnown() bool { } type BotManagementUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result BotManagementUpdateResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success BotManagementUpdateResponseEnvelopeSuccess `json:"success,required"` + Result BotManagementUpdateResponse `json:"result"` JSON botManagementUpdateResponseEnvelopeJSON `json:"-"` } @@ -809,8 +809,8 @@ type BotManagementUpdateResponseEnvelope struct { type botManagementUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -844,11 +844,11 @@ type BotManagementGetParams struct { } type BotManagementGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result BotManagementGetResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success BotManagementGetResponseEnvelopeSuccess `json:"success,required"` + Result BotManagementGetResponse `json:"result"` JSON botManagementGetResponseEnvelopeJSON `json:"-"` } @@ -857,8 +857,8 @@ type BotManagementGetResponseEnvelope struct { type botManagementGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/bot_management/botmanagement_test.go b/bot_management/botmanagement_test.go index c8b5b09395f..b840013dd4c 100644 --- a/bot_management/botmanagement_test.go +++ b/bot_management/botmanagement_test.go @@ -15,7 +15,6 @@ import ( ) func TestBotManagementUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestBotManagementUpdateWithOptionalParams(t *testing.T) { } func TestBotManagementGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/brand_protection/aliases.go b/brand_protection/aliases.go index cdf7261418f..028c9bf13a4 100644 --- a/brand_protection/aliases.go +++ b/brand_protection/aliases.go @@ -4,7 +4,7 @@ package brand_protection import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/brand_protection/brandprotection.go b/brand_protection/brandprotection.go index 607899dbc7a..3feb9a89252 100644 --- a/brand_protection/brandprotection.go +++ b/brand_protection/brandprotection.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // BrandProtectionService contains methods and other services that help with @@ -325,9 +325,9 @@ func (r BrandProtectionSubmitParams) MarshalJSON() (data []byte, err error) { type BrandProtectionSubmitResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Submit `json:"result,required"` // Whether the API call was successful Success BrandProtectionSubmitResponseEnvelopeSuccess `json:"success,required"` + Result Submit `json:"result"` JSON brandProtectionSubmitResponseEnvelopeJSON `json:"-"` } @@ -336,8 +336,8 @@ type BrandProtectionSubmitResponseEnvelope struct { type brandProtectionSubmitResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -398,9 +398,9 @@ func (r BrandProtectionURLInfoParamsURLIDParam) URLQuery() (v url.Values) { type BrandProtectionURLInfoResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Info `json:"result,required"` // Whether the API call was successful Success BrandProtectionURLInfoResponseEnvelopeSuccess `json:"success,required"` + Result Info `json:"result"` JSON brandProtectionURLInfoResponseEnvelopeJSON `json:"-"` } @@ -409,8 +409,8 @@ type BrandProtectionURLInfoResponseEnvelope struct { type brandProtectionURLInfoResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/brand_protection/brandprotection_test.go b/brand_protection/brandprotection_test.go index 757be0c5613..422d0e4631b 100644 --- a/brand_protection/brandprotection_test.go +++ b/brand_protection/brandprotection_test.go @@ -15,7 +15,6 @@ import ( ) func TestBrandProtectionSubmitWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestBrandProtectionSubmitWithOptionalParams(t *testing.T) { } func TestBrandProtectionURLInfoWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/cache/aliases.go b/cache/aliases.go index 8827f486a68..1d187d244cb 100644 --- a/cache/aliases.go +++ b/cache/aliases.go @@ -4,7 +4,7 @@ package cache import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/cache/cache.go b/cache/cache.go index e2ca758e71e..e2f4a59b098 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CacheService contains methods and other services that help with interacting with diff --git a/cache/cache_test.go b/cache/cache_test.go index d452bb279fd..2de0944910c 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -15,7 +15,6 @@ import ( ) func TestCachePurgeWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/cache/cachereserve.go b/cache/cachereserve.go index 030d60b4f52..caa471998e7 100644 --- a/cache/cachereserve.go +++ b/cache/cachereserve.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CacheReserveService contains methods and other services that help with @@ -41,7 +41,7 @@ func (r *CacheReserveService) Clear(ctx context.Context, params CacheReserveClea opts = append(r.Options[:], opts...) var env CacheReserveClearResponseEnvelope path := fmt.Sprintf("zones/%s/cache/cache_reserve_clear", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -131,6 +131,22 @@ func (r CacheReserveClear) IsKnown() bool { return false } +// The current state of the Cache Reserve Clear operation. +type State string + +const ( + StateInProgress State = "In-progress" + StateCompleted State = "Completed" +) + +func (r State) IsKnown() bool { + switch r { + case StateInProgress, StateCompleted: + return true + } + return false +} + // You can use Cache Reserve Clear to clear your Cache Reserve, but you must first // disable Cache Reserve. In most cases, this will be accomplished within 24 hours. // You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind @@ -143,7 +159,7 @@ type CacheReserveClearResponse struct { // The time that the latest Cache Reserve Clear operation started. StartTs time.Time `json:"start_ts,required" format:"date-time"` // The current state of the Cache Reserve Clear operation. - State CacheReserveClearResponseState `json:"state,required"` + State State `json:"state,required"` // The time that the latest Cache Reserve Clear operation completed. EndTs time.Time `json:"end_ts" format:"date-time"` JSON cacheReserveClearResponseJSON `json:"-"` @@ -169,22 +185,6 @@ func (r cacheReserveClearResponseJSON) RawJSON() string { return r.raw } -// The current state of the Cache Reserve Clear operation. -type CacheReserveClearResponseState string - -const ( - CacheReserveClearResponseStateInProgress CacheReserveClearResponseState = "In-progress" - CacheReserveClearResponseStateCompleted CacheReserveClearResponseState = "Completed" -) - -func (r CacheReserveClearResponseState) IsKnown() bool { - switch r { - case CacheReserveClearResponseStateInProgress, CacheReserveClearResponseStateCompleted: - return true - } - return false -} - // Increase cache lifetimes by automatically storing all cacheable files into // Cloudflare's persistent object storage buckets. Requires Cache Reserve // subscription. Note: using Tiered Cache with Cache Reserve is highly recommended @@ -297,7 +297,7 @@ type CacheReserveStatusResponse struct { // The time that the latest Cache Reserve Clear operation started. StartTs time.Time `json:"start_ts,required" format:"date-time"` // The current state of the Cache Reserve Clear operation. - State CacheReserveStatusResponseState `json:"state,required"` + State State `json:"state,required"` // The time that the latest Cache Reserve Clear operation completed. EndTs time.Time `json:"end_ts" format:"date-time"` JSON cacheReserveStatusResponseJSON `json:"-"` @@ -323,22 +323,6 @@ func (r cacheReserveStatusResponseJSON) RawJSON() string { return r.raw } -// The current state of the Cache Reserve Clear operation. -type CacheReserveStatusResponseState string - -const ( - CacheReserveStatusResponseStateInProgress CacheReserveStatusResponseState = "In-progress" - CacheReserveStatusResponseStateCompleted CacheReserveStatusResponseState = "Completed" -) - -func (r CacheReserveStatusResponseState) IsKnown() bool { - switch r { - case CacheReserveStatusResponseStateInProgress, CacheReserveStatusResponseStateCompleted: - return true - } - return false -} - type CacheReserveClearParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` diff --git a/cache/cachereserve_test.go b/cache/cachereserve_test.go index af51eb1a1a0..5ba08282af6 100644 --- a/cache/cachereserve_test.go +++ b/cache/cachereserve_test.go @@ -15,7 +15,6 @@ import ( ) func TestCacheReserveClear(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestCacheReserveClear(t *testing.T) { } func TestCacheReserveEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestCacheReserveEdit(t *testing.T) { } func TestCacheReserveGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -95,7 +92,6 @@ func TestCacheReserveGet(t *testing.T) { } func TestCacheReserveStatus(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/cache/regionaltieredcache.go b/cache/regionaltieredcache.go index ac03f6bf3e2..39398270795 100644 --- a/cache/regionaltieredcache.go +++ b/cache/regionaltieredcache.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RegionalTieredCacheService contains methods and other services that help with diff --git a/cache/regionaltieredcache_test.go b/cache/regionaltieredcache_test.go index e8973cca30f..103ff446cbf 100644 --- a/cache/regionaltieredcache_test.go +++ b/cache/regionaltieredcache_test.go @@ -15,7 +15,6 @@ import ( ) func TestRegionalTieredCacheEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestRegionalTieredCacheEdit(t *testing.T) { } func TestRegionalTieredCacheGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/cache/smarttieredcache.go b/cache/smarttieredcache.go index dbbbec55ad7..374102250d6 100644 --- a/cache/smarttieredcache.go +++ b/cache/smarttieredcache.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -35,10 +35,10 @@ func NewSmartTieredCacheService(opts ...option.RequestOption) (r *SmartTieredCac } // Remvoves enablement of Smart Tiered Cache -func (r *SmartTieredCacheService) Delete(ctx context.Context, params SmartTieredCacheDeleteParams, opts ...option.RequestOption) (res *SmartTieredCacheDeleteResponseUnion, err error) { +func (r *SmartTieredCacheService) Delete(ctx context.Context, body SmartTieredCacheDeleteParams, opts ...option.RequestOption) (res *SmartTieredCacheDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env SmartTieredCacheDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/cache/tiered_cache_smart_topology_enable", params.ZoneID) + path := fmt.Sprintf("zones/%s/cache/tiered_cache_smart_topology_enable", body.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -127,11 +127,6 @@ func init() { type SmartTieredCacheDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r SmartTieredCacheDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type SmartTieredCacheDeleteResponseEnvelope struct { diff --git a/cache/smarttieredcache_test.go b/cache/smarttieredcache_test.go index 661bf82872f..dbd0fee6667 100644 --- a/cache/smarttieredcache_test.go +++ b/cache/smarttieredcache_test.go @@ -15,7 +15,6 @@ import ( ) func TestSmartTieredCacheDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -30,7 +29,6 @@ func TestSmartTieredCacheDelete(t *testing.T) { ) _, err := client.Cache.SmartTieredCache.Delete(context.TODO(), cache.SmartTieredCacheDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +40,6 @@ func TestSmartTieredCacheDelete(t *testing.T) { } func TestSmartTieredCacheEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +66,6 @@ func TestSmartTieredCacheEdit(t *testing.T) { } func TestSmartTieredCacheGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/cache/variant.go b/cache/variant.go index af095ffdbd0..8dbe5889bdf 100644 --- a/cache/variant.go +++ b/cache/variant.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // VariantService contains methods and other services that help with interacting @@ -37,10 +37,10 @@ func NewVariantService(opts ...option.RequestOption) (r *VariantService) { // 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but // does not serve the variant requested, the response will not be cached. This will // be indicated with BYPASS cache status in the response headers. -func (r *VariantService) Delete(ctx context.Context, params VariantDeleteParams, opts ...option.RequestOption) (res *CacheVariant, err error) { +func (r *VariantService) Delete(ctx context.Context, body VariantDeleteParams, opts ...option.RequestOption) (res *CacheVariant, err error) { opts = append(r.Options[:], opts...) var env VariantDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/cache/variants", params.ZoneID) + path := fmt.Sprintf("zones/%s/cache/variants", body.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -164,7 +164,7 @@ func (r variantEditResponseJSON) RawJSON() string { type VariantEditResponseValue struct { // List of strings with the MIME types of all the variants that should be served // for avif. - Avif []string `json:"avif"` + AVIF []string `json:"avif"` // List of strings with the MIME types of all the variants that should be served // for bmp. BMP []string `json:"bmp"` @@ -179,7 +179,7 @@ type VariantEditResponseValue struct { JPEG []string `json:"jpeg"` // List of strings with the MIME types of all the variants that should be served // for jpg. - Jpg []string `json:"jpg"` + JPG []string `json:"jpg"` // List of strings with the MIME types of all the variants that should be served // for jpg2. JPG2 []string `json:"jpg2"` @@ -201,12 +201,12 @@ type VariantEditResponseValue struct { // variantEditResponseValueJSON contains the JSON metadata for the struct // [VariantEditResponseValue] type variantEditResponseValueJSON struct { - Avif apijson.Field + AVIF apijson.Field BMP apijson.Field GIF apijson.Field JP2 apijson.Field JPEG apijson.Field - Jpg apijson.Field + JPG apijson.Field JPG2 apijson.Field PNG apijson.Field TIF apijson.Field @@ -261,7 +261,7 @@ func (r variantGetResponseJSON) RawJSON() string { type VariantGetResponseValue struct { // List of strings with the MIME types of all the variants that should be served // for avif. - Avif []string `json:"avif"` + AVIF []string `json:"avif"` // List of strings with the MIME types of all the variants that should be served // for bmp. BMP []string `json:"bmp"` @@ -276,7 +276,7 @@ type VariantGetResponseValue struct { JPEG []string `json:"jpeg"` // List of strings with the MIME types of all the variants that should be served // for jpg. - Jpg []string `json:"jpg"` + JPG []string `json:"jpg"` // List of strings with the MIME types of all the variants that should be served // for jpg2. JPG2 []string `json:"jpg2"` @@ -298,12 +298,12 @@ type VariantGetResponseValue struct { // variantGetResponseValueJSON contains the JSON metadata for the struct // [VariantGetResponseValue] type variantGetResponseValueJSON struct { - Avif apijson.Field + AVIF apijson.Field BMP apijson.Field GIF apijson.Field JP2 apijson.Field JPEG apijson.Field - Jpg apijson.Field + JPG apijson.Field JPG2 apijson.Field PNG apijson.Field TIF apijson.Field @@ -324,11 +324,6 @@ func (r variantGetResponseValueJSON) RawJSON() string { type VariantDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r VariantDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type VariantDeleteResponseEnvelope struct { @@ -394,7 +389,7 @@ func (r VariantEditParams) MarshalJSON() (data []byte, err error) { type VariantEditParamsValue struct { // List of strings with the MIME types of all the variants that should be served // for avif. - Avif param.Field[[]string] `json:"avif"` + AVIF param.Field[[]string] `json:"avif"` // List of strings with the MIME types of all the variants that should be served // for bmp. BMP param.Field[[]string] `json:"bmp"` @@ -409,7 +404,7 @@ type VariantEditParamsValue struct { JPEG param.Field[[]string] `json:"jpeg"` // List of strings with the MIME types of all the variants that should be served // for jpg. - Jpg param.Field[[]string] `json:"jpg"` + JPG param.Field[[]string] `json:"jpg"` // List of strings with the MIME types of all the variants that should be served // for jpg2. JPG2 param.Field[[]string] `json:"jpg2"` diff --git a/cache/variant_test.go b/cache/variant_test.go index cfa9a34ae5f..6a75ae1eac6 100644 --- a/cache/variant_test.go +++ b/cache/variant_test.go @@ -15,7 +15,6 @@ import ( ) func TestVariantDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -30,7 +29,6 @@ func TestVariantDelete(t *testing.T) { ) _, err := client.Cache.Variants.Delete(context.TODO(), cache.VariantDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +40,6 @@ func TestVariantDelete(t *testing.T) { } func TestVariantEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -58,12 +55,12 @@ func TestVariantEditWithOptionalParams(t *testing.T) { _, err := client.Cache.Variants.Edit(context.TODO(), cache.VariantEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Value: cloudflare.F(cache.VariantEditParamsValue{ - Avif: cloudflare.F([]string{"image/webp", "image/jpeg"}), + AVIF: cloudflare.F([]string{"image/webp", "image/jpeg"}), BMP: cloudflare.F([]string{"image/webp", "image/jpeg"}), GIF: cloudflare.F([]string{"image/webp", "image/jpeg"}), JP2: cloudflare.F([]string{"image/webp", "image/avif"}), JPEG: cloudflare.F([]string{"image/webp", "image/avif"}), - Jpg: cloudflare.F([]string{"image/webp", "image/avif"}), + JPG: cloudflare.F([]string{"image/webp", "image/avif"}), JPG2: cloudflare.F([]string{"image/webp", "image/avif"}), PNG: cloudflare.F([]string{"image/webp", "image/avif"}), TIF: cloudflare.F([]string{"image/webp", "image/avif"}), @@ -81,7 +78,6 @@ func TestVariantEditWithOptionalParams(t *testing.T) { } func TestVariantGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/calls/aliases.go b/calls/aliases.go index 6264bd17aae..e18ab25a76f 100644 --- a/calls/aliases.go +++ b/calls/aliases.go @@ -4,7 +4,7 @@ package calls import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/calls/call.go b/calls/call.go index 693a135c819..f231ab239a4 100644 --- a/calls/call.go +++ b/calls/call.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CallService contains methods and other services that help with interacting with @@ -66,7 +66,7 @@ func (r *CallService) List(ctx context.Context, query CallListParams, opts ...op opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/calls/apps", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/calls/call_test.go b/calls/call_test.go index 34930f089bd..c2b5a8e9e5a 100644 --- a/calls/call_test.go +++ b/calls/call_test.go @@ -15,7 +15,6 @@ import ( ) func TestCallNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestCallNewWithOptionalParams(t *testing.T) { } func TestCallUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -73,7 +71,6 @@ func TestCallUpdateWithOptionalParams(t *testing.T) { } func TestCallList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -99,7 +96,6 @@ func TestCallList(t *testing.T) { } func TestCallDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -129,7 +125,6 @@ func TestCallDelete(t *testing.T) { } func TestCallGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/certificate_authorities/aliases.go b/certificate_authorities/aliases.go index 328c01a55d3..9cdc6da8597 100644 --- a/certificate_authorities/aliases.go +++ b/certificate_authorities/aliases.go @@ -4,7 +4,7 @@ package certificate_authorities import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/certificate_authorities/hostnameassociation.go b/certificate_authorities/hostnameassociation.go index 9ac2362bd9e..508d035d321 100644 --- a/certificate_authorities/hostnameassociation.go +++ b/certificate_authorities/hostnameassociation.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // HostnameAssociationService contains methods and other services that help with @@ -129,11 +129,11 @@ func (r HostnameAssociationUpdateParams) MarshalJSON() (data []byte, err error) } type HostnameAssociationUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result HostnameAssociationUpdateResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success HostnameAssociationUpdateResponseEnvelopeSuccess `json:"success,required"` + Result HostnameAssociationUpdateResponse `json:"result"` JSON hostnameAssociationUpdateResponseEnvelopeJSON `json:"-"` } @@ -142,8 +142,8 @@ type HostnameAssociationUpdateResponseEnvelope struct { type hostnameAssociationUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -190,11 +190,11 @@ func (r HostnameAssociationGetParams) URLQuery() (v url.Values) { } type HostnameAssociationGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result HostnameAssociationGetResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success HostnameAssociationGetResponseEnvelopeSuccess `json:"success,required"` + Result HostnameAssociationGetResponse `json:"result"` JSON hostnameAssociationGetResponseEnvelopeJSON `json:"-"` } @@ -203,8 +203,8 @@ type HostnameAssociationGetResponseEnvelope struct { type hostnameAssociationGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/certificate_authorities/hostnameassociation_test.go b/certificate_authorities/hostnameassociation_test.go index fb40cc9e557..073bf735d29 100644 --- a/certificate_authorities/hostnameassociation_test.go +++ b/certificate_authorities/hostnameassociation_test.go @@ -15,7 +15,6 @@ import ( ) func TestHostnameAssociationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestHostnameAssociationUpdateWithOptionalParams(t *testing.T) { } func TestHostnameAssociationGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/challenges/aliases.go b/challenges/aliases.go index a7b3b45cf0c..e7865d17cdc 100644 --- a/challenges/aliases.go +++ b/challenges/aliases.go @@ -4,7 +4,7 @@ package challenges import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/challenges/widget.go b/challenges/widget.go index f90f2aa08d5..a69b92339e3 100644 --- a/challenges/widget.go +++ b/challenges/widget.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // WidgetService contains methods and other services that help with interacting diff --git a/challenges/widget_test.go b/challenges/widget_test.go index 489014e7763..d9756330ddb 100644 --- a/challenges/widget_test.go +++ b/challenges/widget_test.go @@ -15,7 +15,6 @@ import ( ) func TestWidgetNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -52,7 +51,6 @@ func TestWidgetNewWithOptionalParams(t *testing.T) { } func TestWidgetUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -88,7 +86,6 @@ func TestWidgetUpdateWithOptionalParams(t *testing.T) { } func TestWidgetListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -118,7 +115,6 @@ func TestWidgetListWithOptionalParams(t *testing.T) { } func TestWidgetDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -148,7 +144,6 @@ func TestWidgetDelete(t *testing.T) { } func TestWidgetGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -178,7 +173,6 @@ func TestWidgetGet(t *testing.T) { } func TestWidgetRotateSecretWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/client.go b/client.go index 64360fdedad..7688d133436 100644 --- a/client.go +++ b/client.go @@ -10,6 +10,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/accounts" "github.com/cloudflare/cloudflare-go/v2/acm" "github.com/cloudflare/cloudflare-go/v2/addressing" + "github.com/cloudflare/cloudflare-go/v2/ai_gateway" "github.com/cloudflare/cloudflare-go/v2/alerting" "github.com/cloudflare/cloudflare-go/v2/argo" "github.com/cloudflare/cloudflare-go/v2/audit_logs" @@ -178,6 +179,7 @@ type Client struct { Calls *calls.CallService CloudforceOne *cloudforce_one.CloudforceOneService EventNotifications *event_notifications.EventNotificationService + AIGateway *ai_gateway.AIGatewayService } // NewClient generates a new client with the default option read from the @@ -284,6 +286,7 @@ func NewClient(opts ...option.RequestOption) (r *Client) { r.Calls = calls.NewCallService(opts...) r.CloudforceOne = cloudforce_one.NewCloudforceOneService(opts...) r.EventNotifications = event_notifications.NewEventNotificationService(opts...) + r.AIGateway = ai_gateway.NewAIGatewayService(opts...) return } diff --git a/client_certificates/aliases.go b/client_certificates/aliases.go index 43adaaea18c..c4ef11c0775 100644 --- a/client_certificates/aliases.go +++ b/client_certificates/aliases.go @@ -4,7 +4,7 @@ package client_certificates import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/client_certificates/clientcertificate.go b/client_certificates/clientcertificate.go index f606f442ab8..5069f10323f 100644 --- a/client_certificates/clientcertificate.go +++ b/client_certificates/clientcertificate.go @@ -8,13 +8,14 @@ import ( "net/http" "net/url" + "github.com/cloudflare/cloudflare-go/v2/custom_certificates" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ClientCertificateService contains methods and other services that help with @@ -149,7 +150,7 @@ type ClientCertificate struct { State string `json:"state"` // Client Certificates may be active or revoked, and the pending_reactivation or // pending_revocation represent in-progress asynchronous transitions - Status ClientCertificateStatus `json:"status"` + Status custom_certificates.Status `json:"status"` // The number of days the Client Certificate will be valid after the issued_on date ValidityDays int64 `json:"validity_days"` JSON clientCertificateJSON `json:"-"` @@ -212,25 +213,6 @@ func (r clientCertificateCertificateAuthorityJSON) RawJSON() string { return r.raw } -// Client Certificates may be active or revoked, and the pending_reactivation or -// pending_revocation represent in-progress asynchronous transitions -type ClientCertificateStatus string - -const ( - ClientCertificateStatusActive ClientCertificateStatus = "active" - ClientCertificateStatusPendingReactivation ClientCertificateStatus = "pending_reactivation" - ClientCertificateStatusPendingRevocation ClientCertificateStatus = "pending_revocation" - ClientCertificateStatusRevoked ClientCertificateStatus = "revoked" -) - -func (r ClientCertificateStatus) IsKnown() bool { - switch r { - case ClientCertificateStatusActive, ClientCertificateStatusPendingReactivation, ClientCertificateStatusPendingRevocation, ClientCertificateStatusRevoked: - return true - } - return false -} - type ClientCertificateNewParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -247,9 +229,9 @@ func (r ClientCertificateNewParams) MarshalJSON() (data []byte, err error) { type ClientCertificateNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result ClientCertificate `json:"result,required"` // Whether the API call was successful Success ClientCertificateNewResponseEnvelopeSuccess `json:"success,required"` + Result ClientCertificate `json:"result"` JSON clientCertificateNewResponseEnvelopeJSON `json:"-"` } @@ -258,8 +240,8 @@ type ClientCertificateNewResponseEnvelope struct { type clientCertificateNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -338,9 +320,9 @@ type ClientCertificateDeleteParams struct { type ClientCertificateDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result ClientCertificate `json:"result,required"` // Whether the API call was successful Success ClientCertificateDeleteResponseEnvelopeSuccess `json:"success,required"` + Result ClientCertificate `json:"result"` JSON clientCertificateDeleteResponseEnvelopeJSON `json:"-"` } @@ -349,8 +331,8 @@ type ClientCertificateDeleteResponseEnvelope struct { type clientCertificateDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -386,9 +368,9 @@ type ClientCertificateEditParams struct { type ClientCertificateEditResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result ClientCertificate `json:"result,required"` // Whether the API call was successful Success ClientCertificateEditResponseEnvelopeSuccess `json:"success,required"` + Result ClientCertificate `json:"result"` JSON clientCertificateEditResponseEnvelopeJSON `json:"-"` } @@ -397,8 +379,8 @@ type ClientCertificateEditResponseEnvelope struct { type clientCertificateEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -434,9 +416,9 @@ type ClientCertificateGetParams struct { type ClientCertificateGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result ClientCertificate `json:"result,required"` // Whether the API call was successful Success ClientCertificateGetResponseEnvelopeSuccess `json:"success,required"` + Result ClientCertificate `json:"result"` JSON clientCertificateGetResponseEnvelopeJSON `json:"-"` } @@ -445,8 +427,8 @@ type ClientCertificateGetResponseEnvelope struct { type clientCertificateGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/client_certificates/clientcertificate_test.go b/client_certificates/clientcertificate_test.go index 47d6119b603..81fc7287f67 100644 --- a/client_certificates/clientcertificate_test.go +++ b/client_certificates/clientcertificate_test.go @@ -15,7 +15,6 @@ import ( ) func TestClientCertificateNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestClientCertificateNew(t *testing.T) { } func TestClientCertificateListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -74,7 +72,6 @@ func TestClientCertificateListWithOptionalParams(t *testing.T) { } func TestClientCertificateDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -104,7 +101,6 @@ func TestClientCertificateDelete(t *testing.T) { } func TestClientCertificateEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -134,7 +130,6 @@ func TestClientCertificateEdit(t *testing.T) { } func TestClientCertificateGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/client_test.go b/client_test.go index d190cfc9251..cf75e23d244 100644 --- a/client_test.go +++ b/client_test.go @@ -42,7 +42,7 @@ func TestUserAgentHeader(t *testing.T) { ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }), Name: cloudflare.F("example.com"), - Type: cloudflare.F(zones.ZoneNewParamsTypeFull), + Type: cloudflare.F(zones.TypeFull), }) if userAgent != fmt.Sprintf("Cloudflare/Go %s", internal.PackageVersion) { t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent) @@ -71,7 +71,7 @@ func TestRetryAfter(t *testing.T) { ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }), Name: cloudflare.F("example.com"), - Type: cloudflare.F(zones.ZoneNewParamsTypeFull), + Type: cloudflare.F(zones.TypeFull), }) if err == nil || res != nil { t.Error("Expected there to be a cancel error and for the response to be nil") @@ -103,7 +103,7 @@ func TestRetryAfterMs(t *testing.T) { ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }), Name: cloudflare.F("example.com"), - Type: cloudflare.F(zones.ZoneNewParamsTypeFull), + Type: cloudflare.F(zones.TypeFull), }) if err == nil || res != nil { t.Error("Expected there to be a cancel error and for the response to be nil") @@ -131,7 +131,7 @@ func TestContextCancel(t *testing.T) { ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }), Name: cloudflare.F("example.com"), - Type: cloudflare.F(zones.ZoneNewParamsTypeFull), + Type: cloudflare.F(zones.TypeFull), }) if err == nil || res != nil { t.Error("Expected there to be a cancel error and for the response to be nil") @@ -156,7 +156,7 @@ func TestContextCancelDelay(t *testing.T) { ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }), Name: cloudflare.F("example.com"), - Type: cloudflare.F(zones.ZoneNewParamsTypeFull), + Type: cloudflare.F(zones.TypeFull), }) if err == nil || res != nil { t.Error("expected there to be a cancel error and for the response to be nil") @@ -187,7 +187,7 @@ func TestContextDeadline(t *testing.T) { ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }), Name: cloudflare.F("example.com"), - Type: cloudflare.F(zones.ZoneNewParamsTypeFull), + Type: cloudflare.F(zones.TypeFull), }) if err == nil || res != nil { t.Error("expected there to be a deadline error and for the response to be nil") diff --git a/cloudforce_one/aliases.go b/cloudforce_one/aliases.go index 49542c81985..9de195f4325 100644 --- a/cloudforce_one/aliases.go +++ b/cloudforce_one/aliases.go @@ -4,7 +4,7 @@ package cloudforce_one import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/cloudforce_one/request.go b/cloudforce_one/request.go index 34545b10e2e..a5865d5f351 100644 --- a/cloudforce_one/request.go +++ b/cloudforce_one/request.go @@ -6,16 +6,14 @@ import ( "context" "fmt" "net/http" - "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/tidwall/gjson" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RequestService contains methods and other services that help with interacting @@ -93,15 +91,10 @@ func (r *RequestService) ListAutoPaging(ctx context.Context, accountIdentifier s } // Delete a Request -func (r *RequestService) Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, opts ...option.RequestOption) (res *RequestDeleteResponseUnion, err error) { +func (r *RequestService) Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, opts ...option.RequestOption) (res *RequestDeleteResponse, err error) { opts = append(r.Options[:], opts...) - var env RequestDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/cloudforce-one/requests/%s", accountIdentifier, requestIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -469,30 +462,46 @@ func (r RequestConstantsTlp) IsKnown() bool { type RequestTypes []string -// Union satisfied by [cloudforce_one.RequestDeleteResponseUnknown], -// [cloudforce_one.RequestDeleteResponseArray] or [shared.UnionString]. -type RequestDeleteResponseUnion interface { - ImplementsCloudforceOneRequestDeleteResponseUnion() +type RequestDeleteResponse struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // Whether the API call was successful + Success RequestDeleteResponseSuccess `json:"success,required"` + JSON requestDeleteResponseJSON `json:"-"` +} + +// requestDeleteResponseJSON contains the JSON metadata for the struct +// [RequestDeleteResponse] +type requestDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RequestDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RequestDeleteResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RequestDeleteResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) +func (r requestDeleteResponseJSON) RawJSON() string { + return r.raw } -type RequestDeleteResponseArray []interface{} +// Whether the API call was successful +type RequestDeleteResponseSuccess bool -func (r RequestDeleteResponseArray) ImplementsCloudforceOneRequestDeleteResponseUnion() {} +const ( + RequestDeleteResponseSuccessTrue RequestDeleteResponseSuccess = true +) + +func (r RequestDeleteResponseSuccess) IsKnown() bool { + switch r { + case RequestDeleteResponseSuccessTrue: + return true + } + return false +} type RequestNewParams struct { // Request content @@ -533,9 +542,9 @@ func (r RequestNewParamsTlp) IsKnown() bool { type RequestNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Item `json:"result,required"` // Whether the API call was successful Success RequestNewResponseEnvelopeSuccess `json:"success,required"` + Result Item `json:"result"` JSON requestNewResponseEnvelopeJSON `json:"-"` } @@ -544,8 +553,8 @@ type RequestNewResponseEnvelope struct { type requestNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -612,9 +621,9 @@ func (r RequestUpdateParamsTlp) IsKnown() bool { type RequestUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Item `json:"result,required"` // Whether the API call was successful Success RequestUpdateResponseEnvelopeSuccess `json:"success,required"` + Result Item `json:"result"` JSON requestUpdateResponseEnvelopeJSON `json:"-"` } @@ -623,8 +632,8 @@ type RequestUpdateResponseEnvelope struct { type requestUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -715,55 +724,12 @@ func (r RequestListParamsStatus) IsKnown() bool { return false } -type RequestDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result RequestDeleteResponseUnion `json:"result,required"` - // Whether the API call was successful - Success RequestDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON requestDeleteResponseEnvelopeJSON `json:"-"` -} - -// requestDeleteResponseEnvelopeJSON contains the JSON metadata for the struct -// [RequestDeleteResponseEnvelope] -type requestDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RequestDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r requestDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type RequestDeleteResponseEnvelopeSuccess bool - -const ( - RequestDeleteResponseEnvelopeSuccessTrue RequestDeleteResponseEnvelopeSuccess = true -) - -func (r RequestDeleteResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case RequestDeleteResponseEnvelopeSuccessTrue: - return true - } - return false -} - type RequestConstantsResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result RequestConstants `json:"result,required"` // Whether the API call was successful Success RequestConstantsResponseEnvelopeSuccess `json:"success,required"` + Result RequestConstants `json:"result"` JSON requestConstantsResponseEnvelopeJSON `json:"-"` } @@ -772,8 +738,8 @@ type RequestConstantsResponseEnvelope struct { type requestConstantsResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -804,9 +770,9 @@ func (r RequestConstantsResponseEnvelopeSuccess) IsKnown() bool { type RequestGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Item `json:"result,required"` // Whether the API call was successful Success RequestGetResponseEnvelopeSuccess `json:"success,required"` + Result Item `json:"result"` JSON requestGetResponseEnvelopeJSON `json:"-"` } @@ -815,8 +781,8 @@ type RequestGetResponseEnvelope struct { type requestGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -847,9 +813,9 @@ func (r RequestGetResponseEnvelopeSuccess) IsKnown() bool { type RequestQuotaResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Quota `json:"result,required"` // Whether the API call was successful Success RequestQuotaResponseEnvelopeSuccess `json:"success,required"` + Result Quota `json:"result"` JSON requestQuotaResponseEnvelopeJSON `json:"-"` } @@ -858,8 +824,8 @@ type RequestQuotaResponseEnvelope struct { type requestQuotaResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -890,9 +856,9 @@ func (r RequestQuotaResponseEnvelopeSuccess) IsKnown() bool { type RequestTypesResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result RequestTypes `json:"result,required"` // Whether the API call was successful Success RequestTypesResponseEnvelopeSuccess `json:"success,required"` + Result RequestTypes `json:"result"` JSON requestTypesResponseEnvelopeJSON `json:"-"` } @@ -901,8 +867,8 @@ type RequestTypesResponseEnvelope struct { type requestTypesResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/cloudforce_one/request_test.go b/cloudforce_one/request_test.go index 356bca2ef57..a1204865a68 100644 --- a/cloudforce_one/request_test.go +++ b/cloudforce_one/request_test.go @@ -16,7 +16,6 @@ import ( ) func TestRequestNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestRequestNewWithOptionalParams(t *testing.T) { } func TestRequestUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -85,7 +83,6 @@ func TestRequestUpdateWithOptionalParams(t *testing.T) { } func TestRequestListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -124,7 +121,6 @@ func TestRequestListWithOptionalParams(t *testing.T) { } func TestRequestDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -152,7 +148,6 @@ func TestRequestDelete(t *testing.T) { } func TestRequestConstants(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -176,7 +171,6 @@ func TestRequestConstants(t *testing.T) { } func TestRequestGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -204,7 +198,6 @@ func TestRequestGet(t *testing.T) { } func TestRequestQuota(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -228,7 +221,6 @@ func TestRequestQuota(t *testing.T) { } func TestRequestTypes(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/cloudforce_one/requestmessage.go b/cloudforce_one/requestmessage.go index 1d1fd458289..f3949be2ee4 100644 --- a/cloudforce_one/requestmessage.go +++ b/cloudforce_one/requestmessage.go @@ -6,15 +6,13 @@ import ( "context" "fmt" "net/http" - "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/tidwall/gjson" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RequestMessageService contains methods and other services that help with @@ -64,15 +62,10 @@ func (r *RequestMessageService) Update(ctx context.Context, accountIdentifier st } // Delete a Request Message -func (r *RequestMessageService) Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, messageIdentifer int64, opts ...option.RequestOption) (res *RequestMessageDeleteResponseUnion, err error) { +func (r *RequestMessageService) Delete(ctx context.Context, accountIdentifier string, requestIdentifier string, messageIdentifer int64, opts ...option.RequestOption) (res *RequestMessageDeleteResponse, err error) { opts = append(r.Options[:], opts...) - var env RequestMessageDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/cloudforce-one/requests/%s/message/%v", accountIdentifier, requestIdentifier, messageIdentifer) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -125,30 +118,45 @@ func (r messageJSON) RawJSON() string { return r.raw } -// Union satisfied by [cloudforce_one.RequestMessageDeleteResponseUnknown], -// [cloudforce_one.RequestMessageDeleteResponseArray] or [shared.UnionString]. -type RequestMessageDeleteResponseUnion interface { - ImplementsCloudforceOneRequestMessageDeleteResponseUnion() +type RequestMessageDeleteResponse struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // Whether the API call was successful + Success RequestMessageDeleteResponseSuccess `json:"success,required"` + JSON requestMessageDeleteResponseJSON `json:"-"` +} + +// requestMessageDeleteResponseJSON contains the JSON metadata for the struct +// [RequestMessageDeleteResponse] +type requestMessageDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *RequestMessageDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RequestMessageDeleteResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RequestMessageDeleteResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) +func (r requestMessageDeleteResponseJSON) RawJSON() string { + return r.raw } -type RequestMessageDeleteResponseArray []interface{} +// Whether the API call was successful +type RequestMessageDeleteResponseSuccess bool + +const ( + RequestMessageDeleteResponseSuccessTrue RequestMessageDeleteResponseSuccess = true +) -func (r RequestMessageDeleteResponseArray) ImplementsCloudforceOneRequestMessageDeleteResponseUnion() { +func (r RequestMessageDeleteResponseSuccess) IsKnown() bool { + switch r { + case RequestMessageDeleteResponseSuccessTrue: + return true + } + return false } type RequestMessageNewParams struct { @@ -163,9 +171,9 @@ func (r RequestMessageNewParams) MarshalJSON() (data []byte, err error) { type RequestMessageNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Message `json:"result,required"` // Whether the API call was successful Success RequestMessageNewResponseEnvelopeSuccess `json:"success,required"` + Result Message `json:"result"` JSON requestMessageNewResponseEnvelopeJSON `json:"-"` } @@ -174,8 +182,8 @@ type RequestMessageNewResponseEnvelope struct { type requestMessageNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -242,9 +250,9 @@ func (r RequestMessageUpdateParamsTlp) IsKnown() bool { type RequestMessageUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Message `json:"result,required"` // Whether the API call was successful Success RequestMessageUpdateResponseEnvelopeSuccess `json:"success,required"` + Result Message `json:"result"` JSON requestMessageUpdateResponseEnvelopeJSON `json:"-"` } @@ -253,8 +261,8 @@ type RequestMessageUpdateResponseEnvelope struct { type requestMessageUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -282,49 +290,6 @@ func (r RequestMessageUpdateResponseEnvelopeSuccess) IsKnown() bool { return false } -type RequestMessageDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result RequestMessageDeleteResponseUnion `json:"result,required"` - // Whether the API call was successful - Success RequestMessageDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON requestMessageDeleteResponseEnvelopeJSON `json:"-"` -} - -// requestMessageDeleteResponseEnvelopeJSON contains the JSON metadata for the -// struct [RequestMessageDeleteResponseEnvelope] -type requestMessageDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RequestMessageDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r requestMessageDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type RequestMessageDeleteResponseEnvelopeSuccess bool - -const ( - RequestMessageDeleteResponseEnvelopeSuccessTrue RequestMessageDeleteResponseEnvelopeSuccess = true -) - -func (r RequestMessageDeleteResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case RequestMessageDeleteResponseEnvelopeSuccessTrue: - return true - } - return false -} - type RequestMessageGetParams struct { // Page number of results Page param.Field[int64] `json:"page,required"` @@ -363,9 +328,9 @@ func (r RequestMessageGetParamsSortOrder) IsKnown() bool { type RequestMessageGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result []Message `json:"result,required"` // Whether the API call was successful Success RequestMessageGetResponseEnvelopeSuccess `json:"success,required"` + Result []Message `json:"result"` JSON requestMessageGetResponseEnvelopeJSON `json:"-"` } @@ -374,8 +339,8 @@ type RequestMessageGetResponseEnvelope struct { type requestMessageGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/cloudforce_one/requestmessage_test.go b/cloudforce_one/requestmessage_test.go index 1204633b33c..4cf854f8dc3 100644 --- a/cloudforce_one/requestmessage_test.go +++ b/cloudforce_one/requestmessage_test.go @@ -16,7 +16,6 @@ import ( ) func TestRequestMessageNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestRequestMessageNewWithOptionalParams(t *testing.T) { } func TestRequestMessageUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -83,7 +81,6 @@ func TestRequestMessageUpdateWithOptionalParams(t *testing.T) { } func TestRequestMessageDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -112,7 +109,6 @@ func TestRequestMessageDelete(t *testing.T) { } func TestRequestMessageGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/cloudforce_one/requestpriority.go b/cloudforce_one/requestpriority.go index c11633c7654..eef29460bf0 100644 --- a/cloudforce_one/requestpriority.go +++ b/cloudforce_one/requestpriority.go @@ -6,15 +6,13 @@ import ( "context" "fmt" "net/http" - "reflect" "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/tidwall/gjson" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RequestPriorityService contains methods and other services that help with @@ -62,15 +60,10 @@ func (r *RequestPriorityService) Update(ctx context.Context, accountIdentifier s } // Delete a Priority Intelligence Report -func (r *RequestPriorityService) Delete(ctx context.Context, accountIdentifier string, priorityIdentifer string, opts ...option.RequestOption) (res *RequestPriorityDeleteResponseUnion, err error) { +func (r *RequestPriorityService) Delete(ctx context.Context, accountIdentifier string, priorityIdentifer string, opts ...option.RequestOption) (res *RequestPriorityDeleteResponse, err error) { opts = append(r.Options[:], opts...) - var env RequestPriorityDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/cloudforce-one/requests/priority/%s", accountIdentifier, priorityIdentifer) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -196,30 +189,45 @@ func (r PriorityEditTlp) IsKnown() bool { return false } -// Union satisfied by [cloudforce_one.RequestPriorityDeleteResponseUnknown], -// [cloudforce_one.RequestPriorityDeleteResponseArray] or [shared.UnionString]. -type RequestPriorityDeleteResponseUnion interface { - ImplementsCloudforceOneRequestPriorityDeleteResponseUnion() +type RequestPriorityDeleteResponse struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // Whether the API call was successful + Success RequestPriorityDeleteResponseSuccess `json:"success,required"` + JSON requestPriorityDeleteResponseJSON `json:"-"` } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*RequestPriorityDeleteResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(RequestPriorityDeleteResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) +// requestPriorityDeleteResponseJSON contains the JSON metadata for the struct +// [RequestPriorityDeleteResponse] +type requestPriorityDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } -type RequestPriorityDeleteResponseArray []interface{} +func (r *RequestPriorityDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} -func (r RequestPriorityDeleteResponseArray) ImplementsCloudforceOneRequestPriorityDeleteResponseUnion() { +func (r requestPriorityDeleteResponseJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type RequestPriorityDeleteResponseSuccess bool + +const ( + RequestPriorityDeleteResponseSuccessTrue RequestPriorityDeleteResponseSuccess = true +) + +func (r RequestPriorityDeleteResponseSuccess) IsKnown() bool { + switch r { + case RequestPriorityDeleteResponseSuccessTrue: + return true + } + return false } type RequestPriorityNewParams struct { @@ -233,9 +241,9 @@ func (r RequestPriorityNewParams) MarshalJSON() (data []byte, err error) { type RequestPriorityNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Priority `json:"result,required"` // Whether the API call was successful Success RequestPriorityNewResponseEnvelopeSuccess `json:"success,required"` + Result Priority `json:"result"` JSON requestPriorityNewResponseEnvelopeJSON `json:"-"` } @@ -244,8 +252,8 @@ type RequestPriorityNewResponseEnvelope struct { type requestPriorityNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -284,9 +292,9 @@ func (r RequestPriorityUpdateParams) MarshalJSON() (data []byte, err error) { type RequestPriorityUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Item `json:"result,required"` // Whether the API call was successful Success RequestPriorityUpdateResponseEnvelopeSuccess `json:"success,required"` + Result Item `json:"result"` JSON requestPriorityUpdateResponseEnvelopeJSON `json:"-"` } @@ -295,8 +303,8 @@ type RequestPriorityUpdateResponseEnvelope struct { type requestPriorityUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -324,55 +332,12 @@ func (r RequestPriorityUpdateResponseEnvelopeSuccess) IsKnown() bool { return false } -type RequestPriorityDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result RequestPriorityDeleteResponseUnion `json:"result,required"` - // Whether the API call was successful - Success RequestPriorityDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON requestPriorityDeleteResponseEnvelopeJSON `json:"-"` -} - -// requestPriorityDeleteResponseEnvelopeJSON contains the JSON metadata for the -// struct [RequestPriorityDeleteResponseEnvelope] -type requestPriorityDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *RequestPriorityDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r requestPriorityDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type RequestPriorityDeleteResponseEnvelopeSuccess bool - -const ( - RequestPriorityDeleteResponseEnvelopeSuccessTrue RequestPriorityDeleteResponseEnvelopeSuccess = true -) - -func (r RequestPriorityDeleteResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case RequestPriorityDeleteResponseEnvelopeSuccessTrue: - return true - } - return false -} - type RequestPriorityGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Item `json:"result,required"` // Whether the API call was successful Success RequestPriorityGetResponseEnvelopeSuccess `json:"success,required"` + Result Item `json:"result"` JSON requestPriorityGetResponseEnvelopeJSON `json:"-"` } @@ -381,8 +346,8 @@ type RequestPriorityGetResponseEnvelope struct { type requestPriorityGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -413,9 +378,9 @@ func (r RequestPriorityGetResponseEnvelopeSuccess) IsKnown() bool { type RequestPriorityQuotaResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Quota `json:"result,required"` // Whether the API call was successful Success RequestPriorityQuotaResponseEnvelopeSuccess `json:"success,required"` + Result Quota `json:"result"` JSON requestPriorityQuotaResponseEnvelopeJSON `json:"-"` } @@ -424,8 +389,8 @@ type RequestPriorityQuotaResponseEnvelope struct { type requestPriorityQuotaResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/cloudforce_one/requestpriority_test.go b/cloudforce_one/requestpriority_test.go index 4888c2d1deb..7e8cbe9551e 100644 --- a/cloudforce_one/requestpriority_test.go +++ b/cloudforce_one/requestpriority_test.go @@ -15,7 +15,6 @@ import ( ) func TestRequestPriorityNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestRequestPriorityNew(t *testing.T) { } func TestRequestPriorityUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -86,7 +84,6 @@ func TestRequestPriorityUpdate(t *testing.T) { } func TestRequestPriorityDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -114,7 +111,6 @@ func TestRequestPriorityDelete(t *testing.T) { } func TestRequestPriorityGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -142,7 +138,6 @@ func TestRequestPriorityGet(t *testing.T) { } func TestRequestPriorityQuota(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/custom_certificates/aliases.go b/custom_certificates/aliases.go index 08bf4fd221d..d836857b4cf 100644 --- a/custom_certificates/aliases.go +++ b/custom_certificates/aliases.go @@ -4,7 +4,7 @@ package custom_certificates import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/custom_certificates/customcertificate.go b/custom_certificates/customcertificate.go index 5f1cd33ce6b..6b04f11e558 100644 --- a/custom_certificates/customcertificate.go +++ b/custom_certificates/customcertificate.go @@ -16,9 +16,9 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/keyless_certificates" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -83,10 +83,10 @@ func (r *CustomCertificateService) ListAutoPaging(ctx context.Context, params Cu } // Remove a SSL certificate from a zone. -func (r *CustomCertificateService) Delete(ctx context.Context, customCertificateID string, params CustomCertificateDeleteParams, opts ...option.RequestOption) (res *CustomCertificateDeleteResponse, err error) { +func (r *CustomCertificateService) Delete(ctx context.Context, customCertificateID string, body CustomCertificateDeleteParams, opts ...option.RequestOption) (res *CustomCertificateDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env CustomCertificateDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/custom_certificates/%s", params.ZoneID, customCertificateID) + path := fmt.Sprintf("zones/%s/custom_certificates/%s", body.ZoneID, customCertificateID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -279,6 +279,25 @@ func (r GeoRestrictionsParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Client Certificates may be active or revoked, and the pending_reactivation or +// pending_revocation represent in-progress asynchronous transitions +type Status string + +const ( + StatusActive Status = "active" + StatusPendingReactivation Status = "pending_reactivation" + StatusPendingRevocation Status = "pending_revocation" + StatusRevoked Status = "revoked" +) + +func (r Status) IsKnown() bool { + switch r { + case StatusActive, StatusPendingReactivation, StatusPendingRevocation, StatusRevoked: + return true + } + return false +} + // Union satisfied by [custom_certificates.CustomCertificateNewResponseUnknown] or // [shared.UnionString]. type CustomCertificateNewResponseUnion interface { @@ -397,23 +416,23 @@ type CustomCertificateNewParamsType string const ( CustomCertificateNewParamsTypeLegacyCustom CustomCertificateNewParamsType = "legacy_custom" - CustomCertificateNewParamsTypeSniCustom CustomCertificateNewParamsType = "sni_custom" + CustomCertificateNewParamsTypeSNICustom CustomCertificateNewParamsType = "sni_custom" ) func (r CustomCertificateNewParamsType) IsKnown() bool { switch r { - case CustomCertificateNewParamsTypeLegacyCustom, CustomCertificateNewParamsTypeSniCustom: + case CustomCertificateNewParamsTypeLegacyCustom, CustomCertificateNewParamsTypeSNICustom: return true } return false } type CustomCertificateNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomCertificateNewResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CustomCertificateNewResponseEnvelopeSuccess `json:"success,required"` + Result CustomCertificateNewResponseUnion `json:"result"` JSON customCertificateNewResponseEnvelopeJSON `json:"-"` } @@ -422,8 +441,8 @@ type CustomCertificateNewResponseEnvelope struct { type customCertificateNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -511,19 +530,14 @@ func (r CustomCertificateListParamsStatus) IsKnown() bool { type CustomCertificateDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r CustomCertificateDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type CustomCertificateDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomCertificateDeleteResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CustomCertificateDeleteResponseEnvelopeSuccess `json:"success,required"` + Result CustomCertificateDeleteResponse `json:"result"` JSON customCertificateDeleteResponseEnvelopeJSON `json:"-"` } @@ -532,8 +546,8 @@ type CustomCertificateDeleteResponseEnvelope struct { type customCertificateDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -598,11 +612,11 @@ func (r CustomCertificateEditParams) MarshalJSON() (data []byte, err error) { } type CustomCertificateEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomCertificateEditResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CustomCertificateEditResponseEnvelopeSuccess `json:"success,required"` + Result CustomCertificateEditResponseUnion `json:"result"` JSON customCertificateEditResponseEnvelopeJSON `json:"-"` } @@ -611,8 +625,8 @@ type CustomCertificateEditResponseEnvelope struct { type customCertificateEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -646,11 +660,11 @@ type CustomCertificateGetParams struct { } type CustomCertificateGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomCertificateGetResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CustomCertificateGetResponseEnvelopeSuccess `json:"success,required"` + Result CustomCertificateGetResponseUnion `json:"result"` JSON customCertificateGetResponseEnvelopeJSON `json:"-"` } @@ -659,8 +673,8 @@ type CustomCertificateGetResponseEnvelope struct { type customCertificateGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/custom_certificates/customcertificate_test.go b/custom_certificates/customcertificate_test.go index ba46385c715..1f4a58aa30e 100644 --- a/custom_certificates/customcertificate_test.go +++ b/custom_certificates/customcertificate_test.go @@ -16,7 +16,6 @@ import ( ) func TestCustomCertificateNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -38,7 +37,7 @@ func TestCustomCertificateNewWithOptionalParams(t *testing.T) { Label: cloudflare.F(custom_certificates.GeoRestrictionsLabelUs), }), Policy: cloudflare.F("(country: US) or (region: EU)"), - Type: cloudflare.F(custom_certificates.CustomCertificateNewParamsTypeSniCustom), + Type: cloudflare.F(custom_certificates.CustomCertificateNewParamsTypeSNICustom), }) if err != nil { var apierr *cloudflare.Error @@ -50,7 +49,6 @@ func TestCustomCertificateNewWithOptionalParams(t *testing.T) { } func TestCustomCertificateListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -80,7 +78,6 @@ func TestCustomCertificateListWithOptionalParams(t *testing.T) { } func TestCustomCertificateDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -98,7 +95,6 @@ func TestCustomCertificateDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", custom_certificates.CustomCertificateDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -111,7 +107,6 @@ func TestCustomCertificateDelete(t *testing.T) { } func TestCustomCertificateEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -148,7 +143,6 @@ func TestCustomCertificateEditWithOptionalParams(t *testing.T) { } func TestCustomCertificateGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/custom_certificates/prioritize.go b/custom_certificates/prioritize.go index e482e723871..7c18727fc37 100644 --- a/custom_certificates/prioritize.go +++ b/custom_certificates/prioritize.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PrioritizeService contains methods and other services that help with interacting @@ -72,9 +72,9 @@ func (r PrioritizeUpdateParamsCertificate) MarshalJSON() (data []byte, err error type PrioritizeUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result []CustomCertificate `json:"result,required,nullable"` // Whether the API call was successful Success PrioritizeUpdateResponseEnvelopeSuccess `json:"success,required"` + Result []CustomCertificate `json:"result,nullable"` ResultInfo PrioritizeUpdateResponseEnvelopeResultInfo `json:"result_info"` JSON prioritizeUpdateResponseEnvelopeJSON `json:"-"` } @@ -84,8 +84,8 @@ type PrioritizeUpdateResponseEnvelope struct { type prioritizeUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field ResultInfo apijson.Field raw string ExtraFields map[string]apijson.Field diff --git a/custom_certificates/prioritize_test.go b/custom_certificates/prioritize_test.go index c953a49eb84..1064f392ac0 100644 --- a/custom_certificates/prioritize_test.go +++ b/custom_certificates/prioritize_test.go @@ -15,7 +15,6 @@ import ( ) func TestPrioritizeUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/custom_hostnames/aliases.go b/custom_hostnames/aliases.go index dde8525828d..66355fbf023 100644 --- a/custom_hostnames/aliases.go +++ b/custom_hostnames/aliases.go @@ -4,7 +4,7 @@ package custom_hostnames import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/custom_hostnames/customhostname.go b/custom_hostnames/customhostname.go index c06346dcc45..34bb210d720 100644 --- a/custom_hostnames/customhostname.go +++ b/custom_hostnames/customhostname.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CustomHostnameService contains methods and other services that help with @@ -81,9 +81,9 @@ func (r *CustomHostnameService) ListAutoPaging(ctx context.Context, params Custo } // Delete Custom Hostname (and any issued SSL certificates) -func (r *CustomHostnameService) Delete(ctx context.Context, customHostnameID string, params CustomHostnameDeleteParams, opts ...option.RequestOption) (res *CustomHostnameDeleteResponse, err error) { +func (r *CustomHostnameService) Delete(ctx context.Context, customHostnameID string, body CustomHostnameDeleteParams, opts ...option.RequestOption) (res *CustomHostnameDeleteResponse, err error) { opts = append(r.Options[:], opts...) - path := fmt.Sprintf("zones/%s/custom_hostnames/%s", params.ZoneID, customHostnameID) + path := fmt.Sprintf("zones/%s/custom_hostnames/%s", body.ZoneID, customHostnameID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -189,7 +189,7 @@ type CustomHostnameNewResponse struct { // name or the string ':request_host_header:' which will cause the host header in // the request to be used as SNI. Not configurable with default/fallback origin // server. - CustomOriginSni string `json:"custom_origin_sni"` + CustomOriginSNI string `json:"custom_origin_sni"` // This is a record which can be placed to activate a hostname. OwnershipVerification CustomHostnameNewResponseOwnershipVerification `json:"ownership_verification"` // This presents the token to be served by the given http url to activate a @@ -211,7 +211,7 @@ type customHostnameNewResponseJSON struct { CreatedAt apijson.Field CustomMetadata apijson.Field CustomOriginServer apijson.Field - CustomOriginSni apijson.Field + CustomOriginSNI apijson.Field OwnershipVerification apijson.Field OwnershipVerificationHTTP apijson.Field Status apijson.Field @@ -238,7 +238,7 @@ type CustomHostnameNewResponseSSL struct { // chain, but does not otherwise modify it. BundleMethod BundleMethod `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority CustomHostnameNewResponseSSLCertificateAuthority `json:"certificate_authority"` + CertificateAuthority shared.CertificateCA `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate string `json:"custom_certificate"` // The identifier for the Custom CSR that was used. @@ -309,23 +309,6 @@ func (r customHostnameNewResponseSSLJSON) RawJSON() string { return r.raw } -// The Certificate Authority that will issue the certificate -type CustomHostnameNewResponseSSLCertificateAuthority string - -const ( - CustomHostnameNewResponseSSLCertificateAuthorityDigicert CustomHostnameNewResponseSSLCertificateAuthority = "digicert" - CustomHostnameNewResponseSSLCertificateAuthorityGoogle CustomHostnameNewResponseSSLCertificateAuthority = "google" - CustomHostnameNewResponseSSLCertificateAuthorityLetsEncrypt CustomHostnameNewResponseSSLCertificateAuthority = "lets_encrypt" -) - -func (r CustomHostnameNewResponseSSLCertificateAuthority) IsKnown() bool { - switch r { - case CustomHostnameNewResponseSSLCertificateAuthorityDigicert, CustomHostnameNewResponseSSLCertificateAuthorityGoogle, CustomHostnameNewResponseSSLCertificateAuthorityLetsEncrypt: - return true - } - return false -} - // SSL specific settings. type CustomHostnameNewResponseSSLSettings struct { // An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -668,7 +651,7 @@ type CustomHostnameListResponse struct { // name or the string ':request_host_header:' which will cause the host header in // the request to be used as SNI. Not configurable with default/fallback origin // server. - CustomOriginSni string `json:"custom_origin_sni"` + CustomOriginSNI string `json:"custom_origin_sni"` // This is a record which can be placed to activate a hostname. OwnershipVerification CustomHostnameListResponseOwnershipVerification `json:"ownership_verification"` // This presents the token to be served by the given http url to activate a @@ -690,7 +673,7 @@ type customHostnameListResponseJSON struct { CreatedAt apijson.Field CustomMetadata apijson.Field CustomOriginServer apijson.Field - CustomOriginSni apijson.Field + CustomOriginSNI apijson.Field OwnershipVerification apijson.Field OwnershipVerificationHTTP apijson.Field Status apijson.Field @@ -717,7 +700,7 @@ type CustomHostnameListResponseSSL struct { // chain, but does not otherwise modify it. BundleMethod BundleMethod `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority CustomHostnameListResponseSSLCertificateAuthority `json:"certificate_authority"` + CertificateAuthority shared.CertificateCA `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate string `json:"custom_certificate"` // The identifier for the Custom CSR that was used. @@ -788,23 +771,6 @@ func (r customHostnameListResponseSSLJSON) RawJSON() string { return r.raw } -// The Certificate Authority that will issue the certificate -type CustomHostnameListResponseSSLCertificateAuthority string - -const ( - CustomHostnameListResponseSSLCertificateAuthorityDigicert CustomHostnameListResponseSSLCertificateAuthority = "digicert" - CustomHostnameListResponseSSLCertificateAuthorityGoogle CustomHostnameListResponseSSLCertificateAuthority = "google" - CustomHostnameListResponseSSLCertificateAuthorityLetsEncrypt CustomHostnameListResponseSSLCertificateAuthority = "lets_encrypt" -) - -func (r CustomHostnameListResponseSSLCertificateAuthority) IsKnown() bool { - switch r { - case CustomHostnameListResponseSSLCertificateAuthorityDigicert, CustomHostnameListResponseSSLCertificateAuthorityGoogle, CustomHostnameListResponseSSLCertificateAuthorityLetsEncrypt: - return true - } - return false -} - // SSL specific settings. type CustomHostnameListResponseSSLSettings struct { // An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -1169,7 +1135,7 @@ type CustomHostnameEditResponse struct { // name or the string ':request_host_header:' which will cause the host header in // the request to be used as SNI. Not configurable with default/fallback origin // server. - CustomOriginSni string `json:"custom_origin_sni"` + CustomOriginSNI string `json:"custom_origin_sni"` // This is a record which can be placed to activate a hostname. OwnershipVerification CustomHostnameEditResponseOwnershipVerification `json:"ownership_verification"` // This presents the token to be served by the given http url to activate a @@ -1191,7 +1157,7 @@ type customHostnameEditResponseJSON struct { CreatedAt apijson.Field CustomMetadata apijson.Field CustomOriginServer apijson.Field - CustomOriginSni apijson.Field + CustomOriginSNI apijson.Field OwnershipVerification apijson.Field OwnershipVerificationHTTP apijson.Field Status apijson.Field @@ -1218,7 +1184,7 @@ type CustomHostnameEditResponseSSL struct { // chain, but does not otherwise modify it. BundleMethod BundleMethod `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority CustomHostnameEditResponseSSLCertificateAuthority `json:"certificate_authority"` + CertificateAuthority shared.CertificateCA `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate string `json:"custom_certificate"` // The identifier for the Custom CSR that was used. @@ -1289,23 +1255,6 @@ func (r customHostnameEditResponseSSLJSON) RawJSON() string { return r.raw } -// The Certificate Authority that will issue the certificate -type CustomHostnameEditResponseSSLCertificateAuthority string - -const ( - CustomHostnameEditResponseSSLCertificateAuthorityDigicert CustomHostnameEditResponseSSLCertificateAuthority = "digicert" - CustomHostnameEditResponseSSLCertificateAuthorityGoogle CustomHostnameEditResponseSSLCertificateAuthority = "google" - CustomHostnameEditResponseSSLCertificateAuthorityLetsEncrypt CustomHostnameEditResponseSSLCertificateAuthority = "lets_encrypt" -) - -func (r CustomHostnameEditResponseSSLCertificateAuthority) IsKnown() bool { - switch r { - case CustomHostnameEditResponseSSLCertificateAuthorityDigicert, CustomHostnameEditResponseSSLCertificateAuthorityGoogle, CustomHostnameEditResponseSSLCertificateAuthorityLetsEncrypt: - return true - } - return false -} - // SSL specific settings. type CustomHostnameEditResponseSSLSettings struct { // An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -1648,7 +1597,7 @@ type CustomHostnameGetResponse struct { // name or the string ':request_host_header:' which will cause the host header in // the request to be used as SNI. Not configurable with default/fallback origin // server. - CustomOriginSni string `json:"custom_origin_sni"` + CustomOriginSNI string `json:"custom_origin_sni"` // This is a record which can be placed to activate a hostname. OwnershipVerification CustomHostnameGetResponseOwnershipVerification `json:"ownership_verification"` // This presents the token to be served by the given http url to activate a @@ -1670,7 +1619,7 @@ type customHostnameGetResponseJSON struct { CreatedAt apijson.Field CustomMetadata apijson.Field CustomOriginServer apijson.Field - CustomOriginSni apijson.Field + CustomOriginSNI apijson.Field OwnershipVerification apijson.Field OwnershipVerificationHTTP apijson.Field Status apijson.Field @@ -1697,7 +1646,7 @@ type CustomHostnameGetResponseSSL struct { // chain, but does not otherwise modify it. BundleMethod BundleMethod `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority CustomHostnameGetResponseSSLCertificateAuthority `json:"certificate_authority"` + CertificateAuthority shared.CertificateCA `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate string `json:"custom_certificate"` // The identifier for the Custom CSR that was used. @@ -1768,23 +1717,6 @@ func (r customHostnameGetResponseSSLJSON) RawJSON() string { return r.raw } -// The Certificate Authority that will issue the certificate -type CustomHostnameGetResponseSSLCertificateAuthority string - -const ( - CustomHostnameGetResponseSSLCertificateAuthorityDigicert CustomHostnameGetResponseSSLCertificateAuthority = "digicert" - CustomHostnameGetResponseSSLCertificateAuthorityGoogle CustomHostnameGetResponseSSLCertificateAuthority = "google" - CustomHostnameGetResponseSSLCertificateAuthorityLetsEncrypt CustomHostnameGetResponseSSLCertificateAuthority = "lets_encrypt" -) - -func (r CustomHostnameGetResponseSSLCertificateAuthority) IsKnown() bool { - switch r { - case CustomHostnameGetResponseSSLCertificateAuthorityDigicert, CustomHostnameGetResponseSSLCertificateAuthorityGoogle, CustomHostnameGetResponseSSLCertificateAuthorityLetsEncrypt: - return true - } - return false -} - // SSL specific settings. type CustomHostnameGetResponseSSLSettings struct { // An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -2131,7 +2063,7 @@ type CustomHostnameNewParamsSSL struct { // chain, but does not otherwise modify it. BundleMethod param.Field[BundleMethod] `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority param.Field[CustomHostnameNewParamsSSLCertificateAuthority] `json:"certificate_authority"` + CertificateAuthority param.Field[shared.CertificateCA] `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate param.Field[string] `json:"custom_certificate"` // The key for a custom uploaded certificate. @@ -2151,23 +2083,6 @@ func (r CustomHostnameNewParamsSSL) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The Certificate Authority that will issue the certificate -type CustomHostnameNewParamsSSLCertificateAuthority string - -const ( - CustomHostnameNewParamsSSLCertificateAuthorityDigicert CustomHostnameNewParamsSSLCertificateAuthority = "digicert" - CustomHostnameNewParamsSSLCertificateAuthorityGoogle CustomHostnameNewParamsSSLCertificateAuthority = "google" - CustomHostnameNewParamsSSLCertificateAuthorityLetsEncrypt CustomHostnameNewParamsSSLCertificateAuthority = "lets_encrypt" -) - -func (r CustomHostnameNewParamsSSLCertificateAuthority) IsKnown() bool { - switch r { - case CustomHostnameNewParamsSSLCertificateAuthorityDigicert, CustomHostnameNewParamsSSLCertificateAuthorityGoogle, CustomHostnameNewParamsSSLCertificateAuthorityLetsEncrypt: - return true - } - return false -} - // SSL specific settings. type CustomHostnameNewParamsSSLSettings struct { // An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -2264,11 +2179,11 @@ func (r CustomHostnameNewParamsCustomMetadata) MarshalJSON() (data []byte, err e } type CustomHostnameNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomHostnameNewResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CustomHostnameNewResponseEnvelopeSuccess `json:"success,required"` + Result CustomHostnameNewResponse `json:"result"` JSON customHostnameNewResponseEnvelopeJSON `json:"-"` } @@ -2277,8 +2192,8 @@ type CustomHostnameNewResponseEnvelope struct { type customHostnameNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -2388,11 +2303,6 @@ func (r CustomHostnameListParamsSSL) IsKnown() bool { type CustomHostnameDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r CustomHostnameDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type CustomHostnameEditParams struct { @@ -2408,7 +2318,7 @@ type CustomHostnameEditParams struct { // name or the string ':request_host_header:' which will cause the host header in // the request to be used as SNI. Not configurable with default/fallback origin // server. - CustomOriginSni param.Field[string] `json:"custom_origin_sni"` + CustomOriginSNI param.Field[string] `json:"custom_origin_sni"` // SSL properties used when creating the custom hostname. SSL param.Field[CustomHostnameEditParamsSSL] `json:"ssl"` } @@ -2435,7 +2345,7 @@ type CustomHostnameEditParamsSSL struct { // chain, but does not otherwise modify it. BundleMethod param.Field[BundleMethod] `json:"bundle_method"` // The Certificate Authority that will issue the certificate - CertificateAuthority param.Field[CustomHostnameEditParamsSSLCertificateAuthority] `json:"certificate_authority"` + CertificateAuthority param.Field[shared.CertificateCA] `json:"certificate_authority"` // If a custom uploaded certificate is used. CustomCertificate param.Field[string] `json:"custom_certificate"` // The key for a custom uploaded certificate. @@ -2455,23 +2365,6 @@ func (r CustomHostnameEditParamsSSL) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The Certificate Authority that will issue the certificate -type CustomHostnameEditParamsSSLCertificateAuthority string - -const ( - CustomHostnameEditParamsSSLCertificateAuthorityDigicert CustomHostnameEditParamsSSLCertificateAuthority = "digicert" - CustomHostnameEditParamsSSLCertificateAuthorityGoogle CustomHostnameEditParamsSSLCertificateAuthority = "google" - CustomHostnameEditParamsSSLCertificateAuthorityLetsEncrypt CustomHostnameEditParamsSSLCertificateAuthority = "lets_encrypt" -) - -func (r CustomHostnameEditParamsSSLCertificateAuthority) IsKnown() bool { - switch r { - case CustomHostnameEditParamsSSLCertificateAuthorityDigicert, CustomHostnameEditParamsSSLCertificateAuthorityGoogle, CustomHostnameEditParamsSSLCertificateAuthorityLetsEncrypt: - return true - } - return false -} - // SSL specific settings. type CustomHostnameEditParamsSSLSettings struct { // An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -2558,11 +2451,11 @@ func (r CustomHostnameEditParamsSSLSettingsTLS1_3) IsKnown() bool { } type CustomHostnameEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomHostnameEditResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CustomHostnameEditResponseEnvelopeSuccess `json:"success,required"` + Result CustomHostnameEditResponse `json:"result"` JSON customHostnameEditResponseEnvelopeJSON `json:"-"` } @@ -2571,8 +2464,8 @@ type CustomHostnameEditResponseEnvelope struct { type customHostnameEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -2606,11 +2499,11 @@ type CustomHostnameGetParams struct { } type CustomHostnameGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomHostnameGetResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CustomHostnameGetResponseEnvelopeSuccess `json:"success,required"` + Result CustomHostnameGetResponse `json:"result"` JSON customHostnameGetResponseEnvelopeJSON `json:"-"` } @@ -2619,8 +2512,8 @@ type CustomHostnameGetResponseEnvelope struct { type customHostnameGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/custom_hostnames/customhostname_test.go b/custom_hostnames/customhostname_test.go index 6ae3aeefb07..0b826e623c1 100644 --- a/custom_hostnames/customhostname_test.go +++ b/custom_hostnames/customhostname_test.go @@ -12,10 +12,10 @@ import ( "github.com/cloudflare/cloudflare-go/v2/custom_hostnames" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) func TestCustomHostnameNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -33,7 +33,7 @@ func TestCustomHostnameNewWithOptionalParams(t *testing.T) { Hostname: cloudflare.F("app.example.com"), SSL: cloudflare.F(custom_hostnames.CustomHostnameNewParamsSSL{ BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous), - CertificateAuthority: cloudflare.F(custom_hostnames.CustomHostnameNewParamsSSLCertificateAuthorityGoogle), + CertificateAuthority: cloudflare.F(shared.CertificateCAGoogle), CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP/2gdUySbfzANBgkqhkiG9w0BAQsFADBN\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E...SzSHfXp5lnu/3V08I72q1QNzOCgY1XeL4GKVcj4or6cT6tX6oJH7ePPmfrBfqI/O\\nOeH8gMJ+FuwtXYEPa4hBf38M5eU5xWG7\\n-----END CERTIFICATE-----\\n"), CustomKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), Method: cloudflare.F(custom_hostnames.DCVMethodHTTP), @@ -61,7 +61,6 @@ func TestCustomHostnameNewWithOptionalParams(t *testing.T) { } func TestCustomHostnameListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -94,7 +93,6 @@ func TestCustomHostnameListWithOptionalParams(t *testing.T) { } func TestCustomHostnameDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -112,7 +110,6 @@ func TestCustomHostnameDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", custom_hostnames.CustomHostnameDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -125,7 +122,6 @@ func TestCustomHostnameDelete(t *testing.T) { } func TestCustomHostnameEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -147,10 +143,10 @@ func TestCustomHostnameEditWithOptionalParams(t *testing.T) { Key: cloudflare.F("value"), }), CustomOriginServer: cloudflare.F("origin2.example.com"), - CustomOriginSni: cloudflare.F("sni.example.com"), + CustomOriginSNI: cloudflare.F("sni.example.com"), SSL: cloudflare.F(custom_hostnames.CustomHostnameEditParamsSSL{ BundleMethod: cloudflare.F(custom_hostnames.BundleMethodUbiquitous), - CertificateAuthority: cloudflare.F(custom_hostnames.CustomHostnameEditParamsSSLCertificateAuthorityGoogle), + CertificateAuthority: cloudflare.F(shared.CertificateCAGoogle), CustomCertificate: cloudflare.F("-----BEGIN CERTIFICATE-----\\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP/2gdUySbfzANBgkqhkiG9w0BAQsFADBN\\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMScwJQYDVQQDEx5E...SzSHfXp5lnu/3V08I72q1QNzOCgY1XeL4GKVcj4or6cT6tX6oJH7ePPmfrBfqI/O\\nOeH8gMJ+FuwtXYEPa4hBf38M5eU5xWG7\\n-----END CERTIFICATE-----\\n"), CustomKey: cloudflare.F("-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n"), Method: cloudflare.F(custom_hostnames.DCVMethodHTTP), @@ -176,7 +172,6 @@ func TestCustomHostnameEditWithOptionalParams(t *testing.T) { } func TestCustomHostnameGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/custom_hostnames/fallbackorigin.go b/custom_hostnames/fallbackorigin.go index d63acaa3359..647706af5be 100644 --- a/custom_hostnames/fallbackorigin.go +++ b/custom_hostnames/fallbackorigin.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -48,10 +48,10 @@ func (r *FallbackOriginService) Update(ctx context.Context, params FallbackOrigi } // Delete Fallback Origin for Custom Hostnames -func (r *FallbackOriginService) Delete(ctx context.Context, params FallbackOriginDeleteParams, opts ...option.RequestOption) (res *FallbackOriginDeleteResponseUnion, err error) { +func (r *FallbackOriginService) Delete(ctx context.Context, body FallbackOriginDeleteParams, opts ...option.RequestOption) (res *FallbackOriginDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env FallbackOriginDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/custom_hostnames/fallback_origin", params.ZoneID) + path := fmt.Sprintf("zones/%s/custom_hostnames/fallback_origin", body.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -136,11 +136,11 @@ func (r FallbackOriginUpdateParams) MarshalJSON() (data []byte, err error) { } type FallbackOriginUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result FallbackOriginUpdateResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success FallbackOriginUpdateResponseEnvelopeSuccess `json:"success,required"` + Result FallbackOriginUpdateResponseUnion `json:"result"` JSON fallbackOriginUpdateResponseEnvelopeJSON `json:"-"` } @@ -149,8 +149,8 @@ type FallbackOriginUpdateResponseEnvelope struct { type fallbackOriginUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -181,19 +181,14 @@ func (r FallbackOriginUpdateResponseEnvelopeSuccess) IsKnown() bool { type FallbackOriginDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r FallbackOriginDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type FallbackOriginDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result FallbackOriginDeleteResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success FallbackOriginDeleteResponseEnvelopeSuccess `json:"success,required"` + Result FallbackOriginDeleteResponseUnion `json:"result"` JSON fallbackOriginDeleteResponseEnvelopeJSON `json:"-"` } @@ -202,8 +197,8 @@ type FallbackOriginDeleteResponseEnvelope struct { type fallbackOriginDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -237,11 +232,11 @@ type FallbackOriginGetParams struct { } type FallbackOriginGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result FallbackOriginGetResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success FallbackOriginGetResponseEnvelopeSuccess `json:"success,required"` + Result FallbackOriginGetResponseUnion `json:"result"` JSON fallbackOriginGetResponseEnvelopeJSON `json:"-"` } @@ -250,8 +245,8 @@ type FallbackOriginGetResponseEnvelope struct { type fallbackOriginGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/custom_hostnames/fallbackorigin_test.go b/custom_hostnames/fallbackorigin_test.go index 988da10cf65..03320338c86 100644 --- a/custom_hostnames/fallbackorigin_test.go +++ b/custom_hostnames/fallbackorigin_test.go @@ -15,7 +15,6 @@ import ( ) func TestFallbackOriginUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestFallbackOriginUpdate(t *testing.T) { } func TestFallbackOriginDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -57,7 +55,6 @@ func TestFallbackOriginDelete(t *testing.T) { ) _, err := client.CustomHostnames.FallbackOrigin.Delete(context.TODO(), custom_hostnames.FallbackOriginDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -69,7 +66,6 @@ func TestFallbackOriginDelete(t *testing.T) { } func TestFallbackOriginGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/custom_nameservers/aliases.go b/custom_nameservers/aliases.go index 8bb76f07834..c2e65fec1cb 100644 --- a/custom_nameservers/aliases.go +++ b/custom_nameservers/aliases.go @@ -4,7 +4,7 @@ package custom_nameservers import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/custom_nameservers/customnameserver.go b/custom_nameservers/customnameserver.go index 67dfa7ba459..dc9972e568d 100644 --- a/custom_nameservers/customnameserver.go +++ b/custom_nameservers/customnameserver.go @@ -6,14 +6,12 @@ import ( "context" "fmt" "net/http" - "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/tidwall/gjson" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CustomNameserverService contains methods and other services that help with @@ -48,10 +46,10 @@ func (r *CustomNameserverService) New(ctx context.Context, params CustomNameserv } // Delete Account Custom Nameserver -func (r *CustomNameserverService) Delete(ctx context.Context, customNSID string, params CustomNameserverDeleteParams, opts ...option.RequestOption) (res *CustomNameserverDeleteResponseUnion, err error) { +func (r *CustomNameserverService) Delete(ctx context.Context, customNSID string, body CustomNameserverDeleteParams, opts ...option.RequestOption) (res *[]CustomNameserverDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env CustomNameserverDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/custom_ns/%s", params.AccountID, customNSID) + path := fmt.Sprintf("accounts/%s/custom_ns/%s", body.AccountID, customNSID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -86,19 +84,6 @@ func (r *CustomNameserverService) Get(ctx context.Context, query CustomNameserve return } -// Verify Account Custom Nameserver Glue Records -func (r *CustomNameserverService) Verify(ctx context.Context, params CustomNameserverVerifyParams, opts ...option.RequestOption) (res *[]CustomNameserver, err error) { - opts = append(r.Options[:], opts...) - var env CustomNameserverVerifyResponseEnvelope - path := fmt.Sprintf("accounts/%s/custom_ns/verify", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - // A single account custom nameserver. type CustomNameserver struct { // A and AAAA records associated with the nameserver. @@ -192,32 +177,7 @@ func (r CustomNameserverStatus) IsKnown() bool { return false } -// Union satisfied by [custom_nameservers.CustomNameserverDeleteResponseUnknown], -// [custom_nameservers.CustomNameserverDeleteResponseArray] or -// [shared.UnionString]. -type CustomNameserverDeleteResponseUnion interface { - ImplementsCustomNameserversCustomNameserverDeleteResponseUnion() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*CustomNameserverDeleteResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(CustomNameserverDeleteResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type CustomNameserverDeleteResponseArray []interface{} - -func (r CustomNameserverDeleteResponseArray) ImplementsCustomNameserversCustomNameserverDeleteResponseUnion() { -} +type CustomNameserverDeleteResponse = interface{} type CustomNameserverNewParams struct { // Account identifier tag. @@ -235,11 +195,11 @@ func (r CustomNameserverNewParams) MarshalJSON() (data []byte, err error) { type CustomNameserverNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - // A single account custom nameserver. - Result CustomNameserver `json:"result,required"` // Whether the API call was successful Success CustomNameserverNewResponseEnvelopeSuccess `json:"success,required"` - JSON customNameserverNewResponseEnvelopeJSON `json:"-"` + // A single account custom nameserver. + Result CustomNameserver `json:"result"` + JSON customNameserverNewResponseEnvelopeJSON `json:"-"` } // customNameserverNewResponseEnvelopeJSON contains the JSON metadata for the @@ -247,8 +207,8 @@ type CustomNameserverNewResponseEnvelope struct { type customNameserverNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -279,19 +239,14 @@ func (r CustomNameserverNewResponseEnvelopeSuccess) IsKnown() bool { type CustomNameserverDeleteParams struct { // Account identifier tag. AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r CustomNameserverDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type CustomNameserverDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomNameserverDeleteResponseUnion `json:"result,required,nullable"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CustomNameserverDeleteResponseEnvelopeSuccess `json:"success,required"` + Result []CustomNameserverDeleteResponse `json:"result,nullable"` ResultInfo CustomNameserverDeleteResponseEnvelopeResultInfo `json:"result_info"` JSON customNameserverDeleteResponseEnvelopeJSON `json:"-"` } @@ -301,8 +256,8 @@ type CustomNameserverDeleteResponseEnvelope struct { type customNameserverDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field ResultInfo apijson.Field raw string ExtraFields map[string]apijson.Field @@ -370,9 +325,9 @@ type CustomNameserverAvailabiltyParams struct { type CustomNameserverAvailabiltyResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result []string `json:"result,required,nullable" format:"hostname"` // Whether the API call was successful Success CustomNameserverAvailabiltyResponseEnvelopeSuccess `json:"success,required"` + Result []string `json:"result,nullable" format:"hostname"` ResultInfo CustomNameserverAvailabiltyResponseEnvelopeResultInfo `json:"result_info"` JSON customNameserverAvailabiltyResponseEnvelopeJSON `json:"-"` } @@ -382,8 +337,8 @@ type CustomNameserverAvailabiltyResponseEnvelope struct { type customNameserverAvailabiltyResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field ResultInfo apijson.Field raw string ExtraFields map[string]apijson.Field @@ -451,9 +406,9 @@ type CustomNameserverGetParams struct { type CustomNameserverGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result []CustomNameserver `json:"result,required,nullable"` // Whether the API call was successful Success CustomNameserverGetResponseEnvelopeSuccess `json:"success,required"` + Result []CustomNameserver `json:"result,nullable"` ResultInfo CustomNameserverGetResponseEnvelopeResultInfo `json:"result_info"` JSON customNameserverGetResponseEnvelopeJSON `json:"-"` } @@ -463,8 +418,8 @@ type CustomNameserverGetResponseEnvelope struct { type customNameserverGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field ResultInfo apijson.Field raw string ExtraFields map[string]apijson.Field @@ -523,89 +478,3 @@ func (r *CustomNameserverGetResponseEnvelopeResultInfo) UnmarshalJSON(data []byt func (r customNameserverGetResponseEnvelopeResultInfoJSON) RawJSON() string { return r.raw } - -type CustomNameserverVerifyParams struct { - // Account identifier tag. - AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r CustomNameserverVerifyParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - -type CustomNameserverVerifyResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result []CustomNameserver `json:"result,required,nullable"` - // Whether the API call was successful - Success CustomNameserverVerifyResponseEnvelopeSuccess `json:"success,required"` - ResultInfo CustomNameserverVerifyResponseEnvelopeResultInfo `json:"result_info"` - JSON customNameserverVerifyResponseEnvelopeJSON `json:"-"` -} - -// customNameserverVerifyResponseEnvelopeJSON contains the JSON metadata for the -// struct [CustomNameserverVerifyResponseEnvelope] -type customNameserverVerifyResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - ResultInfo apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *CustomNameserverVerifyResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r customNameserverVerifyResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -// Whether the API call was successful -type CustomNameserverVerifyResponseEnvelopeSuccess bool - -const ( - CustomNameserverVerifyResponseEnvelopeSuccessTrue CustomNameserverVerifyResponseEnvelopeSuccess = true -) - -func (r CustomNameserverVerifyResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case CustomNameserverVerifyResponseEnvelopeSuccessTrue: - return true - } - return false -} - -type CustomNameserverVerifyResponseEnvelopeResultInfo struct { - // Total number of results for the requested service - Count float64 `json:"count"` - // Current page within paginated list of results - Page float64 `json:"page"` - // Number of results per page of results - PerPage float64 `json:"per_page"` - // Total results available without any search parameters - TotalCount float64 `json:"total_count"` - JSON customNameserverVerifyResponseEnvelopeResultInfoJSON `json:"-"` -} - -// customNameserverVerifyResponseEnvelopeResultInfoJSON contains the JSON metadata -// for the struct [CustomNameserverVerifyResponseEnvelopeResultInfo] -type customNameserverVerifyResponseEnvelopeResultInfoJSON struct { - Count apijson.Field - Page apijson.Field - PerPage apijson.Field - TotalCount apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *CustomNameserverVerifyResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r customNameserverVerifyResponseEnvelopeResultInfoJSON) RawJSON() string { - return r.raw -} diff --git a/custom_nameservers/customnameserver_test.go b/custom_nameservers/customnameserver_test.go index 7d9df3e08e4..8a9fb12a049 100644 --- a/custom_nameservers/customnameserver_test.go +++ b/custom_nameservers/customnameserver_test.go @@ -15,7 +15,6 @@ import ( ) func TestCustomNameserverNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestCustomNameserverNewWithOptionalParams(t *testing.T) { } func TestCustomNameserverDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -61,7 +59,6 @@ func TestCustomNameserverDelete(t *testing.T) { "ns1.example.com", custom_nameservers.CustomNameserverDeleteParams{ AccountID: cloudflare.F("372e67954025e0ba6aaa6d586b9e0b59"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -74,7 +71,6 @@ func TestCustomNameserverDelete(t *testing.T) { } func TestCustomNameserverAvailabilty(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -100,7 +96,6 @@ func TestCustomNameserverAvailabilty(t *testing.T) { } func TestCustomNameserverGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -124,30 +119,3 @@ func TestCustomNameserverGet(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } - -func TestCustomNameserverVerify(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.CustomNameservers.Verify(context.TODO(), custom_nameservers.CustomNameserverVerifyParams{ - AccountID: cloudflare.F("372e67954025e0ba6aaa6d586b9e0b59"), - Body: map[string]interface{}{}, - }) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/d1/aliases.go b/d1/aliases.go index 7f8f3a3deec..6ca45d2b7b6 100644 --- a/d1/aliases.go +++ b/d1/aliases.go @@ -4,7 +4,7 @@ package d1 import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/d1/database.go b/d1/database.go index a37699d1b82..10b1718a89b 100644 --- a/d1/database.go +++ b/d1/database.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/d1/database_test.go b/d1/database_test.go index a130eef651f..b9fa9320cf4 100644 --- a/d1/database_test.go +++ b/d1/database_test.go @@ -15,7 +15,6 @@ import ( ) func TestDatabaseNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestDatabaseNew(t *testing.T) { } func TestDatabaseListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -71,7 +69,6 @@ func TestDatabaseListWithOptionalParams(t *testing.T) { } func TestDatabaseDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -99,7 +96,6 @@ func TestDatabaseDelete(t *testing.T) { } func TestDatabaseGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -127,7 +123,6 @@ func TestDatabaseGet(t *testing.T) { } func TestDatabaseQueryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/dcv_delegation/aliases.go b/dcv_delegation/aliases.go index 14f905e7e23..64589d1c8bc 100644 --- a/dcv_delegation/aliases.go +++ b/dcv_delegation/aliases.go @@ -4,7 +4,7 @@ package dcv_delegation import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/dcv_delegation/uuid.go b/dcv_delegation/uuid.go index 6e51a39cc9a..8438a29c593 100644 --- a/dcv_delegation/uuid.go +++ b/dcv_delegation/uuid.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // UUIDService contains methods and other services that help with interacting with @@ -75,9 +75,9 @@ type UUIDGetParams struct { type UUIDGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result DCVDelegationUUID `json:"result,required"` // Whether the API call was successful Success UUIDGetResponseEnvelopeSuccess `json:"success,required"` + Result DCVDelegationUUID `json:"result"` JSON uuidGetResponseEnvelopeJSON `json:"-"` } @@ -86,8 +86,8 @@ type UUIDGetResponseEnvelope struct { type uuidGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/dcv_delegation/uuid_test.go b/dcv_delegation/uuid_test.go index 39b99f5b560..d5ba65f3eed 100644 --- a/dcv_delegation/uuid_test.go +++ b/dcv_delegation/uuid_test.go @@ -15,7 +15,6 @@ import ( ) func TestUUIDGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/diagnostics/aliases.go b/diagnostics/aliases.go index 6aef22300e4..18ae0a57562 100644 --- a/diagnostics/aliases.go +++ b/diagnostics/aliases.go @@ -4,7 +4,7 @@ package diagnostics import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/diagnostics/traceroute.go b/diagnostics/traceroute.go index 44e880a10ad..9bd9915ff32 100644 --- a/diagnostics/traceroute.go +++ b/diagnostics/traceroute.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // TracerouteService contains methods and other services that help with interacting diff --git a/diagnostics/traceroute_test.go b/diagnostics/traceroute_test.go index e7dd38398fb..d09d777390f 100644 --- a/diagnostics/traceroute_test.go +++ b/diagnostics/traceroute_test.go @@ -15,7 +15,6 @@ import ( ) func TestTracerouteNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/dns/aliases.go b/dns/aliases.go index 6dacb5bd012..a9f71097302 100644 --- a/dns/aliases.go +++ b/dns/aliases.go @@ -4,7 +4,7 @@ package dns import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/dns/analyticsreport.go b/dns/analyticsreport.go index 048c10cc4ab..848216c35f2 100644 --- a/dns/analyticsreport.go +++ b/dns/analyticsreport.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AnalyticsReportService contains methods and other services that help with diff --git a/dns/analyticsreport_test.go b/dns/analyticsreport_test.go index 16993e5c056..17f32a2d394 100644 --- a/dns/analyticsreport_test.go +++ b/dns/analyticsreport_test.go @@ -16,7 +16,6 @@ import ( ) func TestAnalyticsReportGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/dns/analyticsreportbytime.go b/dns/analyticsreportbytime.go index ef59b9073ac..a5afea77e6c 100644 --- a/dns/analyticsreportbytime.go +++ b/dns/analyticsreportbytime.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AnalyticsReportBytimeService contains methods and other services that help with @@ -141,7 +141,7 @@ type AnalyticsReportBytimeGetParams struct { // prefixed by - (descending) or + (ascending). Sort param.Field[string] `query:"sort"` // Unit of time to group data by. - TimeDelta param.Field[AnalyticsReportBytimeGetParamsTimeDelta] `query:"time_delta"` + TimeDelta param.Field[Delta] `query:"time_delta"` // End date and time of requesting data period in ISO 8601 format. Until param.Field[time.Time] `query:"until" format:"date-time"` } @@ -155,30 +155,6 @@ func (r AnalyticsReportBytimeGetParams) URLQuery() (v url.Values) { }) } -// Unit of time to group data by. -type AnalyticsReportBytimeGetParamsTimeDelta string - -const ( - AnalyticsReportBytimeGetParamsTimeDeltaAll AnalyticsReportBytimeGetParamsTimeDelta = "all" - AnalyticsReportBytimeGetParamsTimeDeltaAuto AnalyticsReportBytimeGetParamsTimeDelta = "auto" - AnalyticsReportBytimeGetParamsTimeDeltaYear AnalyticsReportBytimeGetParamsTimeDelta = "year" - AnalyticsReportBytimeGetParamsTimeDeltaQuarter AnalyticsReportBytimeGetParamsTimeDelta = "quarter" - AnalyticsReportBytimeGetParamsTimeDeltaMonth AnalyticsReportBytimeGetParamsTimeDelta = "month" - AnalyticsReportBytimeGetParamsTimeDeltaWeek AnalyticsReportBytimeGetParamsTimeDelta = "week" - AnalyticsReportBytimeGetParamsTimeDeltaDay AnalyticsReportBytimeGetParamsTimeDelta = "day" - AnalyticsReportBytimeGetParamsTimeDeltaHour AnalyticsReportBytimeGetParamsTimeDelta = "hour" - AnalyticsReportBytimeGetParamsTimeDeltaDekaminute AnalyticsReportBytimeGetParamsTimeDelta = "dekaminute" - AnalyticsReportBytimeGetParamsTimeDeltaMinute AnalyticsReportBytimeGetParamsTimeDelta = "minute" -) - -func (r AnalyticsReportBytimeGetParamsTimeDelta) IsKnown() bool { - switch r { - case AnalyticsReportBytimeGetParamsTimeDeltaAll, AnalyticsReportBytimeGetParamsTimeDeltaAuto, AnalyticsReportBytimeGetParamsTimeDeltaYear, AnalyticsReportBytimeGetParamsTimeDeltaQuarter, AnalyticsReportBytimeGetParamsTimeDeltaMonth, AnalyticsReportBytimeGetParamsTimeDeltaWeek, AnalyticsReportBytimeGetParamsTimeDeltaDay, AnalyticsReportBytimeGetParamsTimeDeltaHour, AnalyticsReportBytimeGetParamsTimeDeltaDekaminute, AnalyticsReportBytimeGetParamsTimeDeltaMinute: - return true - } - return false -} - type AnalyticsReportBytimeGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/dns/analyticsreportbytime_test.go b/dns/analyticsreportbytime_test.go index 21ea18b2a67..4ba00b6747e 100644 --- a/dns/analyticsreportbytime_test.go +++ b/dns/analyticsreportbytime_test.go @@ -16,7 +16,6 @@ import ( ) func TestAnalyticsReportBytimeGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -37,7 +36,7 @@ func TestAnalyticsReportBytimeGetWithOptionalParams(t *testing.T) { Metrics: cloudflare.F("queryCount,uncachedCount"), Since: cloudflare.F(time.Now()), Sort: cloudflare.F("+responseCode,-queryName"), - TimeDelta: cloudflare.F(dns.AnalyticsReportBytimeGetParamsTimeDeltaHour), + TimeDelta: cloudflare.F(dns.DeltaHour), Until: cloudflare.F(time.Now()), }) if err != nil { diff --git a/dns/dns.go b/dns/dns.go index 1237b3e020a..32d4377def2 100644 --- a/dns/dns.go +++ b/dns/dns.go @@ -44,7 +44,7 @@ type DNSAnalyticsQuery struct { // Start date and time of requesting data period in ISO 8601 format. Since time.Time `json:"since,required" format:"date-time"` // Unit of time to group data by. - TimeDelta DNSAnalyticsQueryTimeDelta `json:"time_delta,required"` + TimeDelta Delta `json:"time_delta,required"` // End date and time of requesting data period in ISO 8601 format. Until time.Time `json:"until,required" format:"date-time"` // Segmentation filter in 'attribute operator value' format. @@ -77,27 +77,3 @@ func (r *DNSAnalyticsQuery) UnmarshalJSON(data []byte) (err error) { func (r dnsAnalyticsQueryJSON) RawJSON() string { return r.raw } - -// Unit of time to group data by. -type DNSAnalyticsQueryTimeDelta string - -const ( - DNSAnalyticsQueryTimeDeltaAll DNSAnalyticsQueryTimeDelta = "all" - DNSAnalyticsQueryTimeDeltaAuto DNSAnalyticsQueryTimeDelta = "auto" - DNSAnalyticsQueryTimeDeltaYear DNSAnalyticsQueryTimeDelta = "year" - DNSAnalyticsQueryTimeDeltaQuarter DNSAnalyticsQueryTimeDelta = "quarter" - DNSAnalyticsQueryTimeDeltaMonth DNSAnalyticsQueryTimeDelta = "month" - DNSAnalyticsQueryTimeDeltaWeek DNSAnalyticsQueryTimeDelta = "week" - DNSAnalyticsQueryTimeDeltaDay DNSAnalyticsQueryTimeDelta = "day" - DNSAnalyticsQueryTimeDeltaHour DNSAnalyticsQueryTimeDelta = "hour" - DNSAnalyticsQueryTimeDeltaDekaminute DNSAnalyticsQueryTimeDelta = "dekaminute" - DNSAnalyticsQueryTimeDeltaMinute DNSAnalyticsQueryTimeDelta = "minute" -) - -func (r DNSAnalyticsQueryTimeDelta) IsKnown() bool { - switch r { - case DNSAnalyticsQueryTimeDeltaAll, DNSAnalyticsQueryTimeDeltaAuto, DNSAnalyticsQueryTimeDeltaYear, DNSAnalyticsQueryTimeDeltaQuarter, DNSAnalyticsQueryTimeDeltaMonth, DNSAnalyticsQueryTimeDeltaWeek, DNSAnalyticsQueryTimeDeltaDay, DNSAnalyticsQueryTimeDeltaHour, DNSAnalyticsQueryTimeDeltaDekaminute, DNSAnalyticsQueryTimeDeltaMinute: - return true - } - return false -} diff --git a/dns/firewall.go b/dns/firewall.go index cab5e9339c6..cb6cae2f0bc 100644 --- a/dns/firewall.go +++ b/dns/firewall.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -76,10 +76,10 @@ func (r *FirewallService) ListAutoPaging(ctx context.Context, params FirewallLis } // Delete a configured DNS Firewall Cluster. -func (r *FirewallService) Delete(ctx context.Context, dnsFirewallID string, params FirewallDeleteParams, opts ...option.RequestOption) (res *FirewallDeleteResponse, err error) { +func (r *FirewallService) Delete(ctx context.Context, dnsFirewallID string, body FirewallDeleteParams, opts ...option.RequestOption) (res *FirewallDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env FirewallDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/dns_firewall/%s", params.AccountID, dnsFirewallID) + path := fmt.Sprintf("accounts/%s/dns_firewall/%s", body.AccountID, dnsFirewallID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -413,11 +413,6 @@ func (r FirewallListParams) URLQuery() (v url.Values) { type FirewallDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r FirewallDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type FirewallDeleteResponseEnvelope struct { diff --git a/dns/firewall_test.go b/dns/firewall_test.go index 624ae1b64ec..abcd75a78a6 100644 --- a/dns/firewall_test.go +++ b/dns/firewall_test.go @@ -10,13 +10,12 @@ import ( "github.com/cloudflare/cloudflare-go/v2" "github.com/cloudflare/cloudflare-go/v2/dns" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) func TestFirewallNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -55,7 +54,6 @@ func TestFirewallNewWithOptionalParams(t *testing.T) { } func TestFirewallListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -83,7 +81,6 @@ func TestFirewallListWithOptionalParams(t *testing.T) { } func TestFirewallDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -101,7 +98,6 @@ func TestFirewallDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", dns.FirewallDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -114,7 +110,6 @@ func TestFirewallDelete(t *testing.T) { } func TestFirewallEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -160,7 +155,6 @@ func TestFirewallEditWithOptionalParams(t *testing.T) { } func TestFirewallGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/dns/firewallanalytics.go b/dns/firewallanalytics.go index 0e121e2e854..8cb00ee8658 100644 --- a/dns/firewallanalytics.go +++ b/dns/firewallanalytics.go @@ -25,3 +25,27 @@ func NewFirewallAnalyticsService(opts ...option.RequestOption) (r *FirewallAnaly r.Reports = NewFirewallAnalyticsReportService(opts...) return } + +// Unit of time to group data by. +type Delta string + +const ( + DeltaAll Delta = "all" + DeltaAuto Delta = "auto" + DeltaYear Delta = "year" + DeltaQuarter Delta = "quarter" + DeltaMonth Delta = "month" + DeltaWeek Delta = "week" + DeltaDay Delta = "day" + DeltaHour Delta = "hour" + DeltaDekaminute Delta = "dekaminute" + DeltaMinute Delta = "minute" +) + +func (r Delta) IsKnown() bool { + switch r { + case DeltaAll, DeltaAuto, DeltaYear, DeltaQuarter, DeltaMonth, DeltaWeek, DeltaDay, DeltaHour, DeltaDekaminute, DeltaMinute: + return true + } + return false +} diff --git a/dns/firewallanalyticsreport.go b/dns/firewallanalyticsreport.go index 613717a647f..8f230766109 100644 --- a/dns/firewallanalyticsreport.go +++ b/dns/firewallanalyticsreport.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // FirewallAnalyticsReportService contains methods and other services that help diff --git a/dns/firewallanalyticsreport_test.go b/dns/firewallanalyticsreport_test.go index 3ba63eacc61..73b49c91c24 100644 --- a/dns/firewallanalyticsreport_test.go +++ b/dns/firewallanalyticsreport_test.go @@ -16,7 +16,6 @@ import ( ) func TestFirewallAnalyticsReportGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/dns/firewallanalyticsreportbytime.go b/dns/firewallanalyticsreportbytime.go index 8d252877425..57298398f04 100644 --- a/dns/firewallanalyticsreportbytime.go +++ b/dns/firewallanalyticsreportbytime.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // FirewallAnalyticsReportBytimeService contains methods and other services that @@ -69,7 +69,7 @@ type FirewallAnalyticsReportBytimeGetParams struct { // prefixed by - (descending) or + (ascending). Sort param.Field[string] `query:"sort"` // Unit of time to group data by. - TimeDelta param.Field[FirewallAnalyticsReportBytimeGetParamsTimeDelta] `query:"time_delta"` + TimeDelta param.Field[Delta] `query:"time_delta"` // End date and time of requesting data period in ISO 8601 format. Until param.Field[time.Time] `query:"until" format:"date-time"` } @@ -83,30 +83,6 @@ func (r FirewallAnalyticsReportBytimeGetParams) URLQuery() (v url.Values) { }) } -// Unit of time to group data by. -type FirewallAnalyticsReportBytimeGetParamsTimeDelta string - -const ( - FirewallAnalyticsReportBytimeGetParamsTimeDeltaAll FirewallAnalyticsReportBytimeGetParamsTimeDelta = "all" - FirewallAnalyticsReportBytimeGetParamsTimeDeltaAuto FirewallAnalyticsReportBytimeGetParamsTimeDelta = "auto" - FirewallAnalyticsReportBytimeGetParamsTimeDeltaYear FirewallAnalyticsReportBytimeGetParamsTimeDelta = "year" - FirewallAnalyticsReportBytimeGetParamsTimeDeltaQuarter FirewallAnalyticsReportBytimeGetParamsTimeDelta = "quarter" - FirewallAnalyticsReportBytimeGetParamsTimeDeltaMonth FirewallAnalyticsReportBytimeGetParamsTimeDelta = "month" - FirewallAnalyticsReportBytimeGetParamsTimeDeltaWeek FirewallAnalyticsReportBytimeGetParamsTimeDelta = "week" - FirewallAnalyticsReportBytimeGetParamsTimeDeltaDay FirewallAnalyticsReportBytimeGetParamsTimeDelta = "day" - FirewallAnalyticsReportBytimeGetParamsTimeDeltaHour FirewallAnalyticsReportBytimeGetParamsTimeDelta = "hour" - FirewallAnalyticsReportBytimeGetParamsTimeDeltaDekaminute FirewallAnalyticsReportBytimeGetParamsTimeDelta = "dekaminute" - FirewallAnalyticsReportBytimeGetParamsTimeDeltaMinute FirewallAnalyticsReportBytimeGetParamsTimeDelta = "minute" -) - -func (r FirewallAnalyticsReportBytimeGetParamsTimeDelta) IsKnown() bool { - switch r { - case FirewallAnalyticsReportBytimeGetParamsTimeDeltaAll, FirewallAnalyticsReportBytimeGetParamsTimeDeltaAuto, FirewallAnalyticsReportBytimeGetParamsTimeDeltaYear, FirewallAnalyticsReportBytimeGetParamsTimeDeltaQuarter, FirewallAnalyticsReportBytimeGetParamsTimeDeltaMonth, FirewallAnalyticsReportBytimeGetParamsTimeDeltaWeek, FirewallAnalyticsReportBytimeGetParamsTimeDeltaDay, FirewallAnalyticsReportBytimeGetParamsTimeDeltaHour, FirewallAnalyticsReportBytimeGetParamsTimeDeltaDekaminute, FirewallAnalyticsReportBytimeGetParamsTimeDeltaMinute: - return true - } - return false -} - type FirewallAnalyticsReportBytimeGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/dns/firewallanalyticsreportbytime_test.go b/dns/firewallanalyticsreportbytime_test.go index 66f749cac80..74a1442e22b 100644 --- a/dns/firewallanalyticsreportbytime_test.go +++ b/dns/firewallanalyticsreportbytime_test.go @@ -16,7 +16,6 @@ import ( ) func TestFirewallAnalyticsReportBytimeGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -40,7 +39,7 @@ func TestFirewallAnalyticsReportBytimeGetWithOptionalParams(t *testing.T) { Metrics: cloudflare.F("queryCount,uncachedCount"), Since: cloudflare.F(time.Now()), Sort: cloudflare.F("+responseCode,-queryName"), - TimeDelta: cloudflare.F(dns.FirewallAnalyticsReportBytimeGetParamsTimeDeltaHour), + TimeDelta: cloudflare.F(dns.DeltaHour), Until: cloudflare.F(time.Now()), }, ) diff --git a/dns/record.go b/dns/record.go index 4d132329a9a..5593aac0ae7 100644 --- a/dns/record.go +++ b/dns/record.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -99,10 +99,10 @@ func (r *RecordService) ListAutoPaging(ctx context.Context, params RecordListPar } // Delete DNS Record -func (r *RecordService) Delete(ctx context.Context, dnsRecordID string, params RecordDeleteParams, opts ...option.RequestOption) (res *RecordDeleteResponse, err error) { +func (r *RecordService) Delete(ctx context.Context, dnsRecordID string, body RecordDeleteParams, opts ...option.RequestOption) (res *RecordDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env RecordDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/dns_records/%s", params.ZoneID, dnsRecordID) + path := fmt.Sprintf("zones/%s/dns_records/%s", body.ZoneID, dnsRecordID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -183,7 +183,7 @@ func (r *RecordService) Scan(ctx context.Context, params RecordScanParams, opts opts = append(r.Options[:], opts...) var env RecordScanResponseEnvelope path := fmt.Sprintf("zones/%s/dns_records/scan", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -3378,7 +3378,7 @@ func (r URIRecord) implementsDNSRecord() {} // Components of a URI record. type URIRecordData struct { // The record content. - Content string `json:"content"` + Target string `json:"target"` // The record weight. Weight float64 `json:"weight"` JSON uriRecordDataJSON `json:"-"` @@ -3386,7 +3386,7 @@ type URIRecordData struct { // uriRecordDataJSON contains the JSON metadata for the struct [URIRecordData] type uriRecordDataJSON struct { - Content apijson.Field + Target apijson.Field Weight apijson.Field raw string ExtraFields map[string]apijson.Field @@ -3445,7 +3445,7 @@ func (r URIRecordParam) implementsDNSRecordUnionParam() {} // Components of a URI record. type URIRecordDataParam struct { // The record content. - Content param.Field[string] `json:"content"` + Target param.Field[string] `json:"target"` // The record weight. Weight param.Field[float64] `json:"weight"` } @@ -3639,7 +3639,7 @@ type RecordListParams struct { // DNS record content. Content param.Field[string] `query:"content"` // Direction to order DNS records in. - Direction param.Field[RecordListParamsDirection] `query:"direction"` + Direction param.Field[shared.SortDirection] `query:"direction"` // Whether to match all search requirements or at least one (any). If set to `all`, // acts like a logical AND between filters. If set to `any`, acts like a logical OR // instead. Note that the interaction between tag filters is controlled by the @@ -3704,22 +3704,6 @@ func (r RecordListParamsComment) URLQuery() (v url.Values) { }) } -// Direction to order DNS records in. -type RecordListParamsDirection string - -const ( - RecordListParamsDirectionAsc RecordListParamsDirection = "asc" - RecordListParamsDirectionDesc RecordListParamsDirection = "desc" -) - -func (r RecordListParamsDirection) IsKnown() bool { - switch r { - case RecordListParamsDirectionAsc, RecordListParamsDirectionDesc: - return true - } - return false -} - // Whether to match all search requirements or at least one (any). If set to `all`, // acts like a logical AND between filters. If set to `any`, acts like a logical OR // instead. Note that the interaction between tag filters is controlled by the @@ -3847,11 +3831,6 @@ func (r RecordListParamsType) IsKnown() bool { type RecordDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r RecordDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type RecordDeleteResponseEnvelope struct { diff --git a/dns/record_test.go b/dns/record_test.go index 267e28141f4..b1b32f864a3 100644 --- a/dns/record_test.go +++ b/dns/record_test.go @@ -10,13 +10,13 @@ import ( "github.com/cloudflare/cloudflare-go/v2" "github.com/cloudflare/cloudflare-go/v2/dns" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) func TestRecordNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -51,7 +51,7 @@ func TestRecordNewWithOptionalParams(t *testing.T) { } func TestRecordUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -90,7 +90,6 @@ func TestRecordUpdateWithOptionalParams(t *testing.T) { } func TestRecordListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -114,7 +113,7 @@ func TestRecordListWithOptionalParams(t *testing.T) { Endswith: cloudflare.F("o, world"), }), Content: cloudflare.F("127.0.0.1"), - Direction: cloudflare.F(dns.RecordListParamsDirectionAsc), + Direction: cloudflare.F(shared.SortDirectionAsc), Match: cloudflare.F(dns.RecordListParamsMatchAny), Name: cloudflare.F("example.com"), Order: cloudflare.F(dns.RecordListParamsOrderType), @@ -143,7 +142,6 @@ func TestRecordListWithOptionalParams(t *testing.T) { } func TestRecordDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -161,7 +159,6 @@ func TestRecordDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", dns.RecordDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -174,7 +171,7 @@ func TestRecordDelete(t *testing.T) { } func TestRecordEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -213,7 +210,6 @@ func TestRecordEditWithOptionalParams(t *testing.T) { } func TestRecordExport(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -239,7 +235,6 @@ func TestRecordExport(t *testing.T) { } func TestRecordGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -269,7 +264,7 @@ func TestRecordGet(t *testing.T) { } func TestRecordImportWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -297,7 +292,6 @@ func TestRecordImportWithOptionalParams(t *testing.T) { } func TestRecordScan(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/dnssec/aliases.go b/dnssec/aliases.go index ed730a13824..7815bead076 100644 --- a/dnssec/aliases.go +++ b/dnssec/aliases.go @@ -4,7 +4,7 @@ package dnssec import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/dnssec/dnssec.go b/dnssec/dnssec.go index 2236c973e56..42dcdc62225 100644 --- a/dnssec/dnssec.go +++ b/dnssec/dnssec.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -35,10 +35,10 @@ func NewDNSSECService(opts ...option.RequestOption) (r *DNSSECService) { } // Delete DNSSEC. -func (r *DNSSECService) Delete(ctx context.Context, params DNSSECDeleteParams, opts ...option.RequestOption) (res *DNSSECDeleteResponseUnion, err error) { +func (r *DNSSECService) Delete(ctx context.Context, body DNSSECDeleteParams, opts ...option.RequestOption) (res *DNSSECDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env DNSSECDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/dnssec", params.ZoneID) + path := fmt.Sprintf("zones/%s/dnssec", body.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -181,11 +181,6 @@ func init() { type DNSSECDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r DNSSECDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type DNSSECDeleteResponseEnvelope struct { diff --git a/dnssec/dnssec_test.go b/dnssec/dnssec_test.go index 2e87d475d14..66ece721102 100644 --- a/dnssec/dnssec_test.go +++ b/dnssec/dnssec_test.go @@ -15,7 +15,6 @@ import ( ) func TestDNSSECDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -30,7 +29,6 @@ func TestDNSSECDelete(t *testing.T) { ) _, err := client.DNSSEC.Delete(context.TODO(), dnssec.DNSSECDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -42,7 +40,6 @@ func TestDNSSECDelete(t *testing.T) { } func TestDNSSECEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -71,7 +68,6 @@ func TestDNSSECEditWithOptionalParams(t *testing.T) { } func TestDNSSECGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/durable_objects/aliases.go b/durable_objects/aliases.go index 41c3b68a484..cab5083ba9d 100644 --- a/durable_objects/aliases.go +++ b/durable_objects/aliases.go @@ -4,7 +4,7 @@ package durable_objects import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/durable_objects/namespace.go b/durable_objects/namespace.go index dca9761392f..8805cd4abde 100644 --- a/durable_objects/namespace.go +++ b/durable_objects/namespace.go @@ -39,7 +39,7 @@ func (r *NamespaceService) List(ctx context.Context, query NamespaceListParams, opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/workers/durable_objects/namespaces", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/durable_objects/namespace_test.go b/durable_objects/namespace_test.go index 5703c74b69b..f2726ce1c30 100644 --- a/durable_objects/namespace_test.go +++ b/durable_objects/namespace_test.go @@ -15,7 +15,6 @@ import ( ) func TestNamespaceList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/durable_objects/namespaceobject_test.go b/durable_objects/namespaceobject_test.go index 23f3deef1ec..aba9d77d806 100644 --- a/durable_objects/namespaceobject_test.go +++ b/durable_objects/namespaceobject_test.go @@ -15,7 +15,6 @@ import ( ) func TestNamespaceObjectListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/email_routing/address.go b/email_routing/address.go index f1644572a7b..9475ed9b225 100644 --- a/email_routing/address.go +++ b/email_routing/address.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AddressService contains methods and other services that help with interacting @@ -148,9 +148,9 @@ func (r AddressNewParams) MarshalJSON() (data []byte, err error) { type AddressNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Address `json:"result,required"` // Whether the API call was successful Success AddressNewResponseEnvelopeSuccess `json:"success,required"` + Result Address `json:"result"` JSON addressNewResponseEnvelopeJSON `json:"-"` } @@ -159,8 +159,8 @@ type AddressNewResponseEnvelope struct { type addressNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -242,9 +242,9 @@ func (r AddressListParamsVerified) IsKnown() bool { type AddressDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Address `json:"result,required"` // Whether the API call was successful Success AddressDeleteResponseEnvelopeSuccess `json:"success,required"` + Result Address `json:"result"` JSON addressDeleteResponseEnvelopeJSON `json:"-"` } @@ -253,8 +253,8 @@ type AddressDeleteResponseEnvelope struct { type addressDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -285,9 +285,9 @@ func (r AddressDeleteResponseEnvelopeSuccess) IsKnown() bool { type AddressGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Address `json:"result,required"` // Whether the API call was successful Success AddressGetResponseEnvelopeSuccess `json:"success,required"` + Result Address `json:"result"` JSON addressGetResponseEnvelopeJSON `json:"-"` } @@ -296,8 +296,8 @@ type AddressGetResponseEnvelope struct { type addressGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/email_routing/address_test.go b/email_routing/address_test.go index 5b1ddf6f232..9ce0600551b 100644 --- a/email_routing/address_test.go +++ b/email_routing/address_test.go @@ -15,7 +15,6 @@ import ( ) func TestAddressNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestAddressNew(t *testing.T) { } func TestAddressListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -78,7 +76,6 @@ func TestAddressListWithOptionalParams(t *testing.T) { } func TestAddressDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -106,7 +103,6 @@ func TestAddressDelete(t *testing.T) { } func TestAddressGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/email_routing/aliases.go b/email_routing/aliases.go index 8674f4034a0..427c383fa0b 100644 --- a/email_routing/aliases.go +++ b/email_routing/aliases.go @@ -4,7 +4,7 @@ package email_routing import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/email_routing/dns.go b/email_routing/dns.go index 3eb565abce2..feb561decda 100644 --- a/email_routing/dns.go +++ b/email_routing/dns.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -153,9 +153,9 @@ func (r DNSRecordType) IsKnown() bool { type DNSGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result []DNSRecord `json:"result,required,nullable"` // Whether the API call was successful Success DNSGetResponseEnvelopeSuccess `json:"success,required"` + Result []DNSRecord `json:"result,nullable"` ResultInfo DNSGetResponseEnvelopeResultInfo `json:"result_info"` JSON dnsGetResponseEnvelopeJSON `json:"-"` } @@ -165,8 +165,8 @@ type DNSGetResponseEnvelope struct { type dnsGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field ResultInfo apijson.Field raw string ExtraFields map[string]apijson.Field diff --git a/email_routing/dns_test.go b/email_routing/dns_test.go index 50e7fa5772b..8a629dc5a36 100644 --- a/email_routing/dns_test.go +++ b/email_routing/dns_test.go @@ -14,7 +14,6 @@ import ( ) func TestDNSGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/email_routing/emailrouting.go b/email_routing/emailrouting.go index 35bded23be9..1268041038b 100644 --- a/email_routing/emailrouting.go +++ b/email_routing/emailrouting.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // EmailRoutingService contains methods and other services that help with @@ -44,7 +44,7 @@ func (r *EmailRoutingService) Disable(ctx context.Context, zoneIdentifier string opts = append(r.Options[:], opts...) var env EmailRoutingDisableResponseEnvelope path := fmt.Sprintf("zones/%s/email/routing/disable", zoneIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) if err != nil { return } @@ -57,7 +57,7 @@ func (r *EmailRoutingService) Enable(ctx context.Context, zoneIdentifier string, opts = append(r.Options[:], opts...) var env EmailRoutingEnableResponseEnvelope path := fmt.Sprintf("zones/%s/email/routing/enable", zoneIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) if err != nil { return } @@ -183,9 +183,9 @@ func (r EmailRoutingDisableParams) MarshalJSON() (data []byte, err error) { type EmailRoutingDisableResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Settings `json:"result,required"` // Whether the API call was successful Success EmailRoutingDisableResponseEnvelopeSuccess `json:"success,required"` + Result Settings `json:"result"` JSON emailRoutingDisableResponseEnvelopeJSON `json:"-"` } @@ -194,8 +194,8 @@ type EmailRoutingDisableResponseEnvelope struct { type emailRoutingDisableResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -234,9 +234,9 @@ func (r EmailRoutingEnableParams) MarshalJSON() (data []byte, err error) { type EmailRoutingEnableResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Settings `json:"result,required"` // Whether the API call was successful Success EmailRoutingEnableResponseEnvelopeSuccess `json:"success,required"` + Result Settings `json:"result"` JSON emailRoutingEnableResponseEnvelopeJSON `json:"-"` } @@ -245,8 +245,8 @@ type EmailRoutingEnableResponseEnvelope struct { type emailRoutingEnableResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -277,9 +277,9 @@ func (r EmailRoutingEnableResponseEnvelopeSuccess) IsKnown() bool { type EmailRoutingGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Settings `json:"result,required"` // Whether the API call was successful Success EmailRoutingGetResponseEnvelopeSuccess `json:"success,required"` + Result Settings `json:"result"` JSON emailRoutingGetResponseEnvelopeJSON `json:"-"` } @@ -288,8 +288,8 @@ type EmailRoutingGetResponseEnvelope struct { type emailRoutingGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/email_routing/emailrouting_test.go b/email_routing/emailrouting_test.go index 6bcafdd26b9..0e45ffcc969 100644 --- a/email_routing/emailrouting_test.go +++ b/email_routing/emailrouting_test.go @@ -15,7 +15,6 @@ import ( ) func TestEmailRoutingDisable(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestEmailRoutingDisable(t *testing.T) { } func TestEmailRoutingEnable(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -75,7 +73,6 @@ func TestEmailRoutingEnable(t *testing.T) { } func TestEmailRoutingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/email_routing/rule.go b/email_routing/rule.go index bd8ca9b70ae..7d1852ebb81 100644 --- a/email_routing/rule.go +++ b/email_routing/rule.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RuleService contains methods and other services that help with interacting with @@ -329,9 +329,9 @@ func (r RuleNewParamsEnabled) IsKnown() bool { type RuleNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result EmailRoutingRule `json:"result,required"` // Whether the API call was successful Success RuleNewResponseEnvelopeSuccess `json:"success,required"` + Result EmailRoutingRule `json:"result"` JSON ruleNewResponseEnvelopeJSON `json:"-"` } @@ -340,8 +340,8 @@ type RuleNewResponseEnvelope struct { type ruleNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -405,9 +405,9 @@ func (r RuleUpdateParamsEnabled) IsKnown() bool { type RuleUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result EmailRoutingRule `json:"result,required"` // Whether the API call was successful Success RuleUpdateResponseEnvelopeSuccess `json:"success,required"` + Result EmailRoutingRule `json:"result"` JSON ruleUpdateResponseEnvelopeJSON `json:"-"` } @@ -416,8 +416,8 @@ type RuleUpdateResponseEnvelope struct { type ruleUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -481,9 +481,9 @@ func (r RuleListParamsEnabled) IsKnown() bool { type RuleDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result EmailRoutingRule `json:"result,required"` // Whether the API call was successful Success RuleDeleteResponseEnvelopeSuccess `json:"success,required"` + Result EmailRoutingRule `json:"result"` JSON ruleDeleteResponseEnvelopeJSON `json:"-"` } @@ -492,8 +492,8 @@ type RuleDeleteResponseEnvelope struct { type ruleDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -524,9 +524,9 @@ func (r RuleDeleteResponseEnvelopeSuccess) IsKnown() bool { type RuleGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result EmailRoutingRule `json:"result,required"` // Whether the API call was successful Success RuleGetResponseEnvelopeSuccess `json:"success,required"` + Result EmailRoutingRule `json:"result"` JSON ruleGetResponseEnvelopeJSON `json:"-"` } @@ -535,8 +535,8 @@ type RuleGetResponseEnvelope struct { type ruleGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/email_routing/rule_test.go b/email_routing/rule_test.go index ec41c0dbb95..6e1965bd899 100644 --- a/email_routing/rule_test.go +++ b/email_routing/rule_test.go @@ -15,7 +15,6 @@ import ( ) func TestRuleNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -70,7 +69,6 @@ func TestRuleNewWithOptionalParams(t *testing.T) { } func TestRuleUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -126,7 +124,6 @@ func TestRuleUpdateWithOptionalParams(t *testing.T) { } func TestRuleListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -158,7 +155,6 @@ func TestRuleListWithOptionalParams(t *testing.T) { } func TestRuleDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -186,7 +182,6 @@ func TestRuleDelete(t *testing.T) { } func TestRuleGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/email_routing/rulecatchall.go b/email_routing/rulecatchall.go index e05779bd788..7bae3fb22e4 100644 --- a/email_routing/rulecatchall.go +++ b/email_routing/rulecatchall.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RuleCatchAllService contains methods and other services that help with @@ -296,11 +296,11 @@ func (r RuleCatchAllUpdateParamsEnabled) IsKnown() bool { } type RuleCatchAllUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result RuleCatchAllUpdateResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success RuleCatchAllUpdateResponseEnvelopeSuccess `json:"success,required"` + Result RuleCatchAllUpdateResponse `json:"result"` JSON ruleCatchAllUpdateResponseEnvelopeJSON `json:"-"` } @@ -309,8 +309,8 @@ type RuleCatchAllUpdateResponseEnvelope struct { type ruleCatchAllUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -339,11 +339,11 @@ func (r RuleCatchAllUpdateResponseEnvelopeSuccess) IsKnown() bool { } type RuleCatchAllGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result RuleCatchAllGetResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success RuleCatchAllGetResponseEnvelopeSuccess `json:"success,required"` + Result RuleCatchAllGetResponse `json:"result"` JSON ruleCatchAllGetResponseEnvelopeJSON `json:"-"` } @@ -352,8 +352,8 @@ type RuleCatchAllGetResponseEnvelope struct { type ruleCatchAllGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/email_routing/rulecatchall_test.go b/email_routing/rulecatchall_test.go index fc47c1c6205..22b490f9a5e 100644 --- a/email_routing/rulecatchall_test.go +++ b/email_routing/rulecatchall_test.go @@ -15,7 +15,6 @@ import ( ) func TestRuleCatchAllUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -63,7 +62,6 @@ func TestRuleCatchAllUpdateWithOptionalParams(t *testing.T) { } func TestRuleCatchAllGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/event_notifications/aliases.go b/event_notifications/aliases.go index 21ddf22f76c..3bc83366e43 100644 --- a/event_notifications/aliases.go +++ b/event_notifications/aliases.go @@ -4,7 +4,7 @@ package event_notifications import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/event_notifications/r2configuration.go b/event_notifications/r2configuration.go index 23c06736f8c..7c69c923768 100644 --- a/event_notifications/r2configuration.go +++ b/event_notifications/r2configuration.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // R2ConfigurationService contains methods and other services that help with @@ -48,7 +48,78 @@ func (r *R2ConfigurationService) Get(ctx context.Context, bucketName string, que return } -type R2ConfigurationGetResponse map[string]map[string]R2ConfigurationGetResponse +type R2ConfigurationGetResponse map[string]map[string]R2ConfigurationGetResponseItem + +type R2ConfigurationGetResponseItem struct { + // Queue ID that will receive notifications based on the configured rules + Queue string `json:"queue,required"` + // Array of rules to drive notifications + Rules []R2ConfigurationGetResponseItemRule `json:"rules,required"` + JSON r2ConfigurationGetResponseItemJSON `json:"-"` +} + +// r2ConfigurationGetResponseItemJSON contains the JSON metadata for the struct +// [R2ConfigurationGetResponseItem] +type r2ConfigurationGetResponseItemJSON struct { + Queue apijson.Field + Rules apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *R2ConfigurationGetResponseItem) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r r2ConfigurationGetResponseItemJSON) RawJSON() string { + return r.raw +} + +type R2ConfigurationGetResponseItemRule struct { + // Array of R2 object actions that will trigger notifications + Actions []R2ConfigurationGetResponseItemRulesAction `json:"actions,required"` + // Notifications will be sent only for objects with this prefix + Prefix string `json:"prefix"` + // Notifications will be sent only for objects with this suffix + Suffix string `json:"suffix"` + JSON r2ConfigurationGetResponseItemRuleJSON `json:"-"` +} + +// r2ConfigurationGetResponseItemRuleJSON contains the JSON metadata for the struct +// [R2ConfigurationGetResponseItemRule] +type r2ConfigurationGetResponseItemRuleJSON struct { + Actions apijson.Field + Prefix apijson.Field + Suffix apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *R2ConfigurationGetResponseItemRule) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r r2ConfigurationGetResponseItemRuleJSON) RawJSON() string { + return r.raw +} + +type R2ConfigurationGetResponseItemRulesAction string + +const ( + R2ConfigurationGetResponseItemRulesActionPutObject R2ConfigurationGetResponseItemRulesAction = "PutObject" + R2ConfigurationGetResponseItemRulesActionCopyObject R2ConfigurationGetResponseItemRulesAction = "CopyObject" + R2ConfigurationGetResponseItemRulesActionDeleteObject R2ConfigurationGetResponseItemRulesAction = "DeleteObject" + R2ConfigurationGetResponseItemRulesActionCompleteMultipartUpload R2ConfigurationGetResponseItemRulesAction = "CompleteMultipartUpload" + R2ConfigurationGetResponseItemRulesActionAbortMultipartUpload R2ConfigurationGetResponseItemRulesAction = "AbortMultipartUpload" +) + +func (r R2ConfigurationGetResponseItemRulesAction) IsKnown() bool { + switch r { + case R2ConfigurationGetResponseItemRulesActionPutObject, R2ConfigurationGetResponseItemRulesActionCopyObject, R2ConfigurationGetResponseItemRulesActionDeleteObject, R2ConfigurationGetResponseItemRulesActionCompleteMultipartUpload, R2ConfigurationGetResponseItemRulesActionAbortMultipartUpload: + return true + } + return false +} type R2ConfigurationGetParams struct { // Identifier diff --git a/event_notifications/r2configuration_test.go b/event_notifications/r2configuration_test.go index b8893110b45..0bd0542286a 100644 --- a/event_notifications/r2configuration_test.go +++ b/event_notifications/r2configuration_test.go @@ -15,7 +15,6 @@ import ( ) func TestR2ConfigurationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/event_notifications/r2configurationqueue.go b/event_notifications/r2configurationqueue.go index f1d4c6f5adb..fd4617bd284 100644 --- a/event_notifications/r2configurationqueue.go +++ b/event_notifications/r2configurationqueue.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/event_notifications/r2configurationqueue_test.go b/event_notifications/r2configurationqueue_test.go index 5186b21985c..8994ac66cd4 100644 --- a/event_notifications/r2configurationqueue_test.go +++ b/event_notifications/r2configurationqueue_test.go @@ -15,7 +15,6 @@ import ( ) func TestR2ConfigurationQueueUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -59,7 +58,6 @@ func TestR2ConfigurationQueueUpdateWithOptionalParams(t *testing.T) { } func TestR2ConfigurationQueueDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/filters/aliases.go b/filters/aliases.go index 93c946ad4c1..ad67b431907 100644 --- a/filters/aliases.go +++ b/filters/aliases.go @@ -4,7 +4,7 @@ package filters import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/filters/filter.go b/filters/filter.go index 8ed53f1a813..7883efa1a2f 100644 --- a/filters/filter.go +++ b/filters/filter.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // FilterService contains methods and other services that help with interacting @@ -86,7 +86,7 @@ func (r *FilterService) ListAutoPaging(ctx context.Context, zoneIdentifier strin } // Deletes an existing filter. -func (r *FilterService) Delete(ctx context.Context, zoneIdentifier string, id string, body FilterDeleteParams, opts ...option.RequestOption) (res *FirewallFilter, err error) { +func (r *FilterService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *FirewallFilter, err error) { opts = append(r.Options[:], opts...) var env FilterDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/filters/%s", zoneIdentifier, id) @@ -145,7 +145,7 @@ func (r firewallFilterJSON) RawJSON() string { return r.raw } -func (r FirewallFilter) implementsFirewallFirewallRuleFilter() {} +func (r FirewallFilter) ImplementsFirewallFirewallRuleFilter() {} type FilterNewParams struct { Body interface{} `json:"body,required"` @@ -307,14 +307,6 @@ func (r FilterListParams) URLQuery() (v url.Values) { }) } -type FilterDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r FilterDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type FilterDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/filters/filter_test.go b/filters/filter_test.go index f39799c8455..fedc66efbe2 100644 --- a/filters/filter_test.go +++ b/filters/filter_test.go @@ -15,7 +15,7 @@ import ( ) func TestFilterNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +45,7 @@ func TestFilterNew(t *testing.T) { } func TestFilterUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +76,6 @@ func TestFilterUpdate(t *testing.T) { } func TestFilterListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -112,7 +111,6 @@ func TestFilterListWithOptionalParams(t *testing.T) { } func TestFilterDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -129,9 +127,6 @@ func TestFilterDelete(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b61", - filters.FilterDeleteParams{ - Body: map[string]interface{}{}, - }, ) if err != nil { var apierr *cloudflare.Error @@ -143,7 +138,6 @@ func TestFilterDelete(t *testing.T) { } func TestFilterGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/firewall/accessrule.go b/firewall/accessrule.go index 81b293daa86..38f8d59c032 100644 --- a/firewall/accessrule.go +++ b/firewall/accessrule.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -101,17 +101,17 @@ func (r *AccessRuleService) ListAutoPaging(ctx context.Context, params AccessRul // Deletes an existing IP Access rule defined. // // Note: This operation will affect all zones in the account or zone. -func (r *AccessRuleService) Delete(ctx context.Context, identifier interface{}, params AccessRuleDeleteParams, opts ...option.RequestOption) (res *AccessRuleDeleteResponse, err error) { +func (r *AccessRuleService) Delete(ctx context.Context, identifier interface{}, body AccessRuleDeleteParams, opts ...option.RequestOption) (res *AccessRuleDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env AccessRuleDeleteResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.AccountID.Present { + if body.AccountID.Present { accountOrZone = "accounts" - accountOrZoneID = params.AccountID + accountOrZoneID = body.AccountID } else { accountOrZone = "zones" - accountOrZoneID = params.ZoneID + accountOrZoneID = body.ZoneID } path := fmt.Sprintf("%s/%s/firewall/access_rules/rules/%v", accountOrZone, accountOrZoneID, identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) @@ -703,17 +703,12 @@ func (r AccessRuleListParamsOrder) IsKnown() bool { } type AccessRuleDeleteParams struct { - Body interface{} `json:"body,required"` // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. AccountID param.Field[string] `path:"account_id"` // The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. ZoneID param.Field[string] `path:"zone_id"` } -func (r AccessRuleDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type AccessRuleDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/firewall/accessrule_test.go b/firewall/accessrule_test.go index 102a172c4c0..c467f75d54d 100644 --- a/firewall/accessrule_test.go +++ b/firewall/accessrule_test.go @@ -15,7 +15,7 @@ import ( ) func TestAccessRuleNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -48,7 +48,7 @@ func TestAccessRuleNewWithOptionalParams(t *testing.T) { } func TestAccessRuleListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -92,7 +92,7 @@ func TestAccessRuleListWithOptionalParams(t *testing.T) { } func TestAccessRuleDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -109,7 +109,6 @@ func TestAccessRuleDeleteWithOptionalParams(t *testing.T) { context.TODO(), map[string]interface{}{}, firewall.AccessRuleDeleteParams{ - Body: map[string]interface{}{}, AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), }, @@ -124,7 +123,7 @@ func TestAccessRuleDeleteWithOptionalParams(t *testing.T) { } func TestAccessRuleEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -161,7 +160,7 @@ func TestAccessRuleEditWithOptionalParams(t *testing.T) { } func TestAccessRuleGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/firewall/aliases.go b/firewall/aliases.go index 942b054ca96..8f069993d77 100644 --- a/firewall/aliases.go +++ b/firewall/aliases.go @@ -4,7 +4,7 @@ package firewall import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/firewall/lockdown.go b/firewall/lockdown.go index 4d509127efa..d884a8291d7 100644 --- a/firewall/lockdown.go +++ b/firewall/lockdown.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -89,7 +89,7 @@ func (r *LockdownService) ListAutoPaging(ctx context.Context, zoneIdentifier str } // Deletes an existing Zone Lockdown rule. -func (r *LockdownService) Delete(ctx context.Context, zoneIdentifier string, id string, body LockdownDeleteParams, opts ...option.RequestOption) (res *LockdownDeleteResponse, err error) { +func (r *LockdownService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *LockdownDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env LockdownDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/firewall/lockdowns/%s", zoneIdentifier, id) @@ -194,34 +194,6 @@ func (r ConfigurationTarget) IsKnown() bool { return false } -// A list of IP addresses or CIDR ranges that will be allowed to access the URLs -// specified in the Zone Lockdown rule. You can include any number of `ip` or -// `ip_range` configurations. -type ConfigurationParam struct { - // The configuration target. You must set the target to `ip` when specifying an IP - // address in the Zone Lockdown rule. - Target param.Field[ConfigurationTarget] `json:"target"` - // The IP address to match. This address will be compared to the IP address of - // incoming requests. - Value param.Field[string] `json:"value"` -} - -func (r ConfigurationParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -func (r ConfigurationParam) implementsFirewallConfigurationUnionParam() {} - -// A list of IP addresses or CIDR ranges that will be allowed to access the URLs -// specified in the Zone Lockdown rule. You can include any number of `ip` or -// `ip_range` configurations. -// -// Satisfied by [firewall.LockdownIPConfigurationParam], -// [firewall.LockdownCIDRConfigurationParam], [ConfigurationParam]. -type ConfigurationUnionParam interface { - implementsFirewallConfigurationUnionParam() -} - type Lockdown struct { // The unique identifier of the Zone Lockdown rule. ID string `json:"id,required"` @@ -516,14 +488,6 @@ func (r LockdownListParams) URLQuery() (v url.Values) { }) } -type LockdownDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r LockdownDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type LockdownDeleteResponseEnvelope struct { Result LockdownDeleteResponse `json:"result"` JSON lockdownDeleteResponseEnvelopeJSON `json:"-"` diff --git a/firewall/lockdown_test.go b/firewall/lockdown_test.go index 37c38596048..1bca94b4556 100644 --- a/firewall/lockdown_test.go +++ b/firewall/lockdown_test.go @@ -16,7 +16,7 @@ import ( ) func TestLockdownNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +46,7 @@ func TestLockdownNew(t *testing.T) { } func TestLockdownUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +77,6 @@ func TestLockdownUpdate(t *testing.T) { } func TestLockdownListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -117,7 +116,6 @@ func TestLockdownListWithOptionalParams(t *testing.T) { } func TestLockdownDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -134,9 +132,6 @@ func TestLockdownDelete(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", - firewall.LockdownDeleteParams{ - Body: map[string]interface{}{}, - }, ) if err != nil { var apierr *cloudflare.Error @@ -148,7 +143,6 @@ func TestLockdownDelete(t *testing.T) { } func TestLockdownGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/firewall/rule.go b/firewall/rule.go index 5e9e1cd9eac..c6c27b01ef7 100644 --- a/firewall/rule.go +++ b/firewall/rule.go @@ -15,9 +15,9 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/rate_limits" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -90,11 +90,11 @@ func (r *RuleService) ListAutoPaging(ctx context.Context, zoneIdentifier string, } // Deletes an existing firewall rule. -func (r *RuleService) Delete(ctx context.Context, zoneIdentifier string, id string, body RuleDeleteParams, opts ...option.RequestOption) (res *FirewallRule, err error) { +func (r *RuleService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *FirewallRule, err error) { opts = append(r.Options[:], opts...) var env RuleDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/firewall/rules/%s", zoneIdentifier, id) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, body, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return } @@ -220,7 +220,7 @@ func (r FirewallRuleFilter) AsUnion() FirewallRuleFilterUnion { // Union satisfied by [filters.FirewallFilter] or [firewall.DeletedFilter]. type FirewallRuleFilterUnion interface { - implementsFirewallFirewallRuleFilter() + ImplementsFirewallFirewallRuleFilter() } func init() { @@ -283,7 +283,7 @@ func (r deletedFilterJSON) RawJSON() string { return r.raw } -func (r DeletedFilter) implementsFirewallFirewallRuleFilter() {} +func (r DeletedFilter) ImplementsFirewallFirewallRuleFilter() {} type RuleNewParams struct { Body interface{} `json:"body,required"` @@ -443,16 +443,6 @@ func (r RuleListParams) URLQuery() (v url.Values) { }) } -type RuleDeleteParams struct { - // When true, indicates that Cloudflare should also delete the associated filter if - // there are no other firewall rules referencing the filter. - DeleteFilterIfUnused param.Field[bool] `json:"delete_filter_if_unused"` -} - -func (r RuleDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type RuleDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/firewall/rule_test.go b/firewall/rule_test.go index 2d99b0534db..5061d3d1df8 100644 --- a/firewall/rule_test.go +++ b/firewall/rule_test.go @@ -15,7 +15,7 @@ import ( ) func TestRuleNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +45,7 @@ func TestRuleNew(t *testing.T) { } func TestRuleUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +76,6 @@ func TestRuleUpdate(t *testing.T) { } func TestRuleListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -110,8 +109,7 @@ func TestRuleListWithOptionalParams(t *testing.T) { } } -func TestRuleDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") +func TestRuleDelete(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -128,9 +126,6 @@ func TestRuleDeleteWithOptionalParams(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b60", - firewall.RuleDeleteParams{ - DeleteFilterIfUnused: cloudflare.F(true), - }, ) if err != nil { var apierr *cloudflare.Error @@ -142,7 +137,7 @@ func TestRuleDeleteWithOptionalParams(t *testing.T) { } func TestRuleEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -173,7 +168,6 @@ func TestRuleEdit(t *testing.T) { } func TestRuleGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/firewall/uarule.go b/firewall/uarule.go index bbddbba5b13..ab6b26aa5ec 100644 --- a/firewall/uarule.go +++ b/firewall/uarule.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -88,7 +88,7 @@ func (r *UARuleService) ListAutoPaging(ctx context.Context, zoneIdentifier strin } // Deletes an existing User Agent Blocking rule. -func (r *UARuleService) Delete(ctx context.Context, zoneIdentifier string, id string, body UARuleDeleteParams, opts ...option.RequestOption) (res *UARuleDeleteResponse, err error) { +func (r *UARuleService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *UARuleDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env UARuleDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/firewall/ua_rules/%s", zoneIdentifier, id) @@ -388,14 +388,6 @@ func (r UARuleListParams) URLQuery() (v url.Values) { }) } -type UARuleDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r UARuleDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type UARuleDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/firewall/uarule_test.go b/firewall/uarule_test.go index 909e141d2fc..b5b536148ae 100644 --- a/firewall/uarule_test.go +++ b/firewall/uarule_test.go @@ -15,7 +15,7 @@ import ( ) func TestUARuleNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +45,7 @@ func TestUARuleNew(t *testing.T) { } func TestUARuleUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +76,6 @@ func TestUARuleUpdate(t *testing.T) { } func TestUARuleListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -110,7 +109,6 @@ func TestUARuleListWithOptionalParams(t *testing.T) { } func TestUARuleDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -127,9 +125,6 @@ func TestUARuleDelete(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", - firewall.UARuleDeleteParams{ - Body: map[string]interface{}{}, - }, ) if err != nil { var apierr *cloudflare.Error @@ -141,7 +136,6 @@ func TestUARuleDelete(t *testing.T) { } func TestUARuleGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/firewall/wafoverride.go b/firewall/wafoverride.go index d3afc09ecd2..6ad6729648a 100644 --- a/firewall/wafoverride.go +++ b/firewall/wafoverride.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // WAFOverrideService contains methods and other services that help with @@ -100,7 +100,7 @@ func (r *WAFOverrideService) ListAutoPaging(ctx context.Context, zoneIdentifier // // **Note:** Applies only to the // [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). -func (r *WAFOverrideService) Delete(ctx context.Context, zoneIdentifier string, id string, body WAFOverrideDeleteParams, opts ...option.RequestOption) (res *WAFOverrideDeleteResponse, err error) { +func (r *WAFOverrideService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *WAFOverrideDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env WAFOverrideDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/firewall/waf/overrides/%s", zoneIdentifier, id) @@ -255,22 +255,22 @@ func (r RewriteActionDisable) IsKnown() bool { return false } -type WAFRule map[string]WAFRuleItem +type WAFRule map[string]WAFRuleItemItem // The WAF rule action to apply. -type WAFRuleItem string +type WAFRuleItemItem string const ( - WAFRuleItemChallenge WAFRuleItem = "challenge" - WAFRuleItemBlock WAFRuleItem = "block" - WAFRuleItemSimulate WAFRuleItem = "simulate" - WAFRuleItemDisable WAFRuleItem = "disable" - WAFRuleItemDefault WAFRuleItem = "default" + WAFRuleItemItemChallenge WAFRuleItemItem = "challenge" + WAFRuleItemItemBlock WAFRuleItemItem = "block" + WAFRuleItemItemSimulate WAFRuleItemItem = "simulate" + WAFRuleItemItemDisable WAFRuleItemItem = "disable" + WAFRuleItemItemDefault WAFRuleItemItem = "default" ) -func (r WAFRuleItem) IsKnown() bool { +func (r WAFRuleItemItem) IsKnown() bool { switch r { - case WAFRuleItemChallenge, WAFRuleItemBlock, WAFRuleItemSimulate, WAFRuleItemDisable, WAFRuleItemDefault: + case WAFRuleItemItemChallenge, WAFRuleItemItemBlock, WAFRuleItemItemSimulate, WAFRuleItemItemDisable, WAFRuleItemItemDefault: return true } return false @@ -415,14 +415,6 @@ func (r WAFOverrideListParams) URLQuery() (v url.Values) { }) } -type WAFOverrideDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r WAFOverrideDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type WAFOverrideDeleteResponseEnvelope struct { Result WAFOverrideDeleteResponse `json:"result"` JSON wafOverrideDeleteResponseEnvelopeJSON `json:"-"` diff --git a/firewall/wafoverride_test.go b/firewall/wafoverride_test.go index 1a187260cdf..46a08427d71 100644 --- a/firewall/wafoverride_test.go +++ b/firewall/wafoverride_test.go @@ -15,7 +15,7 @@ import ( ) func TestWAFOverrideNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +45,7 @@ func TestWAFOverrideNew(t *testing.T) { } func TestWAFOverrideUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +76,6 @@ func TestWAFOverrideUpdate(t *testing.T) { } func TestWAFOverrideListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -107,7 +106,6 @@ func TestWAFOverrideListWithOptionalParams(t *testing.T) { } func TestWAFOverrideDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -124,9 +122,6 @@ func TestWAFOverrideDelete(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "de677e5818985db1285d0e80225f06e5", - firewall.WAFOverrideDeleteParams{ - Body: map[string]interface{}{}, - }, ) if err != nil { var apierr *cloudflare.Error @@ -138,7 +133,6 @@ func TestWAFOverrideDelete(t *testing.T) { } func TestWAFOverrideGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/firewall/wafpackage.go b/firewall/wafpackage.go index ae9b1a2842a..0b84efe913d 100644 --- a/firewall/wafpackage.go +++ b/firewall/wafpackage.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/firewall/wafpackage_test.go b/firewall/wafpackage_test.go index 6abf2e73bfa..3b8cf81fc59 100644 --- a/firewall/wafpackage_test.go +++ b/firewall/wafpackage_test.go @@ -15,7 +15,7 @@ import ( ) func TestWAFPackageListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +50,6 @@ func TestWAFPackageListWithOptionalParams(t *testing.T) { } func TestWAFPackageGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/firewall/wafpackagegroup.go b/firewall/wafpackagegroup.go index 13c542f25fd..7fbe514fe0c 100644 --- a/firewall/wafpackagegroup.go +++ b/firewall/wafpackagegroup.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/firewall/wafpackagegroup_test.go b/firewall/wafpackagegroup_test.go index 61a96ef341c..86eb054d647 100644 --- a/firewall/wafpackagegroup_test.go +++ b/firewall/wafpackagegroup_test.go @@ -15,7 +15,6 @@ import ( ) func TestWAFPackageGroupListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -53,7 +52,6 @@ func TestWAFPackageGroupListWithOptionalParams(t *testing.T) { } func TestWAFPackageGroupEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -85,7 +83,6 @@ func TestWAFPackageGroupEditWithOptionalParams(t *testing.T) { } func TestWAFPackageGroupGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/firewall/wafpackagerule.go b/firewall/wafpackagerule.go index 50481126a48..845612f6f2b 100644 --- a/firewall/wafpackagerule.go +++ b/firewall/wafpackagerule.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -158,9 +158,10 @@ type WAFPackageRuleListResponse struct { AllowedModes interface{} `json:"allowed_modes"` // When set to `on`, the current WAF rule will be used when evaluating the request. // Applies to anomaly detection WAF rules. - Mode AllowedModesAnomaly `json:"mode,required"` - DefaultMode interface{} `json:"default_mode,required"` - JSON wafPackageRuleListResponseJSON `json:"-"` + Mode AllowedModesAnomaly `json:"mode,required"` + // The default action/mode of a rule. + DefaultMode WAFPackageRuleListResponseDefaultMode `json:"default_mode"` + JSON wafPackageRuleListResponseJSON `json:"-"` union WAFPackageRuleListResponseUnion } @@ -394,7 +395,6 @@ type WAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRule struct { ID string `json:"id,required"` // Defines the available modes for the current WAF rule. AllowedModes []WAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleAllowedMode `json:"allowed_modes,required"` - DefaultMode interface{} `json:"default_mode,required"` // The public description of the WAF rule. Description string `json:"description,required"` // The rule group to which the current WAF rule belongs. @@ -415,7 +415,6 @@ type WAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRule struct { type wafPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleJSON struct { ID apijson.Field AllowedModes apijson.Field - DefaultMode apijson.Field Description apijson.Field Group apijson.Field Mode apijson.Field @@ -470,6 +469,24 @@ func (r WAFPackageRuleListResponseWAFManagedRulesTraditionalAllowRuleMode) IsKno return false } +// The default action/mode of a rule. +type WAFPackageRuleListResponseDefaultMode string + +const ( + WAFPackageRuleListResponseDefaultModeDisable WAFPackageRuleListResponseDefaultMode = "disable" + WAFPackageRuleListResponseDefaultModeSimulate WAFPackageRuleListResponseDefaultMode = "simulate" + WAFPackageRuleListResponseDefaultModeBlock WAFPackageRuleListResponseDefaultMode = "block" + WAFPackageRuleListResponseDefaultModeChallenge WAFPackageRuleListResponseDefaultMode = "challenge" +) + +func (r WAFPackageRuleListResponseDefaultMode) IsKnown() bool { + switch r { + case WAFPackageRuleListResponseDefaultModeDisable, WAFPackageRuleListResponseDefaultModeSimulate, WAFPackageRuleListResponseDefaultModeBlock, WAFPackageRuleListResponseDefaultModeChallenge: + return true + } + return false +} + // When triggered, anomaly detection WAF rules contribute to an overall threat // score that will determine if a request is considered malicious. You can // configure the total scoring threshold through the 'sensitivity' property of the @@ -488,9 +505,10 @@ type WAFPackageRuleEditResponse struct { AllowedModes interface{} `json:"allowed_modes"` // When set to `on`, the current WAF rule will be used when evaluating the request. // Applies to anomaly detection WAF rules. - Mode AllowedModesAnomaly `json:"mode,required"` - DefaultMode interface{} `json:"default_mode,required"` - JSON wafPackageRuleEditResponseJSON `json:"-"` + Mode AllowedModesAnomaly `json:"mode,required"` + // The default action/mode of a rule. + DefaultMode WAFPackageRuleEditResponseDefaultMode `json:"default_mode"` + JSON wafPackageRuleEditResponseJSON `json:"-"` union WAFPackageRuleEditResponseUnion } @@ -724,7 +742,6 @@ type WAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule struct { ID string `json:"id,required"` // Defines the available modes for the current WAF rule. AllowedModes []WAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleAllowedMode `json:"allowed_modes,required"` - DefaultMode interface{} `json:"default_mode,required"` // The public description of the WAF rule. Description string `json:"description,required"` // The rule group to which the current WAF rule belongs. @@ -745,7 +762,6 @@ type WAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRule struct { type wafPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleJSON struct { ID apijson.Field AllowedModes apijson.Field - DefaultMode apijson.Field Description apijson.Field Group apijson.Field Mode apijson.Field @@ -800,6 +816,24 @@ func (r WAFPackageRuleEditResponseWAFManagedRulesTraditionalAllowRuleMode) IsKno return false } +// The default action/mode of a rule. +type WAFPackageRuleEditResponseDefaultMode string + +const ( + WAFPackageRuleEditResponseDefaultModeDisable WAFPackageRuleEditResponseDefaultMode = "disable" + WAFPackageRuleEditResponseDefaultModeSimulate WAFPackageRuleEditResponseDefaultMode = "simulate" + WAFPackageRuleEditResponseDefaultModeBlock WAFPackageRuleEditResponseDefaultMode = "block" + WAFPackageRuleEditResponseDefaultModeChallenge WAFPackageRuleEditResponseDefaultMode = "challenge" +) + +func (r WAFPackageRuleEditResponseDefaultMode) IsKnown() bool { + switch r { + case WAFPackageRuleEditResponseDefaultModeDisable, WAFPackageRuleEditResponseDefaultModeSimulate, WAFPackageRuleEditResponseDefaultModeBlock, WAFPackageRuleEditResponseDefaultModeChallenge: + return true + } + return false +} + // Union satisfied by [firewall.WAFPackageRuleGetResponseUnknown] or // [shared.UnionString]. type WAFPackageRuleGetResponseUnion interface { diff --git a/firewall/wafpackagerule_test.go b/firewall/wafpackagerule_test.go index 1cdf79b6960..19412d32d27 100644 --- a/firewall/wafpackagerule_test.go +++ b/firewall/wafpackagerule_test.go @@ -15,7 +15,6 @@ import ( ) func TestWAFPackageRuleListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -54,7 +53,6 @@ func TestWAFPackageRuleListWithOptionalParams(t *testing.T) { } func TestWAFPackageRuleEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -86,7 +84,6 @@ func TestWAFPackageRuleEditWithOptionalParams(t *testing.T) { } func TestWAFPackageRuleGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/healthchecks/aliases.go b/healthchecks/aliases.go index 9884095cb89..d17b62e3db5 100644 --- a/healthchecks/aliases.go +++ b/healthchecks/aliases.go @@ -4,7 +4,7 @@ package healthchecks import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/healthchecks/healthcheck.go b/healthchecks/healthcheck.go index 1916c5b0d4b..01a7f544a91 100644 --- a/healthchecks/healthcheck.go +++ b/healthchecks/healthcheck.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // HealthcheckService contains methods and other services that help with @@ -88,10 +88,10 @@ func (r *HealthcheckService) ListAutoPaging(ctx context.Context, params Healthch } // Delete a health check. -func (r *HealthcheckService) Delete(ctx context.Context, healthcheckID string, params HealthcheckDeleteParams, opts ...option.RequestOption) (res *HealthcheckDeleteResponse, err error) { +func (r *HealthcheckService) Delete(ctx context.Context, healthcheckID string, body HealthcheckDeleteParams, opts ...option.RequestOption) (res *HealthcheckDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env HealthcheckDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/healthchecks/%s", params.ZoneID, healthcheckID) + path := fmt.Sprintf("zones/%s/healthchecks/%s", body.ZoneID, healthcheckID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -588,11 +588,6 @@ func (r HealthcheckListParams) URLQuery() (v url.Values) { type HealthcheckDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r HealthcheckDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type HealthcheckDeleteResponseEnvelope struct { diff --git a/healthchecks/healthcheck_test.go b/healthchecks/healthcheck_test.go index 3edde20e3d2..66be1e01231 100644 --- a/healthchecks/healthcheck_test.go +++ b/healthchecks/healthcheck_test.go @@ -15,7 +15,6 @@ import ( ) func TestHealthcheckNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -75,7 +74,6 @@ func TestHealthcheckNewWithOptionalParams(t *testing.T) { } func TestHealthcheckUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -139,7 +137,6 @@ func TestHealthcheckUpdateWithOptionalParams(t *testing.T) { } func TestHealthcheckListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -167,7 +164,6 @@ func TestHealthcheckListWithOptionalParams(t *testing.T) { } func TestHealthcheckDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -185,7 +181,6 @@ func TestHealthcheckDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", healthchecks.HealthcheckDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -198,7 +193,6 @@ func TestHealthcheckDelete(t *testing.T) { } func TestHealthcheckEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -262,7 +256,6 @@ func TestHealthcheckEditWithOptionalParams(t *testing.T) { } func TestHealthcheckGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/healthchecks/preview.go b/healthchecks/preview.go index 2101e5169b2..12929aa480e 100644 --- a/healthchecks/preview.go +++ b/healthchecks/preview.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PreviewService contains methods and other services that help with interacting @@ -45,10 +45,10 @@ func (r *PreviewService) New(ctx context.Context, params PreviewNewParams, opts } // Delete a health check. -func (r *PreviewService) Delete(ctx context.Context, healthcheckID string, params PreviewDeleteParams, opts ...option.RequestOption) (res *PreviewDeleteResponse, err error) { +func (r *PreviewService) Delete(ctx context.Context, healthcheckID string, body PreviewDeleteParams, opts ...option.RequestOption) (res *PreviewDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env PreviewDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/healthchecks/preview/%s", params.ZoneID, healthcheckID) + path := fmt.Sprintf("zones/%s/healthchecks/preview/%s", body.ZoneID, healthcheckID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -148,11 +148,6 @@ func (r PreviewNewResponseEnvelopeSuccess) IsKnown() bool { type PreviewDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r PreviewDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type PreviewDeleteResponseEnvelope struct { diff --git a/healthchecks/preview_test.go b/healthchecks/preview_test.go index 47267ef08f0..68795d62341 100644 --- a/healthchecks/preview_test.go +++ b/healthchecks/preview_test.go @@ -15,7 +15,6 @@ import ( ) func TestPreviewNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -75,7 +74,6 @@ func TestPreviewNewWithOptionalParams(t *testing.T) { } func TestPreviewDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -93,7 +91,6 @@ func TestPreviewDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", healthchecks.PreviewDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -106,7 +103,6 @@ func TestPreviewDelete(t *testing.T) { } func TestPreviewGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/hostnames/aliases.go b/hostnames/aliases.go index 33c2b4381fa..b7f60a3475b 100644 --- a/hostnames/aliases.go +++ b/hostnames/aliases.go @@ -4,7 +4,7 @@ package hostnames import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/hostnames/settingtls.go b/hostnames/settingtls.go index 207abfb50a9..2717eb67736 100644 --- a/hostnames/settingtls.go +++ b/hostnames/settingtls.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -246,9 +246,9 @@ func (r SettingTLSUpdateParamsSettingID) IsKnown() bool { type SettingTLSUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Setting `json:"result,required"` // Whether the API call was successful Success SettingTLSUpdateResponseEnvelopeSuccess `json:"success,required"` + Result Setting `json:"result"` JSON settingTLSUpdateResponseEnvelopeJSON `json:"-"` } @@ -257,8 +257,8 @@ type SettingTLSUpdateResponseEnvelope struct { type settingTLSUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -309,11 +309,11 @@ func (r SettingTLSDeleteParamsSettingID) IsKnown() bool { } type SettingTLSDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result SettingTLSDeleteResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success SettingTLSDeleteResponseEnvelopeSuccess `json:"success,required"` + Result SettingTLSDeleteResponse `json:"result"` JSON settingTLSDeleteResponseEnvelopeJSON `json:"-"` } @@ -322,8 +322,8 @@ type SettingTLSDeleteResponseEnvelope struct { type settingTLSDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -374,11 +374,11 @@ func (r SettingTLSGetParamsSettingID) IsKnown() bool { } type SettingTLSGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result []SettingTLSGetResponse `json:"result,required,nullable"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success SettingTLSGetResponseEnvelopeSuccess `json:"success,required"` + Result []SettingTLSGetResponse `json:"result,nullable"` ResultInfo SettingTLSGetResponseEnvelopeResultInfo `json:"result_info"` JSON settingTLSGetResponseEnvelopeJSON `json:"-"` } @@ -388,8 +388,8 @@ type SettingTLSGetResponseEnvelope struct { type settingTLSGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field ResultInfo apijson.Field raw string ExtraFields map[string]apijson.Field diff --git a/hostnames/settingtls_test.go b/hostnames/settingtls_test.go index dfb2056f914..85f977be599 100644 --- a/hostnames/settingtls_test.go +++ b/hostnames/settingtls_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingTLSUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestSettingTLSUpdate(t *testing.T) { } func TestSettingTLSDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -78,7 +76,6 @@ func TestSettingTLSDelete(t *testing.T) { } func TestSettingTLSGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/hyperdrive/aliases.go b/hyperdrive/aliases.go index 69c8bf6b025..a786a9fcbb0 100644 --- a/hyperdrive/aliases.go +++ b/hyperdrive/aliases.go @@ -4,7 +4,7 @@ package hyperdrive import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/hyperdrive/config.go b/hyperdrive/config.go index 47b9116f50a..a0381faac5c 100644 --- a/hyperdrive/config.go +++ b/hyperdrive/config.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -66,7 +66,7 @@ func (r *ConfigService) List(ctx context.Context, query ConfigListParams, opts . opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/hyperdrive/configs", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/hyperdrive/config_test.go b/hyperdrive/config_test.go index 19dfd6b1936..5258d61dbd5 100644 --- a/hyperdrive/config_test.go +++ b/hyperdrive/config_test.go @@ -15,7 +15,7 @@ import ( ) func TestConfigNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -40,7 +40,7 @@ func TestConfigNewWithOptionalParams(t *testing.T) { Origin: cloudflare.F(hyperdrive.ConfigurationParam{ Database: cloudflare.F("postgres"), Host: cloudflare.F("database.example.com"), - Port: cloudflare.F(int64(0)), + Port: cloudflare.F(int64(5432)), Scheme: cloudflare.F(hyperdrive.ConfigurationSchemePostgres), User: cloudflare.F("postgres"), }), @@ -56,7 +56,7 @@ func TestConfigNewWithOptionalParams(t *testing.T) { } func TestConfigUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -84,7 +84,7 @@ func TestConfigUpdateWithOptionalParams(t *testing.T) { Origin: cloudflare.F(hyperdrive.ConfigurationParam{ Database: cloudflare.F("postgres"), Host: cloudflare.F("database.example.com"), - Port: cloudflare.F(int64(0)), + Port: cloudflare.F(int64(5432)), Scheme: cloudflare.F(hyperdrive.ConfigurationSchemePostgres), User: cloudflare.F("postgres"), }), @@ -101,7 +101,6 @@ func TestConfigUpdateWithOptionalParams(t *testing.T) { } func TestConfigList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -127,7 +126,6 @@ func TestConfigList(t *testing.T) { } func TestConfigDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -157,7 +155,7 @@ func TestConfigDelete(t *testing.T) { } func TestConfigEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -185,7 +183,7 @@ func TestConfigEditWithOptionalParams(t *testing.T) { Origin: cloudflare.F(hyperdrive.ConfigurationParam{ Database: cloudflare.F("postgres"), Host: cloudflare.F("database.example.com"), - Port: cloudflare.F(int64(0)), + Port: cloudflare.F(int64(5432)), Scheme: cloudflare.F(hyperdrive.ConfigurationSchemePostgres), User: cloudflare.F("postgres"), }), @@ -202,7 +200,6 @@ func TestConfigEditWithOptionalParams(t *testing.T) { } func TestConfigGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/images/aliases.go b/images/aliases.go index 9a9ac5f5afe..b3ed3249cea 100644 --- a/images/aliases.go +++ b/images/aliases.go @@ -4,7 +4,7 @@ package images import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/images/v1.go b/images/v1.go index 5508db86710..01f9ed0413c 100644 --- a/images/v1.go +++ b/images/v1.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -87,10 +87,10 @@ func (r *V1Service) ListAutoPaging(ctx context.Context, params V1ListParams, opt // Delete an image on Cloudflare Images. On success, all copies of the image are // deleted and purged from cache. -func (r *V1Service) Delete(ctx context.Context, imageID string, params V1DeleteParams, opts ...option.RequestOption) (res *V1DeleteResponseUnion, err error) { +func (r *V1Service) Delete(ctx context.Context, imageID string, body V1DeleteParams, opts ...option.RequestOption) (res *V1DeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env V1DeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/images/v1/%s", params.AccountID, imageID) + path := fmt.Sprintf("accounts/%s/images/v1/%s", body.AccountID, imageID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -352,11 +352,6 @@ func (r V1ListParams) URLQuery() (v url.Values) { type V1DeleteParams struct { // Account identifier tag. AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r V1DeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type V1DeleteResponseEnvelope struct { diff --git a/images/v1_test.go b/images/v1_test.go index 3971ac966bf..d6b577b1884 100644 --- a/images/v1_test.go +++ b/images/v1_test.go @@ -15,7 +15,7 @@ import ( ) func TestV1NewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +45,6 @@ func TestV1NewWithOptionalParams(t *testing.T) { } func TestV1ListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -73,7 +72,6 @@ func TestV1ListWithOptionalParams(t *testing.T) { } func TestV1Delete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -91,7 +89,6 @@ func TestV1Delete(t *testing.T) { "string", images.V1DeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -104,7 +101,6 @@ func TestV1Delete(t *testing.T) { } func TestV1EditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -136,7 +132,6 @@ func TestV1EditWithOptionalParams(t *testing.T) { } func TestV1Get(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/images/v1blob_test.go b/images/v1blob_test.go index 2526efe0181..5670f99fda2 100644 --- a/images/v1blob_test.go +++ b/images/v1blob_test.go @@ -17,7 +17,6 @@ import ( ) func TestV1BlobGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) w.Write([]byte("abc")) diff --git a/images/v1key.go b/images/v1key.go index 706ddc05ad8..3ac957bce67 100644 --- a/images/v1key.go +++ b/images/v1key.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // V1KeyService contains methods and other services that help with interacting with diff --git a/images/v1key_test.go b/images/v1key_test.go index 670ae3783c8..2364962a5b7 100644 --- a/images/v1key_test.go +++ b/images/v1key_test.go @@ -15,7 +15,6 @@ import ( ) func TestV1KeyUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestV1KeyUpdate(t *testing.T) { } func TestV1KeyList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -71,7 +69,6 @@ func TestV1KeyList(t *testing.T) { } func TestV1KeyDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/images/v1stat.go b/images/v1stat.go index eb1dcc00949..bfeaf0d5f50 100644 --- a/images/v1stat.go +++ b/images/v1stat.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // V1StatService contains methods and other services that help with interacting diff --git a/images/v1stat_test.go b/images/v1stat_test.go index 0e7079513ff..8add044cd63 100644 --- a/images/v1stat_test.go +++ b/images/v1stat_test.go @@ -15,7 +15,6 @@ import ( ) func TestV1StatGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/images/v1variant.go b/images/v1variant.go index 1e1222b24a2..21fe4af4e91 100644 --- a/images/v1variant.go +++ b/images/v1variant.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -60,10 +60,10 @@ func (r *V1VariantService) List(ctx context.Context, query V1VariantListParams, } // Deleting a variant purges the cache for all images associated with the variant. -func (r *V1VariantService) Delete(ctx context.Context, variantID string, params V1VariantDeleteParams, opts ...option.RequestOption) (res *V1VariantDeleteResponseUnion, err error) { +func (r *V1VariantService) Delete(ctx context.Context, variantID string, body V1VariantDeleteParams, opts ...option.RequestOption) (res *V1VariantDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env V1VariantDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/images/v1/variants/%s", params.AccountID, variantID) + path := fmt.Sprintf("accounts/%s/images/v1/variants/%s", body.AccountID, variantID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -773,11 +773,6 @@ func (r V1VariantListResponseEnvelopeSuccess) IsKnown() bool { type V1VariantDeleteParams struct { // Account identifier tag. AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r V1VariantDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type V1VariantDeleteResponseEnvelope struct { diff --git a/images/v1variant_test.go b/images/v1variant_test.go index 75b21ec3790..613c3e394c1 100644 --- a/images/v1variant_test.go +++ b/images/v1variant_test.go @@ -15,7 +15,6 @@ import ( ) func TestV1VariantNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestV1VariantNewWithOptionalParams(t *testing.T) { } func TestV1VariantList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -75,7 +73,6 @@ func TestV1VariantList(t *testing.T) { } func TestV1VariantDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -93,7 +90,6 @@ func TestV1VariantDelete(t *testing.T) { "hero", images.V1VariantDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -106,7 +102,6 @@ func TestV1VariantDelete(t *testing.T) { } func TestV1VariantEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -143,7 +138,6 @@ func TestV1VariantEditWithOptionalParams(t *testing.T) { } func TestV1VariantGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/images/v2.go b/images/v2.go index 335c89a0e2f..9110704bf20 100644 --- a/images/v2.go +++ b/images/v2.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // V2Service contains methods and other services that help with interacting with diff --git a/images/v2_test.go b/images/v2_test.go index 3c0155f5dfe..9640ba02824 100644 --- a/images/v2_test.go +++ b/images/v2_test.go @@ -15,7 +15,6 @@ import ( ) func TestV2ListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/images/v2directupload.go b/images/v2directupload.go index 8bc3f3edb5e..ba55009eff0 100644 --- a/images/v2directupload.go +++ b/images/v2directupload.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // V2DirectUploadService contains methods and other services that help with diff --git a/images/v2directupload_test.go b/images/v2directupload_test.go index 70bcaee3491..95e3e8344b5 100644 --- a/images/v2directupload_test.go +++ b/images/v2directupload_test.go @@ -16,7 +16,7 @@ import ( ) func TestV2DirectUploadNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/aliases.go b/intel/aliases.go index 3e135f84773..8f36b379469 100644 --- a/intel/aliases.go +++ b/intel/aliases.go @@ -4,7 +4,7 @@ package intel import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/intel/asn.go b/intel/asn.go index dd2e71d4630..c546ec4f60c 100644 --- a/intel/asn.go +++ b/intel/asn.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ASNService contains methods and other services that help with interacting with @@ -54,9 +54,9 @@ type ASNGetParams struct { type ASNGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result shared.ASN `json:"result,required"` // Whether the API call was successful Success ASNGetResponseEnvelopeSuccess `json:"success,required"` + Result shared.ASN `json:"result"` JSON asnGetResponseEnvelopeJSON `json:"-"` } @@ -65,8 +65,8 @@ type ASNGetResponseEnvelope struct { type asnGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/intel/asn_test.go b/intel/asn_test.go index 5e348aebd99..37efdae2f48 100644 --- a/intel/asn_test.go +++ b/intel/asn_test.go @@ -15,7 +15,6 @@ import ( ) func TestASNGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/asnsubnet.go b/intel/asnsubnet.go index 5132a2f398a..245d30e60ab 100644 --- a/intel/asnsubnet.go +++ b/intel/asnsubnet.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ASNSubnetService contains methods and other services that help with interacting diff --git a/intel/asnsubnet_test.go b/intel/asnsubnet_test.go index bc3a7fcdacd..92692f20501 100644 --- a/intel/asnsubnet_test.go +++ b/intel/asnsubnet_test.go @@ -15,7 +15,6 @@ import ( ) func TestASNSubnetGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/attacksurfacereportissue.go b/intel/attacksurfacereportissue.go index 98a16d2b4bd..2e676ff5bd0 100644 --- a/intel/attacksurfacereportissue.go +++ b/intel/attacksurfacereportissue.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -113,8 +113,6 @@ func (r *AttackSurfaceReportIssueService) Type(ctx context.Context, params Attac return } -type IssueClassParam []string - type IssueType string const ( @@ -133,8 +131,6 @@ func (r IssueType) IsKnown() bool { return false } -type ProductParam []string - type SeverityQueryParam string const ( @@ -151,8 +147,6 @@ func (r SeverityQueryParam) IsKnown() bool { return false } -type SubjectParam []string - type AttackSurfaceReportIssueListResponse struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` @@ -212,18 +206,18 @@ func (r attackSurfaceReportIssueListResponseResultJSON) RawJSON() string { } type AttackSurfaceReportIssueListResponseResultIssue struct { - ID string `json:"id"` - Dismissed bool `json:"dismissed"` - IssueClass string `json:"issue_class"` - IssueType AttackSurfaceReportIssueListResponseResultIssuesIssueType `json:"issue_type"` - Payload interface{} `json:"payload"` - ResolveLink string `json:"resolve_link"` - ResolveText string `json:"resolve_text"` - Severity AttackSurfaceReportIssueListResponseResultIssuesSeverity `json:"severity"` - Since time.Time `json:"since" format:"date-time"` - Subject string `json:"subject"` - Timestamp time.Time `json:"timestamp" format:"date-time"` - JSON attackSurfaceReportIssueListResponseResultIssueJSON `json:"-"` + ID string `json:"id"` + Dismissed bool `json:"dismissed"` + IssueClass string `json:"issue_class"` + IssueType IssueType `json:"issue_type"` + Payload interface{} `json:"payload"` + ResolveLink string `json:"resolve_link"` + ResolveText string `json:"resolve_text"` + Severity AttackSurfaceReportIssueListResponseResultIssuesSeverity `json:"severity"` + Since time.Time `json:"since" format:"date-time"` + Subject string `json:"subject"` + Timestamp time.Time `json:"timestamp" format:"date-time"` + JSON attackSurfaceReportIssueListResponseResultIssueJSON `json:"-"` } // attackSurfaceReportIssueListResponseResultIssueJSON contains the JSON metadata @@ -252,24 +246,6 @@ func (r attackSurfaceReportIssueListResponseResultIssueJSON) RawJSON() string { return r.raw } -type AttackSurfaceReportIssueListResponseResultIssuesIssueType string - -const ( - AttackSurfaceReportIssueListResponseResultIssuesIssueTypeComplianceViolation AttackSurfaceReportIssueListResponseResultIssuesIssueType = "compliance_violation" - AttackSurfaceReportIssueListResponseResultIssuesIssueTypeEmailSecurity AttackSurfaceReportIssueListResponseResultIssuesIssueType = "email_security" - AttackSurfaceReportIssueListResponseResultIssuesIssueTypeExposedInfrastructure AttackSurfaceReportIssueListResponseResultIssuesIssueType = "exposed_infrastructure" - AttackSurfaceReportIssueListResponseResultIssuesIssueTypeInsecureConfiguration AttackSurfaceReportIssueListResponseResultIssuesIssueType = "insecure_configuration" - AttackSurfaceReportIssueListResponseResultIssuesIssueTypeWeakAuthentication AttackSurfaceReportIssueListResponseResultIssuesIssueType = "weak_authentication" -) - -func (r AttackSurfaceReportIssueListResponseResultIssuesIssueType) IsKnown() bool { - switch r { - case AttackSurfaceReportIssueListResponseResultIssuesIssueTypeComplianceViolation, AttackSurfaceReportIssueListResponseResultIssuesIssueTypeEmailSecurity, AttackSurfaceReportIssueListResponseResultIssuesIssueTypeExposedInfrastructure, AttackSurfaceReportIssueListResponseResultIssuesIssueTypeInsecureConfiguration, AttackSurfaceReportIssueListResponseResultIssuesIssueTypeWeakAuthentication: - return true - } - return false -} - type AttackSurfaceReportIssueListResponseResultIssuesSeverity string const ( @@ -389,22 +365,22 @@ func (r attackSurfaceReportIssueTypeResponseJSON) RawJSON() string { type AttackSurfaceReportIssueListParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Dismissed param.Field[bool] `query:"dismissed"` - IssueClass param.Field[IssueClassParam] `query:"issue_class"` - IssueClassNeq param.Field[IssueClassParam] `query:"issue_class~neq"` - IssueType param.Field[[]IssueType] `query:"issue_type"` - IssueTypeNeq param.Field[[]IssueType] `query:"issue_type~neq"` + AccountID param.Field[string] `path:"account_id,required"` + Dismissed param.Field[bool] `query:"dismissed"` + IssueClass param.Field[[]string] `query:"issue_class"` + IssueClassNeq param.Field[[]string] `query:"issue_class~neq"` + IssueType param.Field[[]IssueType] `query:"issue_type"` + IssueTypeNeq param.Field[[]IssueType] `query:"issue_type~neq"` // Current page within paginated list of results Page param.Field[int64] `query:"page"` // Number of results per page of results PerPage param.Field[int64] `query:"per_page"` - Product param.Field[ProductParam] `query:"product"` - ProductNeq param.Field[ProductParam] `query:"product~neq"` + Product param.Field[[]string] `query:"product"` + ProductNeq param.Field[[]string] `query:"product~neq"` Severity param.Field[[]SeverityQueryParam] `query:"severity"` SeverityNeq param.Field[[]SeverityQueryParam] `query:"severity~neq"` - Subject param.Field[SubjectParam] `query:"subject"` - SubjectNeq param.Field[SubjectParam] `query:"subject~neq"` + Subject param.Field[[]string] `query:"subject"` + SubjectNeq param.Field[[]string] `query:"subject~neq"` } // URLQuery serializes [AttackSurfaceReportIssueListParams]'s query parameters as @@ -420,16 +396,16 @@ type AttackSurfaceReportIssueClassParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` Dismissed param.Field[bool] `query:"dismissed"` - IssueClass param.Field[IssueClassParam] `query:"issue_class"` - IssueClassNeq param.Field[IssueClassParam] `query:"issue_class~neq"` + IssueClass param.Field[[]string] `query:"issue_class"` + IssueClassNeq param.Field[[]string] `query:"issue_class~neq"` IssueType param.Field[[]IssueType] `query:"issue_type"` IssueTypeNeq param.Field[[]IssueType] `query:"issue_type~neq"` - Product param.Field[ProductParam] `query:"product"` - ProductNeq param.Field[ProductParam] `query:"product~neq"` + Product param.Field[[]string] `query:"product"` + ProductNeq param.Field[[]string] `query:"product~neq"` Severity param.Field[[]SeverityQueryParam] `query:"severity"` SeverityNeq param.Field[[]SeverityQueryParam] `query:"severity~neq"` - Subject param.Field[SubjectParam] `query:"subject"` - SubjectNeq param.Field[SubjectParam] `query:"subject~neq"` + Subject param.Field[[]string] `query:"subject"` + SubjectNeq param.Field[[]string] `query:"subject~neq"` } // URLQuery serializes [AttackSurfaceReportIssueClassParams]'s query parameters as @@ -541,16 +517,16 @@ type AttackSurfaceReportIssueSeverityParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` Dismissed param.Field[bool] `query:"dismissed"` - IssueClass param.Field[IssueClassParam] `query:"issue_class"` - IssueClassNeq param.Field[IssueClassParam] `query:"issue_class~neq"` + IssueClass param.Field[[]string] `query:"issue_class"` + IssueClassNeq param.Field[[]string] `query:"issue_class~neq"` IssueType param.Field[[]IssueType] `query:"issue_type"` IssueTypeNeq param.Field[[]IssueType] `query:"issue_type~neq"` - Product param.Field[ProductParam] `query:"product"` - ProductNeq param.Field[ProductParam] `query:"product~neq"` + Product param.Field[[]string] `query:"product"` + ProductNeq param.Field[[]string] `query:"product~neq"` Severity param.Field[[]SeverityQueryParam] `query:"severity"` SeverityNeq param.Field[[]SeverityQueryParam] `query:"severity~neq"` - Subject param.Field[SubjectParam] `query:"subject"` - SubjectNeq param.Field[SubjectParam] `query:"subject~neq"` + Subject param.Field[[]string] `query:"subject"` + SubjectNeq param.Field[[]string] `query:"subject~neq"` } // URLQuery serializes [AttackSurfaceReportIssueSeverityParams]'s query parameters @@ -609,16 +585,16 @@ type AttackSurfaceReportIssueTypeParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` Dismissed param.Field[bool] `query:"dismissed"` - IssueClass param.Field[IssueClassParam] `query:"issue_class"` - IssueClassNeq param.Field[IssueClassParam] `query:"issue_class~neq"` + IssueClass param.Field[[]string] `query:"issue_class"` + IssueClassNeq param.Field[[]string] `query:"issue_class~neq"` IssueType param.Field[[]IssueType] `query:"issue_type"` IssueTypeNeq param.Field[[]IssueType] `query:"issue_type~neq"` - Product param.Field[ProductParam] `query:"product"` - ProductNeq param.Field[ProductParam] `query:"product~neq"` + Product param.Field[[]string] `query:"product"` + ProductNeq param.Field[[]string] `query:"product~neq"` Severity param.Field[[]SeverityQueryParam] `query:"severity"` SeverityNeq param.Field[[]SeverityQueryParam] `query:"severity~neq"` - Subject param.Field[SubjectParam] `query:"subject"` - SubjectNeq param.Field[SubjectParam] `query:"subject~neq"` + Subject param.Field[[]string] `query:"subject"` + SubjectNeq param.Field[[]string] `query:"subject~neq"` } // URLQuery serializes [AttackSurfaceReportIssueTypeParams]'s query parameters as diff --git a/intel/attacksurfacereportissue_test.go b/intel/attacksurfacereportissue_test.go index 0384573822e..d130c6c15bc 100644 --- a/intel/attacksurfacereportissue_test.go +++ b/intel/attacksurfacereportissue_test.go @@ -15,7 +15,6 @@ import ( ) func TestAttackSurfaceReportIssueListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -54,7 +53,6 @@ func TestAttackSurfaceReportIssueListWithOptionalParams(t *testing.T) { } func TestAttackSurfaceReportIssueClassWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -91,7 +89,6 @@ func TestAttackSurfaceReportIssueClassWithOptionalParams(t *testing.T) { } func TestAttackSurfaceReportIssueDismissWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -122,7 +119,6 @@ func TestAttackSurfaceReportIssueDismissWithOptionalParams(t *testing.T) { } func TestAttackSurfaceReportIssueSeverityWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -159,7 +155,6 @@ func TestAttackSurfaceReportIssueSeverityWithOptionalParams(t *testing.T) { } func TestAttackSurfaceReportIssueTypeWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/attacksurfacereportissuetype.go b/intel/attacksurfacereportissuetype.go index af9df35cd01..d1e6b95a807 100644 --- a/intel/attacksurfacereportissuetype.go +++ b/intel/attacksurfacereportissuetype.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AttackSurfaceReportIssueTypeService contains methods and other services that diff --git a/intel/attacksurfacereportissuetype_test.go b/intel/attacksurfacereportissuetype_test.go index c10067441aa..86cc9f95cae 100644 --- a/intel/attacksurfacereportissuetype_test.go +++ b/intel/attacksurfacereportissuetype_test.go @@ -15,7 +15,6 @@ import ( ) func TestAttackSurfaceReportIssueTypeGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/dns.go b/intel/dns.go index 7f1cb07d88c..4ff47b12e5a 100644 --- a/intel/dns.go +++ b/intel/dns.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DNSService contains methods and other services that help with interacting with @@ -116,40 +116,12 @@ func (r dnsReverseRecordJSON) RawJSON() string { return r.raw } -type DNSParam struct { - // Total results returned based on your search parameters. - Count param.Field[float64] `json:"count"` - // Current page within paginated list of results. - Page param.Field[float64] `json:"page"` - // Number of results per page of results. - PerPage param.Field[float64] `json:"per_page"` - // Reverse DNS look-ups observed during the time period. - ReverseRecords param.Field[[]DNSReverseRecordParam] `json:"reverse_records"` -} - -func (r DNSParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type DNSReverseRecordParam struct { - // First seen date of the DNS record during the time period. - FirstSeen param.Field[time.Time] `json:"first_seen" format:"date"` - // Hostname that the IP was observed resolving to. - Hostname param.Field[interface{}] `json:"hostname"` - // Last seen date of the DNS record during the time period. - LastSeen param.Field[time.Time] `json:"last_seen" format:"date"` -} - -func (r DNSReverseRecordParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type DNSListResponse struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result DNS `json:"result,required"` // Whether the API call was successful Success DNSListResponseSuccess `json:"success,required"` + Result DNS `json:"result"` JSON dnsListResponseJSON `json:"-"` } @@ -157,8 +129,8 @@ type DNSListResponse struct { type dnsListResponseJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/intel/dns_test.go b/intel/dns_test.go index fb1700345f1..a1e5b3aab4c 100644 --- a/intel/dns_test.go +++ b/intel/dns_test.go @@ -16,7 +16,6 @@ import ( ) func TestDNSListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/domain.go b/intel/domain.go index 61baec62142..01dc8dd1e08 100644 --- a/intel/domain.go +++ b/intel/domain.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DomainService contains methods and other services that help with interacting @@ -239,9 +239,9 @@ func (r DomainGetParams) URLQuery() (v url.Values) { type DomainGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Domain `json:"result,required"` // Whether the API call was successful Success DomainGetResponseEnvelopeSuccess `json:"success,required"` + Result Domain `json:"result"` JSON domainGetResponseEnvelopeJSON `json:"-"` } @@ -250,8 +250,8 @@ type DomainGetResponseEnvelope struct { type domainGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/intel/domain_test.go b/intel/domain_test.go index fc74babe65a..35377c4df83 100644 --- a/intel/domain_test.go +++ b/intel/domain_test.go @@ -15,7 +15,6 @@ import ( ) func TestDomainGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/domainbulk.go b/intel/domainbulk.go index ee3d9225a59..4fff0851811 100644 --- a/intel/domainbulk.go +++ b/intel/domainbulk.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DomainBulkService contains methods and other services that help with interacting diff --git a/intel/domainbulk_test.go b/intel/domainbulk_test.go index e42b9bb2082..c1f8d21d276 100644 --- a/intel/domainbulk_test.go +++ b/intel/domainbulk_test.go @@ -15,7 +15,6 @@ import ( ) func TestDomainBulkGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/domainhistory.go b/intel/domainhistory.go index 552c9695c60..71238dafd23 100644 --- a/intel/domainhistory.go +++ b/intel/domainhistory.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DomainHistoryService contains methods and other services that help with diff --git a/intel/domainhistory_test.go b/intel/domainhistory_test.go index 8de27a27703..65f81860948 100644 --- a/intel/domainhistory_test.go +++ b/intel/domainhistory_test.go @@ -15,7 +15,6 @@ import ( ) func TestDomainHistoryGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/indicatorfeed.go b/intel/indicatorfeed.go index 87296245c6c..74e4a0bef02 100644 --- a/intel/indicatorfeed.go +++ b/intel/indicatorfeed.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // IndicatorFeedService contains methods and other services that help with @@ -23,6 +23,7 @@ import ( // instead. type IndicatorFeedService struct { Options []option.RequestOption + Snapshots *IndicatorFeedSnapshotService Permissions *IndicatorFeedPermissionService } @@ -32,6 +33,7 @@ type IndicatorFeedService struct { func NewIndicatorFeedService(opts ...option.RequestOption) (r *IndicatorFeedService) { r = &IndicatorFeedService{} r.Options = opts + r.Snapshots = NewIndicatorFeedSnapshotService(opts...) r.Permissions = NewIndicatorFeedPermissionService(opts...) return } @@ -49,11 +51,11 @@ func (r *IndicatorFeedService) New(ctx context.Context, params IndicatorFeedNewP return } -// Update indicator feed data +// Update indicator feed metadata func (r *IndicatorFeedService) Update(ctx context.Context, feedID int64, params IndicatorFeedUpdateParams, opts ...option.RequestOption) (res *IndicatorFeedUpdateResponse, err error) { opts = append(r.Options[:], opts...) var env IndicatorFeedUpdateResponseEnvelope - path := fmt.Sprintf("accounts/%s/intel/indicator-feeds/%v/snapshot", params.AccountID, feedID) + path := fmt.Sprintf("accounts/%s/intel/indicator-feeds/%v", params.AccountID, feedID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return @@ -68,7 +70,7 @@ func (r *IndicatorFeedService) List(ctx context.Context, query IndicatorFeedList opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/intel/indicator-feeds", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -114,6 +116,10 @@ type IndicatorFeedNewResponse struct { CreatedOn time.Time `json:"created_on" format:"date-time"` // The description of the example test Description string `json:"description"` + // Whether the indicator feed can be attributed to a provider + IsAttributable bool `json:"is_attributable"` + // Whether the indicator feed is exposed to customers + IsPublic bool `json:"is_public"` // The date and time when the data entry was last modified ModifiedOn time.Time `json:"modified_on" format:"date-time"` // The name of the indicator feed @@ -124,13 +130,15 @@ type IndicatorFeedNewResponse struct { // indicatorFeedNewResponseJSON contains the JSON metadata for the struct // [IndicatorFeedNewResponse] type indicatorFeedNewResponseJSON struct { - ID apijson.Field - CreatedOn apijson.Field - Description apijson.Field - ModifiedOn apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + IsAttributable apijson.Field + IsPublic apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *IndicatorFeedNewResponse) UnmarshalJSON(data []byte) (err error) { @@ -142,23 +150,35 @@ func (r indicatorFeedNewResponseJSON) RawJSON() string { } type IndicatorFeedUpdateResponse struct { - // Feed id - FileID int64 `json:"file_id"` - // Name of the file unified in our system - Filename string `json:"filename"` - // Current status of upload, should be unified - Status string `json:"status"` - JSON indicatorFeedUpdateResponseJSON `json:"-"` + // The unique identifier for the indicator feed + ID int64 `json:"id"` + // The date and time when the data entry was created + CreatedOn time.Time `json:"created_on" format:"date-time"` + // The description of the example test + Description string `json:"description"` + // Whether the indicator feed can be attributed to a provider + IsAttributable bool `json:"is_attributable"` + // Whether the indicator feed is exposed to customers + IsPublic bool `json:"is_public"` + // The date and time when the data entry was last modified + ModifiedOn time.Time `json:"modified_on" format:"date-time"` + // The name of the indicator feed + Name string `json:"name"` + JSON indicatorFeedUpdateResponseJSON `json:"-"` } // indicatorFeedUpdateResponseJSON contains the JSON metadata for the struct // [IndicatorFeedUpdateResponse] type indicatorFeedUpdateResponseJSON struct { - FileID apijson.Field - Filename apijson.Field - Status apijson.Field - raw string - ExtraFields map[string]apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + IsAttributable apijson.Field + IsPublic apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *IndicatorFeedUpdateResponse) UnmarshalJSON(data []byte) (err error) { @@ -176,6 +196,10 @@ type IndicatorFeedListResponse struct { CreatedOn time.Time `json:"created_on" format:"date-time"` // The description of the example test Description string `json:"description"` + // Whether the indicator feed can be attributed to a provider + IsAttributable bool `json:"is_attributable"` + // Whether the indicator feed is exposed to customers + IsPublic bool `json:"is_public"` // The date and time when the data entry was last modified ModifiedOn time.Time `json:"modified_on" format:"date-time"` // The name of the indicator feed @@ -186,13 +210,15 @@ type IndicatorFeedListResponse struct { // indicatorFeedListResponseJSON contains the JSON metadata for the struct // [IndicatorFeedListResponse] type indicatorFeedListResponseJSON struct { - ID apijson.Field - CreatedOn apijson.Field - Description apijson.Field - ModifiedOn apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field + ID apijson.Field + CreatedOn apijson.Field + Description apijson.Field + IsAttributable apijson.Field + IsPublic apijson.Field + ModifiedOn apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *IndicatorFeedListResponse) UnmarshalJSON(data []byte) (err error) { @@ -274,11 +300,11 @@ func (r IndicatorFeedNewParams) MarshalJSON() (data []byte, err error) { } type IndicatorFeedNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result IndicatorFeedNewResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success IndicatorFeedNewResponseEnvelopeSuccess `json:"success,required"` + Result IndicatorFeedNewResponse `json:"result"` JSON indicatorFeedNewResponseEnvelopeJSON `json:"-"` } @@ -287,8 +313,8 @@ type IndicatorFeedNewResponseEnvelope struct { type indicatorFeedNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -319,8 +345,12 @@ func (r IndicatorFeedNewResponseEnvelopeSuccess) IsKnown() bool { type IndicatorFeedUpdateParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - // The file to upload - Source param.Field[string] `json:"source"` + // The new description of the feed + FeedDescription param.Field[string] `json:"feed_description"` + // The new is_attributable value of the feed + IsAttributable param.Field[bool] `json:"is_attributable"` + // The new is_public value of the feed + IsPublic param.Field[bool] `json:"is_public"` } func (r IndicatorFeedUpdateParams) MarshalJSON() (data []byte, err error) { @@ -328,11 +358,11 @@ func (r IndicatorFeedUpdateParams) MarshalJSON() (data []byte, err error) { } type IndicatorFeedUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result IndicatorFeedUpdateResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success IndicatorFeedUpdateResponseEnvelopeSuccess `json:"success,required"` + Result IndicatorFeedUpdateResponse `json:"result"` JSON indicatorFeedUpdateResponseEnvelopeJSON `json:"-"` } @@ -341,8 +371,8 @@ type IndicatorFeedUpdateResponseEnvelope struct { type indicatorFeedUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -386,11 +416,11 @@ type IndicatorFeedGetParams struct { } type IndicatorFeedGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result IndicatorFeedGetResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success IndicatorFeedGetResponseEnvelopeSuccess `json:"success,required"` + Result IndicatorFeedGetResponse `json:"result"` JSON indicatorFeedGetResponseEnvelopeJSON `json:"-"` } @@ -399,8 +429,8 @@ type IndicatorFeedGetResponseEnvelope struct { type indicatorFeedGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/intel/indicatorfeed_test.go b/intel/indicatorfeed_test.go index 60ea6840b57..e3f2fb800e2 100644 --- a/intel/indicatorfeed_test.go +++ b/intel/indicatorfeed_test.go @@ -15,7 +15,6 @@ import ( ) func TestIndicatorFeedNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestIndicatorFeedNewWithOptionalParams(t *testing.T) { } func TestIndicatorFeedUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -60,8 +58,10 @@ func TestIndicatorFeedUpdateWithOptionalParams(t *testing.T) { context.TODO(), int64(12), intel.IndicatorFeedUpdateParams{ - AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Source: cloudflare.F("@/Users/me/test.stix2"), + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + FeedDescription: cloudflare.F("This is an example description"), + IsAttributable: cloudflare.F(true), + IsPublic: cloudflare.F(true), }, ) if err != nil { @@ -74,7 +74,6 @@ func TestIndicatorFeedUpdateWithOptionalParams(t *testing.T) { } func TestIndicatorFeedList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -100,7 +99,6 @@ func TestIndicatorFeedList(t *testing.T) { } func TestIndicatorFeedData(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -130,7 +128,6 @@ func TestIndicatorFeedData(t *testing.T) { } func TestIndicatorFeedGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/indicatorfeedpermission.go b/intel/indicatorfeedpermission.go index ae962e755b6..a7c3b73d06a 100644 --- a/intel/indicatorfeedpermission.go +++ b/intel/indicatorfeedpermission.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // IndicatorFeedPermissionService contains methods and other services that help @@ -98,6 +98,10 @@ type IndicatorFeedPermissionListResponse struct { ID int64 `json:"id"` // The description of the example test Description string `json:"description"` + // Whether the indicator feed can be attributed to a provider + IsAttributable bool `json:"is_attributable"` + // Whether the indicator feed is exposed to customers + IsPublic bool `json:"is_public"` // The name of the indicator feed Name string `json:"name"` JSON indicatorFeedPermissionListResponseJSON `json:"-"` @@ -106,11 +110,13 @@ type IndicatorFeedPermissionListResponse struct { // indicatorFeedPermissionListResponseJSON contains the JSON metadata for the // struct [IndicatorFeedPermissionListResponse] type indicatorFeedPermissionListResponseJSON struct { - ID apijson.Field - Description apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field + ID apijson.Field + Description apijson.Field + IsAttributable apijson.Field + IsPublic apijson.Field + Name apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *IndicatorFeedPermissionListResponse) UnmarshalJSON(data []byte) (err error) { @@ -157,11 +163,11 @@ func (r IndicatorFeedPermissionNewParams) MarshalJSON() (data []byte, err error) } type IndicatorFeedPermissionNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result IndicatorFeedPermissionNewResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success IndicatorFeedPermissionNewResponseEnvelopeSuccess `json:"success,required"` + Result IndicatorFeedPermissionNewResponse `json:"result"` JSON indicatorFeedPermissionNewResponseEnvelopeJSON `json:"-"` } @@ -170,8 +176,8 @@ type IndicatorFeedPermissionNewResponseEnvelope struct { type indicatorFeedPermissionNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -205,11 +211,11 @@ type IndicatorFeedPermissionListParams struct { } type IndicatorFeedPermissionListResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result []IndicatorFeedPermissionListResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success IndicatorFeedPermissionListResponseEnvelopeSuccess `json:"success,required"` + Result []IndicatorFeedPermissionListResponse `json:"result"` JSON indicatorFeedPermissionListResponseEnvelopeJSON `json:"-"` } @@ -218,8 +224,8 @@ type IndicatorFeedPermissionListResponseEnvelope struct { type indicatorFeedPermissionListResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -261,11 +267,11 @@ func (r IndicatorFeedPermissionDeleteParams) MarshalJSON() (data []byte, err err } type IndicatorFeedPermissionDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result IndicatorFeedPermissionDeleteResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success IndicatorFeedPermissionDeleteResponseEnvelopeSuccess `json:"success,required"` + Result IndicatorFeedPermissionDeleteResponse `json:"result"` JSON indicatorFeedPermissionDeleteResponseEnvelopeJSON `json:"-"` } @@ -274,8 +280,8 @@ type IndicatorFeedPermissionDeleteResponseEnvelope struct { type indicatorFeedPermissionDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/intel/indicatorfeedpermission_test.go b/intel/indicatorfeedpermission_test.go index d03140692aa..5467a49a029 100644 --- a/intel/indicatorfeedpermission_test.go +++ b/intel/indicatorfeedpermission_test.go @@ -15,7 +15,6 @@ import ( ) func TestIndicatorFeedPermissionNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestIndicatorFeedPermissionNewWithOptionalParams(t *testing.T) { } func TestIndicatorFeedPermissionList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestIndicatorFeedPermissionList(t *testing.T) { } func TestIndicatorFeedPermissionDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/indicatorfeedsnapshot.go b/intel/indicatorfeedsnapshot.go new file mode 100644 index 00000000000..0e36b78bc0b --- /dev/null +++ b/intel/indicatorfeedsnapshot.go @@ -0,0 +1,128 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package intel + +import ( + "context" + "fmt" + "net/http" + + "github.com/cloudflare/cloudflare-go/v2/internal/apijson" + "github.com/cloudflare/cloudflare-go/v2/internal/param" + "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" + "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" +) + +// IndicatorFeedSnapshotService contains methods and other services that help with +// interacting with the cloudflare API. Note, unlike clients, this service does not +// read variables from the environment automatically. You should not instantiate +// this service directly, and instead use the [NewIndicatorFeedSnapshotService] +// method instead. +type IndicatorFeedSnapshotService struct { + Options []option.RequestOption +} + +// NewIndicatorFeedSnapshotService generates a new service that applies the given +// options to each request. These options are applied after the parent client's +// options (if there is one), and before any request-specific options. +func NewIndicatorFeedSnapshotService(opts ...option.RequestOption) (r *IndicatorFeedSnapshotService) { + r = &IndicatorFeedSnapshotService{} + r.Options = opts + return +} + +// Update indicator feed data +func (r *IndicatorFeedSnapshotService) Update(ctx context.Context, feedID int64, params IndicatorFeedSnapshotUpdateParams, opts ...option.RequestOption) (res *IndicatorFeedSnapshotUpdateResponse, err error) { + opts = append(r.Options[:], opts...) + var env IndicatorFeedSnapshotUpdateResponseEnvelope + path := fmt.Sprintf("accounts/%s/intel/indicator-feeds/%v/snapshot", params.AccountID, feedID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type IndicatorFeedSnapshotUpdateResponse struct { + // Feed id + FileID int64 `json:"file_id"` + // Name of the file unified in our system + Filename string `json:"filename"` + // Current status of upload, should be unified + Status string `json:"status"` + JSON indicatorFeedSnapshotUpdateResponseJSON `json:"-"` +} + +// indicatorFeedSnapshotUpdateResponseJSON contains the JSON metadata for the +// struct [IndicatorFeedSnapshotUpdateResponse] +type indicatorFeedSnapshotUpdateResponseJSON struct { + FileID apijson.Field + Filename apijson.Field + Status apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IndicatorFeedSnapshotUpdateResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r indicatorFeedSnapshotUpdateResponseJSON) RawJSON() string { + return r.raw +} + +type IndicatorFeedSnapshotUpdateParams struct { + // Identifier + AccountID param.Field[string] `path:"account_id,required"` + // The file to upload + Source param.Field[string] `json:"source"` +} + +func (r IndicatorFeedSnapshotUpdateParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +type IndicatorFeedSnapshotUpdateResponseEnvelope struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // Whether the API call was successful + Success IndicatorFeedSnapshotUpdateResponseEnvelopeSuccess `json:"success,required"` + Result IndicatorFeedSnapshotUpdateResponse `json:"result"` + JSON indicatorFeedSnapshotUpdateResponseEnvelopeJSON `json:"-"` +} + +// indicatorFeedSnapshotUpdateResponseEnvelopeJSON contains the JSON metadata for +// the struct [IndicatorFeedSnapshotUpdateResponseEnvelope] +type indicatorFeedSnapshotUpdateResponseEnvelopeJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *IndicatorFeedSnapshotUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r indicatorFeedSnapshotUpdateResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type IndicatorFeedSnapshotUpdateResponseEnvelopeSuccess bool + +const ( + IndicatorFeedSnapshotUpdateResponseEnvelopeSuccessTrue IndicatorFeedSnapshotUpdateResponseEnvelopeSuccess = true +) + +func (r IndicatorFeedSnapshotUpdateResponseEnvelopeSuccess) IsKnown() bool { + switch r { + case IndicatorFeedSnapshotUpdateResponseEnvelopeSuccessTrue: + return true + } + return false +} diff --git a/intel/indicatorfeedsnapshot_test.go b/intel/indicatorfeedsnapshot_test.go new file mode 100644 index 00000000000..1744ee1930a --- /dev/null +++ b/intel/indicatorfeedsnapshot_test.go @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package intel_test + +import ( + "context" + "errors" + "os" + "testing" + + "github.com/cloudflare/cloudflare-go/v2" + "github.com/cloudflare/cloudflare-go/v2/intel" + "github.com/cloudflare/cloudflare-go/v2/internal/testutil" + "github.com/cloudflare/cloudflare-go/v2/option" +) + +func TestIndicatorFeedSnapshotUpdateWithOptionalParams(t *testing.T) { + t.Skip("TODO: investigate broken test") + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.Intel.IndicatorFeeds.Snapshots.Update( + context.TODO(), + int64(12), + intel.IndicatorFeedSnapshotUpdateParams{ + AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Source: cloudflare.F("@/Users/me/test.stix2"), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/intel/ip.go b/intel/ip.go index ad18b856d69..f440a672259 100644 --- a/intel/ip.go +++ b/intel/ip.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/intel/ip_test.go b/intel/ip_test.go index efa167b8f6c..20387116c3a 100644 --- a/intel/ip_test.go +++ b/intel/ip_test.go @@ -15,7 +15,6 @@ import ( ) func TestIPGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/iplist.go b/intel/iplist.go index 4f727dba9c5..4f32bc4d885 100644 --- a/intel/iplist.go +++ b/intel/iplist.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // IPListService contains methods and other services that help with interacting diff --git a/intel/iplist_test.go b/intel/iplist_test.go index cb817df57fd..6885ac2cf10 100644 --- a/intel/iplist_test.go +++ b/intel/iplist_test.go @@ -15,7 +15,6 @@ import ( ) func TestIPListGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/miscategorization.go b/intel/miscategorization.go index 4a3b7217fe7..19881b374fc 100644 --- a/intel/miscategorization.go +++ b/intel/miscategorization.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -106,11 +106,11 @@ func (r MiscategorizationNewParamsIndicatorType) IsKnown() bool { } type MiscategorizationNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result MiscategorizationNewResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success MiscategorizationNewResponseEnvelopeSuccess `json:"success,required"` + Result MiscategorizationNewResponseUnion `json:"result"` JSON miscategorizationNewResponseEnvelopeJSON `json:"-"` } @@ -119,8 +119,8 @@ type MiscategorizationNewResponseEnvelope struct { type miscategorizationNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/intel/miscategorization_test.go b/intel/miscategorization_test.go index 11936e603a2..a4f0d3a774b 100644 --- a/intel/miscategorization_test.go +++ b/intel/miscategorization_test.go @@ -15,7 +15,6 @@ import ( ) func TestMiscategorizationNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/sinkhole.go b/intel/sinkhole.go index 726252fb5cb..859afefefb4 100644 --- a/intel/sinkhole.go +++ b/intel/sinkhole.go @@ -38,7 +38,7 @@ func (r *SinkholeService) List(ctx context.Context, query SinkholeListParams, op opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/intel/sinkholes", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/intel/sinkhole_test.go b/intel/sinkhole_test.go index a3f131f8609..450d992ac53 100644 --- a/intel/sinkhole_test.go +++ b/intel/sinkhole_test.go @@ -15,7 +15,6 @@ import ( ) func TestSinkholeList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/intel/whois.go b/intel/whois.go index f30bca89a62..0f25671e566 100644 --- a/intel/whois.go +++ b/intel/whois.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // WhoisService contains methods and other services that help with interacting with @@ -35,7 +35,7 @@ func NewWhoisService(opts ...option.RequestOption) (r *WhoisService) { } // Get WHOIS Record -func (r *WhoisService) Get(ctx context.Context, params WhoisGetParams, opts ...option.RequestOption) (res *Whois, err error) { +func (r *WhoisService) Get(ctx context.Context, params WhoisGetParams, opts ...option.RequestOption) (res *WhoisGetResponse, err error) { opts = append(r.Options[:], opts...) var env WhoisGetResponseEnvelope path := fmt.Sprintf("accounts/%s/intel/whois", params.AccountID) @@ -47,39 +47,196 @@ func (r *WhoisService) Get(ctx context.Context, params WhoisGetParams, opts ...o return } -type Whois struct { - CreatedDate time.Time `json:"created_date" format:"date"` - Domain string `json:"domain"` - Nameservers []string `json:"nameservers"` - Registrant string `json:"registrant"` - RegistrantCountry string `json:"registrant_country"` - RegistrantEmail string `json:"registrant_email"` - RegistrantOrg string `json:"registrant_org"` - Registrar string `json:"registrar"` - UpdatedDate time.Time `json:"updated_date" format:"date"` - JSON whoisJSON `json:"-"` +type WhoisGetResponse struct { + Domain string `json:"domain,required"` + Extension string `json:"extension,required"` + Found bool `json:"found,required"` + Nameservers []string `json:"nameservers,required"` + Punycode string `json:"punycode,required"` + Registrant string `json:"registrant,required"` + Registrar string `json:"registrar,required"` + ID string `json:"id"` + AdministrativeCity string `json:"administrative_city"` + AdministrativeCountry string `json:"administrative_country"` + AdministrativeEmail string `json:"administrative_email"` + AdministrativeFax string `json:"administrative_fax"` + AdministrativeFaxExt string `json:"administrative_fax_ext"` + AdministrativeID string `json:"administrative_id"` + AdministrativeName string `json:"administrative_name"` + AdministrativeOrg string `json:"administrative_org"` + AdministrativePhone string `json:"administrative_phone"` + AdministrativePhoneExt string `json:"administrative_phone_ext"` + AdministrativePostalCode string `json:"administrative_postal_code"` + AdministrativeProvince string `json:"administrative_province"` + AdministrativeReferralURL string `json:"administrative_referral_url"` + AdministrativeStreet string `json:"administrative_street"` + BillingCity string `json:"billing_city"` + BillingCountry string `json:"billing_country"` + BillingEmail string `json:"billing_email"` + BillingFax string `json:"billing_fax"` + BillingFaxExt string `json:"billing_fax_ext"` + BillingID string `json:"billing_id"` + BillingName string `json:"billing_name"` + BillingOrg string `json:"billing_org"` + BillingPhone string `json:"billing_phone"` + BillingPhoneExt string `json:"billing_phone_ext"` + BillingPostalCode string `json:"billing_postal_code"` + BillingProvince string `json:"billing_province"` + BillingReferralURL string `json:"billing_referral_url"` + BillingStreet string `json:"billing_street"` + CreatedDate time.Time `json:"created_date" format:"date-time"` + CreatedDateRaw string `json:"created_date_raw"` + DNSSEC bool `json:"dnssec"` + ExpirationDate time.Time `json:"expiration_date" format:"date-time"` + ExpirationDateRaw string `json:"expiration_date_raw"` + RegistrantCity string `json:"registrant_city"` + RegistrantCountry string `json:"registrant_country"` + RegistrantEmail string `json:"registrant_email"` + RegistrantFax string `json:"registrant_fax"` + RegistrantFaxExt string `json:"registrant_fax_ext"` + RegistrantID string `json:"registrant_id"` + RegistrantName string `json:"registrant_name"` + RegistrantOrg string `json:"registrant_org"` + RegistrantPhone string `json:"registrant_phone"` + RegistrantPhoneExt string `json:"registrant_phone_ext"` + RegistrantPostalCode string `json:"registrant_postal_code"` + RegistrantProvince string `json:"registrant_province"` + RegistrantReferralURL string `json:"registrant_referral_url"` + RegistrantStreet string `json:"registrant_street"` + RegistrarCity string `json:"registrar_city"` + RegistrarCountry string `json:"registrar_country"` + RegistrarEmail string `json:"registrar_email"` + RegistrarFax string `json:"registrar_fax"` + RegistrarFaxExt string `json:"registrar_fax_ext"` + RegistrarID string `json:"registrar_id"` + RegistrarName string `json:"registrar_name"` + RegistrarOrg string `json:"registrar_org"` + RegistrarPhone string `json:"registrar_phone"` + RegistrarPhoneExt string `json:"registrar_phone_ext"` + RegistrarPostalCode string `json:"registrar_postal_code"` + RegistrarProvince string `json:"registrar_province"` + RegistrarReferralURL string `json:"registrar_referral_url"` + RegistrarStreet string `json:"registrar_street"` + Status []string `json:"status"` + TechnicalCity string `json:"technical_city"` + TechnicalCountry string `json:"technical_country"` + TechnicalEmail string `json:"technical_email"` + TechnicalFax string `json:"technical_fax"` + TechnicalFaxExt string `json:"technical_fax_ext"` + TechnicalID string `json:"technical_id"` + TechnicalName string `json:"technical_name"` + TechnicalOrg string `json:"technical_org"` + TechnicalPhone string `json:"technical_phone"` + TechnicalPhoneExt string `json:"technical_phone_ext"` + TechnicalPostalCode string `json:"technical_postal_code"` + TechnicalProvince string `json:"technical_province"` + TechnicalReferralURL string `json:"technical_referral_url"` + TechnicalStreet string `json:"technical_street"` + UpdatedDate time.Time `json:"updated_date" format:"date-time"` + UpdatedDateRaw string `json:"updated_date_raw"` + WhoisServer string `json:"whois_server"` + JSON whoisGetResponseJSON `json:"-"` } -// whoisJSON contains the JSON metadata for the struct [Whois] -type whoisJSON struct { - CreatedDate apijson.Field - Domain apijson.Field - Nameservers apijson.Field - Registrant apijson.Field - RegistrantCountry apijson.Field - RegistrantEmail apijson.Field - RegistrantOrg apijson.Field - Registrar apijson.Field - UpdatedDate apijson.Field - raw string - ExtraFields map[string]apijson.Field +// whoisGetResponseJSON contains the JSON metadata for the struct +// [WhoisGetResponse] +type whoisGetResponseJSON struct { + Domain apijson.Field + Extension apijson.Field + Found apijson.Field + Nameservers apijson.Field + Punycode apijson.Field + Registrant apijson.Field + Registrar apijson.Field + ID apijson.Field + AdministrativeCity apijson.Field + AdministrativeCountry apijson.Field + AdministrativeEmail apijson.Field + AdministrativeFax apijson.Field + AdministrativeFaxExt apijson.Field + AdministrativeID apijson.Field + AdministrativeName apijson.Field + AdministrativeOrg apijson.Field + AdministrativePhone apijson.Field + AdministrativePhoneExt apijson.Field + AdministrativePostalCode apijson.Field + AdministrativeProvince apijson.Field + AdministrativeReferralURL apijson.Field + AdministrativeStreet apijson.Field + BillingCity apijson.Field + BillingCountry apijson.Field + BillingEmail apijson.Field + BillingFax apijson.Field + BillingFaxExt apijson.Field + BillingID apijson.Field + BillingName apijson.Field + BillingOrg apijson.Field + BillingPhone apijson.Field + BillingPhoneExt apijson.Field + BillingPostalCode apijson.Field + BillingProvince apijson.Field + BillingReferralURL apijson.Field + BillingStreet apijson.Field + CreatedDate apijson.Field + CreatedDateRaw apijson.Field + DNSSEC apijson.Field + ExpirationDate apijson.Field + ExpirationDateRaw apijson.Field + RegistrantCity apijson.Field + RegistrantCountry apijson.Field + RegistrantEmail apijson.Field + RegistrantFax apijson.Field + RegistrantFaxExt apijson.Field + RegistrantID apijson.Field + RegistrantName apijson.Field + RegistrantOrg apijson.Field + RegistrantPhone apijson.Field + RegistrantPhoneExt apijson.Field + RegistrantPostalCode apijson.Field + RegistrantProvince apijson.Field + RegistrantReferralURL apijson.Field + RegistrantStreet apijson.Field + RegistrarCity apijson.Field + RegistrarCountry apijson.Field + RegistrarEmail apijson.Field + RegistrarFax apijson.Field + RegistrarFaxExt apijson.Field + RegistrarID apijson.Field + RegistrarName apijson.Field + RegistrarOrg apijson.Field + RegistrarPhone apijson.Field + RegistrarPhoneExt apijson.Field + RegistrarPostalCode apijson.Field + RegistrarProvince apijson.Field + RegistrarReferralURL apijson.Field + RegistrarStreet apijson.Field + Status apijson.Field + TechnicalCity apijson.Field + TechnicalCountry apijson.Field + TechnicalEmail apijson.Field + TechnicalFax apijson.Field + TechnicalFaxExt apijson.Field + TechnicalID apijson.Field + TechnicalName apijson.Field + TechnicalOrg apijson.Field + TechnicalPhone apijson.Field + TechnicalPhoneExt apijson.Field + TechnicalPostalCode apijson.Field + TechnicalProvince apijson.Field + TechnicalReferralURL apijson.Field + TechnicalStreet apijson.Field + UpdatedDate apijson.Field + UpdatedDateRaw apijson.Field + WhoisServer apijson.Field + raw string + ExtraFields map[string]apijson.Field } -func (r *Whois) UnmarshalJSON(data []byte) (err error) { +func (r *WhoisGetResponse) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r whoisJSON) RawJSON() string { +func (r whoisGetResponseJSON) RawJSON() string { return r.raw } @@ -100,9 +257,9 @@ func (r WhoisGetParams) URLQuery() (v url.Values) { type WhoisGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result Whois `json:"result,required"` // Whether the API call was successful Success WhoisGetResponseEnvelopeSuccess `json:"success,required"` + Result WhoisGetResponse `json:"result"` JSON whoisGetResponseEnvelopeJSON `json:"-"` } @@ -111,8 +268,8 @@ type WhoisGetResponseEnvelope struct { type whoisGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/intel/whois_test.go b/intel/whois_test.go index 688920c8be6..85465963b5e 100644 --- a/intel/whois_test.go +++ b/intel/whois_test.go @@ -15,7 +15,6 @@ import ( ) func TestWhoisGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/internal/apierror/apierror.go b/internal/apierror/apierror.go index 6e3ecaf72d2..070e2f2e15b 100644 --- a/internal/apierror/apierror.go +++ b/internal/apierror/apierror.go @@ -9,7 +9,7 @@ import ( "net/http/httputil" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // Error represents an error that originates from the API, i.e. when a request is diff --git a/internal/apijson/encoder.go b/internal/apijson/encoder.go index 3f164898b4c..ac5c84ddcda 100644 --- a/internal/apijson/encoder.go +++ b/internal/apijson/encoder.go @@ -359,6 +359,9 @@ func (e *encoder) encodeMapEntries(json []byte, v reflect.Value) ([]byte, error) if err != nil { return nil, err } + if len(encodedValue) == 0 { + continue + } json, err = sjson.SetRawBytes(json, string(p.key), encodedValue) if err != nil { return nil, err diff --git a/internal/apijson/port.go b/internal/apijson/port.go index e3dc59f2cfa..3ef39df17ee 100644 --- a/internal/apijson/port.go +++ b/internal/apijson/port.go @@ -63,9 +63,18 @@ func Port(from any, to any) error { } if value, ok := values[ptag.name]; ok { delete(values, ptag.name) - if value.Kind() == reflect.String { + switch value.Kind() { + case reflect.String: toVal.Field(i).SetString(value.String()) - } else { + case reflect.Bool: + toVal.Field(i).SetBool(value.Bool()) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + toVal.Field(i).SetInt(value.Int()) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + toVal.Field(i).SetUint(value.Uint()) + case reflect.Float32, reflect.Float64: + toVal.Field(i).SetFloat(value.Float()) + default: toVal.Field(i).Set(value) } } diff --git a/internal/version.go b/internal/version.go index 436f832652e..0759debdbf4 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "2.1.0" // x-release-please-version +const PackageVersion = "2.2.0" // x-release-please-version diff --git a/ips/aliases.go b/ips/aliases.go index aa9a5b80cc0..3ca7ad37acd 100644 --- a/ips/aliases.go +++ b/ips/aliases.go @@ -4,7 +4,7 @@ package ips import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/ips/ip.go b/ips/ip.go index 06513d4043b..151438d6c3d 100644 --- a/ips/ip.go +++ b/ips/ip.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/ips/ip_test.go b/ips/ip_test.go index cf31c45a8bd..17dc2984606 100644 --- a/ips/ip_test.go +++ b/ips/ip_test.go @@ -15,7 +15,6 @@ import ( ) func TestIPListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/keyless_certificates/aliases.go b/keyless_certificates/aliases.go index 376e523b597..8af37e4056e 100644 --- a/keyless_certificates/aliases.go +++ b/keyless_certificates/aliases.go @@ -4,7 +4,7 @@ package keyless_certificates import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/keyless_certificates/keylesscertificate.go b/keyless_certificates/keylesscertificate.go index 903d0dc2425..510d4ad133f 100644 --- a/keyless_certificates/keylesscertificate.go +++ b/keyless_certificates/keylesscertificate.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // KeylessCertificateService contains methods and other services that help with @@ -54,7 +54,7 @@ func (r *KeylessCertificateService) List(ctx context.Context, query KeylessCerti opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("zones/%s/keyless_certificates", query.ZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -72,10 +72,10 @@ func (r *KeylessCertificateService) ListAutoPaging(ctx context.Context, query Ke } // Delete Keyless SSL Configuration -func (r *KeylessCertificateService) Delete(ctx context.Context, keylessCertificateID string, params KeylessCertificateDeleteParams, opts ...option.RequestOption) (res *KeylessCertificateDeleteResponse, err error) { +func (r *KeylessCertificateService) Delete(ctx context.Context, keylessCertificateID string, body KeylessCertificateDeleteParams, opts ...option.RequestOption) (res *KeylessCertificateDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env KeylessCertificateDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/keyless_certificates/%s", params.ZoneID, keylessCertificateID) + path := fmt.Sprintf("zones/%s/keyless_certificates/%s", body.ZoneID, keylessCertificateID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -265,9 +265,9 @@ func (r KeylessCertificateNewParams) MarshalJSON() (data []byte, err error) { type KeylessCertificateNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result KeylessCertificate `json:"result,required"` // Whether the API call was successful Success KeylessCertificateNewResponseEnvelopeSuccess `json:"success,required"` + Result KeylessCertificate `json:"result"` JSON keylessCertificateNewResponseEnvelopeJSON `json:"-"` } @@ -276,8 +276,8 @@ type KeylessCertificateNewResponseEnvelope struct { type keylessCertificateNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -313,19 +313,14 @@ type KeylessCertificateListParams struct { type KeylessCertificateDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r KeylessCertificateDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type KeylessCertificateDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result KeylessCertificateDeleteResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success KeylessCertificateDeleteResponseEnvelopeSuccess `json:"success,required"` + Result KeylessCertificateDeleteResponse `json:"result"` JSON keylessCertificateDeleteResponseEnvelopeJSON `json:"-"` } @@ -334,8 +329,8 @@ type KeylessCertificateDeleteResponseEnvelope struct { type keylessCertificateDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -386,9 +381,9 @@ func (r KeylessCertificateEditParams) MarshalJSON() (data []byte, err error) { type KeylessCertificateEditResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result KeylessCertificate `json:"result,required"` // Whether the API call was successful Success KeylessCertificateEditResponseEnvelopeSuccess `json:"success,required"` + Result KeylessCertificate `json:"result"` JSON keylessCertificateEditResponseEnvelopeJSON `json:"-"` } @@ -397,8 +392,8 @@ type KeylessCertificateEditResponseEnvelope struct { type keylessCertificateEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -434,9 +429,9 @@ type KeylessCertificateGetParams struct { type KeylessCertificateGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result KeylessCertificate `json:"result,required"` // Whether the API call was successful Success KeylessCertificateGetResponseEnvelopeSuccess `json:"success,required"` + Result KeylessCertificate `json:"result"` JSON keylessCertificateGetResponseEnvelopeJSON `json:"-"` } @@ -445,8 +440,8 @@ type KeylessCertificateGetResponseEnvelope struct { type keylessCertificateGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/keyless_certificates/keylesscertificate_test.go b/keyless_certificates/keylesscertificate_test.go index bef4462bd5f..ff07ef48fd6 100644 --- a/keyless_certificates/keylesscertificate_test.go +++ b/keyless_certificates/keylesscertificate_test.go @@ -16,7 +16,6 @@ import ( ) func TestKeylessCertificateNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -51,7 +50,6 @@ func TestKeylessCertificateNewWithOptionalParams(t *testing.T) { } func TestKeylessCertificateList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +75,6 @@ func TestKeylessCertificateList(t *testing.T) { } func TestKeylessCertificateDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -95,7 +92,6 @@ func TestKeylessCertificateDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", keyless_certificates.KeylessCertificateDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -108,7 +104,6 @@ func TestKeylessCertificateDelete(t *testing.T) { } func TestKeylessCertificateEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -146,7 +141,6 @@ func TestKeylessCertificateEditWithOptionalParams(t *testing.T) { } func TestKeylessCertificateGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/kv/aliases.go b/kv/aliases.go index 31cccb83439..9d9fa97e708 100644 --- a/kv/aliases.go +++ b/kv/aliases.go @@ -4,7 +4,7 @@ package kv import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/kv/namespace.go b/kv/namespace.go index c91a623e4b9..60e77ab31bf 100644 --- a/kv/namespace.go +++ b/kv/namespace.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -96,10 +96,10 @@ func (r *NamespaceService) ListAutoPaging(ctx context.Context, params NamespaceL } // Deletes the namespace corresponding to the given ID. -func (r *NamespaceService) Delete(ctx context.Context, namespaceID string, params NamespaceDeleteParams, opts ...option.RequestOption) (res *NamespaceDeleteResponseUnion, err error) { +func (r *NamespaceService) Delete(ctx context.Context, namespaceID string, body NamespaceDeleteParams, opts ...option.RequestOption) (res *NamespaceDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env NamespaceDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s", params.AccountID, namespaceID) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s", body.AccountID, namespaceID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -332,11 +332,6 @@ func (r NamespaceListParamsOrder) IsKnown() bool { type NamespaceDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r NamespaceDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type NamespaceDeleteResponseEnvelope struct { diff --git a/kv/namespace_test.go b/kv/namespace_test.go index 3d4bbb4e88f..b8736d39958 100644 --- a/kv/namespace_test.go +++ b/kv/namespace_test.go @@ -15,7 +15,6 @@ import ( ) func TestNamespaceNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestNamespaceNew(t *testing.T) { } func TestNamespaceUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -73,7 +71,6 @@ func TestNamespaceUpdate(t *testing.T) { } func TestNamespaceListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -103,7 +100,6 @@ func TestNamespaceListWithOptionalParams(t *testing.T) { } func TestNamespaceDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -121,7 +117,6 @@ func TestNamespaceDelete(t *testing.T) { "0f2ac74b498b48028cb68387c421e279", kv.NamespaceDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/kv/namespacebulk.go b/kv/namespacebulk.go index 6d492909e2a..b98188bf0b6 100644 --- a/kv/namespacebulk.go +++ b/kv/namespacebulk.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -54,11 +54,11 @@ func (r *NamespaceBulkService) Update(ctx context.Context, namespaceID string, p // Remove multiple KV pairs from the namespace. Body should be an array of up to // 10,000 keys to be removed. -func (r *NamespaceBulkService) Delete(ctx context.Context, namespaceID string, params NamespaceBulkDeleteParams, opts ...option.RequestOption) (res *NamespaceBulkDeleteResponseUnion, err error) { +func (r *NamespaceBulkService) Delete(ctx context.Context, namespaceID string, body NamespaceBulkDeleteParams, opts ...option.RequestOption) (res *NamespaceBulkDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env NamespaceBulkDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/bulk", params.AccountID, namespaceID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/bulk", body.AccountID, namespaceID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return } @@ -180,11 +180,6 @@ func (r NamespaceBulkUpdateResponseEnvelopeSuccess) IsKnown() bool { type NamespaceBulkDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body []string `json:"body,required"` -} - -func (r NamespaceBulkDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type NamespaceBulkDeleteResponseEnvelope struct { diff --git a/kv/namespacebulk_test.go b/kv/namespacebulk_test.go index b8ab731e9f1..2e2d42d949f 100644 --- a/kv/namespacebulk_test.go +++ b/kv/namespacebulk_test.go @@ -15,7 +15,6 @@ import ( ) func TestNamespaceBulkUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -73,7 +72,6 @@ func TestNamespaceBulkUpdate(t *testing.T) { } func TestNamespaceBulkDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -91,7 +89,6 @@ func TestNamespaceBulkDelete(t *testing.T) { "0f2ac74b498b48028cb68387c421e279", kv.NamespaceBulkDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: []string{"My-Key", "My-Key", "My-Key"}, }, ) if err != nil { diff --git a/kv/namespacekey_test.go b/kv/namespacekey_test.go index af5a9080736..1062c719671 100644 --- a/kv/namespacekey_test.go +++ b/kv/namespacekey_test.go @@ -15,7 +15,6 @@ import ( ) func TestNamespaceKeyListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/kv/namespacemetadata.go b/kv/namespacemetadata.go index fc4e631f59f..fba0471fff2 100644 --- a/kv/namespacemetadata.go +++ b/kv/namespacemetadata.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // NamespaceMetadataService contains methods and other services that help with diff --git a/kv/namespacemetadata_test.go b/kv/namespacemetadata_test.go index f629189be62..b06656431d7 100644 --- a/kv/namespacemetadata_test.go +++ b/kv/namespacemetadata_test.go @@ -15,7 +15,6 @@ import ( ) func TestNamespaceMetadataGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/kv/namespacevalue.go b/kv/namespacevalue.go index c5b061402af..6dec74a0e44 100644 --- a/kv/namespacevalue.go +++ b/kv/namespacevalue.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -54,10 +54,10 @@ func (r *NamespaceValueService) Update(ctx context.Context, namespaceID string, // Remove a KV pair from the namespace. Use URL-encoding to use special characters // (for example, `:`, `!`, `%`) in the key name. -func (r *NamespaceValueService) Delete(ctx context.Context, namespaceID string, keyName string, params NamespaceValueDeleteParams, opts ...option.RequestOption) (res *NamespaceValueDeleteResponseUnion, err error) { +func (r *NamespaceValueService) Delete(ctx context.Context, namespaceID string, keyName string, body NamespaceValueDeleteParams, opts ...option.RequestOption) (res *NamespaceValueDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env NamespaceValueDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", params.AccountID, namespaceID, keyName) + path := fmt.Sprintf("accounts/%s/storage/kv/namespaces/%s/values/%s", body.AccountID, namespaceID, keyName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -171,11 +171,6 @@ func (r NamespaceValueUpdateResponseEnvelopeSuccess) IsKnown() bool { type NamespaceValueDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r NamespaceValueDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type NamespaceValueDeleteResponseEnvelope struct { diff --git a/kv/namespacevalue_test.go b/kv/namespacevalue_test.go index 175a684b6fd..5b0b13ea6e4 100644 --- a/kv/namespacevalue_test.go +++ b/kv/namespacevalue_test.go @@ -15,7 +15,7 @@ import ( ) func TestNamespaceValueUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -48,7 +48,6 @@ func TestNamespaceValueUpdate(t *testing.T) { } func TestNamespaceValueDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -67,7 +66,6 @@ func TestNamespaceValueDelete(t *testing.T) { "My-Key", kv.NamespaceValueDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -80,7 +78,6 @@ func TestNamespaceValueDelete(t *testing.T) { } func TestNamespaceValueGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/load_balancers/aliases.go b/load_balancers/aliases.go index bc826c228a7..0dc92366452 100644 --- a/load_balancers/aliases.go +++ b/load_balancers/aliases.go @@ -4,7 +4,7 @@ package load_balancers import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/load_balancers/loadbalancer.go b/load_balancers/loadbalancer.go index 1447f7662cd..9a41ad3bba4 100644 --- a/load_balancers/loadbalancer.go +++ b/load_balancers/loadbalancer.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // LoadBalancerService contains methods and other services that help with @@ -76,7 +76,7 @@ func (r *LoadBalancerService) List(ctx context.Context, query LoadBalancerListPa opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("zones/%s/load_balancers", query.ZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -94,10 +94,10 @@ func (r *LoadBalancerService) ListAutoPaging(ctx context.Context, query LoadBala } // Delete a configured load balancer. -func (r *LoadBalancerService) Delete(ctx context.Context, loadBalancerID string, params LoadBalancerDeleteParams, opts ...option.RequestOption) (res *LoadBalancerDeleteResponse, err error) { +func (r *LoadBalancerService) Delete(ctx context.Context, loadBalancerID string, body LoadBalancerDeleteParams, opts ...option.RequestOption) (res *LoadBalancerDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env LoadBalancerDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/load_balancers/%s", params.ZoneID, loadBalancerID) + path := fmt.Sprintf("zones/%s/load_balancers/%s", body.ZoneID, loadBalancerID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -379,7 +379,7 @@ type LoadBalancer struct { // server is unhealthy, then a new origin server is calculated and used. See // `headers` in `session_affinity_attributes` for additional required // configuration. - SessionAffinity LoadBalancerSessionAffinity `json:"session_affinity"` + SessionAffinity SessionAffinity `json:"session_affinity"` // Configures attributes for session affinity. SessionAffinityAttributes SessionAffinityAttributes `json:"session_affinity_attributes"` // Time, in seconds, until a client's session expires after being created. Once the @@ -415,7 +415,7 @@ type LoadBalancer struct { // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - SteeringPolicy LoadBalancerSteeringPolicy `json:"steering_policy"` + SteeringPolicy SteeringPolicy `json:"steering_policy"` // Time to live (TTL) of the DNS entry for the IP address returned by this load // balancer. This only applies to gray-clouded (unproxied) load balancers. TTL float64 `json:"ttl"` @@ -457,90 +457,6 @@ func (r loadBalancerJSON) RawJSON() string { return r.raw } -// Specifies the type of session affinity the load balancer should use unless -// specified as `"none"` or "" (default). The supported types are: -// -// - `"cookie"`: On the first request to a proxied load balancer, a cookie is -// generated, encoding information of which origin the request will be forwarded -// to. Subsequent requests, by the same client to the same load balancer, will be -// sent to the origin server the cookie encodes, for the duration of the cookie -// and as long as the origin server remains healthy. If the cookie has expired or -// the origin server is unhealthy, then a new origin server is calculated and -// used. -// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin -// selection is stable and based on the client's ip address. -// - `"header"`: On the first request to a proxied load balancer, a session key -// based on the configured HTTP headers (see -// `session_affinity_attributes.headers`) is generated, encoding the request -// headers used for storing in the load balancer session state which origin the -// request will be forwarded to. Subsequent requests to the load balancer with -// the same headers will be sent to the same origin server, for the duration of -// the session and as long as the origin server remains healthy. If the session -// has been idle for the duration of `session_affinity_ttl` seconds or the origin -// server is unhealthy, then a new origin server is calculated and used. See -// `headers` in `session_affinity_attributes` for additional required -// configuration. -type LoadBalancerSessionAffinity string - -const ( - LoadBalancerSessionAffinityNone LoadBalancerSessionAffinity = "none" - LoadBalancerSessionAffinityCookie LoadBalancerSessionAffinity = "cookie" - LoadBalancerSessionAffinityIPCookie LoadBalancerSessionAffinity = "ip_cookie" - LoadBalancerSessionAffinityHeader LoadBalancerSessionAffinity = "header" - LoadBalancerSessionAffinityEmpty LoadBalancerSessionAffinity = "\"\"" -) - -func (r LoadBalancerSessionAffinity) IsKnown() bool { - switch r { - case LoadBalancerSessionAffinityNone, LoadBalancerSessionAffinityCookie, LoadBalancerSessionAffinityIPCookie, LoadBalancerSessionAffinityHeader, LoadBalancerSessionAffinityEmpty: - return true - } - return false -} - -// Steering Policy for this load balancer. -// -// - `"off"`: Use `default_pools`. -// - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied -// requests, the country for `country_pools` is determined by -// `location_strategy`. -// - `"random"`: Select a pool randomly. -// - `"dynamic_latency"`: Use round trip time to select the closest pool in -// default_pools (requires pool health checks). -// - `"proximity"`: Use the pools' latitude and longitude to select the closest -// pool using the Cloudflare PoP location for proxied requests or the location -// determined by `location_strategy` for non-proxied requests. -// - `"least_outstanding_requests"`: Select a pool by taking into consideration -// `random_steering` weights, as well as each pool's number of outstanding -// requests. Pools with more pending requests are weighted proportionately less -// relative to others. -// - `"least_connections"`: Select a pool by taking into consideration -// `random_steering` weights, as well as each pool's number of open connections. -// Pools with more open connections are weighted proportionately less relative to -// others. Supported for HTTP/1 and HTTP/2 connections. -// - `""`: Will map to `"geo"` if you use -// `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. -type LoadBalancerSteeringPolicy string - -const ( - LoadBalancerSteeringPolicyOff LoadBalancerSteeringPolicy = "off" - LoadBalancerSteeringPolicyGeo LoadBalancerSteeringPolicy = "geo" - LoadBalancerSteeringPolicyRandom LoadBalancerSteeringPolicy = "random" - LoadBalancerSteeringPolicyDynamicLatency LoadBalancerSteeringPolicy = "dynamic_latency" - LoadBalancerSteeringPolicyProximity LoadBalancerSteeringPolicy = "proximity" - LoadBalancerSteeringPolicyLeastOutstandingRequests LoadBalancerSteeringPolicy = "least_outstanding_requests" - LoadBalancerSteeringPolicyLeastConnections LoadBalancerSteeringPolicy = "least_connections" - LoadBalancerSteeringPolicyEmpty LoadBalancerSteeringPolicy = "\"\"" -) - -func (r LoadBalancerSteeringPolicy) IsKnown() bool { - switch r { - case LoadBalancerSteeringPolicyOff, LoadBalancerSteeringPolicyGeo, LoadBalancerSteeringPolicyRandom, LoadBalancerSteeringPolicyDynamicLatency, LoadBalancerSteeringPolicyProximity, LoadBalancerSteeringPolicyLeastOutstandingRequests, LoadBalancerSteeringPolicyLeastConnections, LoadBalancerSteeringPolicyEmpty: - return true - } - return false -} - // Configures load shedding policies and percentages for the pool. type LoadShedding struct { // The percent of traffic to shed from the pool, according to the default policy. @@ -1166,7 +1082,7 @@ type RulesOverrides struct { // server is unhealthy, then a new origin server is calculated and used. See // `headers` in `session_affinity_attributes` for additional required // configuration. - SessionAffinity RulesOverridesSessionAffinity `json:"session_affinity"` + SessionAffinity SessionAffinity `json:"session_affinity"` // Configures attributes for session affinity. SessionAffinityAttributes SessionAffinityAttributes `json:"session_affinity_attributes"` // Time, in seconds, until a client's session expires after being created. Once the @@ -1202,7 +1118,7 @@ type RulesOverrides struct { // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - SteeringPolicy RulesOverridesSteeringPolicy `json:"steering_policy"` + SteeringPolicy SteeringPolicy `json:"steering_policy"` // Time to live (TTL) of the DNS entry for the IP address returned by this load // balancer. This only applies to gray-clouded (unproxied) load balancers. TTL float64 `json:"ttl"` @@ -1236,90 +1152,6 @@ func (r rulesOverridesJSON) RawJSON() string { return r.raw } -// Specifies the type of session affinity the load balancer should use unless -// specified as `"none"` or "" (default). The supported types are: -// -// - `"cookie"`: On the first request to a proxied load balancer, a cookie is -// generated, encoding information of which origin the request will be forwarded -// to. Subsequent requests, by the same client to the same load balancer, will be -// sent to the origin server the cookie encodes, for the duration of the cookie -// and as long as the origin server remains healthy. If the cookie has expired or -// the origin server is unhealthy, then a new origin server is calculated and -// used. -// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin -// selection is stable and based on the client's ip address. -// - `"header"`: On the first request to a proxied load balancer, a session key -// based on the configured HTTP headers (see -// `session_affinity_attributes.headers`) is generated, encoding the request -// headers used for storing in the load balancer session state which origin the -// request will be forwarded to. Subsequent requests to the load balancer with -// the same headers will be sent to the same origin server, for the duration of -// the session and as long as the origin server remains healthy. If the session -// has been idle for the duration of `session_affinity_ttl` seconds or the origin -// server is unhealthy, then a new origin server is calculated and used. See -// `headers` in `session_affinity_attributes` for additional required -// configuration. -type RulesOverridesSessionAffinity string - -const ( - RulesOverridesSessionAffinityNone RulesOverridesSessionAffinity = "none" - RulesOverridesSessionAffinityCookie RulesOverridesSessionAffinity = "cookie" - RulesOverridesSessionAffinityIPCookie RulesOverridesSessionAffinity = "ip_cookie" - RulesOverridesSessionAffinityHeader RulesOverridesSessionAffinity = "header" - RulesOverridesSessionAffinityEmpty RulesOverridesSessionAffinity = "\"\"" -) - -func (r RulesOverridesSessionAffinity) IsKnown() bool { - switch r { - case RulesOverridesSessionAffinityNone, RulesOverridesSessionAffinityCookie, RulesOverridesSessionAffinityIPCookie, RulesOverridesSessionAffinityHeader, RulesOverridesSessionAffinityEmpty: - return true - } - return false -} - -// Steering Policy for this load balancer. -// -// - `"off"`: Use `default_pools`. -// - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied -// requests, the country for `country_pools` is determined by -// `location_strategy`. -// - `"random"`: Select a pool randomly. -// - `"dynamic_latency"`: Use round trip time to select the closest pool in -// default_pools (requires pool health checks). -// - `"proximity"`: Use the pools' latitude and longitude to select the closest -// pool using the Cloudflare PoP location for proxied requests or the location -// determined by `location_strategy` for non-proxied requests. -// - `"least_outstanding_requests"`: Select a pool by taking into consideration -// `random_steering` weights, as well as each pool's number of outstanding -// requests. Pools with more pending requests are weighted proportionately less -// relative to others. -// - `"least_connections"`: Select a pool by taking into consideration -// `random_steering` weights, as well as each pool's number of open connections. -// Pools with more open connections are weighted proportionately less relative to -// others. Supported for HTTP/1 and HTTP/2 connections. -// - `""`: Will map to `"geo"` if you use -// `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. -type RulesOverridesSteeringPolicy string - -const ( - RulesOverridesSteeringPolicyOff RulesOverridesSteeringPolicy = "off" - RulesOverridesSteeringPolicyGeo RulesOverridesSteeringPolicy = "geo" - RulesOverridesSteeringPolicyRandom RulesOverridesSteeringPolicy = "random" - RulesOverridesSteeringPolicyDynamicLatency RulesOverridesSteeringPolicy = "dynamic_latency" - RulesOverridesSteeringPolicyProximity RulesOverridesSteeringPolicy = "proximity" - RulesOverridesSteeringPolicyLeastOutstandingRequests RulesOverridesSteeringPolicy = "least_outstanding_requests" - RulesOverridesSteeringPolicyLeastConnections RulesOverridesSteeringPolicy = "least_connections" - RulesOverridesSteeringPolicyEmpty RulesOverridesSteeringPolicy = "\"\"" -) - -func (r RulesOverridesSteeringPolicy) IsKnown() bool { - switch r { - case RulesOverridesSteeringPolicyOff, RulesOverridesSteeringPolicyGeo, RulesOverridesSteeringPolicyRandom, RulesOverridesSteeringPolicyDynamicLatency, RulesOverridesSteeringPolicyProximity, RulesOverridesSteeringPolicyLeastOutstandingRequests, RulesOverridesSteeringPolicyLeastConnections, RulesOverridesSteeringPolicyEmpty: - return true - } - return false -} - // A rule object containing conditions and overrides for this load balancer to // evaluate. type RulesParam struct { @@ -1436,7 +1268,7 @@ type RulesOverridesParam struct { // server is unhealthy, then a new origin server is calculated and used. See // `headers` in `session_affinity_attributes` for additional required // configuration. - SessionAffinity param.Field[RulesOverridesSessionAffinity] `json:"session_affinity"` + SessionAffinity param.Field[SessionAffinity] `json:"session_affinity"` // Configures attributes for session affinity. SessionAffinityAttributes param.Field[SessionAffinityAttributesParam] `json:"session_affinity_attributes"` // Time, in seconds, until a client's session expires after being created. Once the @@ -1472,7 +1304,7 @@ type RulesOverridesParam struct { // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - SteeringPolicy param.Field[RulesOverridesSteeringPolicy] `json:"steering_policy"` + SteeringPolicy param.Field[SteeringPolicy] `json:"steering_policy"` // Time to live (TTL) of the DNS entry for the IP address returned by this load // balancer. This only applies to gray-clouded (unproxied) load balancers. TTL param.Field[float64] `json:"ttl"` @@ -1482,6 +1314,47 @@ func (r RulesOverridesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Specifies the type of session affinity the load balancer should use unless +// specified as `"none"` or "" (default). The supported types are: +// +// - `"cookie"`: On the first request to a proxied load balancer, a cookie is +// generated, encoding information of which origin the request will be forwarded +// to. Subsequent requests, by the same client to the same load balancer, will be +// sent to the origin server the cookie encodes, for the duration of the cookie +// and as long as the origin server remains healthy. If the cookie has expired or +// the origin server is unhealthy, then a new origin server is calculated and +// used. +// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin +// selection is stable and based on the client's ip address. +// - `"header"`: On the first request to a proxied load balancer, a session key +// based on the configured HTTP headers (see +// `session_affinity_attributes.headers`) is generated, encoding the request +// headers used for storing in the load balancer session state which origin the +// request will be forwarded to. Subsequent requests to the load balancer with +// the same headers will be sent to the same origin server, for the duration of +// the session and as long as the origin server remains healthy. If the session +// has been idle for the duration of `session_affinity_ttl` seconds or the origin +// server is unhealthy, then a new origin server is calculated and used. See +// `headers` in `session_affinity_attributes` for additional required +// configuration. +type SessionAffinity string + +const ( + SessionAffinityNone SessionAffinity = "none" + SessionAffinityCookie SessionAffinity = "cookie" + SessionAffinityIPCookie SessionAffinity = "ip_cookie" + SessionAffinityHeader SessionAffinity = "header" + SessionAffinityEmpty SessionAffinity = "\"\"" +) + +func (r SessionAffinity) IsKnown() bool { + switch r { + case SessionAffinityNone, SessionAffinityCookie, SessionAffinityIPCookie, SessionAffinityHeader, SessionAffinityEmpty: + return true + } + return false +} + // Configures attributes for session affinity. type SessionAffinityAttributes struct { // Configures the drain duration in seconds. This field is only used when session @@ -1671,6 +1544,49 @@ func (r SessionAffinityAttributesParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } +// Steering Policy for this load balancer. +// +// - `"off"`: Use `default_pools`. +// - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied +// requests, the country for `country_pools` is determined by +// `location_strategy`. +// - `"random"`: Select a pool randomly. +// - `"dynamic_latency"`: Use round trip time to select the closest pool in +// default_pools (requires pool health checks). +// - `"proximity"`: Use the pools' latitude and longitude to select the closest +// pool using the Cloudflare PoP location for proxied requests or the location +// determined by `location_strategy` for non-proxied requests. +// - `"least_outstanding_requests"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of outstanding +// requests. Pools with more pending requests are weighted proportionately less +// relative to others. +// - `"least_connections"`: Select a pool by taking into consideration +// `random_steering` weights, as well as each pool's number of open connections. +// Pools with more open connections are weighted proportionately less relative to +// others. Supported for HTTP/1 and HTTP/2 connections. +// - `""`: Will map to `"geo"` if you use +// `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. +type SteeringPolicy string + +const ( + SteeringPolicyOff SteeringPolicy = "off" + SteeringPolicyGeo SteeringPolicy = "geo" + SteeringPolicyRandom SteeringPolicy = "random" + SteeringPolicyDynamicLatency SteeringPolicy = "dynamic_latency" + SteeringPolicyProximity SteeringPolicy = "proximity" + SteeringPolicyLeastOutstandingRequests SteeringPolicy = "least_outstanding_requests" + SteeringPolicyLeastConnections SteeringPolicy = "least_connections" + SteeringPolicyEmpty SteeringPolicy = "\"\"" +) + +func (r SteeringPolicy) IsKnown() bool { + switch r { + case SteeringPolicyOff, SteeringPolicyGeo, SteeringPolicyRandom, SteeringPolicyDynamicLatency, SteeringPolicyProximity, SteeringPolicyLeastOutstandingRequests, SteeringPolicyLeastConnections, SteeringPolicyEmpty: + return true + } + return false +} + type LoadBalancerDeleteResponse struct { ID string `json:"id"` JSON loadBalancerDeleteResponseJSON `json:"-"` @@ -1766,7 +1682,7 @@ type LoadBalancerNewParams struct { // server is unhealthy, then a new origin server is calculated and used. See // `headers` in `session_affinity_attributes` for additional required // configuration. - SessionAffinity param.Field[LoadBalancerNewParamsSessionAffinity] `json:"session_affinity"` + SessionAffinity param.Field[SessionAffinity] `json:"session_affinity"` // Configures attributes for session affinity. SessionAffinityAttributes param.Field[SessionAffinityAttributesParam] `json:"session_affinity_attributes"` // Time, in seconds, until a client's session expires after being created. Once the @@ -1802,7 +1718,7 @@ type LoadBalancerNewParams struct { // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - SteeringPolicy param.Field[LoadBalancerNewParamsSteeringPolicy] `json:"steering_policy"` + SteeringPolicy param.Field[SteeringPolicy] `json:"steering_policy"` // Time to live (TTL) of the DNS entry for the IP address returned by this load // balancer. This only applies to gray-clouded (unproxied) load balancers. TTL param.Field[float64] `json:"ttl"` @@ -1812,90 +1728,6 @@ func (r LoadBalancerNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Specifies the type of session affinity the load balancer should use unless -// specified as `"none"` or "" (default). The supported types are: -// -// - `"cookie"`: On the first request to a proxied load balancer, a cookie is -// generated, encoding information of which origin the request will be forwarded -// to. Subsequent requests, by the same client to the same load balancer, will be -// sent to the origin server the cookie encodes, for the duration of the cookie -// and as long as the origin server remains healthy. If the cookie has expired or -// the origin server is unhealthy, then a new origin server is calculated and -// used. -// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin -// selection is stable and based on the client's ip address. -// - `"header"`: On the first request to a proxied load balancer, a session key -// based on the configured HTTP headers (see -// `session_affinity_attributes.headers`) is generated, encoding the request -// headers used for storing in the load balancer session state which origin the -// request will be forwarded to. Subsequent requests to the load balancer with -// the same headers will be sent to the same origin server, for the duration of -// the session and as long as the origin server remains healthy. If the session -// has been idle for the duration of `session_affinity_ttl` seconds or the origin -// server is unhealthy, then a new origin server is calculated and used. See -// `headers` in `session_affinity_attributes` for additional required -// configuration. -type LoadBalancerNewParamsSessionAffinity string - -const ( - LoadBalancerNewParamsSessionAffinityNone LoadBalancerNewParamsSessionAffinity = "none" - LoadBalancerNewParamsSessionAffinityCookie LoadBalancerNewParamsSessionAffinity = "cookie" - LoadBalancerNewParamsSessionAffinityIPCookie LoadBalancerNewParamsSessionAffinity = "ip_cookie" - LoadBalancerNewParamsSessionAffinityHeader LoadBalancerNewParamsSessionAffinity = "header" - LoadBalancerNewParamsSessionAffinityEmpty LoadBalancerNewParamsSessionAffinity = "\"\"" -) - -func (r LoadBalancerNewParamsSessionAffinity) IsKnown() bool { - switch r { - case LoadBalancerNewParamsSessionAffinityNone, LoadBalancerNewParamsSessionAffinityCookie, LoadBalancerNewParamsSessionAffinityIPCookie, LoadBalancerNewParamsSessionAffinityHeader, LoadBalancerNewParamsSessionAffinityEmpty: - return true - } - return false -} - -// Steering Policy for this load balancer. -// -// - `"off"`: Use `default_pools`. -// - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied -// requests, the country for `country_pools` is determined by -// `location_strategy`. -// - `"random"`: Select a pool randomly. -// - `"dynamic_latency"`: Use round trip time to select the closest pool in -// default_pools (requires pool health checks). -// - `"proximity"`: Use the pools' latitude and longitude to select the closest -// pool using the Cloudflare PoP location for proxied requests or the location -// determined by `location_strategy` for non-proxied requests. -// - `"least_outstanding_requests"`: Select a pool by taking into consideration -// `random_steering` weights, as well as each pool's number of outstanding -// requests. Pools with more pending requests are weighted proportionately less -// relative to others. -// - `"least_connections"`: Select a pool by taking into consideration -// `random_steering` weights, as well as each pool's number of open connections. -// Pools with more open connections are weighted proportionately less relative to -// others. Supported for HTTP/1 and HTTP/2 connections. -// - `""`: Will map to `"geo"` if you use -// `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. -type LoadBalancerNewParamsSteeringPolicy string - -const ( - LoadBalancerNewParamsSteeringPolicyOff LoadBalancerNewParamsSteeringPolicy = "off" - LoadBalancerNewParamsSteeringPolicyGeo LoadBalancerNewParamsSteeringPolicy = "geo" - LoadBalancerNewParamsSteeringPolicyRandom LoadBalancerNewParamsSteeringPolicy = "random" - LoadBalancerNewParamsSteeringPolicyDynamicLatency LoadBalancerNewParamsSteeringPolicy = "dynamic_latency" - LoadBalancerNewParamsSteeringPolicyProximity LoadBalancerNewParamsSteeringPolicy = "proximity" - LoadBalancerNewParamsSteeringPolicyLeastOutstandingRequests LoadBalancerNewParamsSteeringPolicy = "least_outstanding_requests" - LoadBalancerNewParamsSteeringPolicyLeastConnections LoadBalancerNewParamsSteeringPolicy = "least_connections" - LoadBalancerNewParamsSteeringPolicyEmpty LoadBalancerNewParamsSteeringPolicy = "\"\"" -) - -func (r LoadBalancerNewParamsSteeringPolicy) IsKnown() bool { - switch r { - case LoadBalancerNewParamsSteeringPolicyOff, LoadBalancerNewParamsSteeringPolicyGeo, LoadBalancerNewParamsSteeringPolicyRandom, LoadBalancerNewParamsSteeringPolicyDynamicLatency, LoadBalancerNewParamsSteeringPolicyProximity, LoadBalancerNewParamsSteeringPolicyLeastOutstandingRequests, LoadBalancerNewParamsSteeringPolicyLeastConnections, LoadBalancerNewParamsSteeringPolicyEmpty: - return true - } - return false -} - type LoadBalancerNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` @@ -2015,7 +1847,7 @@ type LoadBalancerUpdateParams struct { // server is unhealthy, then a new origin server is calculated and used. See // `headers` in `session_affinity_attributes` for additional required // configuration. - SessionAffinity param.Field[LoadBalancerUpdateParamsSessionAffinity] `json:"session_affinity"` + SessionAffinity param.Field[SessionAffinity] `json:"session_affinity"` // Configures attributes for session affinity. SessionAffinityAttributes param.Field[SessionAffinityAttributesParam] `json:"session_affinity_attributes"` // Time, in seconds, until a client's session expires after being created. Once the @@ -2051,7 +1883,7 @@ type LoadBalancerUpdateParams struct { // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - SteeringPolicy param.Field[LoadBalancerUpdateParamsSteeringPolicy] `json:"steering_policy"` + SteeringPolicy param.Field[SteeringPolicy] `json:"steering_policy"` // Time to live (TTL) of the DNS entry for the IP address returned by this load // balancer. This only applies to gray-clouded (unproxied) load balancers. TTL param.Field[float64] `json:"ttl"` @@ -2061,90 +1893,6 @@ func (r LoadBalancerUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Specifies the type of session affinity the load balancer should use unless -// specified as `"none"` or "" (default). The supported types are: -// -// - `"cookie"`: On the first request to a proxied load balancer, a cookie is -// generated, encoding information of which origin the request will be forwarded -// to. Subsequent requests, by the same client to the same load balancer, will be -// sent to the origin server the cookie encodes, for the duration of the cookie -// and as long as the origin server remains healthy. If the cookie has expired or -// the origin server is unhealthy, then a new origin server is calculated and -// used. -// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin -// selection is stable and based on the client's ip address. -// - `"header"`: On the first request to a proxied load balancer, a session key -// based on the configured HTTP headers (see -// `session_affinity_attributes.headers`) is generated, encoding the request -// headers used for storing in the load balancer session state which origin the -// request will be forwarded to. Subsequent requests to the load balancer with -// the same headers will be sent to the same origin server, for the duration of -// the session and as long as the origin server remains healthy. If the session -// has been idle for the duration of `session_affinity_ttl` seconds or the origin -// server is unhealthy, then a new origin server is calculated and used. See -// `headers` in `session_affinity_attributes` for additional required -// configuration. -type LoadBalancerUpdateParamsSessionAffinity string - -const ( - LoadBalancerUpdateParamsSessionAffinityNone LoadBalancerUpdateParamsSessionAffinity = "none" - LoadBalancerUpdateParamsSessionAffinityCookie LoadBalancerUpdateParamsSessionAffinity = "cookie" - LoadBalancerUpdateParamsSessionAffinityIPCookie LoadBalancerUpdateParamsSessionAffinity = "ip_cookie" - LoadBalancerUpdateParamsSessionAffinityHeader LoadBalancerUpdateParamsSessionAffinity = "header" - LoadBalancerUpdateParamsSessionAffinityEmpty LoadBalancerUpdateParamsSessionAffinity = "\"\"" -) - -func (r LoadBalancerUpdateParamsSessionAffinity) IsKnown() bool { - switch r { - case LoadBalancerUpdateParamsSessionAffinityNone, LoadBalancerUpdateParamsSessionAffinityCookie, LoadBalancerUpdateParamsSessionAffinityIPCookie, LoadBalancerUpdateParamsSessionAffinityHeader, LoadBalancerUpdateParamsSessionAffinityEmpty: - return true - } - return false -} - -// Steering Policy for this load balancer. -// -// - `"off"`: Use `default_pools`. -// - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied -// requests, the country for `country_pools` is determined by -// `location_strategy`. -// - `"random"`: Select a pool randomly. -// - `"dynamic_latency"`: Use round trip time to select the closest pool in -// default_pools (requires pool health checks). -// - `"proximity"`: Use the pools' latitude and longitude to select the closest -// pool using the Cloudflare PoP location for proxied requests or the location -// determined by `location_strategy` for non-proxied requests. -// - `"least_outstanding_requests"`: Select a pool by taking into consideration -// `random_steering` weights, as well as each pool's number of outstanding -// requests. Pools with more pending requests are weighted proportionately less -// relative to others. -// - `"least_connections"`: Select a pool by taking into consideration -// `random_steering` weights, as well as each pool's number of open connections. -// Pools with more open connections are weighted proportionately less relative to -// others. Supported for HTTP/1 and HTTP/2 connections. -// - `""`: Will map to `"geo"` if you use -// `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. -type LoadBalancerUpdateParamsSteeringPolicy string - -const ( - LoadBalancerUpdateParamsSteeringPolicyOff LoadBalancerUpdateParamsSteeringPolicy = "off" - LoadBalancerUpdateParamsSteeringPolicyGeo LoadBalancerUpdateParamsSteeringPolicy = "geo" - LoadBalancerUpdateParamsSteeringPolicyRandom LoadBalancerUpdateParamsSteeringPolicy = "random" - LoadBalancerUpdateParamsSteeringPolicyDynamicLatency LoadBalancerUpdateParamsSteeringPolicy = "dynamic_latency" - LoadBalancerUpdateParamsSteeringPolicyProximity LoadBalancerUpdateParamsSteeringPolicy = "proximity" - LoadBalancerUpdateParamsSteeringPolicyLeastOutstandingRequests LoadBalancerUpdateParamsSteeringPolicy = "least_outstanding_requests" - LoadBalancerUpdateParamsSteeringPolicyLeastConnections LoadBalancerUpdateParamsSteeringPolicy = "least_connections" - LoadBalancerUpdateParamsSteeringPolicyEmpty LoadBalancerUpdateParamsSteeringPolicy = "\"\"" -) - -func (r LoadBalancerUpdateParamsSteeringPolicy) IsKnown() bool { - switch r { - case LoadBalancerUpdateParamsSteeringPolicyOff, LoadBalancerUpdateParamsSteeringPolicyGeo, LoadBalancerUpdateParamsSteeringPolicyRandom, LoadBalancerUpdateParamsSteeringPolicyDynamicLatency, LoadBalancerUpdateParamsSteeringPolicyProximity, LoadBalancerUpdateParamsSteeringPolicyLeastOutstandingRequests, LoadBalancerUpdateParamsSteeringPolicyLeastConnections, LoadBalancerUpdateParamsSteeringPolicyEmpty: - return true - } - return false -} - type LoadBalancerUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` @@ -2194,11 +1942,6 @@ type LoadBalancerListParams struct { type LoadBalancerDeleteParams struct { ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r LoadBalancerDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type LoadBalancerDeleteResponseEnvelope struct { @@ -2320,7 +2063,7 @@ type LoadBalancerEditParams struct { // server is unhealthy, then a new origin server is calculated and used. See // `headers` in `session_affinity_attributes` for additional required // configuration. - SessionAffinity param.Field[LoadBalancerEditParamsSessionAffinity] `json:"session_affinity"` + SessionAffinity param.Field[SessionAffinity] `json:"session_affinity"` // Configures attributes for session affinity. SessionAffinityAttributes param.Field[SessionAffinityAttributesParam] `json:"session_affinity_attributes"` // Time, in seconds, until a client's session expires after being created. Once the @@ -2356,7 +2099,7 @@ type LoadBalancerEditParams struct { // others. Supported for HTTP/1 and HTTP/2 connections. // - `""`: Will map to `"geo"` if you use // `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. - SteeringPolicy param.Field[LoadBalancerEditParamsSteeringPolicy] `json:"steering_policy"` + SteeringPolicy param.Field[SteeringPolicy] `json:"steering_policy"` // Time to live (TTL) of the DNS entry for the IP address returned by this load // balancer. This only applies to gray-clouded (unproxied) load balancers. TTL param.Field[float64] `json:"ttl"` @@ -2366,90 +2109,6 @@ func (r LoadBalancerEditParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Specifies the type of session affinity the load balancer should use unless -// specified as `"none"` or "" (default). The supported types are: -// -// - `"cookie"`: On the first request to a proxied load balancer, a cookie is -// generated, encoding information of which origin the request will be forwarded -// to. Subsequent requests, by the same client to the same load balancer, will be -// sent to the origin server the cookie encodes, for the duration of the cookie -// and as long as the origin server remains healthy. If the cookie has expired or -// the origin server is unhealthy, then a new origin server is calculated and -// used. -// - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin -// selection is stable and based on the client's ip address. -// - `"header"`: On the first request to a proxied load balancer, a session key -// based on the configured HTTP headers (see -// `session_affinity_attributes.headers`) is generated, encoding the request -// headers used for storing in the load balancer session state which origin the -// request will be forwarded to. Subsequent requests to the load balancer with -// the same headers will be sent to the same origin server, for the duration of -// the session and as long as the origin server remains healthy. If the session -// has been idle for the duration of `session_affinity_ttl` seconds or the origin -// server is unhealthy, then a new origin server is calculated and used. See -// `headers` in `session_affinity_attributes` for additional required -// configuration. -type LoadBalancerEditParamsSessionAffinity string - -const ( - LoadBalancerEditParamsSessionAffinityNone LoadBalancerEditParamsSessionAffinity = "none" - LoadBalancerEditParamsSessionAffinityCookie LoadBalancerEditParamsSessionAffinity = "cookie" - LoadBalancerEditParamsSessionAffinityIPCookie LoadBalancerEditParamsSessionAffinity = "ip_cookie" - LoadBalancerEditParamsSessionAffinityHeader LoadBalancerEditParamsSessionAffinity = "header" - LoadBalancerEditParamsSessionAffinityEmpty LoadBalancerEditParamsSessionAffinity = "\"\"" -) - -func (r LoadBalancerEditParamsSessionAffinity) IsKnown() bool { - switch r { - case LoadBalancerEditParamsSessionAffinityNone, LoadBalancerEditParamsSessionAffinityCookie, LoadBalancerEditParamsSessionAffinityIPCookie, LoadBalancerEditParamsSessionAffinityHeader, LoadBalancerEditParamsSessionAffinityEmpty: - return true - } - return false -} - -// Steering Policy for this load balancer. -// -// - `"off"`: Use `default_pools`. -// - `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied -// requests, the country for `country_pools` is determined by -// `location_strategy`. -// - `"random"`: Select a pool randomly. -// - `"dynamic_latency"`: Use round trip time to select the closest pool in -// default_pools (requires pool health checks). -// - `"proximity"`: Use the pools' latitude and longitude to select the closest -// pool using the Cloudflare PoP location for proxied requests or the location -// determined by `location_strategy` for non-proxied requests. -// - `"least_outstanding_requests"`: Select a pool by taking into consideration -// `random_steering` weights, as well as each pool's number of outstanding -// requests. Pools with more pending requests are weighted proportionately less -// relative to others. -// - `"least_connections"`: Select a pool by taking into consideration -// `random_steering` weights, as well as each pool's number of open connections. -// Pools with more open connections are weighted proportionately less relative to -// others. Supported for HTTP/1 and HTTP/2 connections. -// - `""`: Will map to `"geo"` if you use -// `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`. -type LoadBalancerEditParamsSteeringPolicy string - -const ( - LoadBalancerEditParamsSteeringPolicyOff LoadBalancerEditParamsSteeringPolicy = "off" - LoadBalancerEditParamsSteeringPolicyGeo LoadBalancerEditParamsSteeringPolicy = "geo" - LoadBalancerEditParamsSteeringPolicyRandom LoadBalancerEditParamsSteeringPolicy = "random" - LoadBalancerEditParamsSteeringPolicyDynamicLatency LoadBalancerEditParamsSteeringPolicy = "dynamic_latency" - LoadBalancerEditParamsSteeringPolicyProximity LoadBalancerEditParamsSteeringPolicy = "proximity" - LoadBalancerEditParamsSteeringPolicyLeastOutstandingRequests LoadBalancerEditParamsSteeringPolicy = "least_outstanding_requests" - LoadBalancerEditParamsSteeringPolicyLeastConnections LoadBalancerEditParamsSteeringPolicy = "least_connections" - LoadBalancerEditParamsSteeringPolicyEmpty LoadBalancerEditParamsSteeringPolicy = "\"\"" -) - -func (r LoadBalancerEditParamsSteeringPolicy) IsKnown() bool { - switch r { - case LoadBalancerEditParamsSteeringPolicyOff, LoadBalancerEditParamsSteeringPolicyGeo, LoadBalancerEditParamsSteeringPolicyRandom, LoadBalancerEditParamsSteeringPolicyDynamicLatency, LoadBalancerEditParamsSteeringPolicyProximity, LoadBalancerEditParamsSteeringPolicyLeastOutstandingRequests, LoadBalancerEditParamsSteeringPolicyLeastConnections, LoadBalancerEditParamsSteeringPolicyEmpty: - return true - } - return false -} - type LoadBalancerEditResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/load_balancers/loadbalancer_test.go b/load_balancers/loadbalancer_test.go index ce92749b2f3..279d27f923f 100644 --- a/load_balancers/loadbalancer_test.go +++ b/load_balancers/loadbalancer_test.go @@ -15,7 +15,6 @@ import ( ) func TestLoadBalancerNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -138,7 +137,7 @@ func TestLoadBalancerNewWithOptionalParams(t *testing.T) { "1": "9290f38c5d07c2e2f4df57b1f61d4196", }, }), - SessionAffinity: cloudflare.F(load_balancers.RulesOverridesSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -148,7 +147,7 @@ func TestLoadBalancerNewWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.RulesOverridesSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }), Priority: cloudflare.F(int64(0)), @@ -211,7 +210,7 @@ func TestLoadBalancerNewWithOptionalParams(t *testing.T) { "1": "9290f38c5d07c2e2f4df57b1f61d4196", }, }), - SessionAffinity: cloudflare.F(load_balancers.RulesOverridesSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -221,7 +220,7 @@ func TestLoadBalancerNewWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.RulesOverridesSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }), Priority: cloudflare.F(int64(0)), @@ -284,7 +283,7 @@ func TestLoadBalancerNewWithOptionalParams(t *testing.T) { "1": "9290f38c5d07c2e2f4df57b1f61d4196", }, }), - SessionAffinity: cloudflare.F(load_balancers.RulesOverridesSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -294,13 +293,13 @@ func TestLoadBalancerNewWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.RulesOverridesSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }), Priority: cloudflare.F(int64(0)), Terminates: cloudflare.F(true), }}), - SessionAffinity: cloudflare.F(load_balancers.LoadBalancerNewParamsSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -310,7 +309,7 @@ func TestLoadBalancerNewWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.LoadBalancerNewParamsSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }) if err != nil { @@ -323,7 +322,6 @@ func TestLoadBalancerNewWithOptionalParams(t *testing.T) { } func TestLoadBalancerUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -450,7 +448,7 @@ func TestLoadBalancerUpdateWithOptionalParams(t *testing.T) { "1": "9290f38c5d07c2e2f4df57b1f61d4196", }, }), - SessionAffinity: cloudflare.F(load_balancers.RulesOverridesSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -460,7 +458,7 @@ func TestLoadBalancerUpdateWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.RulesOverridesSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }), Priority: cloudflare.F(int64(0)), @@ -523,7 +521,7 @@ func TestLoadBalancerUpdateWithOptionalParams(t *testing.T) { "1": "9290f38c5d07c2e2f4df57b1f61d4196", }, }), - SessionAffinity: cloudflare.F(load_balancers.RulesOverridesSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -533,7 +531,7 @@ func TestLoadBalancerUpdateWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.RulesOverridesSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }), Priority: cloudflare.F(int64(0)), @@ -596,7 +594,7 @@ func TestLoadBalancerUpdateWithOptionalParams(t *testing.T) { "1": "9290f38c5d07c2e2f4df57b1f61d4196", }, }), - SessionAffinity: cloudflare.F(load_balancers.RulesOverridesSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -606,13 +604,13 @@ func TestLoadBalancerUpdateWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.RulesOverridesSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }), Priority: cloudflare.F(int64(0)), Terminates: cloudflare.F(true), }}), - SessionAffinity: cloudflare.F(load_balancers.LoadBalancerUpdateParamsSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -622,7 +620,7 @@ func TestLoadBalancerUpdateWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.LoadBalancerUpdateParamsSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }, ) @@ -636,7 +634,6 @@ func TestLoadBalancerUpdateWithOptionalParams(t *testing.T) { } func TestLoadBalancerList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -662,7 +659,6 @@ func TestLoadBalancerList(t *testing.T) { } func TestLoadBalancerDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -680,7 +676,6 @@ func TestLoadBalancerDelete(t *testing.T) { "699d98642c564d2e855e9661899b7252", load_balancers.LoadBalancerDeleteParams{ ZoneID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -693,7 +688,6 @@ func TestLoadBalancerDelete(t *testing.T) { } func TestLoadBalancerEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -820,7 +814,7 @@ func TestLoadBalancerEditWithOptionalParams(t *testing.T) { "1": "9290f38c5d07c2e2f4df57b1f61d4196", }, }), - SessionAffinity: cloudflare.F(load_balancers.RulesOverridesSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -830,7 +824,7 @@ func TestLoadBalancerEditWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.RulesOverridesSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }), Priority: cloudflare.F(int64(0)), @@ -893,7 +887,7 @@ func TestLoadBalancerEditWithOptionalParams(t *testing.T) { "1": "9290f38c5d07c2e2f4df57b1f61d4196", }, }), - SessionAffinity: cloudflare.F(load_balancers.RulesOverridesSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -903,7 +897,7 @@ func TestLoadBalancerEditWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.RulesOverridesSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }), Priority: cloudflare.F(int64(0)), @@ -966,7 +960,7 @@ func TestLoadBalancerEditWithOptionalParams(t *testing.T) { "1": "9290f38c5d07c2e2f4df57b1f61d4196", }, }), - SessionAffinity: cloudflare.F(load_balancers.RulesOverridesSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -976,13 +970,13 @@ func TestLoadBalancerEditWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.RulesOverridesSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }), Priority: cloudflare.F(int64(0)), Terminates: cloudflare.F(true), }}), - SessionAffinity: cloudflare.F(load_balancers.LoadBalancerEditParamsSessionAffinityCookie), + SessionAffinity: cloudflare.F(load_balancers.SessionAffinityCookie), SessionAffinityAttributes: cloudflare.F(load_balancers.SessionAffinityAttributesParam{ DrainDuration: cloudflare.F(100.000000), Headers: cloudflare.F([]string{"x"}), @@ -992,7 +986,7 @@ func TestLoadBalancerEditWithOptionalParams(t *testing.T) { ZeroDowntimeFailover: cloudflare.F(load_balancers.SessionAffinityAttributesZeroDowntimeFailoverSticky), }), SessionAffinityTTL: cloudflare.F(1800.000000), - SteeringPolicy: cloudflare.F(load_balancers.LoadBalancerEditParamsSteeringPolicyDynamicLatency), + SteeringPolicy: cloudflare.F(load_balancers.SteeringPolicyDynamicLatency), TTL: cloudflare.F(30.000000), }, ) @@ -1006,7 +1000,6 @@ func TestLoadBalancerEditWithOptionalParams(t *testing.T) { } func TestLoadBalancerGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/load_balancers/monitor.go b/load_balancers/monitor.go index 1fdd2f373f0..81f532ee4cd 100644 --- a/load_balancers/monitor.go +++ b/load_balancers/monitor.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // MonitorService contains methods and other services that help with interacting @@ -69,7 +69,7 @@ func (r *MonitorService) List(ctx context.Context, query MonitorListParams, opts opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/load_balancers/monitors", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -87,10 +87,10 @@ func (r *MonitorService) ListAutoPaging(ctx context.Context, query MonitorListPa } // Delete a configured monitor. -func (r *MonitorService) Delete(ctx context.Context, monitorID string, params MonitorDeleteParams, opts ...option.RequestOption) (res *MonitorDeleteResponse, err error) { +func (r *MonitorService) Delete(ctx context.Context, monitorID string, body MonitorDeleteParams, opts ...option.RequestOption) (res *MonitorDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env MonitorDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/load_balancers/monitors/%s", params.AccountID, monitorID) + path := fmt.Sprintf("accounts/%s/load_balancers/monitors/%s", body.AccountID, monitorID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -508,11 +508,6 @@ type MonitorListParams struct { type MonitorDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r MonitorDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type MonitorDeleteResponseEnvelope struct { diff --git a/load_balancers/monitor_test.go b/load_balancers/monitor_test.go index 60066c91079..3c4c59a229c 100644 --- a/load_balancers/monitor_test.go +++ b/load_balancers/monitor_test.go @@ -15,7 +15,6 @@ import ( ) func TestMonitorNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -64,7 +63,6 @@ func TestMonitorNewWithOptionalParams(t *testing.T) { } func TestMonitorUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -117,7 +115,6 @@ func TestMonitorUpdateWithOptionalParams(t *testing.T) { } func TestMonitorList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -143,7 +140,6 @@ func TestMonitorList(t *testing.T) { } func TestMonitorDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -161,7 +157,6 @@ func TestMonitorDelete(t *testing.T) { "f1aba936b94213e5b8dca0c0dbf1f9cc", load_balancers.MonitorDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -174,7 +169,6 @@ func TestMonitorDelete(t *testing.T) { } func TestMonitorEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -227,7 +221,6 @@ func TestMonitorEditWithOptionalParams(t *testing.T) { } func TestMonitorGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/load_balancers/monitorpreview.go b/load_balancers/monitorpreview.go index 23d97881a81..322b247b0b5 100644 --- a/load_balancers/monitorpreview.go +++ b/load_balancers/monitorpreview.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // MonitorPreviewService contains methods and other services that help with diff --git a/load_balancers/monitorpreview_test.go b/load_balancers/monitorpreview_test.go index 3f9fb4d500a..aca2d025f05 100644 --- a/load_balancers/monitorpreview_test.go +++ b/load_balancers/monitorpreview_test.go @@ -15,7 +15,6 @@ import ( ) func TestMonitorPreviewNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/load_balancers/monitorreference.go b/load_balancers/monitorreference.go index 07d46aa5b04..71d2e740028 100644 --- a/load_balancers/monitorreference.go +++ b/load_balancers/monitorreference.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // MonitorReferenceService contains methods and other services that help with diff --git a/load_balancers/monitorreference_test.go b/load_balancers/monitorreference_test.go index 0edf026f95f..507c3ffde5d 100644 --- a/load_balancers/monitorreference_test.go +++ b/load_balancers/monitorreference_test.go @@ -15,7 +15,6 @@ import ( ) func TestMonitorReferenceGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/load_balancers/pool.go b/load_balancers/pool.go index 49a79ff74a6..baa39410803 100644 --- a/load_balancers/pool.go +++ b/load_balancers/pool.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PoolService contains methods and other services that help with interacting with @@ -89,10 +89,10 @@ func (r *PoolService) ListAutoPaging(ctx context.Context, params PoolListParams, } // Delete a configured pool. -func (r *PoolService) Delete(ctx context.Context, poolID string, params PoolDeleteParams, opts ...option.RequestOption) (res *PoolDeleteResponse, err error) { +func (r *PoolService) Delete(ctx context.Context, poolID string, body PoolDeleteParams, opts ...option.RequestOption) (res *PoolDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env PoolDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/load_balancers/pools/%s", params.AccountID, poolID) + path := fmt.Sprintf("accounts/%s/load_balancers/pools/%s", body.AccountID, poolID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -435,11 +435,6 @@ func (r PoolListParams) URLQuery() (v url.Values) { type PoolDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r PoolDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type PoolDeleteResponseEnvelope struct { diff --git a/load_balancers/pool_test.go b/load_balancers/pool_test.go index 2d164435952..d51201af29a 100644 --- a/load_balancers/pool_test.go +++ b/load_balancers/pool_test.go @@ -15,7 +15,6 @@ import ( ) func TestPoolNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -96,7 +95,6 @@ func TestPoolNewWithOptionalParams(t *testing.T) { } func TestPoolUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -182,7 +180,6 @@ func TestPoolUpdateWithOptionalParams(t *testing.T) { } func TestPoolListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -209,7 +206,6 @@ func TestPoolListWithOptionalParams(t *testing.T) { } func TestPoolDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -227,7 +223,6 @@ func TestPoolDelete(t *testing.T) { "17b5962d775c646f3f9725cbc7a53df4", load_balancers.PoolDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -240,7 +235,6 @@ func TestPoolDelete(t *testing.T) { } func TestPoolEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -326,7 +320,6 @@ func TestPoolEditWithOptionalParams(t *testing.T) { } func TestPoolGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/load_balancers/poolhealth.go b/load_balancers/poolhealth.go index a6a7af85312..c5da2b72d1a 100644 --- a/load_balancers/poolhealth.go +++ b/load_balancers/poolhealth.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/load_balancers/poolhealth_test.go b/load_balancers/poolhealth_test.go index 3bbc54b2b00..f982613ecb1 100644 --- a/load_balancers/poolhealth_test.go +++ b/load_balancers/poolhealth_test.go @@ -15,7 +15,6 @@ import ( ) func TestPoolHealthNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -68,7 +67,6 @@ func TestPoolHealthNewWithOptionalParams(t *testing.T) { } func TestPoolHealthGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/load_balancers/poolreference.go b/load_balancers/poolreference.go index a58458f9b83..74bef01122a 100644 --- a/load_balancers/poolreference.go +++ b/load_balancers/poolreference.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PoolReferenceService contains methods and other services that help with diff --git a/load_balancers/poolreference_test.go b/load_balancers/poolreference_test.go index a610ff9174d..8020f111d75 100644 --- a/load_balancers/poolreference_test.go +++ b/load_balancers/poolreference_test.go @@ -15,7 +15,6 @@ import ( ) func TestPoolReferenceGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/load_balancers/preview.go b/load_balancers/preview.go index 8efc9f8d74a..59c33a7eaac 100644 --- a/load_balancers/preview.go +++ b/load_balancers/preview.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PreviewService contains methods and other services that help with interacting @@ -44,7 +44,58 @@ func (r *PreviewService) Get(ctx context.Context, previewID string, query Previe return } -type PreviewGetResponse map[string]PreviewGetResponse +type PreviewGetResponse map[string]PreviewGetResponseItem + +type PreviewGetResponseItem struct { + Healthy bool `json:"healthy"` + Origins []map[string]PreviewGetResponseItemOrigin `json:"origins"` + JSON previewGetResponseItemJSON `json:"-"` +} + +// previewGetResponseItemJSON contains the JSON metadata for the struct +// [PreviewGetResponseItem] +type previewGetResponseItemJSON struct { + Healthy apijson.Field + Origins apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PreviewGetResponseItem) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r previewGetResponseItemJSON) RawJSON() string { + return r.raw +} + +// The origin ipv4/ipv6 address or domain name mapped to it's health data. +type PreviewGetResponseItemOrigin struct { + FailureReason string `json:"failure_reason"` + Healthy bool `json:"healthy"` + ResponseCode float64 `json:"response_code"` + RTT string `json:"rtt"` + JSON previewGetResponseItemOriginJSON `json:"-"` +} + +// previewGetResponseItemOriginJSON contains the JSON metadata for the struct +// [PreviewGetResponseItemOrigin] +type previewGetResponseItemOriginJSON struct { + FailureReason apijson.Field + Healthy apijson.Field + ResponseCode apijson.Field + RTT apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PreviewGetResponseItemOrigin) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r previewGetResponseItemOriginJSON) RawJSON() string { + return r.raw +} type PreviewGetParams struct { // Identifier diff --git a/load_balancers/preview_test.go b/load_balancers/preview_test.go index 073d3fa640d..89b98b8721d 100644 --- a/load_balancers/preview_test.go +++ b/load_balancers/preview_test.go @@ -15,7 +15,6 @@ import ( ) func TestPreviewGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/load_balancers/region.go b/load_balancers/region.go index 11438b44492..2fbfc850f68 100644 --- a/load_balancers/region.go +++ b/load_balancers/region.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/load_balancers/region_test.go b/load_balancers/region_test.go index 335b0bb9f0d..5807a5e9230 100644 --- a/load_balancers/region_test.go +++ b/load_balancers/region_test.go @@ -15,7 +15,6 @@ import ( ) func TestRegionListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestRegionListWithOptionalParams(t *testing.T) { } func TestRegionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/load_balancers/search.go b/load_balancers/search.go index 7ea13c99201..53ebc0f1446 100644 --- a/load_balancers/search.go +++ b/load_balancers/search.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SearchService contains methods and other services that help with interacting diff --git a/load_balancers/search_test.go b/load_balancers/search_test.go index b0c1eaa3256..eeb0ecf22fb 100644 --- a/load_balancers/search_test.go +++ b/load_balancers/search_test.go @@ -15,7 +15,7 @@ import ( ) func TestSearchGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logpush/aliases.go b/logpush/aliases.go index b4daa4f02c5..d1b5893bedb 100644 --- a/logpush/aliases.go +++ b/logpush/aliases.go @@ -4,7 +4,7 @@ package logpush import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/logpush/datasetfield.go b/logpush/datasetfield.go index 5928d2e80ea..adc5fd11551 100644 --- a/logpush/datasetfield.go +++ b/logpush/datasetfield.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DatasetFieldService contains methods and other services that help with diff --git a/logpush/datasetfield_test.go b/logpush/datasetfield_test.go index c161ff6f8be..8f89b12e03b 100644 --- a/logpush/datasetfield_test.go +++ b/logpush/datasetfield_test.go @@ -15,7 +15,7 @@ import ( ) func TestDatasetFieldGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logpush/datasetjob.go b/logpush/datasetjob.go index 935adf7dfbb..4214a408a4b 100644 --- a/logpush/datasetjob.go +++ b/logpush/datasetjob.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DatasetJobService contains methods and other services that help with interacting diff --git a/logpush/datasetjob_test.go b/logpush/datasetjob_test.go index f2016d43a13..be4e14eb32f 100644 --- a/logpush/datasetjob_test.go +++ b/logpush/datasetjob_test.go @@ -15,7 +15,7 @@ import ( ) func TestDatasetJobGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logpush/edge.go b/logpush/edge.go index 6c36a6197d5..85feef6401a 100644 --- a/logpush/edge.go +++ b/logpush/edge.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // EdgeService contains methods and other services that help with interacting with diff --git a/logpush/edge_test.go b/logpush/edge_test.go index 679fa60a4ff..8d729783183 100644 --- a/logpush/edge_test.go +++ b/logpush/edge_test.go @@ -15,7 +15,6 @@ import ( ) func TestEdgeNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestEdgeNewWithOptionalParams(t *testing.T) { } func TestEdgeGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logpush/job.go b/logpush/job.go index fdcec70eb64..b8e273a5404 100644 --- a/logpush/job.go +++ b/logpush/job.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // JobService contains methods and other services that help with interacting with @@ -92,7 +92,7 @@ func (r *JobService) List(ctx context.Context, query JobListParams, opts ...opti accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/logpush/jobs", accountOrZone, accountOrZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -110,17 +110,17 @@ func (r *JobService) ListAutoPaging(ctx context.Context, query JobListParams, op } // Deletes a Logpush job. -func (r *JobService) Delete(ctx context.Context, jobID int64, params JobDeleteParams, opts ...option.RequestOption) (res *JobDeleteResponse, err error) { +func (r *JobService) Delete(ctx context.Context, jobID int64, body JobDeleteParams, opts ...option.RequestOption) (res *JobDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env JobDeleteResponseEnvelope var accountOrZone string var accountOrZoneID param.Field[string] - if params.AccountID.Present { + if body.AccountID.Present { accountOrZone = "accounts" - accountOrZoneID = params.AccountID + accountOrZoneID = body.AccountID } else { accountOrZone = "zones" - accountOrZoneID = params.ZoneID + accountOrZoneID = body.ZoneID } path := fmt.Sprintf("%s/%s/logpush/jobs/%v", accountOrZone, accountOrZoneID, jobID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) @@ -156,7 +156,8 @@ func (r *JobService) Get(ctx context.Context, jobID int64, query JobGetParams, o type LogpushJob struct { // Unique id of the job. ID int64 `json:"id"` - // Name of the dataset. + // Name of the dataset. A list of supported datasets can be found on the + // [Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/). Dataset string `json:"dataset,nullable"` // Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. // Additional configuration parameters supported by the destination may be @@ -169,10 +170,15 @@ type LogpushJob struct { // is recorded. On successful execution of a job the error_message and last_error // are set to null. ErrorMessage time.Time `json:"error_message,nullable" format:"date-time"` - // The frequency at which Cloudflare sends batches of logs to your destination. - // Setting frequency to high sends your logs in larger quantities of smaller files. - // Setting frequency to low sends logs in smaller quantities of larger files. + // This field is deprecated. Please use `max_upload_*` parameters instead. The + // frequency at which Cloudflare sends batches of logs to your destination. Setting + // frequency to high sends your logs in larger quantities of smaller files. Setting + // frequency to low sends logs in smaller quantities of larger files. Frequency LogpushJobFrequency `json:"frequency,nullable"` + // The kind parameter (optional) is used to differentiate between Logpush and Edge + // Log Delivery jobs. Currently, Edge Log Delivery is only supported for the + // `http_requests` dataset. + Kind LogpushJobKind `json:"kind,nullable"` // Records the last time for which logs have been successfully pushed. If the last // successful push was for logs range 2018-07-23T10:00:00Z to 2018-07-23T10:01:00Z // then the value of this field will be 2018-07-23T10:01:00Z. If the job has never @@ -188,6 +194,23 @@ type LogpushJob struct { // here, and logpush will keep on making this call for you, setting start and end // times appropriately. LogpullOptions string `json:"logpull_options,nullable" format:"uri-reference"` + // The maximum uncompressed file size of a batch of logs. This setting value must + // be between `5 MB` and `1 GB`, or `0` to disable it. Note that you cannot set a + // minimum file size; this means that log files may be much smaller than this batch + // size. This parameter is not available for jobs with `edge` as its kind. + MaxUploadBytes int64 `json:"max_upload_bytes,nullable"` + // The maximum interval in seconds for log batches. This setting must be between 30 + // and 300 seconds (5 minutes), or `0` to disable it. Note that you cannot specify + // a minimum interval for log batches; this means that log files may be sent in + // shorter intervals than this. This parameter is only used for jobs with `edge` as + // its kind. + MaxUploadIntervalSeconds int64 `json:"max_upload_interval_seconds,nullable"` + // The maximum number of log lines per batch. This setting must be between 1000 and + // 1,000,000 lines, or `0` to disable it. Note that you cannot specify a minimum + // number of log lines per batch; this means that log files may contain many fewer + // lines than this. This parameter is not available for jobs with `edge` as its + // kind. + MaxUploadRecords int64 `json:"max_upload_records,nullable"` // Optional human readable job name. Not unique. Cloudflare suggests that you set // this to a meaningful string, like the domain name, to make it easier to identify // your job. @@ -200,19 +223,23 @@ type LogpushJob struct { // logpushJobJSON contains the JSON metadata for the struct [LogpushJob] type logpushJobJSON struct { - ID apijson.Field - Dataset apijson.Field - DestinationConf apijson.Field - Enabled apijson.Field - ErrorMessage apijson.Field - Frequency apijson.Field - LastComplete apijson.Field - LastError apijson.Field - LogpullOptions apijson.Field - Name apijson.Field - OutputOptions apijson.Field - raw string - ExtraFields map[string]apijson.Field + ID apijson.Field + Dataset apijson.Field + DestinationConf apijson.Field + Enabled apijson.Field + ErrorMessage apijson.Field + Frequency apijson.Field + Kind apijson.Field + LastComplete apijson.Field + LastError apijson.Field + LogpullOptions apijson.Field + MaxUploadBytes apijson.Field + MaxUploadIntervalSeconds apijson.Field + MaxUploadRecords apijson.Field + Name apijson.Field + OutputOptions apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *LogpushJob) UnmarshalJSON(data []byte) (err error) { @@ -223,9 +250,10 @@ func (r logpushJobJSON) RawJSON() string { return r.raw } -// The frequency at which Cloudflare sends batches of logs to your destination. -// Setting frequency to high sends your logs in larger quantities of smaller files. -// Setting frequency to low sends logs in smaller quantities of larger files. +// This field is deprecated. Please use `max_upload_*` parameters instead. The +// frequency at which Cloudflare sends batches of logs to your destination. Setting +// frequency to high sends your logs in larger quantities of smaller files. Setting +// frequency to low sends logs in smaller quantities of larger files. type LogpushJobFrequency string const ( @@ -241,6 +269,23 @@ func (r LogpushJobFrequency) IsKnown() bool { return false } +// The kind parameter (optional) is used to differentiate between Logpush and Edge +// Log Delivery jobs. Currently, Edge Log Delivery is only supported for the +// `http_requests` dataset. +type LogpushJobKind string + +const ( + LogpushJobKindEdge LogpushJobKind = "edge" +) + +func (r LogpushJobKind) IsKnown() bool { + switch r { + case LogpushJobKindEdge: + return true + } + return false +} + // The structured replacement for `logpull_options`. When including this field, the // `logpull_option` field will be ignored. type OutputOptions struct { @@ -397,20 +442,43 @@ type JobNewParams struct { AccountID param.Field[string] `path:"account_id"` // The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. ZoneID param.Field[string] `path:"zone_id"` - // Name of the dataset. + // Name of the dataset. A list of supported datasets can be found on the + // [Developer Docs](https://developers.cloudflare.com/logs/reference/log-fields/). Dataset param.Field[string] `json:"dataset"` // Flag that indicates if the job is enabled. Enabled param.Field[bool] `json:"enabled"` - // The frequency at which Cloudflare sends batches of logs to your destination. - // Setting frequency to high sends your logs in larger quantities of smaller files. - // Setting frequency to low sends logs in smaller quantities of larger files. + // This field is deprecated. Please use `max_upload_*` parameters instead. The + // frequency at which Cloudflare sends batches of logs to your destination. Setting + // frequency to high sends your logs in larger quantities of smaller files. Setting + // frequency to low sends logs in smaller quantities of larger files. Frequency param.Field[JobNewParamsFrequency] `json:"frequency"` + // The kind parameter (optional) is used to differentiate between Logpush and Edge + // Log Delivery jobs. Currently, Edge Log Delivery is only supported for the + // `http_requests` dataset. + Kind param.Field[JobNewParamsKind] `json:"kind"` // This field is deprecated. Use `output_options` instead. Configuration string. It // specifies things like requested fields and timestamp formats. If migrating from // the logpull api, copy the url (full url or just the query string) of your call // here, and logpush will keep on making this call for you, setting start and end // times appropriately. LogpullOptions param.Field[string] `json:"logpull_options" format:"uri-reference"` + // The maximum uncompressed file size of a batch of logs. This setting value must + // be between `5 MB` and `1 GB`, or `0` to disable it. Note that you cannot set a + // minimum file size; this means that log files may be much smaller than this batch + // size. This parameter is not available for jobs with `edge` as its kind. + MaxUploadBytes param.Field[int64] `json:"max_upload_bytes"` + // The maximum interval in seconds for log batches. This setting must be between 30 + // and 300 seconds (5 minutes), or `0` to disable it. Note that you cannot specify + // a minimum interval for log batches; this means that log files may be sent in + // shorter intervals than this. This parameter is only used for jobs with `edge` as + // its kind. + MaxUploadIntervalSeconds param.Field[int64] `json:"max_upload_interval_seconds"` + // The maximum number of log lines per batch. This setting must be between 1000 and + // 1,000,000 lines, or `0` to disable it. Note that you cannot specify a minimum + // number of log lines per batch; this means that log files may contain many fewer + // lines than this. This parameter is not available for jobs with `edge` as its + // kind. + MaxUploadRecords param.Field[int64] `json:"max_upload_records"` // Optional human readable job name. Not unique. Cloudflare suggests that you set // this to a meaningful string, like the domain name, to make it easier to identify // your job. @@ -426,9 +494,10 @@ func (r JobNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The frequency at which Cloudflare sends batches of logs to your destination. -// Setting frequency to high sends your logs in larger quantities of smaller files. -// Setting frequency to low sends logs in smaller quantities of larger files. +// This field is deprecated. Please use `max_upload_*` parameters instead. The +// frequency at which Cloudflare sends batches of logs to your destination. Setting +// frequency to high sends your logs in larger quantities of smaller files. Setting +// frequency to low sends logs in smaller quantities of larger files. type JobNewParamsFrequency string const ( @@ -444,6 +513,23 @@ func (r JobNewParamsFrequency) IsKnown() bool { return false } +// The kind parameter (optional) is used to differentiate between Logpush and Edge +// Log Delivery jobs. Currently, Edge Log Delivery is only supported for the +// `http_requests` dataset. +type JobNewParamsKind string + +const ( + JobNewParamsKindEdge JobNewParamsKind = "edge" +) + +func (r JobNewParamsKind) IsKnown() bool { + switch r { + case JobNewParamsKindEdge: + return true + } + return false +} + type JobNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` @@ -498,16 +584,38 @@ type JobUpdateParams struct { DestinationConf param.Field[string] `json:"destination_conf" format:"uri"` // Flag that indicates if the job is enabled. Enabled param.Field[bool] `json:"enabled"` - // The frequency at which Cloudflare sends batches of logs to your destination. - // Setting frequency to high sends your logs in larger quantities of smaller files. - // Setting frequency to low sends logs in smaller quantities of larger files. + // This field is deprecated. Please use `max_upload_*` parameters instead. The + // frequency at which Cloudflare sends batches of logs to your destination. Setting + // frequency to high sends your logs in larger quantities of smaller files. Setting + // frequency to low sends logs in smaller quantities of larger files. Frequency param.Field[JobUpdateParamsFrequency] `json:"frequency"` + // The kind parameter (optional) is used to differentiate between Logpush and Edge + // Log Delivery jobs. Currently, Edge Log Delivery is only supported for the + // `http_requests` dataset. + Kind param.Field[JobUpdateParamsKind] `json:"kind"` // This field is deprecated. Use `output_options` instead. Configuration string. It // specifies things like requested fields and timestamp formats. If migrating from // the logpull api, copy the url (full url or just the query string) of your call // here, and logpush will keep on making this call for you, setting start and end // times appropriately. LogpullOptions param.Field[string] `json:"logpull_options" format:"uri-reference"` + // The maximum uncompressed file size of a batch of logs. This setting value must + // be between `5 MB` and `1 GB`, or `0` to disable it. Note that you cannot set a + // minimum file size; this means that log files may be much smaller than this batch + // size. This parameter is not available for jobs with `edge` as its kind. + MaxUploadBytes param.Field[int64] `json:"max_upload_bytes"` + // The maximum interval in seconds for log batches. This setting must be between 30 + // and 300 seconds (5 minutes), or `0` to disable it. Note that you cannot specify + // a minimum interval for log batches; this means that log files may be sent in + // shorter intervals than this. This parameter is only used for jobs with `edge` as + // its kind. + MaxUploadIntervalSeconds param.Field[int64] `json:"max_upload_interval_seconds"` + // The maximum number of log lines per batch. This setting must be between 1000 and + // 1,000,000 lines, or `0` to disable it. Note that you cannot specify a minimum + // number of log lines per batch; this means that log files may contain many fewer + // lines than this. This parameter is not available for jobs with `edge` as its + // kind. + MaxUploadRecords param.Field[int64] `json:"max_upload_records"` // The structured replacement for `logpull_options`. When including this field, the // `logpull_option` field will be ignored. OutputOptions param.Field[OutputOptionsParam] `json:"output_options"` @@ -519,9 +627,10 @@ func (r JobUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The frequency at which Cloudflare sends batches of logs to your destination. -// Setting frequency to high sends your logs in larger quantities of smaller files. -// Setting frequency to low sends logs in smaller quantities of larger files. +// This field is deprecated. Please use `max_upload_*` parameters instead. The +// frequency at which Cloudflare sends batches of logs to your destination. Setting +// frequency to high sends your logs in larger quantities of smaller files. Setting +// frequency to low sends logs in smaller quantities of larger files. type JobUpdateParamsFrequency string const ( @@ -537,6 +646,23 @@ func (r JobUpdateParamsFrequency) IsKnown() bool { return false } +// The kind parameter (optional) is used to differentiate between Logpush and Edge +// Log Delivery jobs. Currently, Edge Log Delivery is only supported for the +// `http_requests` dataset. +type JobUpdateParamsKind string + +const ( + JobUpdateParamsKindEdge JobUpdateParamsKind = "edge" +) + +func (r JobUpdateParamsKind) IsKnown() bool { + switch r { + case JobUpdateParamsKindEdge: + return true + } + return false +} + type JobUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` @@ -588,17 +714,12 @@ type JobListParams struct { } type JobDeleteParams struct { - Body interface{} `json:"body,required"` // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. AccountID param.Field[string] `path:"account_id"` // The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. ZoneID param.Field[string] `path:"zone_id"` } -func (r JobDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type JobDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/logpush/job_test.go b/logpush/job_test.go index b1793153a73..96a98e4d40f 100644 --- a/logpush/job_test.go +++ b/logpush/job_test.go @@ -15,7 +15,7 @@ import ( ) func TestJobNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -29,14 +29,18 @@ func TestJobNewWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Logpush.Jobs.New(context.TODO(), logpush.JobNewParams{ - DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), - AccountID: cloudflare.F("string"), - ZoneID: cloudflare.F("string"), - Dataset: cloudflare.F("http_requests"), - Enabled: cloudflare.F(false), - Frequency: cloudflare.F(logpush.JobNewParamsFrequencyHigh), - LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp×tamps=rfc3339"), - Name: cloudflare.F("example.com"), + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + AccountID: cloudflare.F("string"), + ZoneID: cloudflare.F("string"), + Dataset: cloudflare.F("http_requests"), + Enabled: cloudflare.F(false), + Frequency: cloudflare.F(logpush.JobNewParamsFrequencyHigh), + Kind: cloudflare.F(logpush.JobNewParamsKindEdge), + LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp×tamps=rfc3339"), + MaxUploadBytes: cloudflare.F(int64(5000000)), + MaxUploadIntervalSeconds: cloudflare.F(int64(30)), + MaxUploadRecords: cloudflare.F(int64(1000)), + Name: cloudflare.F("example.com"), OutputOptions: cloudflare.F(logpush.OutputOptionsParam{ Cve2021_4428: cloudflare.F(true), BatchPrefix: cloudflare.F("string"), @@ -63,7 +67,7 @@ func TestJobNewWithOptionalParams(t *testing.T) { } func TestJobUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -80,12 +84,16 @@ func TestJobUpdateWithOptionalParams(t *testing.T) { context.TODO(), int64(1), logpush.JobUpdateParams{ - AccountID: cloudflare.F("string"), - ZoneID: cloudflare.F("string"), - DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), - Enabled: cloudflare.F(false), - Frequency: cloudflare.F(logpush.JobUpdateParamsFrequencyHigh), - LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp×tamps=rfc3339"), + AccountID: cloudflare.F("string"), + ZoneID: cloudflare.F("string"), + DestinationConf: cloudflare.F("s3://mybucket/logs?region=us-west-2"), + Enabled: cloudflare.F(false), + Frequency: cloudflare.F(logpush.JobUpdateParamsFrequencyHigh), + Kind: cloudflare.F(logpush.JobUpdateParamsKindEdge), + LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp×tamps=rfc3339"), + MaxUploadBytes: cloudflare.F(int64(5000000)), + MaxUploadIntervalSeconds: cloudflare.F(int64(30)), + MaxUploadRecords: cloudflare.F(int64(1000)), OutputOptions: cloudflare.F(logpush.OutputOptionsParam{ Cve2021_4428: cloudflare.F(true), BatchPrefix: cloudflare.F("string"), @@ -113,7 +121,7 @@ func TestJobUpdateWithOptionalParams(t *testing.T) { } func TestJobListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -140,7 +148,7 @@ func TestJobListWithOptionalParams(t *testing.T) { } func TestJobDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -157,7 +165,6 @@ func TestJobDeleteWithOptionalParams(t *testing.T) { context.TODO(), int64(1), logpush.JobDeleteParams{ - Body: map[string]interface{}{}, AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), }, @@ -172,7 +179,7 @@ func TestJobDeleteWithOptionalParams(t *testing.T) { } func TestJobGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logpush/ownership.go b/logpush/ownership.go index b42013b6e5b..3a90a58749b 100644 --- a/logpush/ownership.go +++ b/logpush/ownership.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // OwnershipService contains methods and other services that help with interacting diff --git a/logpush/ownership_test.go b/logpush/ownership_test.go index a6aec09c0ec..b637eb49206 100644 --- a/logpush/ownership_test.go +++ b/logpush/ownership_test.go @@ -15,7 +15,7 @@ import ( ) func TestOwnershipNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +43,7 @@ func TestOwnershipNewWithOptionalParams(t *testing.T) { } func TestOwnershipValidateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logpush/validate.go b/logpush/validate.go index 0c8c8640ed3..bc5192e7ab3 100644 --- a/logpush/validate.go +++ b/logpush/validate.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ValidateService contains methods and other services that help with interacting diff --git a/logpush/validate_test.go b/logpush/validate_test.go index 3c60fe8ec14..951a077c2aa 100644 --- a/logpush/validate_test.go +++ b/logpush/validate_test.go @@ -15,7 +15,7 @@ import ( ) func TestValidateDestinationWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +43,7 @@ func TestValidateDestinationWithOptionalParams(t *testing.T) { } func TestValidateOriginWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logs/aliases.go b/logs/aliases.go index 20a6801c2bd..e26c25714d8 100644 --- a/logs/aliases.go +++ b/logs/aliases.go @@ -4,7 +4,7 @@ package logs import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/logs/controlcmbconfig.go b/logs/controlcmbconfig.go index cfbda105947..24b3b6e4a6f 100644 --- a/logs/controlcmbconfig.go +++ b/logs/controlcmbconfig.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ControlCmbConfigService contains methods and other services that help with @@ -46,10 +46,10 @@ func (r *ControlCmbConfigService) New(ctx context.Context, params ControlCmbConf } // Deletes CMB config. -func (r *ControlCmbConfigService) Delete(ctx context.Context, params ControlCmbConfigDeleteParams, opts ...option.RequestOption) (res *ControlCmbConfigDeleteResponse, err error) { +func (r *ControlCmbConfigService) Delete(ctx context.Context, body ControlCmbConfigDeleteParams, opts ...option.RequestOption) (res *ControlCmbConfigDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env ControlCmbConfigDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/logs/control/cmb/config", params.AccountID) + path := fmt.Sprintf("accounts/%s/logs/control/cmb/config", body.AccountID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -159,11 +159,6 @@ func (r ControlCmbConfigNewResponseEnvelopeSuccess) IsKnown() bool { type ControlCmbConfigDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r ControlCmbConfigDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type ControlCmbConfigDeleteResponseEnvelope struct { diff --git a/logs/controlcmbconfig_test.go b/logs/controlcmbconfig_test.go index adad27d9232..2033472c6cd 100644 --- a/logs/controlcmbconfig_test.go +++ b/logs/controlcmbconfig_test.go @@ -15,7 +15,6 @@ import ( ) func TestControlCmbConfigNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestControlCmbConfigNewWithOptionalParams(t *testing.T) { } func TestControlCmbConfigDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -59,7 +57,6 @@ func TestControlCmbConfigDelete(t *testing.T) { ) _, err := client.Logs.Control.Cmb.Config.Delete(context.TODO(), logs.ControlCmbConfigDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -71,7 +68,6 @@ func TestControlCmbConfigDelete(t *testing.T) { } func TestControlCmbConfigGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logs/controlretentionflag.go b/logs/controlretentionflag.go index 72dcc38ab67..fb8dbd94caa 100644 --- a/logs/controlretentionflag.go +++ b/logs/controlretentionflag.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ControlRetentionFlagService contains methods and other services that help with diff --git a/logs/controlretentionflag_test.go b/logs/controlretentionflag_test.go index ff637d7121d..dccea36fa41 100644 --- a/logs/controlretentionflag_test.go +++ b/logs/controlretentionflag_test.go @@ -15,7 +15,6 @@ import ( ) func TestControlRetentionFlagNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestControlRetentionFlagNew(t *testing.T) { } func TestControlRetentionFlagGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logs/rayid.go b/logs/rayid.go index 4b17d837d42..619c1b6c390 100644 --- a/logs/rayid.go +++ b/logs/rayid.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/logs/rayid_test.go b/logs/rayid_test.go index 15fb0010fc1..de2e088e389 100644 --- a/logs/rayid_test.go +++ b/logs/rayid_test.go @@ -15,7 +15,6 @@ import ( ) func TestRayIDGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logs/received.go b/logs/received.go index 64554496485..5579de2660f 100644 --- a/logs/received.go +++ b/logs/received.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/logs/received_test.go b/logs/received_test.go index 9f22f9694fa..d9cd4592c15 100644 --- a/logs/received_test.go +++ b/logs/received_test.go @@ -9,14 +9,13 @@ import ( "testing" "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/logs" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) func TestReceivedGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/logs/receivedfield_test.go b/logs/receivedfield_test.go index 84aabd88a9b..bf5fe40d2e0 100644 --- a/logs/receivedfield_test.go +++ b/logs/receivedfield_test.go @@ -14,7 +14,6 @@ import ( ) func TestReceivedFieldGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_network_monitoring/aliases.go b/magic_network_monitoring/aliases.go index 488c89b0acd..ace9a31e401 100644 --- a/magic_network_monitoring/aliases.go +++ b/magic_network_monitoring/aliases.go @@ -4,7 +4,7 @@ package magic_network_monitoring import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/magic_network_monitoring/config.go b/magic_network_monitoring/config.go index 9d68c935aa1..7564bc0d3f9 100644 --- a/magic_network_monitoring/config.go +++ b/magic_network_monitoring/config.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ConfigService contains methods and other services that help with interacting @@ -38,7 +38,7 @@ func (r *ConfigService) New(ctx context.Context, params ConfigNewParams, opts .. opts = append(r.Options[:], opts...) var env ConfigNewResponseEnvelope path := fmt.Sprintf("accounts/%s/mnm/config", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -52,7 +52,7 @@ func (r *ConfigService) Update(ctx context.Context, params ConfigUpdateParams, o opts = append(r.Options[:], opts...) var env ConfigUpdateResponseEnvelope path := fmt.Sprintf("accounts/%s/mnm/config", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return } @@ -61,10 +61,10 @@ func (r *ConfigService) Update(ctx context.Context, params ConfigUpdateParams, o } // Delete an existing network monitoring configuration. -func (r *ConfigService) Delete(ctx context.Context, params ConfigDeleteParams, opts ...option.RequestOption) (res *Configuration, err error) { +func (r *ConfigService) Delete(ctx context.Context, body ConfigDeleteParams, opts ...option.RequestOption) (res *Configuration, err error) { opts = append(r.Options[:], opts...) var env ConfigDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/mnm/config", params.AccountID) + path := fmt.Sprintf("accounts/%s/mnm/config", body.AccountID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -78,7 +78,7 @@ func (r *ConfigService) Edit(ctx context.Context, params ConfigEditParams, opts opts = append(r.Options[:], opts...) var env ConfigEditResponseEnvelope path := fmt.Sprintf("accounts/%s/mnm/config", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { return } @@ -126,19 +126,6 @@ func (r configurationJSON) RawJSON() string { return r.raw } -type ConfigurationParam struct { - // Fallback sampling rate of flow messages being sent in packets per second. This - // should match the packet sampling rate configured on the router. - DefaultSampling param.Field[float64] `json:"default_sampling,required"` - // The account name. - Name param.Field[string] `json:"name,required"` - RouterIPs param.Field[[]string] `json:"router_ips,required"` -} - -func (r ConfigurationParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type ConfigNewParams struct { AccountID param.Field[string] `path:"account_id,required"` Body interface{} `json:"body,required"` @@ -245,11 +232,6 @@ func (r ConfigUpdateResponseEnvelopeSuccess) IsKnown() bool { type ConfigDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r ConfigDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type ConfigDeleteResponseEnvelope struct { diff --git a/magic_network_monitoring/config_test.go b/magic_network_monitoring/config_test.go index 7cc445edfb9..aed6bbc154f 100644 --- a/magic_network_monitoring/config_test.go +++ b/magic_network_monitoring/config_test.go @@ -15,7 +15,6 @@ import ( ) func TestConfigNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestConfigNew(t *testing.T) { } func TestConfigUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestConfigUpdate(t *testing.T) { } func TestConfigDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -84,7 +81,6 @@ func TestConfigDelete(t *testing.T) { ) _, err := client.MagicNetworkMonitoring.Configs.Delete(context.TODO(), magic_network_monitoring.ConfigDeleteParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -96,7 +92,6 @@ func TestConfigDelete(t *testing.T) { } func TestConfigEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -123,7 +118,6 @@ func TestConfigEdit(t *testing.T) { } func TestConfigGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_network_monitoring/configfull.go b/magic_network_monitoring/configfull.go index 29d06bff158..080c5979122 100644 --- a/magic_network_monitoring/configfull.go +++ b/magic_network_monitoring/configfull.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ConfigFullService contains methods and other services that help with interacting diff --git a/magic_network_monitoring/configfull_test.go b/magic_network_monitoring/configfull_test.go index f0b25963496..3fbcb1e2fcb 100644 --- a/magic_network_monitoring/configfull_test.go +++ b/magic_network_monitoring/configfull_test.go @@ -15,7 +15,6 @@ import ( ) func TestConfigFullGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_network_monitoring/rule.go b/magic_network_monitoring/rule.go index 54f907a8f6e..6993b0e93a2 100644 --- a/magic_network_monitoring/rule.go +++ b/magic_network_monitoring/rule.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RuleService contains methods and other services that help with interacting with @@ -40,7 +40,7 @@ func (r *RuleService) New(ctx context.Context, params RuleNewParams, opts ...opt opts = append(r.Options[:], opts...) var env RuleNewResponseEnvelope path := fmt.Sprintf("accounts/%s/mnm/rules", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -53,7 +53,7 @@ func (r *RuleService) Update(ctx context.Context, params RuleUpdateParams, opts opts = append(r.Options[:], opts...) var env RuleUpdateResponseEnvelope path := fmt.Sprintf("accounts/%s/mnm/rules", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return } @@ -67,7 +67,7 @@ func (r *RuleService) List(ctx context.Context, query RuleListParams, opts ...op opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/mnm/rules", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -85,10 +85,10 @@ func (r *RuleService) ListAutoPaging(ctx context.Context, query RuleListParams, } // Delete a network monitoring rule for account. -func (r *RuleService) Delete(ctx context.Context, ruleID string, params RuleDeleteParams, opts ...option.RequestOption) (res *MagicNetworkMonitoringRule, err error) { +func (r *RuleService) Delete(ctx context.Context, ruleID string, body RuleDeleteParams, opts ...option.RequestOption) (res *MagicNetworkMonitoringRule, err error) { opts = append(r.Options[:], opts...) var env RuleDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/mnm/rules/%s", params.AccountID, ruleID) + path := fmt.Sprintf("accounts/%s/mnm/rules/%s", body.AccountID, ruleID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -102,7 +102,7 @@ func (r *RuleService) Edit(ctx context.Context, ruleID string, params RuleEditPa opts = append(r.Options[:], opts...) var env RuleEditResponseEnvelope path := fmt.Sprintf("accounts/%s/mnm/rules/%s", params.AccountID, ruleID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { return } @@ -282,11 +282,6 @@ type RuleListParams struct { type RuleDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r RuleDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type RuleDeleteResponseEnvelope struct { diff --git a/magic_network_monitoring/rule_test.go b/magic_network_monitoring/rule_test.go index 711b273f820..87299520f4c 100644 --- a/magic_network_monitoring/rule_test.go +++ b/magic_network_monitoring/rule_test.go @@ -15,7 +15,6 @@ import ( ) func TestRuleNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestRuleNew(t *testing.T) { } func TestRuleUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestRuleUpdate(t *testing.T) { } func TestRuleList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -95,7 +92,6 @@ func TestRuleList(t *testing.T) { } func TestRuleDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -113,7 +109,6 @@ func TestRuleDelete(t *testing.T) { "2890e6fa406311ed9b5a23f70f6fb8cf", magic_network_monitoring.RuleDeleteParams{ AccountID: cloudflare.F("6f91088a406011ed95aed352566e8d4c"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -126,7 +121,6 @@ func TestRuleDelete(t *testing.T) { } func TestRuleEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -157,7 +151,6 @@ func TestRuleEdit(t *testing.T) { } func TestRuleGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_network_monitoring/ruleadvertisement.go b/magic_network_monitoring/ruleadvertisement.go index a3ccf7f6bf9..a974fca1c14 100644 --- a/magic_network_monitoring/ruleadvertisement.go +++ b/magic_network_monitoring/ruleadvertisement.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RuleAdvertisementService contains methods and other services that help with @@ -37,7 +37,7 @@ func (r *RuleAdvertisementService) Edit(ctx context.Context, ruleID string, para opts = append(r.Options[:], opts...) var env RuleAdvertisementEditResponseEnvelope path := fmt.Sprintf("accounts/%s/mnm/rules/%s/advertisement", params.AccountID, ruleID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { return } diff --git a/magic_network_monitoring/ruleadvertisement_test.go b/magic_network_monitoring/ruleadvertisement_test.go index dfe6f09bd81..bffae3c1fa0 100644 --- a/magic_network_monitoring/ruleadvertisement_test.go +++ b/magic_network_monitoring/ruleadvertisement_test.go @@ -15,7 +15,6 @@ import ( ) func TestRuleAdvertisementEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_transit/aliases.go b/magic_transit/aliases.go index 598d4371f10..4652b55da75 100644 --- a/magic_transit/aliases.go +++ b/magic_transit/aliases.go @@ -4,7 +4,7 @@ package magic_transit import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/magic_transit/cfinterconnect.go b/magic_transit/cfinterconnect.go index 02d3c17f6e6..b13dfbff92e 100644 --- a/magic_transit/cfinterconnect.go +++ b/magic_transit/cfinterconnect.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CfInterconnectService contains methods and other services that help with diff --git a/magic_transit/cfinterconnect_test.go b/magic_transit/cfinterconnect_test.go index 49df094f77f..3379bd0da1d 100644 --- a/magic_transit/cfinterconnect_test.go +++ b/magic_transit/cfinterconnect_test.go @@ -15,7 +15,6 @@ import ( ) func TestCfInterconnectUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -57,7 +56,6 @@ func TestCfInterconnectUpdateWithOptionalParams(t *testing.T) { } func TestCfInterconnectList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -83,7 +81,6 @@ func TestCfInterconnectList(t *testing.T) { } func TestCfInterconnectGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_transit/gretunnel.go b/magic_transit/gretunnel.go index 7e522ece0e5..ab0a9a644da 100644 --- a/magic_transit/gretunnel.go +++ b/magic_transit/gretunnel.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // GRETunnelService contains methods and other services that help with interacting @@ -75,10 +75,10 @@ func (r *GRETunnelService) List(ctx context.Context, query GRETunnelListParams, // Disables and removes a specific static GRE tunnel. Use `?validate_only=true` as // an optional query parameter to only run validation without persisting changes. -func (r *GRETunnelService) Delete(ctx context.Context, tunnelIdentifier string, params GRETunnelDeleteParams, opts ...option.RequestOption) (res *GRETunnelDeleteResponse, err error) { +func (r *GRETunnelService) Delete(ctx context.Context, tunnelIdentifier string, body GRETunnelDeleteParams, opts ...option.RequestOption) (res *GRETunnelDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env GRETunnelDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", params.AccountID, tunnelIdentifier) + path := fmt.Sprintf("accounts/%s/magic/gre_tunnels/%s", body.AccountID, tunnelIdentifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -494,11 +494,6 @@ func (r GRETunnelListResponseEnvelopeSuccess) IsKnown() bool { type GRETunnelDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r GRETunnelDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type GRETunnelDeleteResponseEnvelope struct { diff --git a/magic_transit/gretunnel_test.go b/magic_transit/gretunnel_test.go index 585c40d1c39..a2f40553ced 100644 --- a/magic_transit/gretunnel_test.go +++ b/magic_transit/gretunnel_test.go @@ -15,7 +15,7 @@ import ( ) func TestGRETunnelNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +42,6 @@ func TestGRETunnelNew(t *testing.T) { } func TestGRETunnelUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -86,7 +85,6 @@ func TestGRETunnelUpdateWithOptionalParams(t *testing.T) { } func TestGRETunnelList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -112,7 +110,6 @@ func TestGRETunnelList(t *testing.T) { } func TestGRETunnelDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -130,7 +127,6 @@ func TestGRETunnelDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.GRETunnelDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -143,7 +139,6 @@ func TestGRETunnelDelete(t *testing.T) { } func TestGRETunnelGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_transit/ipsectunnel.go b/magic_transit/ipsectunnel.go index ce23c8d77c5..b11f508e5b8 100644 --- a/magic_transit/ipsectunnel.go +++ b/magic_transit/ipsectunnel.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // IPSECTunnelService contains methods and other services that help with @@ -79,10 +79,10 @@ func (r *IPSECTunnelService) List(ctx context.Context, query IPSECTunnelListPara // Disables and removes a specific static IPsec Tunnel associated with an account. // Use `?validate_only=true` as an optional query parameter to only run validation // without persisting changes. -func (r *IPSECTunnelService) Delete(ctx context.Context, tunnelIdentifier string, params IPSECTunnelDeleteParams, opts ...option.RequestOption) (res *IPSECTunnelDeleteResponse, err error) { +func (r *IPSECTunnelService) Delete(ctx context.Context, tunnelIdentifier string, body IPSECTunnelDeleteParams, opts ...option.RequestOption) (res *IPSECTunnelDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env IPSECTunnelDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", params.AccountID, tunnelIdentifier) + path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s", body.AccountID, tunnelIdentifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -113,7 +113,7 @@ func (r *IPSECTunnelService) PSKGenerate(ctx context.Context, tunnelIdentifier s opts = append(r.Options[:], opts...) var env IPSECTunnelPSKGenerateResponseEnvelope path := fmt.Sprintf("accounts/%s/magic/ipsec_tunnels/%s/psk_generate", params.AccountID, tunnelIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -657,11 +657,6 @@ func (r IPSECTunnelListResponseEnvelopeSuccess) IsKnown() bool { type IPSECTunnelDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r IPSECTunnelDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type IPSECTunnelDeleteResponseEnvelope struct { diff --git a/magic_transit/ipsectunnel_test.go b/magic_transit/ipsectunnel_test.go index 535200851f8..b46d9c3955c 100644 --- a/magic_transit/ipsectunnel_test.go +++ b/magic_transit/ipsectunnel_test.go @@ -15,7 +15,6 @@ import ( ) func TestIPSECTunnelNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -55,7 +54,6 @@ func TestIPSECTunnelNewWithOptionalParams(t *testing.T) { } func TestIPSECTunnelUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -99,7 +97,6 @@ func TestIPSECTunnelUpdateWithOptionalParams(t *testing.T) { } func TestIPSECTunnelList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -125,7 +122,6 @@ func TestIPSECTunnelList(t *testing.T) { } func TestIPSECTunnelDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -143,7 +139,6 @@ func TestIPSECTunnelDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.IPSECTunnelDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -156,7 +151,6 @@ func TestIPSECTunnelDelete(t *testing.T) { } func TestIPSECTunnelGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -186,7 +180,6 @@ func TestIPSECTunnelGet(t *testing.T) { } func TestIPSECTunnelPSKGenerate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_transit/route.go b/magic_transit/route.go index 7f1a252d679..8806c5695f2 100644 --- a/magic_transit/route.go +++ b/magic_transit/route.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RouteService contains methods and other services that help with interacting with @@ -74,10 +74,10 @@ func (r *RouteService) List(ctx context.Context, query RouteListParams, opts ... } // Disable and remove a specific Magic static route. -func (r *RouteService) Delete(ctx context.Context, routeIdentifier string, params RouteDeleteParams, opts ...option.RequestOption) (res *RouteDeleteResponse, err error) { +func (r *RouteService) Delete(ctx context.Context, routeIdentifier string, body RouteDeleteParams, opts ...option.RequestOption) (res *RouteDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env RouteDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/routes/%s", params.AccountID, routeIdentifier) + path := fmt.Sprintf("accounts/%s/magic/routes/%s", body.AccountID, routeIdentifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -87,11 +87,11 @@ func (r *RouteService) Delete(ctx context.Context, routeIdentifier string, param } // Delete multiple Magic static routes. -func (r *RouteService) Empty(ctx context.Context, params RouteEmptyParams, opts ...option.RequestOption) (res *RouteEmptyResponse, err error) { +func (r *RouteService) Empty(ctx context.Context, body RouteEmptyParams, opts ...option.RequestOption) (res *RouteEmptyResponse, err error) { opts = append(r.Options[:], opts...) var env RouteEmptyResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/routes", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + path := fmt.Sprintf("accounts/%s/magic/routes", body.AccountID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return } @@ -112,21 +112,13 @@ func (r *RouteService) Get(ctx context.Context, routeIdentifier string, query Ro return } -type ColoName []string - -type ColoNameParam []string - -type ColoRegion []string - -type ColoRegionParam []string - // Used only for ECMP routes. type Scope struct { // List of colo names for the ECMP scope. - ColoNames ColoName `json:"colo_names"` + ColoNames []string `json:"colo_names"` // List of colo regions for the ECMP scope. - ColoRegions ColoRegion `json:"colo_regions"` - JSON scopeJSON `json:"-"` + ColoRegions []string `json:"colo_regions"` + JSON scopeJSON `json:"-"` } // scopeJSON contains the JSON metadata for the struct [Scope] @@ -148,9 +140,9 @@ func (r scopeJSON) RawJSON() string { // Used only for ECMP routes. type ScopeParam struct { // List of colo names for the ECMP scope. - ColoNames param.Field[ColoNameParam] `json:"colo_names"` + ColoNames param.Field[[]string] `json:"colo_names"` // List of colo regions for the ECMP scope. - ColoRegions param.Field[ColoRegionParam] `json:"colo_regions"` + ColoRegions param.Field[[]string] `json:"colo_regions"` } func (r ScopeParam) MarshalJSON() (data []byte, err error) { @@ -549,11 +541,6 @@ func (r RouteListResponseEnvelopeSuccess) IsKnown() bool { type RouteDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r RouteDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type RouteDeleteResponseEnvelope struct { @@ -601,19 +588,7 @@ func (r RouteDeleteResponseEnvelopeSuccess) IsKnown() bool { type RouteEmptyParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Routes param.Field[[]RouteEmptyParamsRoute] `json:"routes,required"` -} - -func (r RouteEmptyParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type RouteEmptyParamsRoute struct { -} - -func (r RouteEmptyParamsRoute) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + AccountID param.Field[string] `path:"account_id,required"` } type RouteEmptyResponseEnvelope struct { diff --git a/magic_transit/route_test.go b/magic_transit/route_test.go index bf86a596a0b..201807721a8 100644 --- a/magic_transit/route_test.go +++ b/magic_transit/route_test.go @@ -15,7 +15,7 @@ import ( ) func TestRouteNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +42,6 @@ func TestRouteNew(t *testing.T) { } func TestRouteUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -81,7 +80,6 @@ func TestRouteUpdateWithOptionalParams(t *testing.T) { } func TestRouteList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -107,7 +105,6 @@ func TestRouteList(t *testing.T) { } func TestRouteDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -125,7 +122,6 @@ func TestRouteDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.RouteDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -138,7 +134,6 @@ func TestRouteDelete(t *testing.T) { } func TestRouteEmpty(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -153,7 +148,6 @@ func TestRouteEmpty(t *testing.T) { ) _, err := client.MagicTransit.Routes.Empty(context.TODO(), magic_transit.RouteEmptyParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Routes: cloudflare.F([]magic_transit.RouteEmptyParamsRoute{{}, {}, {}}), }) if err != nil { var apierr *cloudflare.Error @@ -165,7 +159,6 @@ func TestRouteEmpty(t *testing.T) { } func TestRouteGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_transit/site.go b/magic_transit/site.go index e5f320a267b..0e220940108 100644 --- a/magic_transit/site.go +++ b/magic_transit/site.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SiteService contains methods and other services that help with interacting with @@ -94,10 +94,10 @@ func (r *SiteService) ListAutoPaging(ctx context.Context, params SiteListParams, } // Remove a specific Site. -func (r *SiteService) Delete(ctx context.Context, siteID string, params SiteDeleteParams, opts ...option.RequestOption) (res *Site, err error) { +func (r *SiteService) Delete(ctx context.Context, siteID string, body SiteDeleteParams, opts ...option.RequestOption) (res *Site, err error) { opts = append(r.Options[:], opts...) var env SiteDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/sites/%s", params.AccountID, siteID) + path := fmt.Sprintf("accounts/%s/magic/sites/%s", body.AccountID, siteID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -338,11 +338,6 @@ func (r SiteListParams) URLQuery() (v url.Values) { type SiteDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r SiteDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type SiteDeleteResponseEnvelope struct { diff --git a/magic_transit/site_test.go b/magic_transit/site_test.go index eac5b8ab0b2..3afe3718ac1 100644 --- a/magic_transit/site_test.go +++ b/magic_transit/site_test.go @@ -15,7 +15,6 @@ import ( ) func TestSiteNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -35,8 +34,8 @@ func TestSiteNewWithOptionalParams(t *testing.T) { Description: cloudflare.F("string"), HaMode: cloudflare.F(true), Location: cloudflare.F(magic_transit.SiteLocationParam{ - Lat: cloudflare.F("string"), - Lon: cloudflare.F("string"), + Lat: cloudflare.F("37.6192"), + Lon: cloudflare.F("122.3816"), }), SecondaryConnectorID: cloudflare.F("8d67040d3835dbcf46ce29da440dc482"), }) @@ -50,7 +49,6 @@ func TestSiteNewWithOptionalParams(t *testing.T) { } func TestSiteUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -71,8 +69,8 @@ func TestSiteUpdateWithOptionalParams(t *testing.T) { ConnectorID: cloudflare.F("ac60d3d0435248289d446cedd870bcf4"), Description: cloudflare.F("string"), Location: cloudflare.F(magic_transit.SiteLocationParam{ - Lat: cloudflare.F("string"), - Lon: cloudflare.F("string"), + Lat: cloudflare.F("37.6192"), + Lon: cloudflare.F("122.3816"), }), Name: cloudflare.F("site_1"), SecondaryConnectorID: cloudflare.F("8d67040d3835dbcf46ce29da440dc482"), @@ -88,7 +86,6 @@ func TestSiteUpdateWithOptionalParams(t *testing.T) { } func TestSiteListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -115,7 +112,6 @@ func TestSiteListWithOptionalParams(t *testing.T) { } func TestSiteDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -133,7 +129,6 @@ func TestSiteDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -146,7 +141,6 @@ func TestSiteDelete(t *testing.T) { } func TestSiteGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_transit/siteacl.go b/magic_transit/siteacl.go index 68bb0af4a3a..9a6c3045922 100644 --- a/magic_transit/siteacl.go +++ b/magic_transit/siteacl.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -66,7 +66,7 @@ func (r *SiteACLService) List(ctx context.Context, siteID string, query SiteACLL opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/magic/sites/%s/acls", query.AccountID, siteID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -84,10 +84,10 @@ func (r *SiteACLService) ListAutoPaging(ctx context.Context, siteID string, quer } // Remove a specific Site ACL. -func (r *SiteACLService) Delete(ctx context.Context, siteID string, aclIdentifier string, params SiteACLDeleteParams, opts ...option.RequestOption) (res *ACL, err error) { +func (r *SiteACLService) Delete(ctx context.Context, siteID string, aclIdentifier string, body SiteACLDeleteParams, opts ...option.RequestOption) (res *ACL, err error) { opts = append(r.Options[:], opts...) var env SiteACLDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/sites/%s/acls/%s", params.AccountID, siteID, aclIdentifier) + path := fmt.Sprintf("accounts/%s/magic/sites/%s/acls/%s", body.AccountID, siteID, aclIdentifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -149,26 +149,6 @@ func (r aclJSON) RawJSON() string { return r.raw } -// Bidirectional ACL policy for network traffic within a site. -type ACLParam struct { - // Description for the ACL. - Description param.Field[string] `json:"description"` - // 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. - ForwardLocally param.Field[bool] `json:"forward_locally"` - LAN1 param.Field[ACLConfigurationParam] `json:"lan_1"` - LAN2 param.Field[ACLConfigurationParam] `json:"lan_2"` - // The name of the ACL. - Name param.Field[string] `json:"name"` - Protocols param.Field[[]AllowedProtocol] `json:"protocols"` -} - -func (r ACLParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type ACLConfiguration struct { // The identifier for the LAN you want to create an ACL policy with. LANID string `json:"lan_id,required"` @@ -404,11 +384,6 @@ type SiteACLListParams struct { type SiteACLDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r SiteACLDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type SiteACLDeleteResponseEnvelope struct { diff --git a/magic_transit/siteacl_test.go b/magic_transit/siteacl_test.go index 11706522409..841afa7b368 100644 --- a/magic_transit/siteacl_test.go +++ b/magic_transit/siteacl_test.go @@ -9,14 +9,13 @@ import ( "testing" "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/magic_transit" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) func TestSiteACLNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -62,7 +61,6 @@ func TestSiteACLNewWithOptionalParams(t *testing.T) { } func TestSiteACLUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -109,7 +107,6 @@ func TestSiteACLUpdateWithOptionalParams(t *testing.T) { } func TestSiteACLList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -139,7 +136,6 @@ func TestSiteACLList(t *testing.T) { } func TestSiteACLDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -158,7 +154,6 @@ func TestSiteACLDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteACLDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -171,7 +166,6 @@ func TestSiteACLDelete(t *testing.T) { } func TestSiteACLGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_transit/sitelan.go b/magic_transit/sitelan.go index 171caa1bf40..63839363c69 100644 --- a/magic_transit/sitelan.go +++ b/magic_transit/sitelan.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SiteLANService contains methods and other services that help with interacting @@ -65,7 +65,7 @@ func (r *SiteLANService) List(ctx context.Context, siteID string, query SiteLANL opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/magic/sites/%s/lans", query.AccountID, siteID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -83,10 +83,10 @@ func (r *SiteLANService) ListAutoPaging(ctx context.Context, siteID string, quer } // Remove a specific LAN. -func (r *SiteLANService) Delete(ctx context.Context, siteID string, lanID string, params SiteLANDeleteParams, opts ...option.RequestOption) (res *LAN, err error) { +func (r *SiteLANService) Delete(ctx context.Context, siteID string, lanID string, body SiteLANDeleteParams, opts ...option.RequestOption) (res *LAN, err error) { opts = append(r.Options[:], opts...) var env SiteLANDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/sites/%s/lans/%s", params.AccountID, siteID, lanID) + path := fmt.Sprintf("accounts/%s/magic/sites/%s/lans/%s", body.AccountID, siteID, lanID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -483,11 +483,6 @@ type SiteLANListParams struct { type SiteLANDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r SiteLANDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type SiteLANDeleteResponseEnvelope struct { diff --git a/magic_transit/sitelan_test.go b/magic_transit/sitelan_test.go index 8ea86cbfc60..b38c72341b1 100644 --- a/magic_transit/sitelan_test.go +++ b/magic_transit/sitelan_test.go @@ -15,7 +15,6 @@ import ( ) func TestSiteLANNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -88,7 +87,6 @@ func TestSiteLANNewWithOptionalParams(t *testing.T) { } func TestSiteLANUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -161,7 +159,6 @@ func TestSiteLANUpdateWithOptionalParams(t *testing.T) { } func TestSiteLANList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -191,7 +188,6 @@ func TestSiteLANList(t *testing.T) { } func TestSiteLANDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -210,7 +206,6 @@ func TestSiteLANDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteLANDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -223,7 +218,6 @@ func TestSiteLANDelete(t *testing.T) { } func TestSiteLANGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/magic_transit/sitewan.go b/magic_transit/sitewan.go index 31cdc76d3d4..b3013766df1 100644 --- a/magic_transit/sitewan.go +++ b/magic_transit/sitewan.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SiteWANService contains methods and other services that help with interacting @@ -64,7 +64,7 @@ func (r *SiteWANService) List(ctx context.Context, siteID string, query SiteWANL opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/magic/sites/%s/wans", query.AccountID, siteID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -82,10 +82,10 @@ func (r *SiteWANService) ListAutoPaging(ctx context.Context, siteID string, quer } // Remove a specific WAN. -func (r *SiteWANService) Delete(ctx context.Context, siteID string, wanID string, params SiteWANDeleteParams, opts ...option.RequestOption) (res *WAN, err error) { +func (r *SiteWANService) Delete(ctx context.Context, siteID string, wanID string, body SiteWANDeleteParams, opts ...option.RequestOption) (res *WAN, err error) { opts = append(r.Options[:], opts...) var env SiteWANDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/magic/sites/%s/wans/%s", params.AccountID, siteID, wanID) + path := fmt.Sprintf("accounts/%s/magic/sites/%s/wans/%s", body.AccountID, siteID, wanID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -318,11 +318,6 @@ type SiteWANListParams struct { type SiteWANDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r SiteWANDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type SiteWANDeleteResponseEnvelope struct { diff --git a/magic_transit/sitewan_test.go b/magic_transit/sitewan_test.go index 2961c1ac374..1befe50744e 100644 --- a/magic_transit/sitewan_test.go +++ b/magic_transit/sitewan_test.go @@ -15,7 +15,6 @@ import ( ) func TestSiteWANNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -54,7 +53,6 @@ func TestSiteWANNewWithOptionalParams(t *testing.T) { } func TestSiteWANUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -94,7 +92,6 @@ func TestSiteWANUpdateWithOptionalParams(t *testing.T) { } func TestSiteWANList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -124,7 +121,6 @@ func TestSiteWANList(t *testing.T) { } func TestSiteWANDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -143,7 +139,6 @@ func TestSiteWANDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteWANDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -156,7 +151,6 @@ func TestSiteWANDelete(t *testing.T) { } func TestSiteWANGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/managed_headers/aliases.go b/managed_headers/aliases.go index cc969d89580..f5560e725e3 100644 --- a/managed_headers/aliases.go +++ b/managed_headers/aliases.go @@ -4,7 +4,7 @@ package managed_headers import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/managed_headers/managedheader_test.go b/managed_headers/managedheader_test.go index e0c671db033..733083926ee 100644 --- a/managed_headers/managedheader_test.go +++ b/managed_headers/managedheader_test.go @@ -15,7 +15,6 @@ import ( ) func TestManagedHeaderList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -41,7 +40,6 @@ func TestManagedHeaderList(t *testing.T) { } func TestManagedHeaderEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/memberships/aliases.go b/memberships/aliases.go index 0a6a12ddde5..0b05453e9c3 100644 --- a/memberships/aliases.go +++ b/memberships/aliases.go @@ -4,7 +4,7 @@ package memberships import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/memberships/membership.go b/memberships/membership.go index 2d2c95a52aa..42bd5eef08b 100644 --- a/memberships/membership.go +++ b/memberships/membership.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -74,7 +74,7 @@ func (r *MembershipService) ListAutoPaging(ctx context.Context, query Membership } // Remove the associated member from an account. -func (r *MembershipService) Delete(ctx context.Context, membershipID string, body MembershipDeleteParams, opts ...option.RequestOption) (res *MembershipDeleteResponse, err error) { +func (r *MembershipService) Delete(ctx context.Context, membershipID string, opts ...option.RequestOption) (res *MembershipDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env MembershipDeleteResponseEnvelope path := fmt.Sprintf("memberships/%s", membershipID) @@ -411,14 +411,6 @@ func (r MembershipListParamsStatus) IsKnown() bool { return false } -type MembershipDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r MembershipDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type MembershipDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/memberships/membership_test.go b/memberships/membership_test.go index cd5c30699ea..5332b4e9b3a 100644 --- a/memberships/membership_test.go +++ b/memberships/membership_test.go @@ -15,7 +15,6 @@ import ( ) func TestMembershipUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestMembershipUpdate(t *testing.T) { } func TestMembershipListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -79,7 +77,6 @@ func TestMembershipListWithOptionalParams(t *testing.T) { } func TestMembershipDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -92,13 +89,7 @@ func TestMembershipDelete(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Memberships.Delete( - context.TODO(), - "4536bcfad5faccb111b47003c79917fa", - memberships.MembershipDeleteParams{ - Body: map[string]interface{}{}, - }, - ) + _, err := client.Memberships.Delete(context.TODO(), "4536bcfad5faccb111b47003c79917fa") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -109,7 +100,6 @@ func TestMembershipDelete(t *testing.T) { } func TestMembershipGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/mtls_certificates/aliases.go b/mtls_certificates/aliases.go index 7cb164be62a..5e90d9d6124 100644 --- a/mtls_certificates/aliases.go +++ b/mtls_certificates/aliases.go @@ -4,7 +4,7 @@ package mtls_certificates import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/mtls_certificates/association.go b/mtls_certificates/association.go index 4cf3e762797..29cfc43b482 100644 --- a/mtls_certificates/association.go +++ b/mtls_certificates/association.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AssociationService contains methods and other services that help with @@ -76,11 +76,11 @@ type AssociationGetParams struct { } type AssociationGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result []CertificateAsssociation `json:"result,required,nullable"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success AssociationGetResponseEnvelopeSuccess `json:"success,required"` + Result []CertificateAsssociation `json:"result,nullable"` ResultInfo AssociationGetResponseEnvelopeResultInfo `json:"result_info"` JSON associationGetResponseEnvelopeJSON `json:"-"` } @@ -90,8 +90,8 @@ type AssociationGetResponseEnvelope struct { type associationGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field ResultInfo apijson.Field raw string ExtraFields map[string]apijson.Field diff --git a/mtls_certificates/association_test.go b/mtls_certificates/association_test.go index ef82e6bf761..f1a32192605 100644 --- a/mtls_certificates/association_test.go +++ b/mtls_certificates/association_test.go @@ -15,7 +15,6 @@ import ( ) func TestAssociationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/mtls_certificates/mtlscertificate.go b/mtls_certificates/mtlscertificate.go index f6edb7beb2a..dd4521ed2de 100644 --- a/mtls_certificates/mtlscertificate.go +++ b/mtls_certificates/mtlscertificate.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // MTLSCertificateService contains methods and other services that help with @@ -55,7 +55,7 @@ func (r *MTLSCertificateService) List(ctx context.Context, query MTLSCertificate opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/mtls_certificates", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -74,10 +74,10 @@ func (r *MTLSCertificateService) ListAutoPaging(ctx context.Context, query MTLSC // Deletes the mTLS certificate unless the certificate is in use by one or more // Cloudflare services. -func (r *MTLSCertificateService) Delete(ctx context.Context, mtlsCertificateID string, params MTLSCertificateDeleteParams, opts ...option.RequestOption) (res *MTLSCertificate, err error) { +func (r *MTLSCertificateService) Delete(ctx context.Context, mtlsCertificateID string, body MTLSCertificateDeleteParams, opts ...option.RequestOption) (res *MTLSCertificate, err error) { opts = append(r.Options[:], opts...) var env MTLSCertificateDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/mtls_certificates/%s", params.AccountID, mtlsCertificateID) + path := fmt.Sprintf("accounts/%s/mtls_certificates/%s", body.AccountID, mtlsCertificateID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -211,11 +211,11 @@ func (r MTLSCertificateNewParams) MarshalJSON() (data []byte, err error) { } type MTLSCertificateNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result MTLSCertificateNewResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success MTLSCertificateNewResponseEnvelopeSuccess `json:"success,required"` + Result MTLSCertificateNewResponse `json:"result"` JSON mtlsCertificateNewResponseEnvelopeJSON `json:"-"` } @@ -224,8 +224,8 @@ type MTLSCertificateNewResponseEnvelope struct { type mtlsCertificateNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -261,19 +261,14 @@ type MTLSCertificateListParams struct { type MTLSCertificateDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r MTLSCertificateDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type MTLSCertificateDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result MTLSCertificate `json:"result,required"` // Whether the API call was successful Success MTLSCertificateDeleteResponseEnvelopeSuccess `json:"success,required"` + Result MTLSCertificate `json:"result"` JSON mtlsCertificateDeleteResponseEnvelopeJSON `json:"-"` } @@ -282,8 +277,8 @@ type MTLSCertificateDeleteResponseEnvelope struct { type mtlsCertificateDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -319,9 +314,9 @@ type MTLSCertificateGetParams struct { type MTLSCertificateGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result MTLSCertificate `json:"result,required"` // Whether the API call was successful Success MTLSCertificateGetResponseEnvelopeSuccess `json:"success,required"` + Result MTLSCertificate `json:"result"` JSON mtlsCertificateGetResponseEnvelopeJSON `json:"-"` } @@ -330,8 +325,8 @@ type MTLSCertificateGetResponseEnvelope struct { type mtlsCertificateGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/mtls_certificates/mtlscertificate_test.go b/mtls_certificates/mtlscertificate_test.go index 339b113e186..954b082a548 100644 --- a/mtls_certificates/mtlscertificate_test.go +++ b/mtls_certificates/mtlscertificate_test.go @@ -15,7 +15,6 @@ import ( ) func TestMTLSCertificateNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestMTLSCertificateNewWithOptionalParams(t *testing.T) { } func TestMTLSCertificateList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -71,7 +69,6 @@ func TestMTLSCertificateList(t *testing.T) { } func TestMTLSCertificateDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -89,7 +86,6 @@ func TestMTLSCertificateDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", mtls_certificates.MTLSCertificateDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -102,7 +98,6 @@ func TestMTLSCertificateDelete(t *testing.T) { } func TestMTLSCertificateGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/origin_ca_certificates/aliases.go b/origin_ca_certificates/aliases.go index b508bda940a..7efc201b484 100644 --- a/origin_ca_certificates/aliases.go +++ b/origin_ca_certificates/aliases.go @@ -4,7 +4,7 @@ package origin_ca_certificates import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/origin_ca_certificates/origincacertificate.go b/origin_ca_certificates/origincacertificate.go index 53660efd004..dcec7fb6ccb 100644 --- a/origin_ca_certificates/origincacertificate.go +++ b/origin_ca_certificates/origincacertificate.go @@ -15,8 +15,9 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" + "github.com/cloudflare/cloudflare-go/v2/ssl" "github.com/tidwall/gjson" ) @@ -82,7 +83,7 @@ func (r *OriginCACertificateService) ListAutoPaging(ctx context.Context, query O // Revoke an existing Origin CA certificate by its serial number. Use your Origin // CA Key as your User Service Key when calling this endpoint // ([see above](#requests)). -func (r *OriginCACertificateService) Delete(ctx context.Context, certificateID string, body OriginCACertificateDeleteParams, opts ...option.RequestOption) (res *OriginCACertificateDeleteResponse, err error) { +func (r *OriginCACertificateService) Delete(ctx context.Context, certificateID string, opts ...option.RequestOption) (res *OriginCACertificateDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env OriginCACertificateDeleteResponseEnvelope path := fmt.Sprintf("certificates/%s", certificateID) @@ -117,9 +118,9 @@ type OriginCACertificate struct { Hostnames []interface{} `json:"hostnames,required"` // Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), // or "keyless-certificate" (for Keyless SSL servers). - RequestType OriginCACertificateRequestType `json:"request_type,required"` + RequestType shared.CertificateRequestType `json:"request_type,required"` // The number of days for which the certificate should be valid. - RequestedValidity OriginCACertificateRequestedValidity `json:"requested_validity,required"` + RequestedValidity ssl.RequestValidity `json:"requested_validity,required"` // Identifier ID string `json:"id"` // The Origin CA certificate. Will be newline-encoded. @@ -151,45 +152,6 @@ func (r originCACertificateJSON) RawJSON() string { return r.raw } -// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), -// or "keyless-certificate" (for Keyless SSL servers). -type OriginCACertificateRequestType string - -const ( - OriginCACertificateRequestTypeOriginRsa OriginCACertificateRequestType = "origin-rsa" - OriginCACertificateRequestTypeOriginEcc OriginCACertificateRequestType = "origin-ecc" - OriginCACertificateRequestTypeKeylessCertificate OriginCACertificateRequestType = "keyless-certificate" -) - -func (r OriginCACertificateRequestType) IsKnown() bool { - switch r { - case OriginCACertificateRequestTypeOriginRsa, OriginCACertificateRequestTypeOriginEcc, OriginCACertificateRequestTypeKeylessCertificate: - return true - } - return false -} - -// The number of days for which the certificate should be valid. -type OriginCACertificateRequestedValidity float64 - -const ( - OriginCACertificateRequestedValidity7 OriginCACertificateRequestedValidity = 7 - OriginCACertificateRequestedValidity30 OriginCACertificateRequestedValidity = 30 - OriginCACertificateRequestedValidity90 OriginCACertificateRequestedValidity = 90 - OriginCACertificateRequestedValidity365 OriginCACertificateRequestedValidity = 365 - OriginCACertificateRequestedValidity730 OriginCACertificateRequestedValidity = 730 - OriginCACertificateRequestedValidity1095 OriginCACertificateRequestedValidity = 1095 - OriginCACertificateRequestedValidity5475 OriginCACertificateRequestedValidity = 5475 -) - -func (r OriginCACertificateRequestedValidity) IsKnown() bool { - switch r { - case OriginCACertificateRequestedValidity7, OriginCACertificateRequestedValidity30, OriginCACertificateRequestedValidity90, OriginCACertificateRequestedValidity365, OriginCACertificateRequestedValidity730, OriginCACertificateRequestedValidity1095, OriginCACertificateRequestedValidity5475: - return true - } - return false -} - // Union satisfied by // [origin_ca_certificates.OriginCACertificateNewResponseUnknown] or // [shared.UnionString]. @@ -256,60 +218,21 @@ type OriginCACertificateNewParams struct { Hostnames param.Field[[]interface{}] `json:"hostnames"` // Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), // or "keyless-certificate" (for Keyless SSL servers). - RequestType param.Field[OriginCACertificateNewParamsRequestType] `json:"request_type"` + RequestType param.Field[shared.CertificateRequestType] `json:"request_type"` // The number of days for which the certificate should be valid. - RequestedValidity param.Field[OriginCACertificateNewParamsRequestedValidity] `json:"requested_validity"` + RequestedValidity param.Field[ssl.RequestValidity] `json:"requested_validity"` } func (r OriginCACertificateNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), -// or "keyless-certificate" (for Keyless SSL servers). -type OriginCACertificateNewParamsRequestType string - -const ( - OriginCACertificateNewParamsRequestTypeOriginRsa OriginCACertificateNewParamsRequestType = "origin-rsa" - OriginCACertificateNewParamsRequestTypeOriginEcc OriginCACertificateNewParamsRequestType = "origin-ecc" - OriginCACertificateNewParamsRequestTypeKeylessCertificate OriginCACertificateNewParamsRequestType = "keyless-certificate" -) - -func (r OriginCACertificateNewParamsRequestType) IsKnown() bool { - switch r { - case OriginCACertificateNewParamsRequestTypeOriginRsa, OriginCACertificateNewParamsRequestTypeOriginEcc, OriginCACertificateNewParamsRequestTypeKeylessCertificate: - return true - } - return false -} - -// The number of days for which the certificate should be valid. -type OriginCACertificateNewParamsRequestedValidity float64 - -const ( - OriginCACertificateNewParamsRequestedValidity7 OriginCACertificateNewParamsRequestedValidity = 7 - OriginCACertificateNewParamsRequestedValidity30 OriginCACertificateNewParamsRequestedValidity = 30 - OriginCACertificateNewParamsRequestedValidity90 OriginCACertificateNewParamsRequestedValidity = 90 - OriginCACertificateNewParamsRequestedValidity365 OriginCACertificateNewParamsRequestedValidity = 365 - OriginCACertificateNewParamsRequestedValidity730 OriginCACertificateNewParamsRequestedValidity = 730 - OriginCACertificateNewParamsRequestedValidity1095 OriginCACertificateNewParamsRequestedValidity = 1095 - OriginCACertificateNewParamsRequestedValidity5475 OriginCACertificateNewParamsRequestedValidity = 5475 -) - -func (r OriginCACertificateNewParamsRequestedValidity) IsKnown() bool { - switch r { - case OriginCACertificateNewParamsRequestedValidity7, OriginCACertificateNewParamsRequestedValidity30, OriginCACertificateNewParamsRequestedValidity90, OriginCACertificateNewParamsRequestedValidity365, OriginCACertificateNewParamsRequestedValidity730, OriginCACertificateNewParamsRequestedValidity1095, OriginCACertificateNewParamsRequestedValidity5475: - return true - } - return false -} - type OriginCACertificateNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result OriginCACertificateNewResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success OriginCACertificateNewResponseEnvelopeSuccess `json:"success,required"` + Result OriginCACertificateNewResponseUnion `json:"result"` JSON originCACertificateNewResponseEnvelopeJSON `json:"-"` } @@ -318,8 +241,8 @@ type OriginCACertificateNewResponseEnvelope struct { type originCACertificateNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -349,7 +272,7 @@ func (r OriginCACertificateNewResponseEnvelopeSuccess) IsKnown() bool { type OriginCACertificateListParams struct { // Identifier - Identifier param.Field[string] `query:"identifier"` + ZoneID param.Field[string] `query:"zone_id"` } // URLQuery serializes [OriginCACertificateListParams]'s query parameters as @@ -361,20 +284,12 @@ func (r OriginCACertificateListParams) URLQuery() (v url.Values) { }) } -type OriginCACertificateDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r OriginCACertificateDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type OriginCACertificateDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result OriginCACertificateDeleteResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success OriginCACertificateDeleteResponseEnvelopeSuccess `json:"success,required"` + Result OriginCACertificateDeleteResponse `json:"result"` JSON originCACertificateDeleteResponseEnvelopeJSON `json:"-"` } @@ -383,8 +298,8 @@ type OriginCACertificateDeleteResponseEnvelope struct { type originCACertificateDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -413,11 +328,11 @@ func (r OriginCACertificateDeleteResponseEnvelopeSuccess) IsKnown() bool { } type OriginCACertificateGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result OriginCACertificateGetResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success OriginCACertificateGetResponseEnvelopeSuccess `json:"success,required"` + Result OriginCACertificateGetResponseUnion `json:"result"` JSON originCACertificateGetResponseEnvelopeJSON `json:"-"` } @@ -426,8 +341,8 @@ type OriginCACertificateGetResponseEnvelope struct { type originCACertificateGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/origin_ca_certificates/origincacertificate_test.go b/origin_ca_certificates/origincacertificate_test.go index d9697157fb1..0a6253ab5a8 100644 --- a/origin_ca_certificates/origincacertificate_test.go +++ b/origin_ca_certificates/origincacertificate_test.go @@ -12,10 +12,11 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" "github.com/cloudflare/cloudflare-go/v2/origin_ca_certificates" + "github.com/cloudflare/cloudflare-go/v2/shared" + "github.com/cloudflare/cloudflare-go/v2/ssl" ) func TestOriginCACertificateNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -31,8 +32,8 @@ func TestOriginCACertificateNewWithOptionalParams(t *testing.T) { _, err := client.OriginCACertificates.New(context.TODO(), origin_ca_certificates.OriginCACertificateNewParams{ Csr: cloudflare.F("-----BEGIN CERTIFICATE REQUEST-----\nMIICxzCCAa8CAQAwSDELMAkGA1UEBhMCVVMxFjAUBgNVBAgTDVNhbiBGcmFuY2lz\nY28xCzAJBgNVBAcTAkNBMRQwEgYDVQQDEwtleGFtcGxlLm5ldDCCASIwDQYJKoZI\nhvcNAQEBBQADggEPADCCAQoCggEBALxejtu4b+jPdFeFi6OUsye8TYJQBm3WfCvL\nHu5EvijMO/4Z2TImwASbwUF7Ir8OLgH+mGlQZeqyNvGoSOMEaZVXcYfpR1hlVak8\n4GGVr+04IGfOCqaBokaBFIwzclGZbzKmLGwIQioNxGfqFm6RGYGA3be2Je2iseBc\nN8GV1wYmvYE0RR+yWweJCTJ157exyRzu7sVxaEW9F87zBQLyOnwXc64rflXslRqi\ng7F7w5IaQYOl8yvmk/jEPCAha7fkiUfEpj4N12+oPRiMvleJF98chxjD4MH39c5I\nuOslULhrWunfh7GB1jwWNA9y44H0snrf+xvoy2TcHmxvma9Eln8CAwEAAaA6MDgG\nCSqGSIb3DQEJDjErMCkwJwYDVR0RBCAwHoILZXhhbXBsZS5uZXSCD3d3dy5leGFt\ncGxlLm5ldDANBgkqhkiG9w0BAQsFAAOCAQEAcBaX6dOnI8ncARrI9ZSF2AJX+8mx\npTHY2+Y2C0VvrVDGMtbBRH8R9yMbqWtlxeeNGf//LeMkSKSFa4kbpdx226lfui8/\nauRDBTJGx2R1ccUxmLZXx4my0W5iIMxunu+kez+BDlu7bTT2io0uXMRHue4i6quH\nyc5ibxvbJMjR7dqbcanVE10/34oprzXQsJ/VmSuZNXtjbtSKDlmcpw6To/eeAJ+J\nhXykcUihvHyG4A1m2R6qpANBjnA0pHexfwM/SgfzvpbvUg0T1ubmer8BgTwCKIWs\ndcWYTthM51JIqRBfNqy4QcBnX+GY05yltEEswQI55wdiS3CjTTA67sdbcQ==\n-----END CERTIFICATE REQUEST-----"), Hostnames: cloudflare.F([]interface{}{"example.com", "*.example.com"}), - RequestType: cloudflare.F(origin_ca_certificates.OriginCACertificateNewParamsRequestTypeOriginRsa), - RequestedValidity: cloudflare.F(origin_ca_certificates.OriginCACertificateNewParamsRequestedValidity5475), + RequestType: cloudflare.F(shared.CertificateRequestTypeOriginRSA), + RequestedValidity: cloudflare.F(ssl.RequestValidity5475), }) if err != nil { var apierr *cloudflare.Error @@ -44,7 +45,6 @@ func TestOriginCACertificateNewWithOptionalParams(t *testing.T) { } func TestOriginCACertificateListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -58,7 +58,7 @@ func TestOriginCACertificateListWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.OriginCACertificates.List(context.TODO(), origin_ca_certificates.OriginCACertificateListParams{ - Identifier: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { var apierr *cloudflare.Error @@ -70,7 +70,6 @@ func TestOriginCACertificateListWithOptionalParams(t *testing.T) { } func TestOriginCACertificateDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -83,13 +82,7 @@ func TestOriginCACertificateDelete(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.OriginCACertificates.Delete( - context.TODO(), - "023e105f4ecef8ad9ca31a8372d0c353", - origin_ca_certificates.OriginCACertificateDeleteParams{ - Body: map[string]interface{}{}, - }, - ) + _, err := client.OriginCACertificates.Delete(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -100,7 +93,6 @@ func TestOriginCACertificateDelete(t *testing.T) { } func TestOriginCACertificateGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/origin_post_quantum_encryption/aliases.go b/origin_post_quantum_encryption/aliases.go index f4243425a8e..a9bd97b758f 100644 --- a/origin_post_quantum_encryption/aliases.go +++ b/origin_post_quantum_encryption/aliases.go @@ -4,7 +4,7 @@ package origin_post_quantum_encryption import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/origin_post_quantum_encryption/originpostquantumencryption.go b/origin_post_quantum_encryption/originpostquantumencryption.go index 19f69f1f495..4c6f26627c6 100644 --- a/origin_post_quantum_encryption/originpostquantumencryption.go +++ b/origin_post_quantum_encryption/originpostquantumencryption.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/origin_post_quantum_encryption/originpostquantumencryption_test.go b/origin_post_quantum_encryption/originpostquantumencryption_test.go index 382c39f7504..535150fea8c 100644 --- a/origin_post_quantum_encryption/originpostquantumencryption_test.go +++ b/origin_post_quantum_encryption/originpostquantumencryption_test.go @@ -15,7 +15,7 @@ import ( ) func TestOriginPostQuantumEncryptionUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +42,7 @@ func TestOriginPostQuantumEncryptionUpdate(t *testing.T) { } func TestOriginPostQuantumEncryptionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/origin_tls_client_auth/aliases.go b/origin_tls_client_auth/aliases.go index 1aa003da3af..cf7baaa66e5 100644 --- a/origin_tls_client_auth/aliases.go +++ b/origin_tls_client_auth/aliases.go @@ -4,7 +4,7 @@ package origin_tls_client_auth import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/origin_tls_client_auth/hostname.go b/origin_tls_client_auth/hostname.go index ad17b87d8f0..0e39cf7087e 100644 --- a/origin_tls_client_auth/hostname.go +++ b/origin_tls_client_auth/hostname.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // HostnameService contains methods and other services that help with interacting @@ -195,11 +195,11 @@ func (r HostnameUpdateParamsConfig) MarshalJSON() (data []byte, err error) { } type HostnameUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result []AuthenticatedOriginPull `json:"result,required,nullable"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success HostnameUpdateResponseEnvelopeSuccess `json:"success,required"` + Result []AuthenticatedOriginPull `json:"result,nullable"` ResultInfo HostnameUpdateResponseEnvelopeResultInfo `json:"result_info"` JSON hostnameUpdateResponseEnvelopeJSON `json:"-"` } @@ -209,8 +209,8 @@ type HostnameUpdateResponseEnvelope struct { type hostnameUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field ResultInfo apijson.Field raw string ExtraFields map[string]apijson.Field @@ -276,11 +276,11 @@ type HostnameGetParams struct { } type HostnameGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result AuthenticatedOriginPull `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success HostnameGetResponseEnvelopeSuccess `json:"success,required"` + Result AuthenticatedOriginPull `json:"result"` JSON hostnameGetResponseEnvelopeJSON `json:"-"` } @@ -289,8 +289,8 @@ type HostnameGetResponseEnvelope struct { type hostnameGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/origin_tls_client_auth/hostname_test.go b/origin_tls_client_auth/hostname_test.go index 4836ae647da..a6f8292492b 100644 --- a/origin_tls_client_auth/hostname_test.go +++ b/origin_tls_client_auth/hostname_test.go @@ -15,7 +15,6 @@ import ( ) func TestHostnameUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -54,7 +53,6 @@ func TestHostnameUpdate(t *testing.T) { } func TestHostnameGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/origin_tls_client_auth/hostnamecertificate.go b/origin_tls_client_auth/hostnamecertificate.go index 5adecc4d2b3..342d4839c94 100644 --- a/origin_tls_client_auth/hostnamecertificate.go +++ b/origin_tls_client_auth/hostnamecertificate.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // HostnameCertificateService contains methods and other services that help with @@ -54,7 +54,7 @@ func (r *HostnameCertificateService) List(ctx context.Context, query HostnameCer opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("zones/%s/origin_tls_client_auth/hostnames/certificates", query.ZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -72,10 +72,10 @@ func (r *HostnameCertificateService) ListAutoPaging(ctx context.Context, query H } // Delete Hostname Client Certificate -func (r *HostnameCertificateService) Delete(ctx context.Context, certificateID string, params HostnameCertificateDeleteParams, opts ...option.RequestOption) (res *HostnameCertificateDeleteResponse, err error) { +func (r *HostnameCertificateService) Delete(ctx context.Context, certificateID string, body HostnameCertificateDeleteParams, opts ...option.RequestOption) (res *HostnameCertificateDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env HostnameCertificateDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/origin_tls_client_auth/hostnames/certificates/%s", params.ZoneID, certificateID) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/hostnames/certificates/%s", body.ZoneID, certificateID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -97,69 +97,6 @@ func (r *HostnameCertificateService) Get(ctx context.Context, certificateID stri return } -type Certificate struct { - // Identifier - ID string `json:"id"` - // The hostname certificate. - Certificate string `json:"certificate"` - // The date when the certificate expires. - ExpiresOn time.Time `json:"expires_on" format:"date-time"` - // The certificate authority that issued the certificate. - Issuer string `json:"issuer"` - // The serial number on the uploaded certificate. - SerialNumber string `json:"serial_number"` - // The type of hash used for the certificate. - Signature string `json:"signature"` - // Status of the certificate or the association. - Status CertificateStatus `json:"status"` - // The time when the certificate was uploaded. - UploadedOn time.Time `json:"uploaded_on" format:"date-time"` - JSON certificateJSON `json:"-"` -} - -// certificateJSON contains the JSON metadata for the struct [Certificate] -type certificateJSON struct { - ID apijson.Field - Certificate apijson.Field - ExpiresOn apijson.Field - Issuer apijson.Field - SerialNumber apijson.Field - Signature apijson.Field - Status apijson.Field - UploadedOn apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *Certificate) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r certificateJSON) RawJSON() string { - return r.raw -} - -// Status of the certificate or the association. -type CertificateStatus string - -const ( - CertificateStatusInitializing CertificateStatus = "initializing" - CertificateStatusPendingDeployment CertificateStatus = "pending_deployment" - CertificateStatusPendingDeletion CertificateStatus = "pending_deletion" - CertificateStatusActive CertificateStatus = "active" - CertificateStatusDeleted CertificateStatus = "deleted" - CertificateStatusDeploymentTimedOut CertificateStatus = "deployment_timed_out" - CertificateStatusDeletionTimedOut CertificateStatus = "deletion_timed_out" -) - -func (r CertificateStatus) IsKnown() bool { - switch r { - case CertificateStatusInitializing, CertificateStatusPendingDeployment, CertificateStatusPendingDeletion, CertificateStatusActive, CertificateStatusDeleted, CertificateStatusDeploymentTimedOut, CertificateStatusDeletionTimedOut: - return true - } - return false -} - type HostnameCertificateNewResponse struct { // Identifier ID string `json:"id"` @@ -366,11 +303,11 @@ func (r HostnameCertificateNewParams) MarshalJSON() (data []byte, err error) { } type HostnameCertificateNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result HostnameCertificateNewResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success HostnameCertificateNewResponseEnvelopeSuccess `json:"success,required"` + Result HostnameCertificateNewResponse `json:"result"` JSON hostnameCertificateNewResponseEnvelopeJSON `json:"-"` } @@ -379,8 +316,8 @@ type HostnameCertificateNewResponseEnvelope struct { type hostnameCertificateNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -416,19 +353,14 @@ type HostnameCertificateListParams struct { type HostnameCertificateDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r HostnameCertificateDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type HostnameCertificateDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result HostnameCertificateDeleteResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success HostnameCertificateDeleteResponseEnvelopeSuccess `json:"success,required"` + Result HostnameCertificateDeleteResponse `json:"result"` JSON hostnameCertificateDeleteResponseEnvelopeJSON `json:"-"` } @@ -437,8 +369,8 @@ type HostnameCertificateDeleteResponseEnvelope struct { type hostnameCertificateDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -472,11 +404,11 @@ type HostnameCertificateGetParams struct { } type HostnameCertificateGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result HostnameCertificateGetResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success HostnameCertificateGetResponseEnvelopeSuccess `json:"success,required"` + Result HostnameCertificateGetResponse `json:"result"` JSON hostnameCertificateGetResponseEnvelopeJSON `json:"-"` } @@ -485,8 +417,8 @@ type HostnameCertificateGetResponseEnvelope struct { type hostnameCertificateGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/origin_tls_client_auth/hostnamecertificate_test.go b/origin_tls_client_auth/hostnamecertificate_test.go index 28868c3714f..591373513c4 100644 --- a/origin_tls_client_auth/hostnamecertificate_test.go +++ b/origin_tls_client_auth/hostnamecertificate_test.go @@ -15,7 +15,6 @@ import ( ) func TestHostnameCertificateNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestHostnameCertificateNew(t *testing.T) { } func TestHostnameCertificateList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestHostnameCertificateList(t *testing.T) { } func TestHostnameCertificateDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -87,7 +84,6 @@ func TestHostnameCertificateDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", origin_tls_client_auth.HostnameCertificateDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -100,7 +96,6 @@ func TestHostnameCertificateDelete(t *testing.T) { } func TestHostnameCertificateGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/origin_tls_client_auth/origintlsclientauth.go b/origin_tls_client_auth/origintlsclientauth.go index 1c8f62d9672..172251197fa 100644 --- a/origin_tls_client_auth/origintlsclientauth.go +++ b/origin_tls_client_auth/origintlsclientauth.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -63,7 +63,7 @@ func (r *OriginTLSClientAuthService) List(ctx context.Context, query OriginTLSCl opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("zones/%s/origin_tls_client_auth", query.ZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -81,10 +81,10 @@ func (r *OriginTLSClientAuthService) ListAutoPaging(ctx context.Context, query O } // Delete Certificate -func (r *OriginTLSClientAuthService) Delete(ctx context.Context, certificateID string, params OriginTLSClientAuthDeleteParams, opts ...option.RequestOption) (res *OriginTLSClientAuthDeleteResponseUnion, err error) { +func (r *OriginTLSClientAuthService) Delete(ctx context.Context, certificateID string, body OriginTLSClientAuthDeleteParams, opts ...option.RequestOption) (res *OriginTLSClientAuthDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env OriginTLSClientAuthDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/origin_tls_client_auth/%s", params.ZoneID, certificateID) + path := fmt.Sprintf("zones/%s/origin_tls_client_auth/%s", body.ZoneID, certificateID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -235,11 +235,11 @@ func (r OriginTLSClientAuthNewParams) MarshalJSON() (data []byte, err error) { } type OriginTLSClientAuthNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result OriginTLSClientAuthNewResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success OriginTLSClientAuthNewResponseEnvelopeSuccess `json:"success,required"` + Result OriginTLSClientAuthNewResponseUnion `json:"result"` JSON originTLSClientAuthNewResponseEnvelopeJSON `json:"-"` } @@ -248,8 +248,8 @@ type OriginTLSClientAuthNewResponseEnvelope struct { type originTLSClientAuthNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -285,19 +285,14 @@ type OriginTLSClientAuthListParams struct { type OriginTLSClientAuthDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r OriginTLSClientAuthDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type OriginTLSClientAuthDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result OriginTLSClientAuthDeleteResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success OriginTLSClientAuthDeleteResponseEnvelopeSuccess `json:"success,required"` + Result OriginTLSClientAuthDeleteResponseUnion `json:"result"` JSON originTLSClientAuthDeleteResponseEnvelopeJSON `json:"-"` } @@ -306,8 +301,8 @@ type OriginTLSClientAuthDeleteResponseEnvelope struct { type originTLSClientAuthDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -341,11 +336,11 @@ type OriginTLSClientAuthGetParams struct { } type OriginTLSClientAuthGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result OriginTLSClientAuthGetResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success OriginTLSClientAuthGetResponseEnvelopeSuccess `json:"success,required"` + Result OriginTLSClientAuthGetResponseUnion `json:"result"` JSON originTLSClientAuthGetResponseEnvelopeJSON `json:"-"` } @@ -354,8 +349,8 @@ type OriginTLSClientAuthGetResponseEnvelope struct { type originTLSClientAuthGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/origin_tls_client_auth/origintlsclientauth_test.go b/origin_tls_client_auth/origintlsclientauth_test.go index a35d31223c1..335c32b1d5f 100644 --- a/origin_tls_client_auth/origintlsclientauth_test.go +++ b/origin_tls_client_auth/origintlsclientauth_test.go @@ -15,7 +15,6 @@ import ( ) func TestOriginTLSClientAuthNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestOriginTLSClientAuthNew(t *testing.T) { } func TestOriginTLSClientAuthList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestOriginTLSClientAuthList(t *testing.T) { } func TestOriginTLSClientAuthDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -87,7 +84,6 @@ func TestOriginTLSClientAuthDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", origin_tls_client_auth.OriginTLSClientAuthDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -100,7 +96,6 @@ func TestOriginTLSClientAuthDelete(t *testing.T) { } func TestOriginTLSClientAuthGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/origin_tls_client_auth/setting.go b/origin_tls_client_auth/setting.go index e24df19eb48..f0baa8c91c7 100644 --- a/origin_tls_client_auth/setting.go +++ b/origin_tls_client_auth/setting.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingService contains methods and other services that help with interacting @@ -118,9 +118,9 @@ func (r SettingUpdateParams) MarshalJSON() (data []byte, err error) { type SettingUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result SettingUpdateResponse `json:"result,required"` // Whether the API call was successful Success SettingUpdateResponseEnvelopeSuccess `json:"success,required"` + Result SettingUpdateResponse `json:"result"` JSON settingUpdateResponseEnvelopeJSON `json:"-"` } @@ -129,8 +129,8 @@ type SettingUpdateResponseEnvelope struct { type settingUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -166,9 +166,9 @@ type SettingGetParams struct { type SettingGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result SettingGetResponse `json:"result,required"` // Whether the API call was successful Success SettingGetResponseEnvelopeSuccess `json:"success,required"` + Result SettingGetResponse `json:"result"` JSON settingGetResponseEnvelopeJSON `json:"-"` } @@ -177,8 +177,8 @@ type SettingGetResponseEnvelope struct { type settingGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/origin_tls_client_auth/setting_test.go b/origin_tls_client_auth/setting_test.go index e5a70e3a48b..7d70daae3c8 100644 --- a/origin_tls_client_auth/setting_test.go +++ b/origin_tls_client_auth/setting_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingUpdate(t *testing.T) { } func TestSettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/page_shield/aliases.go b/page_shield/aliases.go index 38acbe41045..1c012025569 100644 --- a/page_shield/aliases.go +++ b/page_shield/aliases.go @@ -4,7 +4,7 @@ package page_shield import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/page_shield/connection_test.go b/page_shield/connection_test.go index 5fab545513f..ef394be0dff 100644 --- a/page_shield/connection_test.go +++ b/page_shield/connection_test.go @@ -15,7 +15,6 @@ import ( ) func TestConnectionListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -36,7 +35,7 @@ func TestConnectionListWithOptionalParams(t *testing.T) { Export: cloudflare.F(page_shield.ConnectionListParamsExportCsv), Hosts: cloudflare.F("blog.cloudflare.com,www.example*,*cloudflare.com"), OrderBy: cloudflare.F(page_shield.ConnectionListParamsOrderByFirstSeenAt), - Page: cloudflare.F("string"), + Page: cloudflare.F("2"), PageURL: cloudflare.F("example.com/page,*/checkout,example.com/*,*checkout*"), PerPage: cloudflare.F(100.000000), PrioritizeMalicious: cloudflare.F(true), @@ -53,7 +52,6 @@ func TestConnectionListWithOptionalParams(t *testing.T) { } func TestConnectionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/page_shield/pageshield.go b/page_shield/pageshield.go index 8d66f7775a1..c01d5d13fa4 100644 --- a/page_shield/pageshield.go +++ b/page_shield/pageshield.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PageShieldService contains methods and other services that help with interacting diff --git a/page_shield/pageshield_test.go b/page_shield/pageshield_test.go index 968d323a4e4..bca1f914bdf 100644 --- a/page_shield/pageshield_test.go +++ b/page_shield/pageshield_test.go @@ -15,7 +15,6 @@ import ( ) func TestPageShieldUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestPageShieldUpdateWithOptionalParams(t *testing.T) { } func TestPageShieldGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/page_shield/policy.go b/page_shield/policy.go index 558860a922d..fe3e9f50d6e 100644 --- a/page_shield/policy.go +++ b/page_shield/policy.go @@ -53,7 +53,7 @@ func (r *PolicyService) List(ctx context.Context, query PolicyListParams, opts . opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("zones/%s/page_shield/policies", query.ZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -140,26 +140,6 @@ func (r PolicyAction) IsKnown() bool { return false } -type PolicyParam struct { - // The ID of the policy - ID param.Field[string] `json:"id"` - // The action to take if the expression matches - Action param.Field[PolicyAction] `json:"action"` - // A description for the policy - Description param.Field[string] `json:"description"` - // Whether the policy is enabled - Enabled param.Field[bool] `json:"enabled"` - // The expression which must match for the policy to be applied, using the - // Cloudflare Firewall rule expression syntax - Expression param.Field[string] `json:"expression"` - // The policy which will be applied - Value param.Field[string] `json:"value"` -} - -func (r PolicyParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type PolicyNewParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` diff --git a/page_shield/policy_test.go b/page_shield/policy_test.go index 0183e953564..9b078e19f42 100644 --- a/page_shield/policy_test.go +++ b/page_shield/policy_test.go @@ -15,7 +15,6 @@ import ( ) func TestPolicyNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestPolicyNewWithOptionalParams(t *testing.T) { } func TestPolicyUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -81,7 +79,6 @@ func TestPolicyUpdateWithOptionalParams(t *testing.T) { } func TestPolicyList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -107,7 +104,6 @@ func TestPolicyList(t *testing.T) { } func TestPolicyDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -137,7 +133,6 @@ func TestPolicyDelete(t *testing.T) { } func TestPolicyGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/page_shield/script_test.go b/page_shield/script_test.go index 17dcf95d886..17b619227f2 100644 --- a/page_shield/script_test.go +++ b/page_shield/script_test.go @@ -15,7 +15,6 @@ import ( ) func TestScriptListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -37,7 +36,7 @@ func TestScriptListWithOptionalParams(t *testing.T) { Export: cloudflare.F(page_shield.ScriptListParamsExportCsv), Hosts: cloudflare.F("blog.cloudflare.com,www.example*,*cloudflare.com"), OrderBy: cloudflare.F(page_shield.ScriptListParamsOrderByFirstSeenAt), - Page: cloudflare.F("string"), + Page: cloudflare.F("2"), PageURL: cloudflare.F("example.com/page,*/checkout,example.com/*,*checkout*"), PerPage: cloudflare.F(100.000000), PrioritizeMalicious: cloudflare.F(true), @@ -54,7 +53,6 @@ func TestScriptListWithOptionalParams(t *testing.T) { } func TestScriptGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/pagerules/aliases.go b/pagerules/aliases.go index 0c103619f8d..41ab2ea28e0 100644 --- a/pagerules/aliases.go +++ b/pagerules/aliases.go @@ -4,7 +4,7 @@ package pagerules import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/pagerules/pagerule.go b/pagerules/pagerule.go index 552195ead40..f1286d447ea 100644 --- a/pagerules/pagerule.go +++ b/pagerules/pagerule.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -79,10 +79,10 @@ func (r *PageruleService) List(ctx context.Context, params PageruleListParams, o } // Deletes an existing Page Rule. -func (r *PageruleService) Delete(ctx context.Context, pageruleID string, params PageruleDeleteParams, opts ...option.RequestOption) (res *PageruleDeleteResponse, err error) { +func (r *PageruleService) Delete(ctx context.Context, pageruleID string, body PageruleDeleteParams, opts ...option.RequestOption) (res *PageruleDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env PageruleDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/pagerules/%s", params.ZoneID, pageruleID) + path := fmt.Sprintf("zones/%s/pagerules/%s", body.ZoneID, pageruleID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -281,12 +281,12 @@ func (r RouteValueParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// A request condition target. +// URL target. type Target struct { // String constraint. - Constraint TargetConstraint `json:"constraint,required"` + Constraint TargetConstraint `json:"constraint"` // A target based on the URL of the request. - Target TargetTarget `json:"target,required"` + Target TargetTarget `json:"target"` JSON targetJSON `json:"-"` } @@ -367,12 +367,12 @@ func (r TargetTarget) IsKnown() bool { return false } -// A request condition target. +// URL target. type TargetParam struct { // String constraint. - Constraint param.Field[TargetConstraintParam] `json:"constraint,required"` + Constraint param.Field[TargetConstraintParam] `json:"constraint"` // A target based on the URL of the request. - Target param.Field[TargetTarget] `json:"target,required"` + Target param.Field[TargetTarget] `json:"target"` } func (r TargetParam) MarshalJSON() (data []byte, err error) { @@ -777,11 +777,6 @@ func (r PageruleListResponseEnvelopeSuccess) IsKnown() bool { type PageruleDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r PageruleDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type PageruleDeleteResponseEnvelope struct { diff --git a/pagerules/pagerule_test.go b/pagerules/pagerule_test.go index 6901225ca61..e8450305636 100644 --- a/pagerules/pagerule_test.go +++ b/pagerules/pagerule_test.go @@ -15,7 +15,6 @@ import ( ) func TestPageruleNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -36,6 +35,18 @@ func TestPageruleNewWithOptionalParams(t *testing.T) { Type: cloudflare.F(pagerules.RouteValueTypeTemporary), URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), }), + }, { + Name: cloudflare.F(pagerules.RouteNameForwardURL), + Value: cloudflare.F(pagerules.RouteValueParam{ + Type: cloudflare.F(pagerules.RouteValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }, { + Name: cloudflare.F(pagerules.RouteNameForwardURL), + Value: cloudflare.F(pagerules.RouteValueParam{ + Type: cloudflare.F(pagerules.RouteValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), }}), Targets: cloudflare.F([]pagerules.TargetParam{{ Constraint: cloudflare.F(pagerules.TargetConstraintParam{ @@ -57,7 +68,6 @@ func TestPageruleNewWithOptionalParams(t *testing.T) { } func TestPageruleUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -81,6 +91,18 @@ func TestPageruleUpdateWithOptionalParams(t *testing.T) { Type: cloudflare.F(pagerules.RouteValueTypeTemporary), URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), }), + }, { + Name: cloudflare.F(pagerules.RouteNameForwardURL), + Value: cloudflare.F(pagerules.RouteValueParam{ + Type: cloudflare.F(pagerules.RouteValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }, { + Name: cloudflare.F(pagerules.RouteNameForwardURL), + Value: cloudflare.F(pagerules.RouteValueParam{ + Type: cloudflare.F(pagerules.RouteValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), }}), Targets: cloudflare.F([]pagerules.TargetParam{{ Constraint: cloudflare.F(pagerules.TargetConstraintParam{ @@ -103,7 +125,6 @@ func TestPageruleUpdateWithOptionalParams(t *testing.T) { } func TestPageruleListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -133,7 +154,6 @@ func TestPageruleListWithOptionalParams(t *testing.T) { } func TestPageruleDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -151,7 +171,6 @@ func TestPageruleDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", pagerules.PageruleDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -164,7 +183,6 @@ func TestPageruleDelete(t *testing.T) { } func TestPageruleEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -188,6 +206,18 @@ func TestPageruleEditWithOptionalParams(t *testing.T) { Type: cloudflare.F(pagerules.RouteValueTypeTemporary), URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), }), + }, { + Name: cloudflare.F(pagerules.RouteNameForwardURL), + Value: cloudflare.F(pagerules.RouteValueParam{ + Type: cloudflare.F(pagerules.RouteValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), + }, { + Name: cloudflare.F(pagerules.RouteNameForwardURL), + Value: cloudflare.F(pagerules.RouteValueParam{ + Type: cloudflare.F(pagerules.RouteValueTypeTemporary), + URL: cloudflare.F("http://www.example.com/somewhere/$1/astring/$2/anotherstring/$3"), + }), }}), Priority: cloudflare.F(int64(0)), Status: cloudflare.F(pagerules.PageruleEditParamsStatusActive), @@ -210,7 +240,6 @@ func TestPageruleEditWithOptionalParams(t *testing.T) { } func TestPageruleGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/pagerules/setting.go b/pagerules/setting.go index 4532f44bc68..2a24d56bdd3 100644 --- a/pagerules/setting.go +++ b/pagerules/setting.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingService contains methods and other services that help with interacting diff --git a/pagerules/setting_test.go b/pagerules/setting_test.go index 8d66dfd03df..0910e68a798 100644 --- a/pagerules/setting_test.go +++ b/pagerules/setting_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/pages/aliases.go b/pages/aliases.go index b75f140bf4a..54be946956c 100644 --- a/pages/aliases.go +++ b/pages/aliases.go @@ -4,7 +4,7 @@ package pages import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/pages/project.go b/pages/project.go index 39d97451126..9670d32388f 100644 --- a/pages/project.go +++ b/pages/project.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -58,7 +58,7 @@ func (r *ProjectService) List(ctx context.Context, query ProjectListParams, opts opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/pages/projects", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -76,9 +76,9 @@ func (r *ProjectService) ListAutoPaging(ctx context.Context, query ProjectListPa } // Delete a project by name. -func (r *ProjectService) Delete(ctx context.Context, projectName string, params ProjectDeleteParams, opts ...option.RequestOption) (res *ProjectDeleteResponse, err error) { +func (r *ProjectService) Delete(ctx context.Context, projectName string, body ProjectDeleteParams, opts ...option.RequestOption) (res *ProjectDeleteResponse, err error) { opts = append(r.Options[:], opts...) - path := fmt.Sprintf("accounts/%s/pages/projects/%s", params.AccountID, projectName) + path := fmt.Sprintf("accounts/%s/pages/projects/%s", body.AccountID, projectName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -2572,11 +2572,6 @@ type ProjectListParams struct { type ProjectDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r ProjectDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type ProjectEditParams struct { diff --git a/pages/project_test.go b/pages/project_test.go index 5b8aab66c82..c48fe645898 100644 --- a/pages/project_test.go +++ b/pages/project_test.go @@ -15,7 +15,6 @@ import ( ) func TestProjectNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -203,7 +202,6 @@ func TestProjectNewWithOptionalParams(t *testing.T) { } func TestProjectList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -229,7 +227,6 @@ func TestProjectList(t *testing.T) { } func TestProjectDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -247,7 +244,6 @@ func TestProjectDelete(t *testing.T) { "this-is-my-project-01", pages.ProjectDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -260,7 +256,6 @@ func TestProjectDelete(t *testing.T) { } func TestProjectEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -310,7 +305,6 @@ func TestProjectEdit(t *testing.T) { } func TestProjectGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -340,7 +334,6 @@ func TestProjectGet(t *testing.T) { } func TestProjectPurgeBuildCache(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/pages/projectdeployment.go b/pages/projectdeployment.go index 2504a97fce3..b0a274eff0d 100644 --- a/pages/projectdeployment.go +++ b/pages/projectdeployment.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ProjectDeploymentService contains methods and other services that help with @@ -75,9 +75,9 @@ func (r *ProjectDeploymentService) ListAutoPaging(ctx context.Context, projectNa } // Delete a deployment. -func (r *ProjectDeploymentService) Delete(ctx context.Context, projectName string, deploymentID string, params ProjectDeploymentDeleteParams, opts ...option.RequestOption) (res *ProjectDeploymentDeleteResponse, err error) { +func (r *ProjectDeploymentService) Delete(ctx context.Context, projectName string, deploymentID string, body ProjectDeploymentDeleteParams, opts ...option.RequestOption) (res *ProjectDeploymentDeleteResponse, err error) { opts = append(r.Options[:], opts...) - path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments/%s", params.AccountID, projectName, deploymentID) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments/%s", body.AccountID, projectName, deploymentID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -100,7 +100,7 @@ func (r *ProjectDeploymentService) Retry(ctx context.Context, projectName string opts = append(r.Options[:], opts...) var env ProjectDeploymentRetryResponseEnvelope path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments/%s/retry", params.AccountID, projectName, deploymentID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -114,7 +114,7 @@ func (r *ProjectDeploymentService) Rollback(ctx context.Context, projectName str opts = append(r.Options[:], opts...) var env ProjectDeploymentRollbackResponseEnvelope path := fmt.Sprintf("accounts/%s/pages/projects/%s/deployments/%s/rollback", params.AccountID, projectName, deploymentID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -214,11 +214,6 @@ func (r ProjectDeploymentListParamsEnv) IsKnown() bool { type ProjectDeploymentDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r ProjectDeploymentDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type ProjectDeploymentGetParams struct { diff --git a/pages/projectdeployment_test.go b/pages/projectdeployment_test.go index cd560bf2796..4471944897e 100644 --- a/pages/projectdeployment_test.go +++ b/pages/projectdeployment_test.go @@ -15,7 +15,7 @@ import ( ) func TestProjectDeploymentNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +46,6 @@ func TestProjectDeploymentNewWithOptionalParams(t *testing.T) { } func TestProjectDeploymentListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +76,6 @@ func TestProjectDeploymentListWithOptionalParams(t *testing.T) { } func TestProjectDeploymentDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -96,7 +94,6 @@ func TestProjectDeploymentDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", pages.ProjectDeploymentDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -109,7 +106,6 @@ func TestProjectDeploymentDelete(t *testing.T) { } func TestProjectDeploymentGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -140,7 +136,6 @@ func TestProjectDeploymentGet(t *testing.T) { } func TestProjectDeploymentRetry(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -172,7 +167,6 @@ func TestProjectDeploymentRetry(t *testing.T) { } func TestProjectDeploymentRollback(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/pages/projectdeploymenthistorylog.go b/pages/projectdeploymenthistorylog.go index fb7d86be7bb..d04b57dadcf 100644 --- a/pages/projectdeploymenthistorylog.go +++ b/pages/projectdeploymenthistorylog.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/pages/projectdeploymenthistorylog_test.go b/pages/projectdeploymenthistorylog_test.go index 14e6c374f6f..16ea453d671 100644 --- a/pages/projectdeploymenthistorylog_test.go +++ b/pages/projectdeploymenthistorylog_test.go @@ -15,7 +15,6 @@ import ( ) func TestProjectDeploymentHistoryLogGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/pages/projectdomain.go b/pages/projectdomain.go index 6e86b6b1176..5a8ab732bf0 100644 --- a/pages/projectdomain.go +++ b/pages/projectdomain.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -54,7 +54,7 @@ func (r *ProjectDomainService) List(ctx context.Context, projectName string, que opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/pages/projects/%s/domains", query.AccountID, projectName) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -72,9 +72,9 @@ func (r *ProjectDomainService) ListAutoPaging(ctx context.Context, projectName s } // Delete a Pages project's domain. -func (r *ProjectDomainService) Delete(ctx context.Context, projectName string, domainName string, params ProjectDomainDeleteParams, opts ...option.RequestOption) (res *ProjectDomainDeleteResponse, err error) { +func (r *ProjectDomainService) Delete(ctx context.Context, projectName string, domainName string, body ProjectDomainDeleteParams, opts ...option.RequestOption) (res *ProjectDomainDeleteResponse, err error) { opts = append(r.Options[:], opts...) - path := fmt.Sprintf("accounts/%s/pages/projects/%s/domains/%s", params.AccountID, projectName, domainName) + path := fmt.Sprintf("accounts/%s/pages/projects/%s/domains/%s", body.AccountID, projectName, domainName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -84,7 +84,7 @@ func (r *ProjectDomainService) Edit(ctx context.Context, projectName string, dom opts = append(r.Options[:], opts...) var env ProjectDomainEditResponseEnvelope path := fmt.Sprintf("accounts/%s/pages/projects/%s/domains/%s", params.AccountID, projectName, domainName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { return } @@ -245,11 +245,6 @@ type ProjectDomainListParams struct { type ProjectDomainDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r ProjectDomainDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type ProjectDomainEditParams struct { diff --git a/pages/projectdomain_test.go b/pages/projectdomain_test.go index 6e54698b562..c2414669e8b 100644 --- a/pages/projectdomain_test.go +++ b/pages/projectdomain_test.go @@ -15,7 +15,6 @@ import ( ) func TestProjectDomainNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -48,7 +47,6 @@ func TestProjectDomainNew(t *testing.T) { } func TestProjectDomainList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -78,7 +76,6 @@ func TestProjectDomainList(t *testing.T) { } func TestProjectDomainDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -97,7 +94,6 @@ func TestProjectDomainDelete(t *testing.T) { "this-is-my-domain-01.com", pages.ProjectDomainDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -110,7 +106,6 @@ func TestProjectDomainDelete(t *testing.T) { } func TestProjectDomainEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -142,7 +137,6 @@ func TestProjectDomainEdit(t *testing.T) { } func TestProjectDomainGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/pcaps/aliases.go b/pcaps/aliases.go index b09195da288..4f1ba029f9b 100644 --- a/pcaps/aliases.go +++ b/pcaps/aliases.go @@ -4,7 +4,7 @@ package pcaps import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/pcaps/download_test.go b/pcaps/download_test.go index b8b39208bc0..deffd349a34 100644 --- a/pcaps/download_test.go +++ b/pcaps/download_test.go @@ -17,7 +17,6 @@ import ( ) func TestDownloadGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) w.Write([]byte("abc")) diff --git a/pcaps/ownership.go b/pcaps/ownership.go index e664fb91858..efaa4e0a83d 100644 --- a/pcaps/ownership.go +++ b/pcaps/ownership.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // OwnershipService contains methods and other services that help with interacting diff --git a/pcaps/ownership_test.go b/pcaps/ownership_test.go index 2724e3c429b..80ed081c411 100644 --- a/pcaps/ownership_test.go +++ b/pcaps/ownership_test.go @@ -15,7 +15,6 @@ import ( ) func TestOwnershipNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestOwnershipNew(t *testing.T) { } func TestOwnershipDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -72,7 +70,6 @@ func TestOwnershipDelete(t *testing.T) { } func TestOwnershipGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -98,7 +95,6 @@ func TestOwnershipGet(t *testing.T) { } func TestOwnershipValidate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/pcaps/pcap.go b/pcaps/pcap.go index 90893ef50b0..bc090151d35 100644 --- a/pcaps/pcap.go +++ b/pcaps/pcap.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -57,7 +57,7 @@ func (r *PCAPService) List(ctx context.Context, query PCAPListParams, opts ...op opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/pcaps", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/pcaps/pcap_test.go b/pcaps/pcap_test.go index d67b4f2e140..3541fdc1a27 100644 --- a/pcaps/pcap_test.go +++ b/pcaps/pcap_test.go @@ -15,7 +15,6 @@ import ( ) func TestPCAPNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -54,7 +53,6 @@ func TestPCAPNewWithOptionalParams(t *testing.T) { } func TestPCAPList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -80,7 +78,6 @@ func TestPCAPList(t *testing.T) { } func TestPCAPGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/plans/aliases.go b/plans/aliases.go index 7ece9023360..49d2495fb85 100644 --- a/plans/aliases.go +++ b/plans/aliases.go @@ -4,7 +4,7 @@ package plans import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/plans/plan.go b/plans/plan.go index 326175834bc..309d7231b89 100644 --- a/plans/plan.go +++ b/plans/plan.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PlanService contains methods and other services that help with interacting with diff --git a/plans/plan_test.go b/plans/plan_test.go index 122d9cac3cd..7f9158a410e 100644 --- a/plans/plan_test.go +++ b/plans/plan_test.go @@ -14,7 +14,6 @@ import ( ) func TestPlanList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -38,7 +37,6 @@ func TestPlanList(t *testing.T) { } func TestPlanGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/queues/aliases.go b/queues/aliases.go index 8494dfdff8b..63fa7927766 100644 --- a/queues/aliases.go +++ b/queues/aliases.go @@ -4,7 +4,7 @@ package queues import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/queues/consumer.go b/queues/consumer.go index 9ada172c59b..294d849ef79 100644 --- a/queues/consumer.go +++ b/queues/consumer.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -60,10 +60,10 @@ func (r *ConsumerService) Update(ctx context.Context, queueID string, consumerID } // Deletes the consumer for a queue. -func (r *ConsumerService) Delete(ctx context.Context, queueID string, consumerID string, params ConsumerDeleteParams, opts ...option.RequestOption) (res *ConsumerDeleteResponseUnion, err error) { +func (r *ConsumerService) Delete(ctx context.Context, queueID string, consumerID string, body ConsumerDeleteParams, opts ...option.RequestOption) (res *ConsumerDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env ConsumerDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/queues/%s/consumers/%s", params.AccountID, queueID, consumerID) + path := fmt.Sprintf("accounts/%s/queues/%s/consumers/%s", body.AccountID, queueID, consumerID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -288,14 +288,9 @@ func (r ConsumerNewParams) MarshalJSON() (data []byte, err error) { } type ConsumerNewResponseEnvelope struct { - CreatedOn interface{} `json:"created_on,required"` - DeadLetterQueue interface{} `json:"dead_letter_queue,required"` - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - QueueName interface{} `json:"queue_name,required"` - Result ConsumerNewResponse `json:"result,required,nullable"` - ScriptName interface{} `json:"script_name,required"` - Settings interface{} `json:"settings,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result ConsumerNewResponse `json:"result,required,nullable"` // Whether the API call was successful Success ConsumerNewResponseEnvelopeSuccess `json:"success,required"` ResultInfo ConsumerNewResponseEnvelopeResultInfo `json:"result_info"` @@ -305,18 +300,13 @@ type ConsumerNewResponseEnvelope struct { // consumerNewResponseEnvelopeJSON contains the JSON metadata for the struct // [ConsumerNewResponseEnvelope] type consumerNewResponseEnvelopeJSON struct { - CreatedOn apijson.Field - DeadLetterQueue apijson.Field - Errors apijson.Field - Messages apijson.Field - QueueName apijson.Field - Result apijson.Field - ScriptName apijson.Field - Settings apijson.Field - Success apijson.Field - ResultInfo apijson.Field - raw string - ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + ResultInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *ConsumerNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { @@ -384,14 +374,9 @@ func (r ConsumerUpdateParams) MarshalJSON() (data []byte, err error) { } type ConsumerUpdateResponseEnvelope struct { - CreatedOn interface{} `json:"created_on,required"` - DeadLetterQueue interface{} `json:"dead_letter_queue,required"` - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - QueueName interface{} `json:"queue_name,required"` - Result ConsumerUpdateResponse `json:"result,required,nullable"` - ScriptName interface{} `json:"script_name,required"` - Settings interface{} `json:"settings,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result ConsumerUpdateResponse `json:"result,required,nullable"` // Whether the API call was successful Success ConsumerUpdateResponseEnvelopeSuccess `json:"success,required"` ResultInfo ConsumerUpdateResponseEnvelopeResultInfo `json:"result_info"` @@ -401,18 +386,13 @@ type ConsumerUpdateResponseEnvelope struct { // consumerUpdateResponseEnvelopeJSON contains the JSON metadata for the struct // [ConsumerUpdateResponseEnvelope] type consumerUpdateResponseEnvelopeJSON struct { - CreatedOn apijson.Field - DeadLetterQueue apijson.Field - Errors apijson.Field - Messages apijson.Field - QueueName apijson.Field - Result apijson.Field - ScriptName apijson.Field - Settings apijson.Field - Success apijson.Field - ResultInfo apijson.Field - raw string - ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Result apijson.Field + Success apijson.Field + ResultInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *ConsumerUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error) { @@ -472,11 +452,6 @@ func (r consumerUpdateResponseEnvelopeResultInfoJSON) RawJSON() string { type ConsumerDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r ConsumerDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type ConsumerDeleteResponseEnvelope struct { @@ -561,12 +536,9 @@ type ConsumerGetParams struct { } type ConsumerGetResponseEnvelope struct { - CreatedOn interface{} `json:"created_on,required"` - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - QueueName interface{} `json:"queue_name,required"` - Result []Consumer `json:"result,required,nullable"` - Settings interface{} `json:"settings,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result []Consumer `json:"result,required,nullable"` // Whether the API call was successful Success ConsumerGetResponseEnvelopeSuccess `json:"success,required"` ResultInfo ConsumerGetResponseEnvelopeResultInfo `json:"result_info"` @@ -576,12 +548,9 @@ type ConsumerGetResponseEnvelope struct { // consumerGetResponseEnvelopeJSON contains the JSON metadata for the struct // [ConsumerGetResponseEnvelope] type consumerGetResponseEnvelopeJSON struct { - CreatedOn apijson.Field Errors apijson.Field Messages apijson.Field - QueueName apijson.Field Result apijson.Field - Settings apijson.Field Success apijson.Field ResultInfo apijson.Field raw string diff --git a/queues/consumer_test.go b/queues/consumer_test.go index 3abbbcf1c4d..5824140f0c5 100644 --- a/queues/consumer_test.go +++ b/queues/consumer_test.go @@ -15,7 +15,6 @@ import ( ) func TestConsumerNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -56,7 +55,6 @@ func TestConsumerNew(t *testing.T) { } func TestConsumerUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -95,7 +93,6 @@ func TestConsumerUpdate(t *testing.T) { } func TestConsumerDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -114,7 +111,6 @@ func TestConsumerDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", queues.ConsumerDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -127,7 +123,6 @@ func TestConsumerDelete(t *testing.T) { } func TestConsumerGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/queues/message.go b/queues/message.go index 476acdeae83..2a55005e35d 100644 --- a/queues/message.go +++ b/queues/message.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // MessageService contains methods and other services that help with interacting diff --git a/queues/message_test.go b/queues/message_test.go index 6836144d12b..e17d8312298 100644 --- a/queues/message_test.go +++ b/queues/message_test.go @@ -15,7 +15,6 @@ import ( ) func TestMessageAckWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -62,7 +61,6 @@ func TestMessageAckWithOptionalParams(t *testing.T) { } func TestMessagePullWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/queues/queue.go b/queues/queue.go index c8ca1468ac5..d8549e3e208 100644 --- a/queues/queue.go +++ b/queues/queue.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -70,7 +70,7 @@ func (r *QueueService) List(ctx context.Context, query QueueListParams, opts ... opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/queues", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -88,10 +88,10 @@ func (r *QueueService) ListAutoPaging(ctx context.Context, query QueueListParams } // Deletes a queue. -func (r *QueueService) Delete(ctx context.Context, queueID string, params QueueDeleteParams, opts ...option.RequestOption) (res *QueueDeleteResponseUnion, err error) { +func (r *QueueService) Delete(ctx context.Context, queueID string, body QueueDeleteParams, opts ...option.RequestOption) (res *QueueDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env QueueDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/queues/%s", params.AccountID, queueID) + path := fmt.Sprintf("accounts/%s/queues/%s", body.AccountID, queueID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -235,13 +235,9 @@ func (r QueueNewParams) MarshalJSON() (data []byte, err error) { } type QueueNewResponseEnvelope struct { - CreatedOn interface{} `json:"created_on,required"` - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - ModifiedOn interface{} `json:"modified_on,required"` - QueueID interface{} `json:"queue_id,required"` - QueueName interface{} `json:"queue_name,required"` - Result QueueCreated `json:"result,required,nullable"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result QueueCreated `json:"result,required,nullable"` // Whether the API call was successful Success QueueNewResponseEnvelopeSuccess `json:"success,required"` ResultInfo QueueNewResponseEnvelopeResultInfo `json:"result_info"` @@ -251,12 +247,8 @@ type QueueNewResponseEnvelope struct { // queueNewResponseEnvelopeJSON contains the JSON metadata for the struct // [QueueNewResponseEnvelope] type queueNewResponseEnvelopeJSON struct { - CreatedOn apijson.Field Errors apijson.Field Messages apijson.Field - ModifiedOn apijson.Field - QueueID apijson.Field - QueueName apijson.Field Result apijson.Field Success apijson.Field ResultInfo apijson.Field @@ -329,13 +321,9 @@ func (r QueueUpdateParams) MarshalJSON() (data []byte, err error) { } type QueueUpdateResponseEnvelope struct { - CreatedOn interface{} `json:"created_on,required"` - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - ModifiedOn interface{} `json:"modified_on,required"` - QueueID interface{} `json:"queue_id,required"` - QueueName interface{} `json:"queue_name,required"` - Result QueueUpdated `json:"result,required,nullable"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result QueueUpdated `json:"result,required,nullable"` // Whether the API call was successful Success QueueUpdateResponseEnvelopeSuccess `json:"success,required"` ResultInfo QueueUpdateResponseEnvelopeResultInfo `json:"result_info"` @@ -345,12 +333,8 @@ type QueueUpdateResponseEnvelope struct { // queueUpdateResponseEnvelopeJSON contains the JSON metadata for the struct // [QueueUpdateResponseEnvelope] type queueUpdateResponseEnvelopeJSON struct { - CreatedOn apijson.Field Errors apijson.Field Messages apijson.Field - ModifiedOn apijson.Field - QueueID apijson.Field - QueueName apijson.Field Result apijson.Field Success apijson.Field ResultInfo apijson.Field @@ -420,11 +404,6 @@ type QueueListParams struct { type QueueDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r QueueDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type QueueDeleteResponseEnvelope struct { @@ -509,13 +488,9 @@ type QueueGetParams struct { } type QueueGetResponseEnvelope struct { - CreatedOn interface{} `json:"created_on,required"` - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - ModifiedOn interface{} `json:"modified_on,required"` - QueueID interface{} `json:"queue_id,required"` - QueueName interface{} `json:"queue_name,required"` - Result Queue `json:"result,required,nullable"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + Result Queue `json:"result,required,nullable"` // Whether the API call was successful Success QueueGetResponseEnvelopeSuccess `json:"success,required"` ResultInfo QueueGetResponseEnvelopeResultInfo `json:"result_info"` @@ -525,12 +500,8 @@ type QueueGetResponseEnvelope struct { // queueGetResponseEnvelopeJSON contains the JSON metadata for the struct // [QueueGetResponseEnvelope] type queueGetResponseEnvelopeJSON struct { - CreatedOn apijson.Field Errors apijson.Field Messages apijson.Field - ModifiedOn apijson.Field - QueueID apijson.Field - QueueName apijson.Field Result apijson.Field Success apijson.Field ResultInfo apijson.Field diff --git a/queues/queue_test.go b/queues/queue_test.go index 3cf77ee8818..befa980cc10 100644 --- a/queues/queue_test.go +++ b/queues/queue_test.go @@ -15,7 +15,6 @@ import ( ) func TestQueueNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestQueueNew(t *testing.T) { } func TestQueueUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +75,6 @@ func TestQueueUpdate(t *testing.T) { } func TestQueueList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -103,7 +100,6 @@ func TestQueueList(t *testing.T) { } func TestQueueDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -121,7 +117,6 @@ func TestQueueDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", queues.QueueDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -134,7 +129,6 @@ func TestQueueDelete(t *testing.T) { } func TestQueueGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/r2/aliases.go b/r2/aliases.go index 57bf17772d0..94dc84369ca 100644 --- a/r2/aliases.go +++ b/r2/aliases.go @@ -4,7 +4,7 @@ package r2 import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/r2/bucket.go b/r2/bucket.go index de053114c55..034cb98aa8a 100644 --- a/r2/bucket.go +++ b/r2/bucket.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // BucketService contains methods and other services that help with interacting diff --git a/r2/bucket_test.go b/r2/bucket_test.go index 624e783ccd5..6109ef77c3b 100644 --- a/r2/bucket_test.go +++ b/r2/bucket_test.go @@ -15,7 +15,6 @@ import ( ) func TestBucketNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestBucketNewWithOptionalParams(t *testing.T) { } func TestBucketListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -75,7 +73,6 @@ func TestBucketListWithOptionalParams(t *testing.T) { } func TestBucketDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -105,7 +102,6 @@ func TestBucketDelete(t *testing.T) { } func TestBucketGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/r2/sippy.go b/r2/sippy.go index 747a71e64ce..71d2a14301e 100644 --- a/r2/sippy.go +++ b/r2/sippy.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SippyService contains methods and other services that help with interacting with diff --git a/r2/sippy_test.go b/r2/sippy_test.go index b6b699e22e9..ab8653a4715 100644 --- a/r2/sippy_test.go +++ b/r2/sippy_test.go @@ -15,7 +15,6 @@ import ( ) func TestSippyUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -59,7 +58,6 @@ func TestSippyUpdateWithOptionalParams(t *testing.T) { } func TestSippyDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -89,7 +87,6 @@ func TestSippyDelete(t *testing.T) { } func TestSippyGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/aliases.go b/radar/aliases.go index 66c90b1450e..e14e58cd7bf 100644 --- a/radar/aliases.go +++ b/radar/aliases.go @@ -4,7 +4,7 @@ package radar import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/radar/annotationoutage_test.go b/radar/annotationoutage_test.go index 50606c824e5..a533dbd954a 100644 --- a/radar/annotationoutage_test.go +++ b/radar/annotationoutage_test.go @@ -16,7 +16,6 @@ import ( ) func TestAnnotationOutageGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -30,7 +29,7 @@ func TestAnnotationOutageGetWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Radar.Annotations.Outages.Get(context.TODO(), radar.AnnotationOutageGetParams{ - ASN: cloudflare.F(int64(0)), + ASN: cloudflare.F(int64(174)), DateEnd: cloudflare.F(time.Now()), DateRange: cloudflare.F(radar.AnnotationOutageGetParamsDateRange7d), DateStart: cloudflare.F(time.Now()), @@ -49,7 +48,6 @@ func TestAnnotationOutageGetWithOptionalParams(t *testing.T) { } func TestAnnotationOutageLocationsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/as112_test.go b/radar/as112_test.go index 43db28bb625..4fa0a53d71e 100644 --- a/radar/as112_test.go +++ b/radar/as112_test.go @@ -16,7 +16,6 @@ import ( ) func TestAS112TimeseriesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/as112summary_test.go b/radar/as112summary_test.go index 768baf515eb..5f6c47b79a0 100644 --- a/radar/as112summary_test.go +++ b/radar/as112summary_test.go @@ -16,7 +16,6 @@ import ( ) func TestAS112SummaryDNSSECWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestAS112SummaryDNSSECWithOptionalParams(t *testing.T) { } func TestAS112SummaryEdnsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -82,7 +80,6 @@ func TestAS112SummaryEdnsWithOptionalParams(t *testing.T) { } func TestAS112SummaryIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -115,7 +112,6 @@ func TestAS112SummaryIPVersionWithOptionalParams(t *testing.T) { } func TestAS112SummaryProtocolWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -148,7 +144,6 @@ func TestAS112SummaryProtocolWithOptionalParams(t *testing.T) { } func TestAS112SummaryQueryTypeWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -181,7 +176,6 @@ func TestAS112SummaryQueryTypeWithOptionalParams(t *testing.T) { } func TestAS112SummaryResponseCodesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/as112timeseriesgroup_test.go b/radar/as112timeseriesgroup_test.go index 020483321a7..54e4e94cb10 100644 --- a/radar/as112timeseriesgroup_test.go +++ b/radar/as112timeseriesgroup_test.go @@ -16,7 +16,6 @@ import ( ) func TestAS112TimeseriesGroupDNSSECWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestAS112TimeseriesGroupDNSSECWithOptionalParams(t *testing.T) { } func TestAS112TimeseriesGroupEdnsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -84,7 +82,6 @@ func TestAS112TimeseriesGroupEdnsWithOptionalParams(t *testing.T) { } func TestAS112TimeseriesGroupIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -118,7 +115,6 @@ func TestAS112TimeseriesGroupIPVersionWithOptionalParams(t *testing.T) { } func TestAS112TimeseriesGroupProtocolWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -152,7 +148,6 @@ func TestAS112TimeseriesGroupProtocolWithOptionalParams(t *testing.T) { } func TestAS112TimeseriesGroupQueryTypeWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -186,7 +181,6 @@ func TestAS112TimeseriesGroupQueryTypeWithOptionalParams(t *testing.T) { } func TestAS112TimeseriesGroupResponseCodesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/as112top_test.go b/radar/as112top_test.go index e54bcdb3d56..0d66fbce009 100644 --- a/radar/as112top_test.go +++ b/radar/as112top_test.go @@ -16,7 +16,6 @@ import ( ) func TestAS112TopDNSSECWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -54,7 +53,6 @@ func TestAS112TopDNSSECWithOptionalParams(t *testing.T) { } func TestAS112TopEdnsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -92,7 +90,6 @@ func TestAS112TopEdnsWithOptionalParams(t *testing.T) { } func TestAS112TopIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -130,7 +127,6 @@ func TestAS112TopIPVersionWithOptionalParams(t *testing.T) { } func TestAS112TopLocationsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer3_test.go b/radar/attacklayer3_test.go index 448a71e9a59..230309eee21 100644 --- a/radar/attacklayer3_test.go +++ b/radar/attacklayer3_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer3TimeseriesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer3summary_test.go b/radar/attacklayer3summary_test.go index 409533aa769..c847ce6e466 100644 --- a/radar/attacklayer3summary_test.go +++ b/radar/attacklayer3summary_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer3SummaryBitrateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -51,7 +50,6 @@ func TestAttackLayer3SummaryBitrateWithOptionalParams(t *testing.T) { } func TestAttackLayer3SummaryDurationWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -86,7 +84,6 @@ func TestAttackLayer3SummaryDurationWithOptionalParams(t *testing.T) { } func TestAttackLayer3SummaryGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -119,7 +116,6 @@ func TestAttackLayer3SummaryGetWithOptionalParams(t *testing.T) { } func TestAttackLayer3SummaryIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -153,7 +149,6 @@ func TestAttackLayer3SummaryIPVersionWithOptionalParams(t *testing.T) { } func TestAttackLayer3SummaryProtocolWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -187,7 +182,6 @@ func TestAttackLayer3SummaryProtocolWithOptionalParams(t *testing.T) { } func TestAttackLayer3SummaryVectorWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer3timeseriesgroup_test.go b/radar/attacklayer3timeseriesgroup_test.go index 12865a68a3b..ced4274e509 100644 --- a/radar/attacklayer3timeseriesgroup_test.go +++ b/radar/attacklayer3timeseriesgroup_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer3TimeseriesGroupBitrateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -53,7 +52,6 @@ func TestAttackLayer3TimeseriesGroupBitrateWithOptionalParams(t *testing.T) { } func TestAttackLayer3TimeseriesGroupDurationWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -90,7 +88,6 @@ func TestAttackLayer3TimeseriesGroupDurationWithOptionalParams(t *testing.T) { } func TestAttackLayer3TimeseriesGroupGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -124,7 +121,6 @@ func TestAttackLayer3TimeseriesGroupGetWithOptionalParams(t *testing.T) { } func TestAttackLayer3TimeseriesGroupIndustryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -161,7 +157,6 @@ func TestAttackLayer3TimeseriesGroupIndustryWithOptionalParams(t *testing.T) { } func TestAttackLayer3TimeseriesGroupIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -197,7 +192,6 @@ func TestAttackLayer3TimeseriesGroupIPVersionWithOptionalParams(t *testing.T) { } func TestAttackLayer3TimeseriesGroupProtocolWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -233,7 +227,6 @@ func TestAttackLayer3TimeseriesGroupProtocolWithOptionalParams(t *testing.T) { } func TestAttackLayer3TimeseriesGroupVectorWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -271,7 +264,6 @@ func TestAttackLayer3TimeseriesGroupVectorWithOptionalParams(t *testing.T) { } func TestAttackLayer3TimeseriesGroupVerticalWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer3top_test.go b/radar/attacklayer3top_test.go index c27f5a0365c..23a2a8e4cec 100644 --- a/radar/attacklayer3top_test.go +++ b/radar/attacklayer3top_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer3TopAttacksWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -53,7 +52,6 @@ func TestAttackLayer3TopAttacksWithOptionalParams(t *testing.T) { } func TestAttackLayer3TopIndustryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -88,7 +86,6 @@ func TestAttackLayer3TopIndustryWithOptionalParams(t *testing.T) { } func TestAttackLayer3TopVerticalWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer3toplocation_test.go b/radar/attacklayer3toplocation_test.go index 3d13f00b268..d33d9abded0 100644 --- a/radar/attacklayer3toplocation_test.go +++ b/radar/attacklayer3toplocation_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer3TopLocationOriginWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -51,7 +50,6 @@ func TestAttackLayer3TopLocationOriginWithOptionalParams(t *testing.T) { } func TestAttackLayer3TopLocationTargetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer7_test.go b/radar/attacklayer7_test.go index e9185184a65..546c13423c9 100644 --- a/radar/attacklayer7_test.go +++ b/radar/attacklayer7_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer7TimeseriesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer7summary_test.go b/radar/attacklayer7summary_test.go index 4d52fad6d8b..609911d1702 100644 --- a/radar/attacklayer7summary_test.go +++ b/radar/attacklayer7summary_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer7SummaryGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestAttackLayer7SummaryGetWithOptionalParams(t *testing.T) { } func TestAttackLayer7SummaryHTTPMethodWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -85,7 +83,6 @@ func TestAttackLayer7SummaryHTTPMethodWithOptionalParams(t *testing.T) { } func TestAttackLayer7SummaryHTTPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -121,7 +118,6 @@ func TestAttackLayer7SummaryHTTPVersionWithOptionalParams(t *testing.T) { } func TestAttackLayer7SummaryIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -157,7 +153,6 @@ func TestAttackLayer7SummaryIPVersionWithOptionalParams(t *testing.T) { } func TestAttackLayer7SummaryManagedRulesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -194,7 +189,6 @@ func TestAttackLayer7SummaryManagedRulesWithOptionalParams(t *testing.T) { } func TestAttackLayer7SummaryMitigationProductWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer7timeseriesgroup_test.go b/radar/attacklayer7timeseriesgroup_test.go index 688542200d6..fc4edfbf42e 100644 --- a/radar/attacklayer7timeseriesgroup_test.go +++ b/radar/attacklayer7timeseriesgroup_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer7TimeseriesGroupGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestAttackLayer7TimeseriesGroupGetWithOptionalParams(t *testing.T) { } func TestAttackLayer7TimeseriesGroupHTTPMethodWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -88,7 +86,6 @@ func TestAttackLayer7TimeseriesGroupHTTPMethodWithOptionalParams(t *testing.T) { } func TestAttackLayer7TimeseriesGroupHTTPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -126,7 +123,6 @@ func TestAttackLayer7TimeseriesGroupHTTPVersionWithOptionalParams(t *testing.T) } func TestAttackLayer7TimeseriesGroupIndustryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -166,7 +162,6 @@ func TestAttackLayer7TimeseriesGroupIndustryWithOptionalParams(t *testing.T) { } func TestAttackLayer7TimeseriesGroupIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -204,7 +199,6 @@ func TestAttackLayer7TimeseriesGroupIPVersionWithOptionalParams(t *testing.T) { } func TestAttackLayer7TimeseriesGroupManagedRulesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -243,7 +237,6 @@ func TestAttackLayer7TimeseriesGroupManagedRulesWithOptionalParams(t *testing.T) } func TestAttackLayer7TimeseriesGroupMitigationProductWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -281,7 +274,6 @@ func TestAttackLayer7TimeseriesGroupMitigationProductWithOptionalParams(t *testi } func TestAttackLayer7TimeseriesGroupVerticalWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer7top_test.go b/radar/attacklayer7top_test.go index 628cc58bc48..e7e4d38f7c4 100644 --- a/radar/attacklayer7top_test.go +++ b/radar/attacklayer7top_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer7TopAttacksWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -53,7 +52,6 @@ func TestAttackLayer7TopAttacksWithOptionalParams(t *testing.T) { } func TestAttackLayer7TopIndustryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -87,7 +85,6 @@ func TestAttackLayer7TopIndustryWithOptionalParams(t *testing.T) { } func TestAttackLayer7TopVerticalWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer7topase_test.go b/radar/attacklayer7topase_test.go index e70550c2d54..399b257044c 100644 --- a/radar/attacklayer7topase_test.go +++ b/radar/attacklayer7topase_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer7TopAseOriginWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/attacklayer7toplocation_test.go b/radar/attacklayer7toplocation_test.go index 3eab517f3a2..78a9556c3bb 100644 --- a/radar/attacklayer7toplocation_test.go +++ b/radar/attacklayer7toplocation_test.go @@ -16,7 +16,6 @@ import ( ) func TestAttackLayer7TopLocationOriginWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestAttackLayer7TopLocationOriginWithOptionalParams(t *testing.T) { } func TestAttackLayer7TopLocationTargetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/bgp_test.go b/radar/bgp_test.go index 697640b698f..f16397aa995 100644 --- a/radar/bgp_test.go +++ b/radar/bgp_test.go @@ -16,7 +16,6 @@ import ( ) func TestBGPTimeseriesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/bgphijackevent_test.go b/radar/bgphijackevent_test.go index ad36d1ce826..61551b21288 100644 --- a/radar/bgphijackevent_test.go +++ b/radar/bgphijackevent_test.go @@ -16,7 +16,6 @@ import ( ) func TestBGPHijackEventListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/bgpleakevent_test.go b/radar/bgpleakevent_test.go index 7c44f8c02cd..b9f66befcf2 100644 --- a/radar/bgpleakevent_test.go +++ b/radar/bgpleakevent_test.go @@ -16,7 +16,6 @@ import ( ) func TestBGPLeakEventListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/bgproute_test.go b/radar/bgproute_test.go index b6da03886e5..ecc17a18639 100644 --- a/radar/bgproute_test.go +++ b/radar/bgproute_test.go @@ -16,7 +16,6 @@ import ( ) func TestBGPRouteMoasWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestBGPRouteMoasWithOptionalParams(t *testing.T) { } func TestBGPRoutePfx2asWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -75,7 +73,6 @@ func TestBGPRoutePfx2asWithOptionalParams(t *testing.T) { } func TestBGPRouteStatsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -89,7 +86,7 @@ func TestBGPRouteStatsWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Radar.BGP.Routes.Stats(context.TODO(), radar.BGPRouteStatsParams{ - ASN: cloudflare.F(int64(0)), + ASN: cloudflare.F(int64(174)), Format: cloudflare.F(radar.BGPRouteStatsParamsFormatJson), Location: cloudflare.F("US"), }) @@ -103,7 +100,6 @@ func TestBGPRouteStatsWithOptionalParams(t *testing.T) { } func TestBGPRouteTimeseriesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -117,7 +113,7 @@ func TestBGPRouteTimeseriesWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Radar.BGP.Routes.Timeseries(context.TODO(), radar.BGPRouteTimeseriesParams{ - ASN: cloudflare.F(int64(0)), + ASN: cloudflare.F(int64(174)), DateEnd: cloudflare.F(time.Now()), DateRange: cloudflare.F(radar.BGPRouteTimeseriesParamsDateRange7d), DateStart: cloudflare.F(time.Now()), diff --git a/radar/bgptop_test.go b/radar/bgptop_test.go index 0c8569d86cf..cd787055c82 100644 --- a/radar/bgptop_test.go +++ b/radar/bgptop_test.go @@ -16,7 +16,6 @@ import ( ) func TestBGPTopPrefixesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/bgptopase_test.go b/radar/bgptopase_test.go index f810340c0df..1bcb8166a0c 100644 --- a/radar/bgptopase_test.go +++ b/radar/bgptopase_test.go @@ -16,7 +16,6 @@ import ( ) func TestBGPTopAseGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestBGPTopAseGetWithOptionalParams(t *testing.T) { } func TestBGPTopAsePrefixesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/connectiontampering_test.go b/radar/connectiontampering_test.go index c600683cb7a..911f2ae18db 100644 --- a/radar/connectiontampering_test.go +++ b/radar/connectiontampering_test.go @@ -16,7 +16,6 @@ import ( ) func TestConnectionTamperingSummaryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestConnectionTamperingSummaryWithOptionalParams(t *testing.T) { } func TestConnectionTamperingTimeseriesGroupsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/dataset_test.go b/radar/dataset_test.go index 4d5c8375976..06d80cb332a 100644 --- a/radar/dataset_test.go +++ b/radar/dataset_test.go @@ -15,7 +15,6 @@ import ( ) func TestDatasetListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestDatasetListWithOptionalParams(t *testing.T) { } func TestDatasetDownloadWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -71,7 +69,6 @@ func TestDatasetDownloadWithOptionalParams(t *testing.T) { } func TestDatasetGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/dnstop_test.go b/radar/dnstop_test.go index c1a9be99889..2653b068103 100644 --- a/radar/dnstop_test.go +++ b/radar/dnstop_test.go @@ -16,7 +16,6 @@ import ( ) func TestDNSTopAsesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -51,7 +50,6 @@ func TestDNSTopAsesWithOptionalParams(t *testing.T) { } func TestDNSTopLocationsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/emailroutingsummary_test.go b/radar/emailroutingsummary_test.go index 55c84484455..bd89f46be86 100644 --- a/radar/emailroutingsummary_test.go +++ b/radar/emailroutingsummary_test.go @@ -16,7 +16,6 @@ import ( ) func TestEmailRoutingSummaryARCWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -51,7 +50,6 @@ func TestEmailRoutingSummaryARCWithOptionalParams(t *testing.T) { } func TestEmailRoutingSummaryDKIMWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -86,7 +84,6 @@ func TestEmailRoutingSummaryDKIMWithOptionalParams(t *testing.T) { } func TestEmailRoutingSummaryDMARCWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -121,7 +118,6 @@ func TestEmailRoutingSummaryDMARCWithOptionalParams(t *testing.T) { } func TestEmailRoutingSummaryEncryptedWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -156,7 +152,6 @@ func TestEmailRoutingSummaryEncryptedWithOptionalParams(t *testing.T) { } func TestEmailRoutingSummaryIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -191,7 +186,6 @@ func TestEmailRoutingSummaryIPVersionWithOptionalParams(t *testing.T) { } func TestEmailRoutingSummarySPFWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/emailroutingtimeseriesgroup_test.go b/radar/emailroutingtimeseriesgroup_test.go index 029e959e83c..a9e7cd6a95f 100644 --- a/radar/emailroutingtimeseriesgroup_test.go +++ b/radar/emailroutingtimeseriesgroup_test.go @@ -16,7 +16,6 @@ import ( ) func TestEmailRoutingTimeseriesGroupARCWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -52,7 +51,6 @@ func TestEmailRoutingTimeseriesGroupARCWithOptionalParams(t *testing.T) { } func TestEmailRoutingTimeseriesGroupDKIMWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -88,7 +86,6 @@ func TestEmailRoutingTimeseriesGroupDKIMWithOptionalParams(t *testing.T) { } func TestEmailRoutingTimeseriesGroupDMARCWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -124,7 +121,6 @@ func TestEmailRoutingTimeseriesGroupDMARCWithOptionalParams(t *testing.T) { } func TestEmailRoutingTimeseriesGroupEncryptedWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -160,7 +156,6 @@ func TestEmailRoutingTimeseriesGroupEncryptedWithOptionalParams(t *testing.T) { } func TestEmailRoutingTimeseriesGroupIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -196,7 +191,6 @@ func TestEmailRoutingTimeseriesGroupIPVersionWithOptionalParams(t *testing.T) { } func TestEmailRoutingTimeseriesGroupSPFWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/emailsecuritysummary_test.go b/radar/emailsecuritysummary_test.go index e0c51af3e60..3737b331fe4 100644 --- a/radar/emailsecuritysummary_test.go +++ b/radar/emailsecuritysummary_test.go @@ -16,7 +16,6 @@ import ( ) func TestEmailSecuritySummaryARCWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestEmailSecuritySummaryARCWithOptionalParams(t *testing.T) { } func TestEmailSecuritySummaryDKIMWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -84,7 +82,6 @@ func TestEmailSecuritySummaryDKIMWithOptionalParams(t *testing.T) { } func TestEmailSecuritySummaryDMARCWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -118,7 +115,6 @@ func TestEmailSecuritySummaryDMARCWithOptionalParams(t *testing.T) { } func TestEmailSecuritySummaryMaliciousWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -153,7 +149,6 @@ func TestEmailSecuritySummaryMaliciousWithOptionalParams(t *testing.T) { } func TestEmailSecuritySummarySpamWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -188,7 +183,6 @@ func TestEmailSecuritySummarySpamWithOptionalParams(t *testing.T) { } func TestEmailSecuritySummarySPFWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -222,7 +216,6 @@ func TestEmailSecuritySummarySPFWithOptionalParams(t *testing.T) { } func TestEmailSecuritySummarySpoofWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -257,7 +250,6 @@ func TestEmailSecuritySummarySpoofWithOptionalParams(t *testing.T) { } func TestEmailSecuritySummaryThreatCategoryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -292,7 +284,6 @@ func TestEmailSecuritySummaryThreatCategoryWithOptionalParams(t *testing.T) { } func TestEmailSecuritySummaryTLSVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/emailsecuritytimeseriesgroup_test.go b/radar/emailsecuritytimeseriesgroup_test.go index d480fd9987e..c93fe209ee3 100644 --- a/radar/emailsecuritytimeseriesgroup_test.go +++ b/radar/emailsecuritytimeseriesgroup_test.go @@ -16,7 +16,6 @@ import ( ) func TestEmailSecurityTimeseriesGroupARCWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -51,7 +50,6 @@ func TestEmailSecurityTimeseriesGroupARCWithOptionalParams(t *testing.T) { } func TestEmailSecurityTimeseriesGroupDKIMWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -86,7 +84,6 @@ func TestEmailSecurityTimeseriesGroupDKIMWithOptionalParams(t *testing.T) { } func TestEmailSecurityTimeseriesGroupDMARCWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -121,7 +118,6 @@ func TestEmailSecurityTimeseriesGroupDMARCWithOptionalParams(t *testing.T) { } func TestEmailSecurityTimeseriesGroupMaliciousWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -157,7 +153,6 @@ func TestEmailSecurityTimeseriesGroupMaliciousWithOptionalParams(t *testing.T) { } func TestEmailSecurityTimeseriesGroupSpamWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -193,7 +188,6 @@ func TestEmailSecurityTimeseriesGroupSpamWithOptionalParams(t *testing.T) { } func TestEmailSecurityTimeseriesGroupSPFWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -228,7 +222,6 @@ func TestEmailSecurityTimeseriesGroupSPFWithOptionalParams(t *testing.T) { } func TestEmailSecurityTimeseriesGroupSpoofWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -264,7 +257,6 @@ func TestEmailSecurityTimeseriesGroupSpoofWithOptionalParams(t *testing.T) { } func TestEmailSecurityTimeseriesGroupThreatCategoryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -300,7 +292,6 @@ func TestEmailSecurityTimeseriesGroupThreatCategoryWithOptionalParams(t *testing } func TestEmailSecurityTimeseriesGroupTLSVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/emailsecuritytoptld_test.go b/radar/emailsecuritytoptld_test.go index 6460369f714..d6198370e0e 100644 --- a/radar/emailsecuritytoptld_test.go +++ b/radar/emailsecuritytoptld_test.go @@ -16,7 +16,6 @@ import ( ) func TestEmailSecurityTopTldGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/emailsecuritytoptldmalicious_test.go b/radar/emailsecuritytoptldmalicious_test.go index 3c65f75d1d2..f16eca0c2a3 100644 --- a/radar/emailsecuritytoptldmalicious_test.go +++ b/radar/emailsecuritytoptldmalicious_test.go @@ -16,7 +16,6 @@ import ( ) func TestEmailSecurityTopTldMaliciousGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/emailsecuritytoptldspam_test.go b/radar/emailsecuritytoptldspam_test.go index 410fcee85bf..115307839a4 100644 --- a/radar/emailsecuritytoptldspam_test.go +++ b/radar/emailsecuritytoptldspam_test.go @@ -16,7 +16,6 @@ import ( ) func TestEmailSecurityTopTldSpamGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/emailsecuritytoptldspoof_test.go b/radar/emailsecuritytoptldspoof_test.go index 6f42b6b9bdb..f0325a24658 100644 --- a/radar/emailsecuritytoptldspoof_test.go +++ b/radar/emailsecuritytoptldspoof_test.go @@ -16,7 +16,6 @@ import ( ) func TestEmailSecurityTopTldSpoofGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/entity_test.go b/radar/entity_test.go index 44a99cf761e..6913fbbb044 100644 --- a/radar/entity_test.go +++ b/radar/entity_test.go @@ -15,7 +15,6 @@ import ( ) func TestEntityGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/entityasn_test.go b/radar/entityasn_test.go index 8c76e55fed6..40dce71396f 100644 --- a/radar/entityasn_test.go +++ b/radar/entityasn_test.go @@ -15,7 +15,6 @@ import ( ) func TestEntityASNListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestEntityASNListWithOptionalParams(t *testing.T) { } func TestEntityASNGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +74,6 @@ func TestEntityASNGetWithOptionalParams(t *testing.T) { } func TestEntityASNIPWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -103,7 +100,6 @@ func TestEntityASNIPWithOptionalParams(t *testing.T) { } func TestEntityASNRelWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/entitylocation_test.go b/radar/entitylocation_test.go index 0c8b423f9c3..eba2b9fd5c1 100644 --- a/radar/entitylocation_test.go +++ b/radar/entitylocation_test.go @@ -15,7 +15,6 @@ import ( ) func TestEntityLocationListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestEntityLocationListWithOptionalParams(t *testing.T) { } func TestEntityLocationGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httpase_test.go b/radar/httpase_test.go index 111cb9ea077..212e8c0da10 100644 --- a/radar/httpase_test.go +++ b/radar/httpase_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPAseGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httpasebotclass_test.go b/radar/httpasebotclass_test.go index 85bbd64c8b7..62b49d18b2f 100644 --- a/radar/httpasebotclass_test.go +++ b/radar/httpasebotclass_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPAseBotClassGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httpasedevicetype_test.go b/radar/httpasedevicetype_test.go index eb53f13da7e..63dda3d970b 100644 --- a/radar/httpasedevicetype_test.go +++ b/radar/httpasedevicetype_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPAseDeviceTypeGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httpasehttpmethod_test.go b/radar/httpasehttpmethod_test.go index db5329cd658..8ae152bd2bf 100644 --- a/radar/httpasehttpmethod_test.go +++ b/radar/httpasehttpmethod_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPAseHTTPMethodGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httpasehttpprotocol_test.go b/radar/httpasehttpprotocol_test.go index 6bd5d992c5f..8e6b627defb 100644 --- a/radar/httpasehttpprotocol_test.go +++ b/radar/httpasehttpprotocol_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPAseHTTPProtocolGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httpaseipversion_test.go b/radar/httpaseipversion_test.go index 271260c9196..692d0276957 100644 --- a/radar/httpaseipversion_test.go +++ b/radar/httpaseipversion_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPAseIPVersionGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httpaseos_test.go b/radar/httpaseos_test.go index e560fa37bf6..4f8614b9094 100644 --- a/radar/httpaseos_test.go +++ b/radar/httpaseos_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPAseOSGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httpasetlsversion_test.go b/radar/httpasetlsversion_test.go index 1386874dd50..372d6b02ec4 100644 --- a/radar/httpasetlsversion_test.go +++ b/radar/httpasetlsversion_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPAseTLSVersionGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httplocation_test.go b/radar/httplocation_test.go index 8741eccd851..65907120030 100644 --- a/radar/httplocation_test.go +++ b/radar/httplocation_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPLocationGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httplocationbotclass_test.go b/radar/httplocationbotclass_test.go index a2c97477ea8..5c5c1c058d4 100644 --- a/radar/httplocationbotclass_test.go +++ b/radar/httplocationbotclass_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPLocationBotClassGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httplocationdevicetype_test.go b/radar/httplocationdevicetype_test.go index 995c9eba4b2..1824cf65fdf 100644 --- a/radar/httplocationdevicetype_test.go +++ b/radar/httplocationdevicetype_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPLocationDeviceTypeGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httplocationhttpmethod_test.go b/radar/httplocationhttpmethod_test.go index d285cbd49ca..4ecff553ede 100644 --- a/radar/httplocationhttpmethod_test.go +++ b/radar/httplocationhttpmethod_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPLocationHTTPMethodGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httplocationhttpprotocol_test.go b/radar/httplocationhttpprotocol_test.go index cbbbc683cee..b8a210df83e 100644 --- a/radar/httplocationhttpprotocol_test.go +++ b/radar/httplocationhttpprotocol_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPLocationHTTPProtocolGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httplocationipversion_test.go b/radar/httplocationipversion_test.go index 580d5b65bc8..ba3048348a9 100644 --- a/radar/httplocationipversion_test.go +++ b/radar/httplocationipversion_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPLocationIPVersionGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httplocationos_test.go b/radar/httplocationos_test.go index 090abe760f8..a335f2504f9 100644 --- a/radar/httplocationos_test.go +++ b/radar/httplocationos_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPLocationOSGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httplocationtlsversion_test.go b/radar/httplocationtlsversion_test.go index 5e2cc04a630..46e9d5595d2 100644 --- a/radar/httplocationtlsversion_test.go +++ b/radar/httplocationtlsversion_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPLocationTLSVersionGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httpsummary.go b/radar/httpsummary.go index 58606b03641..684c1f2a714 100644 --- a/radar/httpsummary.go +++ b/radar/httpsummary.go @@ -118,6 +118,20 @@ func (r *HTTPSummaryService) OS(ctx context.Context, query HTTPSummaryOSParams, return } +// Percentage distribution of traffic per Post Quantum support over a given time +// period. +func (r *HTTPSummaryService) PostQuantum(ctx context.Context, query HTTPSummaryPostQuantumParams, opts ...option.RequestOption) (res *HTTPSummaryPostQuantumResponse, err error) { + opts = append(r.Options[:], opts...) + var env HTTPSummaryPostQuantumResponseEnvelope + path := "radar/http/summary/post_quantum" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + // Percentage distribution of traffic per TLS protocol version, over a given time // period. func (r *HTTPSummaryService) TLSVersion(ctx context.Context, query HTTPSummaryTLSVersionParams, opts ...option.RequestOption) (res *HTTPSummaryTLSVersionResponse, err error) { @@ -1065,6 +1079,161 @@ func (r httpSummaryOSResponseSummary0JSON) RawJSON() string { return r.raw } +type HTTPSummaryPostQuantumResponse struct { + Meta HTTPSummaryPostQuantumResponseMeta `json:"meta,required"` + Summary0 HTTPSummaryPostQuantumResponseSummary0 `json:"summary_0,required"` + JSON httpSummaryPostQuantumResponseJSON `json:"-"` +} + +// httpSummaryPostQuantumResponseJSON contains the JSON metadata for the struct +// [HTTPSummaryPostQuantumResponse] +type httpSummaryPostQuantumResponseJSON struct { + Meta apijson.Field + Summary0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HTTPSummaryPostQuantumResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r httpSummaryPostQuantumResponseJSON) RawJSON() string { + return r.raw +} + +type HTTPSummaryPostQuantumResponseMeta struct { + DateRange []HTTPSummaryPostQuantumResponseMetaDateRange `json:"dateRange,required"` + LastUpdated string `json:"lastUpdated,required"` + Normalization string `json:"normalization,required"` + ConfidenceInfo HTTPSummaryPostQuantumResponseMetaConfidenceInfo `json:"confidenceInfo"` + JSON httpSummaryPostQuantumResponseMetaJSON `json:"-"` +} + +// httpSummaryPostQuantumResponseMetaJSON contains the JSON metadata for the struct +// [HTTPSummaryPostQuantumResponseMeta] +type httpSummaryPostQuantumResponseMetaJSON struct { + DateRange apijson.Field + LastUpdated apijson.Field + Normalization apijson.Field + ConfidenceInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HTTPSummaryPostQuantumResponseMeta) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r httpSummaryPostQuantumResponseMetaJSON) RawJSON() string { + return r.raw +} + +type HTTPSummaryPostQuantumResponseMetaDateRange struct { + // Adjusted end of date range. + EndTime time.Time `json:"endTime,required" format:"date-time"` + // Adjusted start of date range. + StartTime time.Time `json:"startTime,required" format:"date-time"` + JSON httpSummaryPostQuantumResponseMetaDateRangeJSON `json:"-"` +} + +// httpSummaryPostQuantumResponseMetaDateRangeJSON contains the JSON metadata for +// the struct [HTTPSummaryPostQuantumResponseMetaDateRange] +type httpSummaryPostQuantumResponseMetaDateRangeJSON struct { + EndTime apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HTTPSummaryPostQuantumResponseMetaDateRange) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r httpSummaryPostQuantumResponseMetaDateRangeJSON) RawJSON() string { + return r.raw +} + +type HTTPSummaryPostQuantumResponseMetaConfidenceInfo struct { + Annotations []HTTPSummaryPostQuantumResponseMetaConfidenceInfoAnnotation `json:"annotations"` + Level int64 `json:"level"` + JSON httpSummaryPostQuantumResponseMetaConfidenceInfoJSON `json:"-"` +} + +// httpSummaryPostQuantumResponseMetaConfidenceInfoJSON contains the JSON metadata +// for the struct [HTTPSummaryPostQuantumResponseMetaConfidenceInfo] +type httpSummaryPostQuantumResponseMetaConfidenceInfoJSON struct { + Annotations apijson.Field + Level apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HTTPSummaryPostQuantumResponseMetaConfidenceInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r httpSummaryPostQuantumResponseMetaConfidenceInfoJSON) RawJSON() string { + return r.raw +} + +type HTTPSummaryPostQuantumResponseMetaConfidenceInfoAnnotation struct { + DataSource string `json:"dataSource,required"` + Description string `json:"description,required"` + EventType string `json:"eventType,required"` + IsInstantaneous interface{} `json:"isInstantaneous,required"` + EndTime time.Time `json:"endTime" format:"date-time"` + LinkedURL string `json:"linkedUrl"` + StartTime time.Time `json:"startTime" format:"date-time"` + JSON httpSummaryPostQuantumResponseMetaConfidenceInfoAnnotationJSON `json:"-"` +} + +// httpSummaryPostQuantumResponseMetaConfidenceInfoAnnotationJSON contains the JSON +// metadata for the struct +// [HTTPSummaryPostQuantumResponseMetaConfidenceInfoAnnotation] +type httpSummaryPostQuantumResponseMetaConfidenceInfoAnnotationJSON struct { + DataSource apijson.Field + Description apijson.Field + EventType apijson.Field + IsInstantaneous apijson.Field + EndTime apijson.Field + LinkedURL apijson.Field + StartTime apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HTTPSummaryPostQuantumResponseMetaConfidenceInfoAnnotation) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r httpSummaryPostQuantumResponseMetaConfidenceInfoAnnotationJSON) RawJSON() string { + return r.raw +} + +type HTTPSummaryPostQuantumResponseSummary0 struct { + NotSupported string `json:"NOT_SUPPORTED,required"` + Supported string `json:"SUPPORTED,required"` + JSON httpSummaryPostQuantumResponseSummary0JSON `json:"-"` +} + +// httpSummaryPostQuantumResponseSummary0JSON contains the JSON metadata for the +// struct [HTTPSummaryPostQuantumResponseSummary0] +type httpSummaryPostQuantumResponseSummary0JSON struct { + NotSupported apijson.Field + Supported apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HTTPSummaryPostQuantumResponseSummary0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r httpSummaryPostQuantumResponseSummary0JSON) RawJSON() string { + return r.raw +} + type HTTPSummaryTLSVersionResponse struct { Meta HTTPSummaryTLSVersionResponseMeta `json:"meta,required"` Summary0 HTTPSummaryTLSVersionResponseSummary0 `json:"summary_0,required"` @@ -2513,6 +2682,239 @@ func (r httpSummaryOSResponseEnvelopeJSON) RawJSON() string { return r.raw } +type HTTPSummaryPostQuantumParams struct { + // 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. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]HTTPSummaryPostQuantumParamsBotClass] `query:"botClass"` + // 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. + Continent param.Field[[]string] `query:"continent"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // 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). + DateRange param.Field[[]HTTPSummaryPostQuantumParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]HTTPSummaryPostQuantumParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[HTTPSummaryPostQuantumParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]HTTPSummaryPostQuantumParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]HTTPSummaryPostQuantumParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]HTTPSummaryPostQuantumParamsIPVersion] `query:"ipVersion"` + // 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. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + OS param.Field[[]HTTPSummaryPostQuantumParamsOS] `query:"os"` + // Filter for tls version. + TLSVersion param.Field[[]HTTPSummaryPostQuantumParamsTLSVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [HTTPSummaryPostQuantumParams]'s query parameters as +// `url.Values`. +func (r HTTPSummaryPostQuantumParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +type HTTPSummaryPostQuantumParamsBotClass string + +const ( + HTTPSummaryPostQuantumParamsBotClassLikelyAutomated HTTPSummaryPostQuantumParamsBotClass = "LIKELY_AUTOMATED" + HTTPSummaryPostQuantumParamsBotClassLikelyHuman HTTPSummaryPostQuantumParamsBotClass = "LIKELY_HUMAN" +) + +func (r HTTPSummaryPostQuantumParamsBotClass) IsKnown() bool { + switch r { + case HTTPSummaryPostQuantumParamsBotClassLikelyAutomated, HTTPSummaryPostQuantumParamsBotClassLikelyHuman: + return true + } + return false +} + +type HTTPSummaryPostQuantumParamsDateRange string + +const ( + HTTPSummaryPostQuantumParamsDateRange1d HTTPSummaryPostQuantumParamsDateRange = "1d" + HTTPSummaryPostQuantumParamsDateRange2d HTTPSummaryPostQuantumParamsDateRange = "2d" + HTTPSummaryPostQuantumParamsDateRange7d HTTPSummaryPostQuantumParamsDateRange = "7d" + HTTPSummaryPostQuantumParamsDateRange14d HTTPSummaryPostQuantumParamsDateRange = "14d" + HTTPSummaryPostQuantumParamsDateRange28d HTTPSummaryPostQuantumParamsDateRange = "28d" + HTTPSummaryPostQuantumParamsDateRange12w HTTPSummaryPostQuantumParamsDateRange = "12w" + HTTPSummaryPostQuantumParamsDateRange24w HTTPSummaryPostQuantumParamsDateRange = "24w" + HTTPSummaryPostQuantumParamsDateRange52w HTTPSummaryPostQuantumParamsDateRange = "52w" + HTTPSummaryPostQuantumParamsDateRange1dControl HTTPSummaryPostQuantumParamsDateRange = "1dControl" + HTTPSummaryPostQuantumParamsDateRange2dControl HTTPSummaryPostQuantumParamsDateRange = "2dControl" + HTTPSummaryPostQuantumParamsDateRange7dControl HTTPSummaryPostQuantumParamsDateRange = "7dControl" + HTTPSummaryPostQuantumParamsDateRange14dControl HTTPSummaryPostQuantumParamsDateRange = "14dControl" + HTTPSummaryPostQuantumParamsDateRange28dControl HTTPSummaryPostQuantumParamsDateRange = "28dControl" + HTTPSummaryPostQuantumParamsDateRange12wControl HTTPSummaryPostQuantumParamsDateRange = "12wControl" + HTTPSummaryPostQuantumParamsDateRange24wControl HTTPSummaryPostQuantumParamsDateRange = "24wControl" +) + +func (r HTTPSummaryPostQuantumParamsDateRange) IsKnown() bool { + switch r { + case HTTPSummaryPostQuantumParamsDateRange1d, HTTPSummaryPostQuantumParamsDateRange2d, HTTPSummaryPostQuantumParamsDateRange7d, HTTPSummaryPostQuantumParamsDateRange14d, HTTPSummaryPostQuantumParamsDateRange28d, HTTPSummaryPostQuantumParamsDateRange12w, HTTPSummaryPostQuantumParamsDateRange24w, HTTPSummaryPostQuantumParamsDateRange52w, HTTPSummaryPostQuantumParamsDateRange1dControl, HTTPSummaryPostQuantumParamsDateRange2dControl, HTTPSummaryPostQuantumParamsDateRange7dControl, HTTPSummaryPostQuantumParamsDateRange14dControl, HTTPSummaryPostQuantumParamsDateRange28dControl, HTTPSummaryPostQuantumParamsDateRange12wControl, HTTPSummaryPostQuantumParamsDateRange24wControl: + return true + } + return false +} + +type HTTPSummaryPostQuantumParamsDeviceType string + +const ( + HTTPSummaryPostQuantumParamsDeviceTypeDesktop HTTPSummaryPostQuantumParamsDeviceType = "DESKTOP" + HTTPSummaryPostQuantumParamsDeviceTypeMobile HTTPSummaryPostQuantumParamsDeviceType = "MOBILE" + HTTPSummaryPostQuantumParamsDeviceTypeOther HTTPSummaryPostQuantumParamsDeviceType = "OTHER" +) + +func (r HTTPSummaryPostQuantumParamsDeviceType) IsKnown() bool { + switch r { + case HTTPSummaryPostQuantumParamsDeviceTypeDesktop, HTTPSummaryPostQuantumParamsDeviceTypeMobile, HTTPSummaryPostQuantumParamsDeviceTypeOther: + return true + } + return false +} + +// Format results are returned in. +type HTTPSummaryPostQuantumParamsFormat string + +const ( + HTTPSummaryPostQuantumParamsFormatJson HTTPSummaryPostQuantumParamsFormat = "JSON" + HTTPSummaryPostQuantumParamsFormatCsv HTTPSummaryPostQuantumParamsFormat = "CSV" +) + +func (r HTTPSummaryPostQuantumParamsFormat) IsKnown() bool { + switch r { + case HTTPSummaryPostQuantumParamsFormatJson, HTTPSummaryPostQuantumParamsFormatCsv: + return true + } + return false +} + +type HTTPSummaryPostQuantumParamsHTTPProtocol string + +const ( + HTTPSummaryPostQuantumParamsHTTPProtocolHTTP HTTPSummaryPostQuantumParamsHTTPProtocol = "HTTP" + HTTPSummaryPostQuantumParamsHTTPProtocolHTTPS HTTPSummaryPostQuantumParamsHTTPProtocol = "HTTPS" +) + +func (r HTTPSummaryPostQuantumParamsHTTPProtocol) IsKnown() bool { + switch r { + case HTTPSummaryPostQuantumParamsHTTPProtocolHTTP, HTTPSummaryPostQuantumParamsHTTPProtocolHTTPS: + return true + } + return false +} + +type HTTPSummaryPostQuantumParamsHTTPVersion string + +const ( + HTTPSummaryPostQuantumParamsHTTPVersionHttPv1 HTTPSummaryPostQuantumParamsHTTPVersion = "HTTPv1" + HTTPSummaryPostQuantumParamsHTTPVersionHttPv2 HTTPSummaryPostQuantumParamsHTTPVersion = "HTTPv2" + HTTPSummaryPostQuantumParamsHTTPVersionHttPv3 HTTPSummaryPostQuantumParamsHTTPVersion = "HTTPv3" +) + +func (r HTTPSummaryPostQuantumParamsHTTPVersion) IsKnown() bool { + switch r { + case HTTPSummaryPostQuantumParamsHTTPVersionHttPv1, HTTPSummaryPostQuantumParamsHTTPVersionHttPv2, HTTPSummaryPostQuantumParamsHTTPVersionHttPv3: + return true + } + return false +} + +type HTTPSummaryPostQuantumParamsIPVersion string + +const ( + HTTPSummaryPostQuantumParamsIPVersionIPv4 HTTPSummaryPostQuantumParamsIPVersion = "IPv4" + HTTPSummaryPostQuantumParamsIPVersionIPv6 HTTPSummaryPostQuantumParamsIPVersion = "IPv6" +) + +func (r HTTPSummaryPostQuantumParamsIPVersion) IsKnown() bool { + switch r { + case HTTPSummaryPostQuantumParamsIPVersionIPv4, HTTPSummaryPostQuantumParamsIPVersionIPv6: + return true + } + return false +} + +type HTTPSummaryPostQuantumParamsOS string + +const ( + HTTPSummaryPostQuantumParamsOSWindows HTTPSummaryPostQuantumParamsOS = "WINDOWS" + HTTPSummaryPostQuantumParamsOSMacosx HTTPSummaryPostQuantumParamsOS = "MACOSX" + HTTPSummaryPostQuantumParamsOSIos HTTPSummaryPostQuantumParamsOS = "IOS" + HTTPSummaryPostQuantumParamsOSAndroid HTTPSummaryPostQuantumParamsOS = "ANDROID" + HTTPSummaryPostQuantumParamsOSChromeos HTTPSummaryPostQuantumParamsOS = "CHROMEOS" + HTTPSummaryPostQuantumParamsOSLinux HTTPSummaryPostQuantumParamsOS = "LINUX" + HTTPSummaryPostQuantumParamsOSSmartTv HTTPSummaryPostQuantumParamsOS = "SMART_TV" +) + +func (r HTTPSummaryPostQuantumParamsOS) IsKnown() bool { + switch r { + case HTTPSummaryPostQuantumParamsOSWindows, HTTPSummaryPostQuantumParamsOSMacosx, HTTPSummaryPostQuantumParamsOSIos, HTTPSummaryPostQuantumParamsOSAndroid, HTTPSummaryPostQuantumParamsOSChromeos, HTTPSummaryPostQuantumParamsOSLinux, HTTPSummaryPostQuantumParamsOSSmartTv: + return true + } + return false +} + +type HTTPSummaryPostQuantumParamsTLSVersion string + +const ( + HTTPSummaryPostQuantumParamsTLSVersionTlSv1_0 HTTPSummaryPostQuantumParamsTLSVersion = "TLSv1_0" + HTTPSummaryPostQuantumParamsTLSVersionTlSv1_1 HTTPSummaryPostQuantumParamsTLSVersion = "TLSv1_1" + HTTPSummaryPostQuantumParamsTLSVersionTlSv1_2 HTTPSummaryPostQuantumParamsTLSVersion = "TLSv1_2" + HTTPSummaryPostQuantumParamsTLSVersionTlSv1_3 HTTPSummaryPostQuantumParamsTLSVersion = "TLSv1_3" + HTTPSummaryPostQuantumParamsTLSVersionTlSvQuic HTTPSummaryPostQuantumParamsTLSVersion = "TLSvQUIC" +) + +func (r HTTPSummaryPostQuantumParamsTLSVersion) IsKnown() bool { + switch r { + case HTTPSummaryPostQuantumParamsTLSVersionTlSv1_0, HTTPSummaryPostQuantumParamsTLSVersionTlSv1_1, HTTPSummaryPostQuantumParamsTLSVersionTlSv1_2, HTTPSummaryPostQuantumParamsTLSVersionTlSv1_3, HTTPSummaryPostQuantumParamsTLSVersionTlSvQuic: + return true + } + return false +} + +type HTTPSummaryPostQuantumResponseEnvelope struct { + Result HTTPSummaryPostQuantumResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON httpSummaryPostQuantumResponseEnvelopeJSON `json:"-"` +} + +// httpSummaryPostQuantumResponseEnvelopeJSON contains the JSON metadata for the +// struct [HTTPSummaryPostQuantumResponseEnvelope] +type httpSummaryPostQuantumResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HTTPSummaryPostQuantumResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r httpSummaryPostQuantumResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + type HTTPSummaryTLSVersionParams struct { // 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 diff --git a/radar/httpsummary_test.go b/radar/httpsummary_test.go index f22e1178fdf..3962f55dd7b 100644 --- a/radar/httpsummary_test.go +++ b/radar/httpsummary_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPSummaryBotClassWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -55,7 +54,6 @@ func TestHTTPSummaryBotClassWithOptionalParams(t *testing.T) { } func TestHTTPSummaryDeviceTypeWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -94,7 +92,6 @@ func TestHTTPSummaryDeviceTypeWithOptionalParams(t *testing.T) { } func TestHTTPSummaryHTTPProtocolWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -133,7 +130,6 @@ func TestHTTPSummaryHTTPProtocolWithOptionalParams(t *testing.T) { } func TestHTTPSummaryHTTPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -172,7 +168,6 @@ func TestHTTPSummaryHTTPVersionWithOptionalParams(t *testing.T) { } func TestHTTPSummaryIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -211,7 +206,6 @@ func TestHTTPSummaryIPVersionWithOptionalParams(t *testing.T) { } func TestHTTPSummaryOSWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -249,8 +243,46 @@ func TestHTTPSummaryOSWithOptionalParams(t *testing.T) { } } +func TestHTTPSummaryPostQuantumWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.Radar.HTTP.Summary.PostQuantum(context.TODO(), radar.HTTPSummaryPostQuantumParams{ + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]radar.HTTPSummaryPostQuantumParamsBotClass{radar.HTTPSummaryPostQuantumParamsBotClassLikelyAutomated, radar.HTTPSummaryPostQuantumParamsBotClassLikelyHuman}), + Continent: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]radar.HTTPSummaryPostQuantumParamsDateRange{radar.HTTPSummaryPostQuantumParamsDateRange1d, radar.HTTPSummaryPostQuantumParamsDateRange2d, radar.HTTPSummaryPostQuantumParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]radar.HTTPSummaryPostQuantumParamsDeviceType{radar.HTTPSummaryPostQuantumParamsDeviceTypeDesktop, radar.HTTPSummaryPostQuantumParamsDeviceTypeMobile, radar.HTTPSummaryPostQuantumParamsDeviceTypeOther}), + Format: cloudflare.F(radar.HTTPSummaryPostQuantumParamsFormatJson), + HTTPProtocol: cloudflare.F([]radar.HTTPSummaryPostQuantumParamsHTTPProtocol{radar.HTTPSummaryPostQuantumParamsHTTPProtocolHTTP, radar.HTTPSummaryPostQuantumParamsHTTPProtocolHTTPS}), + HTTPVersion: cloudflare.F([]radar.HTTPSummaryPostQuantumParamsHTTPVersion{radar.HTTPSummaryPostQuantumParamsHTTPVersionHttPv1, radar.HTTPSummaryPostQuantumParamsHTTPVersionHttPv2, radar.HTTPSummaryPostQuantumParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]radar.HTTPSummaryPostQuantumParamsIPVersion{radar.HTTPSummaryPostQuantumParamsIPVersionIPv4, radar.HTTPSummaryPostQuantumParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + OS: cloudflare.F([]radar.HTTPSummaryPostQuantumParamsOS{radar.HTTPSummaryPostQuantumParamsOSWindows, radar.HTTPSummaryPostQuantumParamsOSMacosx, radar.HTTPSummaryPostQuantumParamsOSIos}), + TLSVersion: cloudflare.F([]radar.HTTPSummaryPostQuantumParamsTLSVersion{radar.HTTPSummaryPostQuantumParamsTLSVersionTlSv1_0, radar.HTTPSummaryPostQuantumParamsTLSVersionTlSv1_1, radar.HTTPSummaryPostQuantumParamsTLSVersionTlSv1_2}), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + func TestHTTPSummaryTLSVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httptimeseriesgroup.go b/radar/httptimeseriesgroup.go index 07dd6fac170..8cf1dce2705 100644 --- a/radar/httptimeseriesgroup.go +++ b/radar/httptimeseriesgroup.go @@ -145,6 +145,20 @@ func (r *HTTPTimeseriesGroupService) OS(ctx context.Context, query HTTPTimeserie return } +// Get a time series of the percentage distribution of traffic per Post Quantum +// suport. +func (r *HTTPTimeseriesGroupService) PostQuantum(ctx context.Context, query HTTPTimeseriesGroupPostQuantumParams, opts ...option.RequestOption) (res *HTTPTimeseriesGroupPostQuantumResponse, err error) { + opts = append(r.Options[:], opts...) + var env HTTPTimeseriesGroupPostQuantumResponseEnvelope + path := "radar/http/timeseries_groups/post_quantum" + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + // Get a time series of the percentage distribution of traffic per TLS protocol // version. func (r *HTTPTimeseriesGroupService) TLSVersion(ctx context.Context, query HTTPTimeseriesGroupTLSVersionParams, opts ...option.RequestOption) (res *HTTPTimeseriesGroupTLSVersionResponse, err error) { @@ -538,6 +552,54 @@ func (r httpTimeseriesGroupOSResponseSerie0JSON) RawJSON() string { return r.raw } +type HTTPTimeseriesGroupPostQuantumResponse struct { + Meta interface{} `json:"meta,required"` + Serie0 HTTPTimeseriesGroupPostQuantumResponseSerie0 `json:"serie_0,required"` + JSON httpTimeseriesGroupPostQuantumResponseJSON `json:"-"` +} + +// httpTimeseriesGroupPostQuantumResponseJSON contains the JSON metadata for the +// struct [HTTPTimeseriesGroupPostQuantumResponse] +type httpTimeseriesGroupPostQuantumResponseJSON struct { + Meta apijson.Field + Serie0 apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HTTPTimeseriesGroupPostQuantumResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r httpTimeseriesGroupPostQuantumResponseJSON) RawJSON() string { + return r.raw +} + +type HTTPTimeseriesGroupPostQuantumResponseSerie0 struct { + NotSupported []string `json:"NOT_SUPPORTED,required"` + Supported []string `json:"SUPPORTED,required"` + Timestamps []string `json:"timestamps,required"` + JSON httpTimeseriesGroupPostQuantumResponseSerie0JSON `json:"-"` +} + +// httpTimeseriesGroupPostQuantumResponseSerie0JSON contains the JSON metadata for +// the struct [HTTPTimeseriesGroupPostQuantumResponseSerie0] +type httpTimeseriesGroupPostQuantumResponseSerie0JSON struct { + NotSupported apijson.Field + Supported apijson.Field + Timestamps apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HTTPTimeseriesGroupPostQuantumResponseSerie0) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r httpTimeseriesGroupPostQuantumResponseSerie0JSON) RawJSON() string { + return r.raw +} + type HTTPTimeseriesGroupTLSVersionResponse struct { Meta interface{} `json:"meta,required"` Serie0 HTTPTimeseriesGroupTLSVersionResponseSerie0 `json:"serie_0,required"` @@ -2541,6 +2603,263 @@ func (r httpTimeseriesGroupOSResponseEnvelopeJSON) RawJSON() string { return r.raw } +type HTTPTimeseriesGroupPostQuantumParams struct { + // 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/). + AggInterval param.Field[HTTPTimeseriesGroupPostQuantumParamsAggInterval] `query:"aggInterval"` + // 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. + ASN param.Field[[]string] `query:"asn"` + // Filter for bot class. Refer to + // [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + BotClass param.Field[[]HTTPTimeseriesGroupPostQuantumParamsBotClass] `query:"botClass"` + // 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. + Continent param.Field[[]string] `query:"continent"` + // End of the date range (inclusive). + DateEnd param.Field[[]time.Time] `query:"dateEnd" format:"date-time"` + // 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). + DateRange param.Field[[]HTTPTimeseriesGroupPostQuantumParamsDateRange] `query:"dateRange"` + // Array of datetimes to filter the start of a series. + DateStart param.Field[[]time.Time] `query:"dateStart" format:"date-time"` + // Filter for device type. + DeviceType param.Field[[]HTTPTimeseriesGroupPostQuantumParamsDeviceType] `query:"deviceType"` + // Format results are returned in. + Format param.Field[HTTPTimeseriesGroupPostQuantumParamsFormat] `query:"format"` + // Filter for http protocol. + HTTPProtocol param.Field[[]HTTPTimeseriesGroupPostQuantumParamsHTTPProtocol] `query:"httpProtocol"` + // Filter for http version. + HTTPVersion param.Field[[]HTTPTimeseriesGroupPostQuantumParamsHTTPVersion] `query:"httpVersion"` + // Filter for ip version. + IPVersion param.Field[[]HTTPTimeseriesGroupPostQuantumParamsIPVersion] `query:"ipVersion"` + // 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. + Location param.Field[[]string] `query:"location"` + // Array of names that will be used to name the series in responses. + Name param.Field[[]string] `query:"name"` + // Filter for os name. + OS param.Field[[]HTTPTimeseriesGroupPostQuantumParamsOS] `query:"os"` + // Filter for tls version. + TLSVersion param.Field[[]HTTPTimeseriesGroupPostQuantumParamsTLSVersion] `query:"tlsVersion"` +} + +// URLQuery serializes [HTTPTimeseriesGroupPostQuantumParams]'s query parameters as +// `url.Values`. +func (r HTTPTimeseriesGroupPostQuantumParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// 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/). +type HTTPTimeseriesGroupPostQuantumParamsAggInterval string + +const ( + HTTPTimeseriesGroupPostQuantumParamsAggInterval15m HTTPTimeseriesGroupPostQuantumParamsAggInterval = "15m" + HTTPTimeseriesGroupPostQuantumParamsAggInterval1h HTTPTimeseriesGroupPostQuantumParamsAggInterval = "1h" + HTTPTimeseriesGroupPostQuantumParamsAggInterval1d HTTPTimeseriesGroupPostQuantumParamsAggInterval = "1d" + HTTPTimeseriesGroupPostQuantumParamsAggInterval1w HTTPTimeseriesGroupPostQuantumParamsAggInterval = "1w" +) + +func (r HTTPTimeseriesGroupPostQuantumParamsAggInterval) IsKnown() bool { + switch r { + case HTTPTimeseriesGroupPostQuantumParamsAggInterval15m, HTTPTimeseriesGroupPostQuantumParamsAggInterval1h, HTTPTimeseriesGroupPostQuantumParamsAggInterval1d, HTTPTimeseriesGroupPostQuantumParamsAggInterval1w: + return true + } + return false +} + +type HTTPTimeseriesGroupPostQuantumParamsBotClass string + +const ( + HTTPTimeseriesGroupPostQuantumParamsBotClassLikelyAutomated HTTPTimeseriesGroupPostQuantumParamsBotClass = "LIKELY_AUTOMATED" + HTTPTimeseriesGroupPostQuantumParamsBotClassLikelyHuman HTTPTimeseriesGroupPostQuantumParamsBotClass = "LIKELY_HUMAN" +) + +func (r HTTPTimeseriesGroupPostQuantumParamsBotClass) IsKnown() bool { + switch r { + case HTTPTimeseriesGroupPostQuantumParamsBotClassLikelyAutomated, HTTPTimeseriesGroupPostQuantumParamsBotClassLikelyHuman: + return true + } + return false +} + +type HTTPTimeseriesGroupPostQuantumParamsDateRange string + +const ( + HTTPTimeseriesGroupPostQuantumParamsDateRange1d HTTPTimeseriesGroupPostQuantumParamsDateRange = "1d" + HTTPTimeseriesGroupPostQuantumParamsDateRange2d HTTPTimeseriesGroupPostQuantumParamsDateRange = "2d" + HTTPTimeseriesGroupPostQuantumParamsDateRange7d HTTPTimeseriesGroupPostQuantumParamsDateRange = "7d" + HTTPTimeseriesGroupPostQuantumParamsDateRange14d HTTPTimeseriesGroupPostQuantumParamsDateRange = "14d" + HTTPTimeseriesGroupPostQuantumParamsDateRange28d HTTPTimeseriesGroupPostQuantumParamsDateRange = "28d" + HTTPTimeseriesGroupPostQuantumParamsDateRange12w HTTPTimeseriesGroupPostQuantumParamsDateRange = "12w" + HTTPTimeseriesGroupPostQuantumParamsDateRange24w HTTPTimeseriesGroupPostQuantumParamsDateRange = "24w" + HTTPTimeseriesGroupPostQuantumParamsDateRange52w HTTPTimeseriesGroupPostQuantumParamsDateRange = "52w" + HTTPTimeseriesGroupPostQuantumParamsDateRange1dControl HTTPTimeseriesGroupPostQuantumParamsDateRange = "1dControl" + HTTPTimeseriesGroupPostQuantumParamsDateRange2dControl HTTPTimeseriesGroupPostQuantumParamsDateRange = "2dControl" + HTTPTimeseriesGroupPostQuantumParamsDateRange7dControl HTTPTimeseriesGroupPostQuantumParamsDateRange = "7dControl" + HTTPTimeseriesGroupPostQuantumParamsDateRange14dControl HTTPTimeseriesGroupPostQuantumParamsDateRange = "14dControl" + HTTPTimeseriesGroupPostQuantumParamsDateRange28dControl HTTPTimeseriesGroupPostQuantumParamsDateRange = "28dControl" + HTTPTimeseriesGroupPostQuantumParamsDateRange12wControl HTTPTimeseriesGroupPostQuantumParamsDateRange = "12wControl" + HTTPTimeseriesGroupPostQuantumParamsDateRange24wControl HTTPTimeseriesGroupPostQuantumParamsDateRange = "24wControl" +) + +func (r HTTPTimeseriesGroupPostQuantumParamsDateRange) IsKnown() bool { + switch r { + case HTTPTimeseriesGroupPostQuantumParamsDateRange1d, HTTPTimeseriesGroupPostQuantumParamsDateRange2d, HTTPTimeseriesGroupPostQuantumParamsDateRange7d, HTTPTimeseriesGroupPostQuantumParamsDateRange14d, HTTPTimeseriesGroupPostQuantumParamsDateRange28d, HTTPTimeseriesGroupPostQuantumParamsDateRange12w, HTTPTimeseriesGroupPostQuantumParamsDateRange24w, HTTPTimeseriesGroupPostQuantumParamsDateRange52w, HTTPTimeseriesGroupPostQuantumParamsDateRange1dControl, HTTPTimeseriesGroupPostQuantumParamsDateRange2dControl, HTTPTimeseriesGroupPostQuantumParamsDateRange7dControl, HTTPTimeseriesGroupPostQuantumParamsDateRange14dControl, HTTPTimeseriesGroupPostQuantumParamsDateRange28dControl, HTTPTimeseriesGroupPostQuantumParamsDateRange12wControl, HTTPTimeseriesGroupPostQuantumParamsDateRange24wControl: + return true + } + return false +} + +type HTTPTimeseriesGroupPostQuantumParamsDeviceType string + +const ( + HTTPTimeseriesGroupPostQuantumParamsDeviceTypeDesktop HTTPTimeseriesGroupPostQuantumParamsDeviceType = "DESKTOP" + HTTPTimeseriesGroupPostQuantumParamsDeviceTypeMobile HTTPTimeseriesGroupPostQuantumParamsDeviceType = "MOBILE" + HTTPTimeseriesGroupPostQuantumParamsDeviceTypeOther HTTPTimeseriesGroupPostQuantumParamsDeviceType = "OTHER" +) + +func (r HTTPTimeseriesGroupPostQuantumParamsDeviceType) IsKnown() bool { + switch r { + case HTTPTimeseriesGroupPostQuantumParamsDeviceTypeDesktop, HTTPTimeseriesGroupPostQuantumParamsDeviceTypeMobile, HTTPTimeseriesGroupPostQuantumParamsDeviceTypeOther: + return true + } + return false +} + +// Format results are returned in. +type HTTPTimeseriesGroupPostQuantumParamsFormat string + +const ( + HTTPTimeseriesGroupPostQuantumParamsFormatJson HTTPTimeseriesGroupPostQuantumParamsFormat = "JSON" + HTTPTimeseriesGroupPostQuantumParamsFormatCsv HTTPTimeseriesGroupPostQuantumParamsFormat = "CSV" +) + +func (r HTTPTimeseriesGroupPostQuantumParamsFormat) IsKnown() bool { + switch r { + case HTTPTimeseriesGroupPostQuantumParamsFormatJson, HTTPTimeseriesGroupPostQuantumParamsFormatCsv: + return true + } + return false +} + +type HTTPTimeseriesGroupPostQuantumParamsHTTPProtocol string + +const ( + HTTPTimeseriesGroupPostQuantumParamsHTTPProtocolHTTP HTTPTimeseriesGroupPostQuantumParamsHTTPProtocol = "HTTP" + HTTPTimeseriesGroupPostQuantumParamsHTTPProtocolHTTPS HTTPTimeseriesGroupPostQuantumParamsHTTPProtocol = "HTTPS" +) + +func (r HTTPTimeseriesGroupPostQuantumParamsHTTPProtocol) IsKnown() bool { + switch r { + case HTTPTimeseriesGroupPostQuantumParamsHTTPProtocolHTTP, HTTPTimeseriesGroupPostQuantumParamsHTTPProtocolHTTPS: + return true + } + return false +} + +type HTTPTimeseriesGroupPostQuantumParamsHTTPVersion string + +const ( + HTTPTimeseriesGroupPostQuantumParamsHTTPVersionHttPv1 HTTPTimeseriesGroupPostQuantumParamsHTTPVersion = "HTTPv1" + HTTPTimeseriesGroupPostQuantumParamsHTTPVersionHttPv2 HTTPTimeseriesGroupPostQuantumParamsHTTPVersion = "HTTPv2" + HTTPTimeseriesGroupPostQuantumParamsHTTPVersionHttPv3 HTTPTimeseriesGroupPostQuantumParamsHTTPVersion = "HTTPv3" +) + +func (r HTTPTimeseriesGroupPostQuantumParamsHTTPVersion) IsKnown() bool { + switch r { + case HTTPTimeseriesGroupPostQuantumParamsHTTPVersionHttPv1, HTTPTimeseriesGroupPostQuantumParamsHTTPVersionHttPv2, HTTPTimeseriesGroupPostQuantumParamsHTTPVersionHttPv3: + return true + } + return false +} + +type HTTPTimeseriesGroupPostQuantumParamsIPVersion string + +const ( + HTTPTimeseriesGroupPostQuantumParamsIPVersionIPv4 HTTPTimeseriesGroupPostQuantumParamsIPVersion = "IPv4" + HTTPTimeseriesGroupPostQuantumParamsIPVersionIPv6 HTTPTimeseriesGroupPostQuantumParamsIPVersion = "IPv6" +) + +func (r HTTPTimeseriesGroupPostQuantumParamsIPVersion) IsKnown() bool { + switch r { + case HTTPTimeseriesGroupPostQuantumParamsIPVersionIPv4, HTTPTimeseriesGroupPostQuantumParamsIPVersionIPv6: + return true + } + return false +} + +type HTTPTimeseriesGroupPostQuantumParamsOS string + +const ( + HTTPTimeseriesGroupPostQuantumParamsOSWindows HTTPTimeseriesGroupPostQuantumParamsOS = "WINDOWS" + HTTPTimeseriesGroupPostQuantumParamsOSMacosx HTTPTimeseriesGroupPostQuantumParamsOS = "MACOSX" + HTTPTimeseriesGroupPostQuantumParamsOSIos HTTPTimeseriesGroupPostQuantumParamsOS = "IOS" + HTTPTimeseriesGroupPostQuantumParamsOSAndroid HTTPTimeseriesGroupPostQuantumParamsOS = "ANDROID" + HTTPTimeseriesGroupPostQuantumParamsOSChromeos HTTPTimeseriesGroupPostQuantumParamsOS = "CHROMEOS" + HTTPTimeseriesGroupPostQuantumParamsOSLinux HTTPTimeseriesGroupPostQuantumParamsOS = "LINUX" + HTTPTimeseriesGroupPostQuantumParamsOSSmartTv HTTPTimeseriesGroupPostQuantumParamsOS = "SMART_TV" +) + +func (r HTTPTimeseriesGroupPostQuantumParamsOS) IsKnown() bool { + switch r { + case HTTPTimeseriesGroupPostQuantumParamsOSWindows, HTTPTimeseriesGroupPostQuantumParamsOSMacosx, HTTPTimeseriesGroupPostQuantumParamsOSIos, HTTPTimeseriesGroupPostQuantumParamsOSAndroid, HTTPTimeseriesGroupPostQuantumParamsOSChromeos, HTTPTimeseriesGroupPostQuantumParamsOSLinux, HTTPTimeseriesGroupPostQuantumParamsOSSmartTv: + return true + } + return false +} + +type HTTPTimeseriesGroupPostQuantumParamsTLSVersion string + +const ( + HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_0 HTTPTimeseriesGroupPostQuantumParamsTLSVersion = "TLSv1_0" + HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_1 HTTPTimeseriesGroupPostQuantumParamsTLSVersion = "TLSv1_1" + HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_2 HTTPTimeseriesGroupPostQuantumParamsTLSVersion = "TLSv1_2" + HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_3 HTTPTimeseriesGroupPostQuantumParamsTLSVersion = "TLSv1_3" + HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSvQuic HTTPTimeseriesGroupPostQuantumParamsTLSVersion = "TLSvQUIC" +) + +func (r HTTPTimeseriesGroupPostQuantumParamsTLSVersion) IsKnown() bool { + switch r { + case HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_0, HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_1, HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_2, HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_3, HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSvQuic: + return true + } + return false +} + +type HTTPTimeseriesGroupPostQuantumResponseEnvelope struct { + Result HTTPTimeseriesGroupPostQuantumResponse `json:"result,required"` + Success bool `json:"success,required"` + JSON httpTimeseriesGroupPostQuantumResponseEnvelopeJSON `json:"-"` +} + +// httpTimeseriesGroupPostQuantumResponseEnvelopeJSON contains the JSON metadata +// for the struct [HTTPTimeseriesGroupPostQuantumResponseEnvelope] +type httpTimeseriesGroupPostQuantumResponseEnvelopeJSON struct { + Result apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *HTTPTimeseriesGroupPostQuantumResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r httpTimeseriesGroupPostQuantumResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + type HTTPTimeseriesGroupTLSVersionParams struct { // Aggregation interval results should be returned in (for example, in 15 minutes // or 1 hour intervals). Refer to diff --git a/radar/httptimeseriesgroup_test.go b/radar/httptimeseriesgroup_test.go index f2e9dcbb90e..278a4022fff 100644 --- a/radar/httptimeseriesgroup_test.go +++ b/radar/httptimeseriesgroup_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPTimeseriesGroupBotClassWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -56,7 +55,6 @@ func TestHTTPTimeseriesGroupBotClassWithOptionalParams(t *testing.T) { } func TestHTTPTimeseriesGroupBrowserWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -98,7 +96,6 @@ func TestHTTPTimeseriesGroupBrowserWithOptionalParams(t *testing.T) { } func TestHTTPTimeseriesGroupBrowserFamilyWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -139,7 +136,6 @@ func TestHTTPTimeseriesGroupBrowserFamilyWithOptionalParams(t *testing.T) { } func TestHTTPTimeseriesGroupDeviceTypeWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -179,7 +175,6 @@ func TestHTTPTimeseriesGroupDeviceTypeWithOptionalParams(t *testing.T) { } func TestHTTPTimeseriesGroupHTTPProtocolWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -219,7 +214,6 @@ func TestHTTPTimeseriesGroupHTTPProtocolWithOptionalParams(t *testing.T) { } func TestHTTPTimeseriesGroupHTTPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -259,7 +253,6 @@ func TestHTTPTimeseriesGroupHTTPVersionWithOptionalParams(t *testing.T) { } func TestHTTPTimeseriesGroupIPVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -299,7 +292,6 @@ func TestHTTPTimeseriesGroupIPVersionWithOptionalParams(t *testing.T) { } func TestHTTPTimeseriesGroupOSWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -338,8 +330,47 @@ func TestHTTPTimeseriesGroupOSWithOptionalParams(t *testing.T) { } } +func TestHTTPTimeseriesGroupPostQuantumWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.Radar.HTTP.TimeseriesGroups.PostQuantum(context.TODO(), radar.HTTPTimeseriesGroupPostQuantumParams{ + AggInterval: cloudflare.F(radar.HTTPTimeseriesGroupPostQuantumParamsAggInterval1h), + ASN: cloudflare.F([]string{"string", "string", "string"}), + BotClass: cloudflare.F([]radar.HTTPTimeseriesGroupPostQuantumParamsBotClass{radar.HTTPTimeseriesGroupPostQuantumParamsBotClassLikelyAutomated, radar.HTTPTimeseriesGroupPostQuantumParamsBotClassLikelyHuman}), + Continent: cloudflare.F([]string{"string", "string", "string"}), + DateEnd: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DateRange: cloudflare.F([]radar.HTTPTimeseriesGroupPostQuantumParamsDateRange{radar.HTTPTimeseriesGroupPostQuantumParamsDateRange1d, radar.HTTPTimeseriesGroupPostQuantumParamsDateRange2d, radar.HTTPTimeseriesGroupPostQuantumParamsDateRange7d}), + DateStart: cloudflare.F([]time.Time{time.Now(), time.Now(), time.Now()}), + DeviceType: cloudflare.F([]radar.HTTPTimeseriesGroupPostQuantumParamsDeviceType{radar.HTTPTimeseriesGroupPostQuantumParamsDeviceTypeDesktop, radar.HTTPTimeseriesGroupPostQuantumParamsDeviceTypeMobile, radar.HTTPTimeseriesGroupPostQuantumParamsDeviceTypeOther}), + Format: cloudflare.F(radar.HTTPTimeseriesGroupPostQuantumParamsFormatJson), + HTTPProtocol: cloudflare.F([]radar.HTTPTimeseriesGroupPostQuantumParamsHTTPProtocol{radar.HTTPTimeseriesGroupPostQuantumParamsHTTPProtocolHTTP, radar.HTTPTimeseriesGroupPostQuantumParamsHTTPProtocolHTTPS}), + HTTPVersion: cloudflare.F([]radar.HTTPTimeseriesGroupPostQuantumParamsHTTPVersion{radar.HTTPTimeseriesGroupPostQuantumParamsHTTPVersionHttPv1, radar.HTTPTimeseriesGroupPostQuantumParamsHTTPVersionHttPv2, radar.HTTPTimeseriesGroupPostQuantumParamsHTTPVersionHttPv3}), + IPVersion: cloudflare.F([]radar.HTTPTimeseriesGroupPostQuantumParamsIPVersion{radar.HTTPTimeseriesGroupPostQuantumParamsIPVersionIPv4, radar.HTTPTimeseriesGroupPostQuantumParamsIPVersionIPv6}), + Location: cloudflare.F([]string{"string", "string", "string"}), + Name: cloudflare.F([]string{"string", "string", "string"}), + OS: cloudflare.F([]radar.HTTPTimeseriesGroupPostQuantumParamsOS{radar.HTTPTimeseriesGroupPostQuantumParamsOSWindows, radar.HTTPTimeseriesGroupPostQuantumParamsOSMacosx, radar.HTTPTimeseriesGroupPostQuantumParamsOSIos}), + TLSVersion: cloudflare.F([]radar.HTTPTimeseriesGroupPostQuantumParamsTLSVersion{radar.HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_0, radar.HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_1, radar.HTTPTimeseriesGroupPostQuantumParamsTLSVersionTlSv1_2}), + }) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + func TestHTTPTimeseriesGroupTLSVersionWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/httptop_test.go b/radar/httptop_test.go index 083ad639862..a34eddfb219 100644 --- a/radar/httptop_test.go +++ b/radar/httptop_test.go @@ -16,7 +16,6 @@ import ( ) func TestHTTPTopBrowserFamiliesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -57,7 +56,6 @@ func TestHTTPTopBrowserFamiliesWithOptionalParams(t *testing.T) { } func TestHTTPTopBrowsersWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/netflow_test.go b/radar/netflow_test.go index 0a7dc12d7ca..aa0d2896e3a 100644 --- a/radar/netflow_test.go +++ b/radar/netflow_test.go @@ -16,7 +16,6 @@ import ( ) func TestNetflowTimeseriesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/netflowtop_test.go b/radar/netflowtop_test.go index 14d65c915c7..d64037cfb5f 100644 --- a/radar/netflowtop_test.go +++ b/radar/netflowtop_test.go @@ -16,7 +16,6 @@ import ( ) func TestNetflowTopAsesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestNetflowTopAsesWithOptionalParams(t *testing.T) { } func TestNetflowTopLocationsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/qualityiqi_test.go b/radar/qualityiqi_test.go index e290873c35a..2eff53238f5 100644 --- a/radar/qualityiqi_test.go +++ b/radar/qualityiqi_test.go @@ -16,7 +16,6 @@ import ( ) func TestQualityIQISummaryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestQualityIQISummaryWithOptionalParams(t *testing.T) { } func TestQualityIQITimeseriesGroupsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/qualityspeed_test.go b/radar/qualityspeed_test.go index efd12d5b350..277ec65f99c 100644 --- a/radar/qualityspeed_test.go +++ b/radar/qualityspeed_test.go @@ -16,7 +16,6 @@ import ( ) func TestQualitySpeedHistogramWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestQualitySpeedHistogramWithOptionalParams(t *testing.T) { } func TestQualitySpeedSummaryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/qualityspeedtop_test.go b/radar/qualityspeedtop_test.go index bc9c2df2aac..4649c1d6e08 100644 --- a/radar/qualityspeedtop_test.go +++ b/radar/qualityspeedtop_test.go @@ -16,7 +16,6 @@ import ( ) func TestQualitySpeedTopAsesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestQualitySpeedTopAsesWithOptionalParams(t *testing.T) { } func TestQualitySpeedTopLocationsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/ranking.go b/radar/ranking.go index d86a9cb4874..6697966d443 100644 --- a/radar/ranking.go +++ b/radar/ranking.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/radar/ranking_test.go b/radar/ranking_test.go index 59310bcbc2b..16b1a0eafca 100644 --- a/radar/ranking_test.go +++ b/radar/ranking_test.go @@ -16,7 +16,6 @@ import ( ) func TestRankingTimeseriesGroupsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestRankingTimeseriesGroupsWithOptionalParams(t *testing.T) { } func TestRankingTopWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/rankingdomain_test.go b/radar/rankingdomain_test.go index 9b9c614428e..3127a1daa4f 100644 --- a/radar/rankingdomain_test.go +++ b/radar/rankingdomain_test.go @@ -15,7 +15,6 @@ import ( ) func TestRankingDomainGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/search_test.go b/radar/search_test.go index e6207ebc61e..0e558c9d8b9 100644 --- a/radar/search_test.go +++ b/radar/search_test.go @@ -15,7 +15,6 @@ import ( ) func TestSearchGlobalWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/trafficanomaly_test.go b/radar/trafficanomaly_test.go index a253eab6642..7232d856d94 100644 --- a/radar/trafficanomaly_test.go +++ b/radar/trafficanomaly_test.go @@ -16,7 +16,6 @@ import ( ) func TestTrafficAnomalyGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -30,7 +29,7 @@ func TestTrafficAnomalyGetWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Radar.TrafficAnomalies.Get(context.TODO(), radar.TrafficAnomalyGetParams{ - ASN: cloudflare.F(int64(0)), + ASN: cloudflare.F(int64(174)), DateEnd: cloudflare.F(time.Now()), DateRange: cloudflare.F(radar.TrafficAnomalyGetParamsDateRange7d), DateStart: cloudflare.F(time.Now()), diff --git a/radar/trafficanomalylocation_test.go b/radar/trafficanomalylocation_test.go index a9da4e69f17..22996497a25 100644 --- a/radar/trafficanomalylocation_test.go +++ b/radar/trafficanomalylocation_test.go @@ -16,7 +16,6 @@ import ( ) func TestTrafficAnomalyLocationGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/radar/verifiedbottop_test.go b/radar/verifiedbottop_test.go index 6b488e10e87..500107d64a7 100644 --- a/radar/verifiedbottop_test.go +++ b/radar/verifiedbottop_test.go @@ -16,7 +16,6 @@ import ( ) func TestVerifiedBotTopBotsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestVerifiedBotTopBotsWithOptionalParams(t *testing.T) { } func TestVerifiedBotTopCategoriesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rate_limits/aliases.go b/rate_limits/aliases.go index 11982770e43..78d0c762475 100644 --- a/rate_limits/aliases.go +++ b/rate_limits/aliases.go @@ -4,7 +4,7 @@ package rate_limits import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/rate_limits/ratelimit.go b/rate_limits/ratelimit.go index 4e8b4936a65..b874df9aa4b 100644 --- a/rate_limits/ratelimit.go +++ b/rate_limits/ratelimit.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -74,7 +74,7 @@ func (r *RateLimitService) ListAutoPaging(ctx context.Context, zoneIdentifier st } // Deletes an existing rate limit. -func (r *RateLimitService) Delete(ctx context.Context, zoneIdentifier string, id string, body RateLimitDeleteParams, opts ...option.RequestOption) (res *RateLimitDeleteResponse, err error) { +func (r *RateLimitService) Delete(ctx context.Context, zoneIdentifier string, id string, opts ...option.RequestOption) (res *RateLimitDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env RateLimitDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/rate_limits/%s", zoneIdentifier, id) @@ -599,14 +599,6 @@ func (r RateLimitListParams) URLQuery() (v url.Values) { }) } -type RateLimitDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r RateLimitDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type RateLimitDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/rate_limits/ratelimit_test.go b/rate_limits/ratelimit_test.go index 596ab863a01..735c0f3988e 100644 --- a/rate_limits/ratelimit_test.go +++ b/rate_limits/ratelimit_test.go @@ -15,7 +15,7 @@ import ( ) func TestRateLimitNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +45,6 @@ func TestRateLimitNew(t *testing.T) { } func TestRateLimitListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +75,6 @@ func TestRateLimitListWithOptionalParams(t *testing.T) { } func TestRateLimitDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -93,9 +91,6 @@ func TestRateLimitDelete(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "372e67954025e0ba6aaa6d586b9e0b59", - rate_limits.RateLimitDeleteParams{ - Body: map[string]interface{}{}, - }, ) if err != nil { var apierr *cloudflare.Error @@ -107,7 +102,7 @@ func TestRateLimitDelete(t *testing.T) { } func TestRateLimitEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -138,7 +133,6 @@ func TestRateLimitEdit(t *testing.T) { } func TestRateLimitGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rate_plans/aliases.go b/rate_plans/aliases.go index f4d52d12f0f..1c4f898e7f0 100644 --- a/rate_plans/aliases.go +++ b/rate_plans/aliases.go @@ -4,7 +4,7 @@ package rate_plans import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/rate_plans/rateplan.go b/rate_plans/rateplan.go index bf1c3922ad3..f55bf999728 100644 --- a/rate_plans/rateplan.go +++ b/rate_plans/rateplan.go @@ -8,10 +8,9 @@ import ( "net/http" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RatePlanService contains methods and other services that help with interacting @@ -144,28 +143,6 @@ func (r RatePlanFrequency) IsKnown() bool { return false } -type RatePlanParam struct { - // Array of available components values for the plan. - Components param.Field[[]RatePlanComponentParam] `json:"components"` - // The duration of the plan subscription. - Duration param.Field[float64] `json:"duration"` -} - -func (r RatePlanParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type RatePlanComponentParam struct { - // The default amount allocated. - Default param.Field[float64] `json:"default"` - // The unique component. - Name param.Field[RatePlanComponentsName] `json:"name"` -} - -func (r RatePlanComponentParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type RatePlanGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/rate_plans/rateplan_test.go b/rate_plans/rateplan_test.go index fb0e730d465..4dc67ab96b5 100644 --- a/rate_plans/rateplan_test.go +++ b/rate_plans/rateplan_test.go @@ -14,7 +14,6 @@ import ( ) func TestRatePlanGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/registrar/aliases.go b/registrar/aliases.go index a79a9f2a4fb..98eb12de4e7 100644 --- a/registrar/aliases.go +++ b/registrar/aliases.go @@ -4,7 +4,7 @@ package registrar import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/registrar/domain.go b/registrar/domain.go index ee7071b636c..c811196825e 100644 --- a/registrar/domain.go +++ b/registrar/domain.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -54,7 +54,7 @@ func (r *DomainService) List(ctx context.Context, query DomainListParams, opts . opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/registrar/domains", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/registrar/domain_test.go b/registrar/domain_test.go index b1576ded046..538249c6729 100644 --- a/registrar/domain_test.go +++ b/registrar/domain_test.go @@ -15,7 +15,6 @@ import ( ) func TestDomainUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -48,7 +47,6 @@ func TestDomainUpdateWithOptionalParams(t *testing.T) { } func TestDomainList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -74,7 +72,6 @@ func TestDomainList(t *testing.T) { } func TestDomainGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/request_tracers/aliases.go b/request_tracers/aliases.go index a0a5811075c..33837b91327 100644 --- a/request_tracers/aliases.go +++ b/request_tracers/aliases.go @@ -4,7 +4,7 @@ package request_tracers import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/request_tracers/trace.go b/request_tracers/trace.go index f65644276f3..a69014b7055 100644 --- a/request_tracers/trace.go +++ b/request_tracers/trace.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // TraceService contains methods and other services that help with interacting with diff --git a/request_tracers/trace_test.go b/request_tracers/trace_test.go index 26fccf31813..d982759fb6e 100644 --- a/request_tracers/trace_test.go +++ b/request_tracers/trace_test.go @@ -15,7 +15,6 @@ import ( ) func TestTraceNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rules/aliases.go b/rules/aliases.go index 70443fcf6e6..64d53c4a13d 100644 --- a/rules/aliases.go +++ b/rules/aliases.go @@ -4,7 +4,7 @@ package rules import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/rules/list.go b/rules/list.go index 4310bf410bb..0f097ab10eb 100644 --- a/rules/list.go +++ b/rules/list.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ListService contains methods and other services that help with interacting with @@ -68,7 +68,7 @@ func (r *ListService) List(ctx context.Context, query ListListParams, opts ...op opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/rules/lists", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -86,10 +86,10 @@ func (r *ListService) ListAutoPaging(ctx context.Context, query ListListParams, } // Deletes a specific list and all its items. -func (r *ListService) Delete(ctx context.Context, listID string, params ListDeleteParams, opts ...option.RequestOption) (res *ListDeleteResponse, err error) { +func (r *ListService) Delete(ctx context.Context, listID string, body ListDeleteParams, opts ...option.RequestOption) (res *ListDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env ListDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/rules/lists/%s", params.AccountID, listID) + path := fmt.Sprintf("accounts/%s/rules/lists/%s", body.AccountID, listID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -442,11 +442,6 @@ type ListListParams struct { type ListDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r ListDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type ListDeleteResponseEnvelope struct { diff --git a/rules/list_test.go b/rules/list_test.go index 9273ae14fba..99838f9ccbb 100644 --- a/rules/list_test.go +++ b/rules/list_test.go @@ -15,7 +15,7 @@ import ( ) func TestListNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +44,7 @@ func TestListNewWithOptionalParams(t *testing.T) { } func TestListUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -75,7 +75,6 @@ func TestListUpdateWithOptionalParams(t *testing.T) { } func TestListList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -101,7 +100,6 @@ func TestListList(t *testing.T) { } func TestListDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -119,7 +117,6 @@ func TestListDelete(t *testing.T) { "2c0fc9fa937b11eaa1b71c4d701ab86e", rules.ListDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -132,7 +129,7 @@ func TestListDelete(t *testing.T) { } func TestListGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rules/listbulkoperation.go b/rules/listbulkoperation.go index 4a65fdcaa69..1b5ecd57fb8 100644 --- a/rules/listbulkoperation.go +++ b/rules/listbulkoperation.go @@ -9,8 +9,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ListBulkOperationService contains methods and other services that help with diff --git a/rules/listbulkoperation_test.go b/rules/listbulkoperation_test.go index 2eb7c8be3c1..1fce56f617e 100644 --- a/rules/listbulkoperation_test.go +++ b/rules/listbulkoperation_test.go @@ -14,7 +14,6 @@ import ( ) func TestListBulkOperationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rules/listitem.go b/rules/listitem.go index c7edaddf411..1731ee4b9b7 100644 --- a/rules/listitem.go +++ b/rules/listitem.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -99,11 +99,11 @@ func (r *ListItemService) ListAutoPaging(ctx context.Context, listID string, par // This operation is asynchronous. To get current the operation status, invoke the // [Get bulk operation status](/operations/lists-get-bulk-operation-status) // endpoint with the returned `operation_id`. -func (r *ListItemService) Delete(ctx context.Context, listID string, params ListItemDeleteParams, opts ...option.RequestOption) (res *ListItemDeleteResponse, err error) { +func (r *ListItemService) Delete(ctx context.Context, listID string, body ListItemDeleteParams, opts ...option.RequestOption) (res *ListItemDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env ListItemDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/rules/lists/%s/items", params.AccountID, listID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + path := fmt.Sprintf("accounts/%s/rules/lists/%s/items", body.AccountID, listID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return } @@ -146,27 +146,6 @@ func (r listCursorJSON) RawJSON() string { return r.raw } -type ListItem struct { - // The unique operation ID of the asynchronous action. - OperationID string `json:"operation_id"` - JSON listItemJSON `json:"-"` -} - -// listItemJSON contains the JSON metadata for the struct [ListItem] -type listItemJSON struct { - OperationID apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *ListItem) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r listItemJSON) RawJSON() string { - return r.raw -} - type ListItemNewResponse struct { // The unique operation ID of the asynchronous action. OperationID string `json:"operation_id"` @@ -438,21 +417,7 @@ func (r ListItemListParams) URLQuery() (v url.Values) { type ListItemDeleteParams struct { // Identifier - AccountID param.Field[string] `path:"account_id,required"` - Items param.Field[[]ListItemDeleteParamsItem] `json:"items"` -} - -func (r ListItemDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -type ListItemDeleteParamsItem struct { - // The unique ID of the item in the List. - ID param.Field[string] `json:"id"` -} - -func (r ListItemDeleteParamsItem) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) + AccountID param.Field[string] `path:"account_id,required"` } type ListItemDeleteResponseEnvelope struct { diff --git a/rules/listitem_test.go b/rules/listitem_test.go index f7e0ccdb4d4..b2989c2fbe7 100644 --- a/rules/listitem_test.go +++ b/rules/listitem_test.go @@ -15,7 +15,6 @@ import ( ) func TestListItemNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -94,7 +93,6 @@ func TestListItemNew(t *testing.T) { } func TestListItemUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -173,7 +171,6 @@ func TestListItemUpdate(t *testing.T) { } func TestListItemListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -205,8 +202,7 @@ func TestListItemListWithOptionalParams(t *testing.T) { } } -func TestListItemDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") +func TestListItemDelete(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -224,9 +220,6 @@ func TestListItemDeleteWithOptionalParams(t *testing.T) { "2c0fc9fa937b11eaa1b71c4d701ab86e", rules.ListItemDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Items: cloudflare.F([]rules.ListItemDeleteParamsItem{{ - ID: cloudflare.F("34b12448945f11eaa1b71c4d701ab86e"), - }}), }, ) if err != nil { @@ -239,7 +232,6 @@ func TestListItemDeleteWithOptionalParams(t *testing.T) { } func TestListItemGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rulesets/aliases.go b/rulesets/aliases.go index c382a432bab..d926a6da500 100644 --- a/rulesets/aliases.go +++ b/rulesets/aliases.go @@ -4,7 +4,7 @@ package rulesets import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/rulesets/phase.go b/rulesets/phase.go index 832f27b8bd8..a679b30ee62 100644 --- a/rulesets/phase.go +++ b/rulesets/phase.go @@ -36,7 +36,7 @@ func NewPhaseService(opts ...option.RequestOption) (r *PhaseService) { } // Updates an account or zone entry point ruleset, creating a new version. -func (r *PhaseService) Update(ctx context.Context, rulesetPhase PhaseUpdateParamsRulesetPhase, params PhaseUpdateParams, opts ...option.RequestOption) (res *PhaseUpdateResponse, err error) { +func (r *PhaseService) Update(ctx context.Context, rulesetPhase Phase, params PhaseUpdateParams, opts ...option.RequestOption) (res *PhaseUpdateResponse, err error) { opts = append(r.Options[:], opts...) var env PhaseUpdateResponseEnvelope var accountOrZone string @@ -59,7 +59,7 @@ func (r *PhaseService) Update(ctx context.Context, rulesetPhase PhaseUpdateParam // Fetches the latest version of the account or zone entry point ruleset for a // given phase. -func (r *PhaseService) Get(ctx context.Context, rulesetPhase PhaseGetParamsRulesetPhase, query PhaseGetParams, opts ...option.RequestOption) (res *PhaseGetResponse, err error) { +func (r *PhaseService) Get(ctx context.Context, rulesetPhase Phase, query PhaseGetParams, opts ...option.RequestOption) (res *PhaseGetResponse, err error) { opts = append(r.Options[:], opts...) var env PhaseGetResponseEnvelope var accountOrZone string @@ -85,13 +85,13 @@ type PhaseUpdateResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind PhaseUpdateResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase PhaseUpdateResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []PhaseUpdateResponseRule `json:"rules,required"` // The version of the ruleset. @@ -124,61 +124,6 @@ func (r phaseUpdateResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type PhaseUpdateResponseKind string - -const ( - PhaseUpdateResponseKindManaged PhaseUpdateResponseKind = "managed" - PhaseUpdateResponseKindCustom PhaseUpdateResponseKind = "custom" - PhaseUpdateResponseKindRoot PhaseUpdateResponseKind = "root" - PhaseUpdateResponseKindZone PhaseUpdateResponseKind = "zone" -) - -func (r PhaseUpdateResponseKind) IsKnown() bool { - switch r { - case PhaseUpdateResponseKindManaged, PhaseUpdateResponseKindCustom, PhaseUpdateResponseKindRoot, PhaseUpdateResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type PhaseUpdateResponsePhase string - -const ( - PhaseUpdateResponsePhaseDDoSL4 PhaseUpdateResponsePhase = "ddos_l4" - PhaseUpdateResponsePhaseDDoSL7 PhaseUpdateResponsePhase = "ddos_l7" - PhaseUpdateResponsePhaseHTTPConfigSettings PhaseUpdateResponsePhase = "http_config_settings" - PhaseUpdateResponsePhaseHTTPCustomErrors PhaseUpdateResponsePhase = "http_custom_errors" - PhaseUpdateResponsePhaseHTTPLogCustomFields PhaseUpdateResponsePhase = "http_log_custom_fields" - PhaseUpdateResponsePhaseHTTPRatelimit PhaseUpdateResponsePhase = "http_ratelimit" - PhaseUpdateResponsePhaseHTTPRequestCacheSettings PhaseUpdateResponsePhase = "http_request_cache_settings" - PhaseUpdateResponsePhaseHTTPRequestDynamicRedirect PhaseUpdateResponsePhase = "http_request_dynamic_redirect" - PhaseUpdateResponsePhaseHTTPRequestFirewallCustom PhaseUpdateResponsePhase = "http_request_firewall_custom" - PhaseUpdateResponsePhaseHTTPRequestFirewallManaged PhaseUpdateResponsePhase = "http_request_firewall_managed" - PhaseUpdateResponsePhaseHTTPRequestLateTransform PhaseUpdateResponsePhase = "http_request_late_transform" - PhaseUpdateResponsePhaseHTTPRequestOrigin PhaseUpdateResponsePhase = "http_request_origin" - PhaseUpdateResponsePhaseHTTPRequestRedirect PhaseUpdateResponsePhase = "http_request_redirect" - PhaseUpdateResponsePhaseHTTPRequestSanitize PhaseUpdateResponsePhase = "http_request_sanitize" - PhaseUpdateResponsePhaseHTTPRequestSBFM PhaseUpdateResponsePhase = "http_request_sbfm" - PhaseUpdateResponsePhaseHTTPRequestSelectConfiguration PhaseUpdateResponsePhase = "http_request_select_configuration" - PhaseUpdateResponsePhaseHTTPRequestTransform PhaseUpdateResponsePhase = "http_request_transform" - PhaseUpdateResponsePhaseHTTPResponseCompression PhaseUpdateResponsePhase = "http_response_compression" - PhaseUpdateResponsePhaseHTTPResponseFirewallManaged PhaseUpdateResponsePhase = "http_response_firewall_managed" - PhaseUpdateResponsePhaseHTTPResponseHeadersTransform PhaseUpdateResponsePhase = "http_response_headers_transform" - PhaseUpdateResponsePhaseMagicTransit PhaseUpdateResponsePhase = "magic_transit" - PhaseUpdateResponsePhaseMagicTransitIDsManaged PhaseUpdateResponsePhase = "magic_transit_ids_managed" - PhaseUpdateResponsePhaseMagicTransitManaged PhaseUpdateResponsePhase = "magic_transit_managed" -) - -func (r PhaseUpdateResponsePhase) IsKnown() bool { - switch r { - case PhaseUpdateResponsePhaseDDoSL4, PhaseUpdateResponsePhaseDDoSL7, PhaseUpdateResponsePhaseHTTPConfigSettings, PhaseUpdateResponsePhaseHTTPCustomErrors, PhaseUpdateResponsePhaseHTTPLogCustomFields, PhaseUpdateResponsePhaseHTTPRatelimit, PhaseUpdateResponsePhaseHTTPRequestCacheSettings, PhaseUpdateResponsePhaseHTTPRequestDynamicRedirect, PhaseUpdateResponsePhaseHTTPRequestFirewallCustom, PhaseUpdateResponsePhaseHTTPRequestFirewallManaged, PhaseUpdateResponsePhaseHTTPRequestLateTransform, PhaseUpdateResponsePhaseHTTPRequestOrigin, PhaseUpdateResponsePhaseHTTPRequestRedirect, PhaseUpdateResponsePhaseHTTPRequestSanitize, PhaseUpdateResponsePhaseHTTPRequestSBFM, PhaseUpdateResponsePhaseHTTPRequestSelectConfiguration, PhaseUpdateResponsePhaseHTTPRequestTransform, PhaseUpdateResponsePhaseHTTPResponseCompression, PhaseUpdateResponsePhaseHTTPResponseFirewallManaged, PhaseUpdateResponsePhaseHTTPResponseHeadersTransform, PhaseUpdateResponsePhaseMagicTransit, PhaseUpdateResponsePhaseMagicTransitIDsManaged, PhaseUpdateResponsePhaseMagicTransitManaged: - return true - } - return false -} - type PhaseUpdateResponseRule struct { // The action to perform when the rule matches. Action PhaseUpdateResponseRulesAction `json:"action"` @@ -364,13 +309,13 @@ type PhaseGetResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind PhaseGetResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase PhaseGetResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []PhaseGetResponseRule `json:"rules,required"` // The version of the ruleset. @@ -403,61 +348,6 @@ func (r phaseGetResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type PhaseGetResponseKind string - -const ( - PhaseGetResponseKindManaged PhaseGetResponseKind = "managed" - PhaseGetResponseKindCustom PhaseGetResponseKind = "custom" - PhaseGetResponseKindRoot PhaseGetResponseKind = "root" - PhaseGetResponseKindZone PhaseGetResponseKind = "zone" -) - -func (r PhaseGetResponseKind) IsKnown() bool { - switch r { - case PhaseGetResponseKindManaged, PhaseGetResponseKindCustom, PhaseGetResponseKindRoot, PhaseGetResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type PhaseGetResponsePhase string - -const ( - PhaseGetResponsePhaseDDoSL4 PhaseGetResponsePhase = "ddos_l4" - PhaseGetResponsePhaseDDoSL7 PhaseGetResponsePhase = "ddos_l7" - PhaseGetResponsePhaseHTTPConfigSettings PhaseGetResponsePhase = "http_config_settings" - PhaseGetResponsePhaseHTTPCustomErrors PhaseGetResponsePhase = "http_custom_errors" - PhaseGetResponsePhaseHTTPLogCustomFields PhaseGetResponsePhase = "http_log_custom_fields" - PhaseGetResponsePhaseHTTPRatelimit PhaseGetResponsePhase = "http_ratelimit" - PhaseGetResponsePhaseHTTPRequestCacheSettings PhaseGetResponsePhase = "http_request_cache_settings" - PhaseGetResponsePhaseHTTPRequestDynamicRedirect PhaseGetResponsePhase = "http_request_dynamic_redirect" - PhaseGetResponsePhaseHTTPRequestFirewallCustom PhaseGetResponsePhase = "http_request_firewall_custom" - PhaseGetResponsePhaseHTTPRequestFirewallManaged PhaseGetResponsePhase = "http_request_firewall_managed" - PhaseGetResponsePhaseHTTPRequestLateTransform PhaseGetResponsePhase = "http_request_late_transform" - PhaseGetResponsePhaseHTTPRequestOrigin PhaseGetResponsePhase = "http_request_origin" - PhaseGetResponsePhaseHTTPRequestRedirect PhaseGetResponsePhase = "http_request_redirect" - PhaseGetResponsePhaseHTTPRequestSanitize PhaseGetResponsePhase = "http_request_sanitize" - PhaseGetResponsePhaseHTTPRequestSBFM PhaseGetResponsePhase = "http_request_sbfm" - PhaseGetResponsePhaseHTTPRequestSelectConfiguration PhaseGetResponsePhase = "http_request_select_configuration" - PhaseGetResponsePhaseHTTPRequestTransform PhaseGetResponsePhase = "http_request_transform" - PhaseGetResponsePhaseHTTPResponseCompression PhaseGetResponsePhase = "http_response_compression" - PhaseGetResponsePhaseHTTPResponseFirewallManaged PhaseGetResponsePhase = "http_response_firewall_managed" - PhaseGetResponsePhaseHTTPResponseHeadersTransform PhaseGetResponsePhase = "http_response_headers_transform" - PhaseGetResponsePhaseMagicTransit PhaseGetResponsePhase = "magic_transit" - PhaseGetResponsePhaseMagicTransitIDsManaged PhaseGetResponsePhase = "magic_transit_ids_managed" - PhaseGetResponsePhaseMagicTransitManaged PhaseGetResponsePhase = "magic_transit_managed" -) - -func (r PhaseGetResponsePhase) IsKnown() bool { - switch r { - case PhaseGetResponsePhaseDDoSL4, PhaseGetResponsePhaseDDoSL7, PhaseGetResponsePhaseHTTPConfigSettings, PhaseGetResponsePhaseHTTPCustomErrors, PhaseGetResponsePhaseHTTPLogCustomFields, PhaseGetResponsePhaseHTTPRatelimit, PhaseGetResponsePhaseHTTPRequestCacheSettings, PhaseGetResponsePhaseHTTPRequestDynamicRedirect, PhaseGetResponsePhaseHTTPRequestFirewallCustom, PhaseGetResponsePhaseHTTPRequestFirewallManaged, PhaseGetResponsePhaseHTTPRequestLateTransform, PhaseGetResponsePhaseHTTPRequestOrigin, PhaseGetResponsePhaseHTTPRequestRedirect, PhaseGetResponsePhaseHTTPRequestSanitize, PhaseGetResponsePhaseHTTPRequestSBFM, PhaseGetResponsePhaseHTTPRequestSelectConfiguration, PhaseGetResponsePhaseHTTPRequestTransform, PhaseGetResponsePhaseHTTPResponseCompression, PhaseGetResponsePhaseHTTPResponseFirewallManaged, PhaseGetResponsePhaseHTTPResponseHeadersTransform, PhaseGetResponsePhaseMagicTransit, PhaseGetResponsePhaseMagicTransitIDsManaged, PhaseGetResponsePhaseMagicTransitManaged: - return true - } - return false -} - type PhaseGetResponseRule struct { // The action to perform when the rule matches. Action PhaseGetResponseRulesAction `json:"action"` @@ -648,54 +538,17 @@ type PhaseUpdateParams struct { // An informative description of the ruleset. Description param.Field[string] `json:"description"` // The kind of the ruleset. - Kind param.Field[PhaseUpdateParamsKind] `json:"kind"` + Kind param.Field[Kind] `json:"kind"` // The human-readable name of the ruleset. Name param.Field[string] `json:"name"` // The phase of the ruleset. - Phase param.Field[PhaseUpdateParamsPhase] `json:"phase"` + Phase param.Field[Phase] `json:"phase"` } func (r PhaseUpdateParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The phase of the ruleset. -type PhaseUpdateParamsRulesetPhase string - -const ( - PhaseUpdateParamsRulesetPhaseDDoSL4 PhaseUpdateParamsRulesetPhase = "ddos_l4" - PhaseUpdateParamsRulesetPhaseDDoSL7 PhaseUpdateParamsRulesetPhase = "ddos_l7" - PhaseUpdateParamsRulesetPhaseHTTPConfigSettings PhaseUpdateParamsRulesetPhase = "http_config_settings" - PhaseUpdateParamsRulesetPhaseHTTPCustomErrors PhaseUpdateParamsRulesetPhase = "http_custom_errors" - PhaseUpdateParamsRulesetPhaseHTTPLogCustomFields PhaseUpdateParamsRulesetPhase = "http_log_custom_fields" - PhaseUpdateParamsRulesetPhaseHTTPRatelimit PhaseUpdateParamsRulesetPhase = "http_ratelimit" - PhaseUpdateParamsRulesetPhaseHTTPRequestCacheSettings PhaseUpdateParamsRulesetPhase = "http_request_cache_settings" - PhaseUpdateParamsRulesetPhaseHTTPRequestDynamicRedirect PhaseUpdateParamsRulesetPhase = "http_request_dynamic_redirect" - PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallCustom PhaseUpdateParamsRulesetPhase = "http_request_firewall_custom" - PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallManaged PhaseUpdateParamsRulesetPhase = "http_request_firewall_managed" - PhaseUpdateParamsRulesetPhaseHTTPRequestLateTransform PhaseUpdateParamsRulesetPhase = "http_request_late_transform" - PhaseUpdateParamsRulesetPhaseHTTPRequestOrigin PhaseUpdateParamsRulesetPhase = "http_request_origin" - PhaseUpdateParamsRulesetPhaseHTTPRequestRedirect PhaseUpdateParamsRulesetPhase = "http_request_redirect" - PhaseUpdateParamsRulesetPhaseHTTPRequestSanitize PhaseUpdateParamsRulesetPhase = "http_request_sanitize" - PhaseUpdateParamsRulesetPhaseHTTPRequestSBFM PhaseUpdateParamsRulesetPhase = "http_request_sbfm" - PhaseUpdateParamsRulesetPhaseHTTPRequestSelectConfiguration PhaseUpdateParamsRulesetPhase = "http_request_select_configuration" - PhaseUpdateParamsRulesetPhaseHTTPRequestTransform PhaseUpdateParamsRulesetPhase = "http_request_transform" - PhaseUpdateParamsRulesetPhaseHTTPResponseCompression PhaseUpdateParamsRulesetPhase = "http_response_compression" - PhaseUpdateParamsRulesetPhaseHTTPResponseFirewallManaged PhaseUpdateParamsRulesetPhase = "http_response_firewall_managed" - PhaseUpdateParamsRulesetPhaseHTTPResponseHeadersTransform PhaseUpdateParamsRulesetPhase = "http_response_headers_transform" - PhaseUpdateParamsRulesetPhaseMagicTransit PhaseUpdateParamsRulesetPhase = "magic_transit" - PhaseUpdateParamsRulesetPhaseMagicTransitIDsManaged PhaseUpdateParamsRulesetPhase = "magic_transit_ids_managed" - PhaseUpdateParamsRulesetPhaseMagicTransitManaged PhaseUpdateParamsRulesetPhase = "magic_transit_managed" -) - -func (r PhaseUpdateParamsRulesetPhase) IsKnown() bool { - switch r { - case PhaseUpdateParamsRulesetPhaseDDoSL4, PhaseUpdateParamsRulesetPhaseDDoSL7, PhaseUpdateParamsRulesetPhaseHTTPConfigSettings, PhaseUpdateParamsRulesetPhaseHTTPCustomErrors, PhaseUpdateParamsRulesetPhaseHTTPLogCustomFields, PhaseUpdateParamsRulesetPhaseHTTPRatelimit, PhaseUpdateParamsRulesetPhaseHTTPRequestCacheSettings, PhaseUpdateParamsRulesetPhaseHTTPRequestDynamicRedirect, PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallCustom, PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallManaged, PhaseUpdateParamsRulesetPhaseHTTPRequestLateTransform, PhaseUpdateParamsRulesetPhaseHTTPRequestOrigin, PhaseUpdateParamsRulesetPhaseHTTPRequestRedirect, PhaseUpdateParamsRulesetPhaseHTTPRequestSanitize, PhaseUpdateParamsRulesetPhaseHTTPRequestSBFM, PhaseUpdateParamsRulesetPhaseHTTPRequestSelectConfiguration, PhaseUpdateParamsRulesetPhaseHTTPRequestTransform, PhaseUpdateParamsRulesetPhaseHTTPResponseCompression, PhaseUpdateParamsRulesetPhaseHTTPResponseFirewallManaged, PhaseUpdateParamsRulesetPhaseHTTPResponseHeadersTransform, PhaseUpdateParamsRulesetPhaseMagicTransit, PhaseUpdateParamsRulesetPhaseMagicTransitIDsManaged, PhaseUpdateParamsRulesetPhaseMagicTransitManaged: - return true - } - return false -} - type PhaseUpdateParamsRule struct { // The action to perform when the rule matches. Action param.Field[PhaseUpdateParamsRulesAction] `json:"action"` @@ -762,61 +615,6 @@ func (r PhaseUpdateParamsRulesAction) IsKnown() bool { return false } -// The kind of the ruleset. -type PhaseUpdateParamsKind string - -const ( - PhaseUpdateParamsKindManaged PhaseUpdateParamsKind = "managed" - PhaseUpdateParamsKindCustom PhaseUpdateParamsKind = "custom" - PhaseUpdateParamsKindRoot PhaseUpdateParamsKind = "root" - PhaseUpdateParamsKindZone PhaseUpdateParamsKind = "zone" -) - -func (r PhaseUpdateParamsKind) IsKnown() bool { - switch r { - case PhaseUpdateParamsKindManaged, PhaseUpdateParamsKindCustom, PhaseUpdateParamsKindRoot, PhaseUpdateParamsKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type PhaseUpdateParamsPhase string - -const ( - PhaseUpdateParamsPhaseDDoSL4 PhaseUpdateParamsPhase = "ddos_l4" - PhaseUpdateParamsPhaseDDoSL7 PhaseUpdateParamsPhase = "ddos_l7" - PhaseUpdateParamsPhaseHTTPConfigSettings PhaseUpdateParamsPhase = "http_config_settings" - PhaseUpdateParamsPhaseHTTPCustomErrors PhaseUpdateParamsPhase = "http_custom_errors" - PhaseUpdateParamsPhaseHTTPLogCustomFields PhaseUpdateParamsPhase = "http_log_custom_fields" - PhaseUpdateParamsPhaseHTTPRatelimit PhaseUpdateParamsPhase = "http_ratelimit" - PhaseUpdateParamsPhaseHTTPRequestCacheSettings PhaseUpdateParamsPhase = "http_request_cache_settings" - PhaseUpdateParamsPhaseHTTPRequestDynamicRedirect PhaseUpdateParamsPhase = "http_request_dynamic_redirect" - PhaseUpdateParamsPhaseHTTPRequestFirewallCustom PhaseUpdateParamsPhase = "http_request_firewall_custom" - PhaseUpdateParamsPhaseHTTPRequestFirewallManaged PhaseUpdateParamsPhase = "http_request_firewall_managed" - PhaseUpdateParamsPhaseHTTPRequestLateTransform PhaseUpdateParamsPhase = "http_request_late_transform" - PhaseUpdateParamsPhaseHTTPRequestOrigin PhaseUpdateParamsPhase = "http_request_origin" - PhaseUpdateParamsPhaseHTTPRequestRedirect PhaseUpdateParamsPhase = "http_request_redirect" - PhaseUpdateParamsPhaseHTTPRequestSanitize PhaseUpdateParamsPhase = "http_request_sanitize" - PhaseUpdateParamsPhaseHTTPRequestSBFM PhaseUpdateParamsPhase = "http_request_sbfm" - PhaseUpdateParamsPhaseHTTPRequestSelectConfiguration PhaseUpdateParamsPhase = "http_request_select_configuration" - PhaseUpdateParamsPhaseHTTPRequestTransform PhaseUpdateParamsPhase = "http_request_transform" - PhaseUpdateParamsPhaseHTTPResponseCompression PhaseUpdateParamsPhase = "http_response_compression" - PhaseUpdateParamsPhaseHTTPResponseFirewallManaged PhaseUpdateParamsPhase = "http_response_firewall_managed" - PhaseUpdateParamsPhaseHTTPResponseHeadersTransform PhaseUpdateParamsPhase = "http_response_headers_transform" - PhaseUpdateParamsPhaseMagicTransit PhaseUpdateParamsPhase = "magic_transit" - PhaseUpdateParamsPhaseMagicTransitIDsManaged PhaseUpdateParamsPhase = "magic_transit_ids_managed" - PhaseUpdateParamsPhaseMagicTransitManaged PhaseUpdateParamsPhase = "magic_transit_managed" -) - -func (r PhaseUpdateParamsPhase) IsKnown() bool { - switch r { - case PhaseUpdateParamsPhaseDDoSL4, PhaseUpdateParamsPhaseDDoSL7, PhaseUpdateParamsPhaseHTTPConfigSettings, PhaseUpdateParamsPhaseHTTPCustomErrors, PhaseUpdateParamsPhaseHTTPLogCustomFields, PhaseUpdateParamsPhaseHTTPRatelimit, PhaseUpdateParamsPhaseHTTPRequestCacheSettings, PhaseUpdateParamsPhaseHTTPRequestDynamicRedirect, PhaseUpdateParamsPhaseHTTPRequestFirewallCustom, PhaseUpdateParamsPhaseHTTPRequestFirewallManaged, PhaseUpdateParamsPhaseHTTPRequestLateTransform, PhaseUpdateParamsPhaseHTTPRequestOrigin, PhaseUpdateParamsPhaseHTTPRequestRedirect, PhaseUpdateParamsPhaseHTTPRequestSanitize, PhaseUpdateParamsPhaseHTTPRequestSBFM, PhaseUpdateParamsPhaseHTTPRequestSelectConfiguration, PhaseUpdateParamsPhaseHTTPRequestTransform, PhaseUpdateParamsPhaseHTTPResponseCompression, PhaseUpdateParamsPhaseHTTPResponseFirewallManaged, PhaseUpdateParamsPhaseHTTPResponseHeadersTransform, PhaseUpdateParamsPhaseMagicTransit, PhaseUpdateParamsPhaseMagicTransitIDsManaged, PhaseUpdateParamsPhaseMagicTransitManaged: - return true - } - return false -} - // A response object. type PhaseUpdateResponseEnvelope struct { // A list of error messages. @@ -975,43 +773,6 @@ type PhaseGetParams struct { ZoneID param.Field[string] `path:"zone_id"` } -// The phase of the ruleset. -type PhaseGetParamsRulesetPhase string - -const ( - PhaseGetParamsRulesetPhaseDDoSL4 PhaseGetParamsRulesetPhase = "ddos_l4" - PhaseGetParamsRulesetPhaseDDoSL7 PhaseGetParamsRulesetPhase = "ddos_l7" - PhaseGetParamsRulesetPhaseHTTPConfigSettings PhaseGetParamsRulesetPhase = "http_config_settings" - PhaseGetParamsRulesetPhaseHTTPCustomErrors PhaseGetParamsRulesetPhase = "http_custom_errors" - PhaseGetParamsRulesetPhaseHTTPLogCustomFields PhaseGetParamsRulesetPhase = "http_log_custom_fields" - PhaseGetParamsRulesetPhaseHTTPRatelimit PhaseGetParamsRulesetPhase = "http_ratelimit" - PhaseGetParamsRulesetPhaseHTTPRequestCacheSettings PhaseGetParamsRulesetPhase = "http_request_cache_settings" - PhaseGetParamsRulesetPhaseHTTPRequestDynamicRedirect PhaseGetParamsRulesetPhase = "http_request_dynamic_redirect" - PhaseGetParamsRulesetPhaseHTTPRequestFirewallCustom PhaseGetParamsRulesetPhase = "http_request_firewall_custom" - PhaseGetParamsRulesetPhaseHTTPRequestFirewallManaged PhaseGetParamsRulesetPhase = "http_request_firewall_managed" - PhaseGetParamsRulesetPhaseHTTPRequestLateTransform PhaseGetParamsRulesetPhase = "http_request_late_transform" - PhaseGetParamsRulesetPhaseHTTPRequestOrigin PhaseGetParamsRulesetPhase = "http_request_origin" - PhaseGetParamsRulesetPhaseHTTPRequestRedirect PhaseGetParamsRulesetPhase = "http_request_redirect" - PhaseGetParamsRulesetPhaseHTTPRequestSanitize PhaseGetParamsRulesetPhase = "http_request_sanitize" - PhaseGetParamsRulesetPhaseHTTPRequestSBFM PhaseGetParamsRulesetPhase = "http_request_sbfm" - PhaseGetParamsRulesetPhaseHTTPRequestSelectConfiguration PhaseGetParamsRulesetPhase = "http_request_select_configuration" - PhaseGetParamsRulesetPhaseHTTPRequestTransform PhaseGetParamsRulesetPhase = "http_request_transform" - PhaseGetParamsRulesetPhaseHTTPResponseCompression PhaseGetParamsRulesetPhase = "http_response_compression" - PhaseGetParamsRulesetPhaseHTTPResponseFirewallManaged PhaseGetParamsRulesetPhase = "http_response_firewall_managed" - PhaseGetParamsRulesetPhaseHTTPResponseHeadersTransform PhaseGetParamsRulesetPhase = "http_response_headers_transform" - PhaseGetParamsRulesetPhaseMagicTransit PhaseGetParamsRulesetPhase = "magic_transit" - PhaseGetParamsRulesetPhaseMagicTransitIDsManaged PhaseGetParamsRulesetPhase = "magic_transit_ids_managed" - PhaseGetParamsRulesetPhaseMagicTransitManaged PhaseGetParamsRulesetPhase = "magic_transit_managed" -) - -func (r PhaseGetParamsRulesetPhase) IsKnown() bool { - switch r { - case PhaseGetParamsRulesetPhaseDDoSL4, PhaseGetParamsRulesetPhaseDDoSL7, PhaseGetParamsRulesetPhaseHTTPConfigSettings, PhaseGetParamsRulesetPhaseHTTPCustomErrors, PhaseGetParamsRulesetPhaseHTTPLogCustomFields, PhaseGetParamsRulesetPhaseHTTPRatelimit, PhaseGetParamsRulesetPhaseHTTPRequestCacheSettings, PhaseGetParamsRulesetPhaseHTTPRequestDynamicRedirect, PhaseGetParamsRulesetPhaseHTTPRequestFirewallCustom, PhaseGetParamsRulesetPhaseHTTPRequestFirewallManaged, PhaseGetParamsRulesetPhaseHTTPRequestLateTransform, PhaseGetParamsRulesetPhaseHTTPRequestOrigin, PhaseGetParamsRulesetPhaseHTTPRequestRedirect, PhaseGetParamsRulesetPhaseHTTPRequestSanitize, PhaseGetParamsRulesetPhaseHTTPRequestSBFM, PhaseGetParamsRulesetPhaseHTTPRequestSelectConfiguration, PhaseGetParamsRulesetPhaseHTTPRequestTransform, PhaseGetParamsRulesetPhaseHTTPResponseCompression, PhaseGetParamsRulesetPhaseHTTPResponseFirewallManaged, PhaseGetParamsRulesetPhaseHTTPResponseHeadersTransform, PhaseGetParamsRulesetPhaseMagicTransit, PhaseGetParamsRulesetPhaseMagicTransitIDsManaged, PhaseGetParamsRulesetPhaseMagicTransitManaged: - return true - } - return false -} - // A response object. type PhaseGetResponseEnvelope struct { // A list of error messages. diff --git a/rulesets/phase_test.go b/rulesets/phase_test.go index 8a722986c54..df14e32e1d3 100644 --- a/rulesets/phase_test.go +++ b/rulesets/phase_test.go @@ -15,7 +15,7 @@ import ( ) func TestPhaseUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -30,7 +30,7 @@ func TestPhaseUpdateWithOptionalParams(t *testing.T) { ) _, err := client.Rulesets.Phases.Update( context.TODO(), - rulesets.PhaseUpdateParamsRulesetPhaseHTTPRequestFirewallCustom, + rulesets.PhaseHTTPRequestFirewallCustom, rulesets.PhaseUpdateParams{ Rules: cloudflare.F([]rulesets.PhaseUpdateParamsRuleUnion{rulesets.BlockRuleParam{ Action: cloudflare.F(rulesets.BlockRuleActionBlock), @@ -87,9 +87,9 @@ func TestPhaseUpdateWithOptionalParams(t *testing.T) { AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), Description: cloudflare.F("My ruleset to execute managed rulesets"), - Kind: cloudflare.F(rulesets.PhaseUpdateParamsKindRoot), + Kind: cloudflare.F(rulesets.KindRoot), Name: cloudflare.F("My ruleset"), - Phase: cloudflare.F(rulesets.PhaseUpdateParamsPhaseHTTPRequestFirewallCustom), + Phase: cloudflare.F(rulesets.PhaseHTTPRequestFirewallCustom), }, ) if err != nil { @@ -102,7 +102,7 @@ func TestPhaseUpdateWithOptionalParams(t *testing.T) { } func TestPhaseGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -117,7 +117,7 @@ func TestPhaseGetWithOptionalParams(t *testing.T) { ) _, err := client.Rulesets.Phases.Get( context.TODO(), - rulesets.PhaseGetParamsRulesetPhaseHTTPRequestFirewallCustom, + rulesets.PhaseHTTPRequestFirewallCustom, rulesets.PhaseGetParams{ AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), diff --git a/rulesets/phaseversion.go b/rulesets/phaseversion.go index aec42b76acb..5575db9bc82 100644 --- a/rulesets/phaseversion.go +++ b/rulesets/phaseversion.go @@ -36,7 +36,7 @@ func NewPhaseVersionService(opts ...option.RequestOption) (r *PhaseVersionServic } // Fetches the versions of an account or zone entry point ruleset. -func (r *PhaseVersionService) List(ctx context.Context, rulesetPhase PhaseVersionListParamsRulesetPhase, query PhaseVersionListParams, opts ...option.RequestOption) (res *pagination.SinglePage[Ruleset], err error) { +func (r *PhaseVersionService) List(ctx context.Context, rulesetPhase Phase, query PhaseVersionListParams, opts ...option.RequestOption) (res *pagination.SinglePage[Ruleset], err error) { var raw *http.Response opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) @@ -50,7 +50,7 @@ func (r *PhaseVersionService) List(ctx context.Context, rulesetPhase PhaseVersio accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/rulesets/phases/%v/entrypoint/versions", accountOrZone, accountOrZoneID, rulesetPhase) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -63,12 +63,12 @@ func (r *PhaseVersionService) List(ctx context.Context, rulesetPhase PhaseVersio } // Fetches the versions of an account or zone entry point ruleset. -func (r *PhaseVersionService) ListAutoPaging(ctx context.Context, rulesetPhase PhaseVersionListParamsRulesetPhase, query PhaseVersionListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[Ruleset] { +func (r *PhaseVersionService) ListAutoPaging(ctx context.Context, rulesetPhase Phase, query PhaseVersionListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[Ruleset] { return pagination.NewSinglePageAutoPager(r.List(ctx, rulesetPhase, query, opts...)) } // Fetches a specific version of an account or zone entry point ruleset. -func (r *PhaseVersionService) Get(ctx context.Context, rulesetPhase PhaseVersionGetParamsRulesetPhase, rulesetVersion string, query PhaseVersionGetParams, opts ...option.RequestOption) (res *PhaseVersionGetResponse, err error) { +func (r *PhaseVersionService) Get(ctx context.Context, rulesetPhase Phase, rulesetVersion string, query PhaseVersionGetParams, opts ...option.RequestOption) (res *PhaseVersionGetResponse, err error) { opts = append(r.Options[:], opts...) var env PhaseVersionGetResponseEnvelope var accountOrZone string @@ -94,13 +94,13 @@ type PhaseVersionGetResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind PhaseVersionGetResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase PhaseVersionGetResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []PhaseVersionGetResponseRule `json:"rules,required"` // The version of the ruleset. @@ -133,61 +133,6 @@ func (r phaseVersionGetResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type PhaseVersionGetResponseKind string - -const ( - PhaseVersionGetResponseKindManaged PhaseVersionGetResponseKind = "managed" - PhaseVersionGetResponseKindCustom PhaseVersionGetResponseKind = "custom" - PhaseVersionGetResponseKindRoot PhaseVersionGetResponseKind = "root" - PhaseVersionGetResponseKindZone PhaseVersionGetResponseKind = "zone" -) - -func (r PhaseVersionGetResponseKind) IsKnown() bool { - switch r { - case PhaseVersionGetResponseKindManaged, PhaseVersionGetResponseKindCustom, PhaseVersionGetResponseKindRoot, PhaseVersionGetResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type PhaseVersionGetResponsePhase string - -const ( - PhaseVersionGetResponsePhaseDDoSL4 PhaseVersionGetResponsePhase = "ddos_l4" - PhaseVersionGetResponsePhaseDDoSL7 PhaseVersionGetResponsePhase = "ddos_l7" - PhaseVersionGetResponsePhaseHTTPConfigSettings PhaseVersionGetResponsePhase = "http_config_settings" - PhaseVersionGetResponsePhaseHTTPCustomErrors PhaseVersionGetResponsePhase = "http_custom_errors" - PhaseVersionGetResponsePhaseHTTPLogCustomFields PhaseVersionGetResponsePhase = "http_log_custom_fields" - PhaseVersionGetResponsePhaseHTTPRatelimit PhaseVersionGetResponsePhase = "http_ratelimit" - PhaseVersionGetResponsePhaseHTTPRequestCacheSettings PhaseVersionGetResponsePhase = "http_request_cache_settings" - PhaseVersionGetResponsePhaseHTTPRequestDynamicRedirect PhaseVersionGetResponsePhase = "http_request_dynamic_redirect" - PhaseVersionGetResponsePhaseHTTPRequestFirewallCustom PhaseVersionGetResponsePhase = "http_request_firewall_custom" - PhaseVersionGetResponsePhaseHTTPRequestFirewallManaged PhaseVersionGetResponsePhase = "http_request_firewall_managed" - PhaseVersionGetResponsePhaseHTTPRequestLateTransform PhaseVersionGetResponsePhase = "http_request_late_transform" - PhaseVersionGetResponsePhaseHTTPRequestOrigin PhaseVersionGetResponsePhase = "http_request_origin" - PhaseVersionGetResponsePhaseHTTPRequestRedirect PhaseVersionGetResponsePhase = "http_request_redirect" - PhaseVersionGetResponsePhaseHTTPRequestSanitize PhaseVersionGetResponsePhase = "http_request_sanitize" - PhaseVersionGetResponsePhaseHTTPRequestSBFM PhaseVersionGetResponsePhase = "http_request_sbfm" - PhaseVersionGetResponsePhaseHTTPRequestSelectConfiguration PhaseVersionGetResponsePhase = "http_request_select_configuration" - PhaseVersionGetResponsePhaseHTTPRequestTransform PhaseVersionGetResponsePhase = "http_request_transform" - PhaseVersionGetResponsePhaseHTTPResponseCompression PhaseVersionGetResponsePhase = "http_response_compression" - PhaseVersionGetResponsePhaseHTTPResponseFirewallManaged PhaseVersionGetResponsePhase = "http_response_firewall_managed" - PhaseVersionGetResponsePhaseHTTPResponseHeadersTransform PhaseVersionGetResponsePhase = "http_response_headers_transform" - PhaseVersionGetResponsePhaseMagicTransit PhaseVersionGetResponsePhase = "magic_transit" - PhaseVersionGetResponsePhaseMagicTransitIDsManaged PhaseVersionGetResponsePhase = "magic_transit_ids_managed" - PhaseVersionGetResponsePhaseMagicTransitManaged PhaseVersionGetResponsePhase = "magic_transit_managed" -) - -func (r PhaseVersionGetResponsePhase) IsKnown() bool { - switch r { - case PhaseVersionGetResponsePhaseDDoSL4, PhaseVersionGetResponsePhaseDDoSL7, PhaseVersionGetResponsePhaseHTTPConfigSettings, PhaseVersionGetResponsePhaseHTTPCustomErrors, PhaseVersionGetResponsePhaseHTTPLogCustomFields, PhaseVersionGetResponsePhaseHTTPRatelimit, PhaseVersionGetResponsePhaseHTTPRequestCacheSettings, PhaseVersionGetResponsePhaseHTTPRequestDynamicRedirect, PhaseVersionGetResponsePhaseHTTPRequestFirewallCustom, PhaseVersionGetResponsePhaseHTTPRequestFirewallManaged, PhaseVersionGetResponsePhaseHTTPRequestLateTransform, PhaseVersionGetResponsePhaseHTTPRequestOrigin, PhaseVersionGetResponsePhaseHTTPRequestRedirect, PhaseVersionGetResponsePhaseHTTPRequestSanitize, PhaseVersionGetResponsePhaseHTTPRequestSBFM, PhaseVersionGetResponsePhaseHTTPRequestSelectConfiguration, PhaseVersionGetResponsePhaseHTTPRequestTransform, PhaseVersionGetResponsePhaseHTTPResponseCompression, PhaseVersionGetResponsePhaseHTTPResponseFirewallManaged, PhaseVersionGetResponsePhaseHTTPResponseHeadersTransform, PhaseVersionGetResponsePhaseMagicTransit, PhaseVersionGetResponsePhaseMagicTransitIDsManaged, PhaseVersionGetResponsePhaseMagicTransitManaged: - return true - } - return false -} - type PhaseVersionGetResponseRule struct { // The action to perform when the rule matches. Action PhaseVersionGetResponseRulesAction `json:"action"` @@ -375,43 +320,6 @@ type PhaseVersionListParams struct { ZoneID param.Field[string] `path:"zone_id"` } -// The phase of the ruleset. -type PhaseVersionListParamsRulesetPhase string - -const ( - PhaseVersionListParamsRulesetPhaseDDoSL4 PhaseVersionListParamsRulesetPhase = "ddos_l4" - PhaseVersionListParamsRulesetPhaseDDoSL7 PhaseVersionListParamsRulesetPhase = "ddos_l7" - PhaseVersionListParamsRulesetPhaseHTTPConfigSettings PhaseVersionListParamsRulesetPhase = "http_config_settings" - PhaseVersionListParamsRulesetPhaseHTTPCustomErrors PhaseVersionListParamsRulesetPhase = "http_custom_errors" - PhaseVersionListParamsRulesetPhaseHTTPLogCustomFields PhaseVersionListParamsRulesetPhase = "http_log_custom_fields" - PhaseVersionListParamsRulesetPhaseHTTPRatelimit PhaseVersionListParamsRulesetPhase = "http_ratelimit" - PhaseVersionListParamsRulesetPhaseHTTPRequestCacheSettings PhaseVersionListParamsRulesetPhase = "http_request_cache_settings" - PhaseVersionListParamsRulesetPhaseHTTPRequestDynamicRedirect PhaseVersionListParamsRulesetPhase = "http_request_dynamic_redirect" - PhaseVersionListParamsRulesetPhaseHTTPRequestFirewallCustom PhaseVersionListParamsRulesetPhase = "http_request_firewall_custom" - PhaseVersionListParamsRulesetPhaseHTTPRequestFirewallManaged PhaseVersionListParamsRulesetPhase = "http_request_firewall_managed" - PhaseVersionListParamsRulesetPhaseHTTPRequestLateTransform PhaseVersionListParamsRulesetPhase = "http_request_late_transform" - PhaseVersionListParamsRulesetPhaseHTTPRequestOrigin PhaseVersionListParamsRulesetPhase = "http_request_origin" - PhaseVersionListParamsRulesetPhaseHTTPRequestRedirect PhaseVersionListParamsRulesetPhase = "http_request_redirect" - PhaseVersionListParamsRulesetPhaseHTTPRequestSanitize PhaseVersionListParamsRulesetPhase = "http_request_sanitize" - PhaseVersionListParamsRulesetPhaseHTTPRequestSBFM PhaseVersionListParamsRulesetPhase = "http_request_sbfm" - PhaseVersionListParamsRulesetPhaseHTTPRequestSelectConfiguration PhaseVersionListParamsRulesetPhase = "http_request_select_configuration" - PhaseVersionListParamsRulesetPhaseHTTPRequestTransform PhaseVersionListParamsRulesetPhase = "http_request_transform" - PhaseVersionListParamsRulesetPhaseHTTPResponseCompression PhaseVersionListParamsRulesetPhase = "http_response_compression" - PhaseVersionListParamsRulesetPhaseHTTPResponseFirewallManaged PhaseVersionListParamsRulesetPhase = "http_response_firewall_managed" - PhaseVersionListParamsRulesetPhaseHTTPResponseHeadersTransform PhaseVersionListParamsRulesetPhase = "http_response_headers_transform" - PhaseVersionListParamsRulesetPhaseMagicTransit PhaseVersionListParamsRulesetPhase = "magic_transit" - PhaseVersionListParamsRulesetPhaseMagicTransitIDsManaged PhaseVersionListParamsRulesetPhase = "magic_transit_ids_managed" - PhaseVersionListParamsRulesetPhaseMagicTransitManaged PhaseVersionListParamsRulesetPhase = "magic_transit_managed" -) - -func (r PhaseVersionListParamsRulesetPhase) IsKnown() bool { - switch r { - case PhaseVersionListParamsRulesetPhaseDDoSL4, PhaseVersionListParamsRulesetPhaseDDoSL7, PhaseVersionListParamsRulesetPhaseHTTPConfigSettings, PhaseVersionListParamsRulesetPhaseHTTPCustomErrors, PhaseVersionListParamsRulesetPhaseHTTPLogCustomFields, PhaseVersionListParamsRulesetPhaseHTTPRatelimit, PhaseVersionListParamsRulesetPhaseHTTPRequestCacheSettings, PhaseVersionListParamsRulesetPhaseHTTPRequestDynamicRedirect, PhaseVersionListParamsRulesetPhaseHTTPRequestFirewallCustom, PhaseVersionListParamsRulesetPhaseHTTPRequestFirewallManaged, PhaseVersionListParamsRulesetPhaseHTTPRequestLateTransform, PhaseVersionListParamsRulesetPhaseHTTPRequestOrigin, PhaseVersionListParamsRulesetPhaseHTTPRequestRedirect, PhaseVersionListParamsRulesetPhaseHTTPRequestSanitize, PhaseVersionListParamsRulesetPhaseHTTPRequestSBFM, PhaseVersionListParamsRulesetPhaseHTTPRequestSelectConfiguration, PhaseVersionListParamsRulesetPhaseHTTPRequestTransform, PhaseVersionListParamsRulesetPhaseHTTPResponseCompression, PhaseVersionListParamsRulesetPhaseHTTPResponseFirewallManaged, PhaseVersionListParamsRulesetPhaseHTTPResponseHeadersTransform, PhaseVersionListParamsRulesetPhaseMagicTransit, PhaseVersionListParamsRulesetPhaseMagicTransitIDsManaged, PhaseVersionListParamsRulesetPhaseMagicTransitManaged: - return true - } - return false -} - type PhaseVersionGetParams struct { // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. AccountID param.Field[string] `path:"account_id"` @@ -419,43 +327,6 @@ type PhaseVersionGetParams struct { ZoneID param.Field[string] `path:"zone_id"` } -// The phase of the ruleset. -type PhaseVersionGetParamsRulesetPhase string - -const ( - PhaseVersionGetParamsRulesetPhaseDDoSL4 PhaseVersionGetParamsRulesetPhase = "ddos_l4" - PhaseVersionGetParamsRulesetPhaseDDoSL7 PhaseVersionGetParamsRulesetPhase = "ddos_l7" - PhaseVersionGetParamsRulesetPhaseHTTPConfigSettings PhaseVersionGetParamsRulesetPhase = "http_config_settings" - PhaseVersionGetParamsRulesetPhaseHTTPCustomErrors PhaseVersionGetParamsRulesetPhase = "http_custom_errors" - PhaseVersionGetParamsRulesetPhaseHTTPLogCustomFields PhaseVersionGetParamsRulesetPhase = "http_log_custom_fields" - PhaseVersionGetParamsRulesetPhaseHTTPRatelimit PhaseVersionGetParamsRulesetPhase = "http_ratelimit" - PhaseVersionGetParamsRulesetPhaseHTTPRequestCacheSettings PhaseVersionGetParamsRulesetPhase = "http_request_cache_settings" - PhaseVersionGetParamsRulesetPhaseHTTPRequestDynamicRedirect PhaseVersionGetParamsRulesetPhase = "http_request_dynamic_redirect" - PhaseVersionGetParamsRulesetPhaseHTTPRequestFirewallCustom PhaseVersionGetParamsRulesetPhase = "http_request_firewall_custom" - PhaseVersionGetParamsRulesetPhaseHTTPRequestFirewallManaged PhaseVersionGetParamsRulesetPhase = "http_request_firewall_managed" - PhaseVersionGetParamsRulesetPhaseHTTPRequestLateTransform PhaseVersionGetParamsRulesetPhase = "http_request_late_transform" - PhaseVersionGetParamsRulesetPhaseHTTPRequestOrigin PhaseVersionGetParamsRulesetPhase = "http_request_origin" - PhaseVersionGetParamsRulesetPhaseHTTPRequestRedirect PhaseVersionGetParamsRulesetPhase = "http_request_redirect" - PhaseVersionGetParamsRulesetPhaseHTTPRequestSanitize PhaseVersionGetParamsRulesetPhase = "http_request_sanitize" - PhaseVersionGetParamsRulesetPhaseHTTPRequestSBFM PhaseVersionGetParamsRulesetPhase = "http_request_sbfm" - PhaseVersionGetParamsRulesetPhaseHTTPRequestSelectConfiguration PhaseVersionGetParamsRulesetPhase = "http_request_select_configuration" - PhaseVersionGetParamsRulesetPhaseHTTPRequestTransform PhaseVersionGetParamsRulesetPhase = "http_request_transform" - PhaseVersionGetParamsRulesetPhaseHTTPResponseCompression PhaseVersionGetParamsRulesetPhase = "http_response_compression" - PhaseVersionGetParamsRulesetPhaseHTTPResponseFirewallManaged PhaseVersionGetParamsRulesetPhase = "http_response_firewall_managed" - PhaseVersionGetParamsRulesetPhaseHTTPResponseHeadersTransform PhaseVersionGetParamsRulesetPhase = "http_response_headers_transform" - PhaseVersionGetParamsRulesetPhaseMagicTransit PhaseVersionGetParamsRulesetPhase = "magic_transit" - PhaseVersionGetParamsRulesetPhaseMagicTransitIDsManaged PhaseVersionGetParamsRulesetPhase = "magic_transit_ids_managed" - PhaseVersionGetParamsRulesetPhaseMagicTransitManaged PhaseVersionGetParamsRulesetPhase = "magic_transit_managed" -) - -func (r PhaseVersionGetParamsRulesetPhase) IsKnown() bool { - switch r { - case PhaseVersionGetParamsRulesetPhaseDDoSL4, PhaseVersionGetParamsRulesetPhaseDDoSL7, PhaseVersionGetParamsRulesetPhaseHTTPConfigSettings, PhaseVersionGetParamsRulesetPhaseHTTPCustomErrors, PhaseVersionGetParamsRulesetPhaseHTTPLogCustomFields, PhaseVersionGetParamsRulesetPhaseHTTPRatelimit, PhaseVersionGetParamsRulesetPhaseHTTPRequestCacheSettings, PhaseVersionGetParamsRulesetPhaseHTTPRequestDynamicRedirect, PhaseVersionGetParamsRulesetPhaseHTTPRequestFirewallCustom, PhaseVersionGetParamsRulesetPhaseHTTPRequestFirewallManaged, PhaseVersionGetParamsRulesetPhaseHTTPRequestLateTransform, PhaseVersionGetParamsRulesetPhaseHTTPRequestOrigin, PhaseVersionGetParamsRulesetPhaseHTTPRequestRedirect, PhaseVersionGetParamsRulesetPhaseHTTPRequestSanitize, PhaseVersionGetParamsRulesetPhaseHTTPRequestSBFM, PhaseVersionGetParamsRulesetPhaseHTTPRequestSelectConfiguration, PhaseVersionGetParamsRulesetPhaseHTTPRequestTransform, PhaseVersionGetParamsRulesetPhaseHTTPResponseCompression, PhaseVersionGetParamsRulesetPhaseHTTPResponseFirewallManaged, PhaseVersionGetParamsRulesetPhaseHTTPResponseHeadersTransform, PhaseVersionGetParamsRulesetPhaseMagicTransit, PhaseVersionGetParamsRulesetPhaseMagicTransitIDsManaged, PhaseVersionGetParamsRulesetPhaseMagicTransitManaged: - return true - } - return false -} - // A response object. type PhaseVersionGetResponseEnvelope struct { // A list of error messages. diff --git a/rulesets/phaseversion_test.go b/rulesets/phaseversion_test.go index 256ef12bfd7..4a5095a983d 100644 --- a/rulesets/phaseversion_test.go +++ b/rulesets/phaseversion_test.go @@ -15,7 +15,7 @@ import ( ) func TestPhaseVersionListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -30,7 +30,7 @@ func TestPhaseVersionListWithOptionalParams(t *testing.T) { ) _, err := client.Rulesets.Phases.Versions.List( context.TODO(), - rulesets.PhaseVersionListParamsRulesetPhaseHTTPRequestFirewallCustom, + rulesets.PhaseHTTPRequestFirewallCustom, rulesets.PhaseVersionListParams{ AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), @@ -46,7 +46,7 @@ func TestPhaseVersionListWithOptionalParams(t *testing.T) { } func TestPhaseVersionGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -61,7 +61,7 @@ func TestPhaseVersionGetWithOptionalParams(t *testing.T) { ) _, err := client.Rulesets.Phases.Versions.Get( context.TODO(), - rulesets.PhaseVersionGetParamsRulesetPhaseHTTPRequestFirewallCustom, + rulesets.PhaseHTTPRequestFirewallCustom, "1", rulesets.PhaseVersionGetParams{ AccountID: cloudflare.F("string"), diff --git a/rulesets/rule.go b/rulesets/rule.go index 4bfabe41fa8..1bbf4d3d4b8 100644 --- a/rulesets/rule.go +++ b/rulesets/rule.go @@ -2522,7 +2522,7 @@ type RouteRuleActionParameters struct { // Override the IP/TCP destination. Origin RouteRuleActionParametersOrigin `json:"origin"` // Override the Server Name Indication (SNI). - Sni RouteRuleActionParametersSni `json:"sni"` + SNI RouteRuleActionParametersSNI `json:"sni"` JSON routeRuleActionParametersJSON `json:"-"` } @@ -2531,7 +2531,7 @@ type RouteRuleActionParameters struct { type routeRuleActionParametersJSON struct { HostHeader apijson.Field Origin apijson.Field - Sni apijson.Field + SNI apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -2571,25 +2571,25 @@ func (r routeRuleActionParametersOriginJSON) RawJSON() string { } // Override the Server Name Indication (SNI). -type RouteRuleActionParametersSni struct { +type RouteRuleActionParametersSNI struct { // The SNI override. Value string `json:"value,required"` - JSON routeRuleActionParametersSniJSON `json:"-"` + JSON routeRuleActionParametersSNIJSON `json:"-"` } -// routeRuleActionParametersSniJSON contains the JSON metadata for the struct -// [RouteRuleActionParametersSni] -type routeRuleActionParametersSniJSON struct { +// routeRuleActionParametersSNIJSON contains the JSON metadata for the struct +// [RouteRuleActionParametersSNI] +type routeRuleActionParametersSNIJSON struct { Value apijson.Field raw string ExtraFields map[string]apijson.Field } -func (r *RouteRuleActionParametersSni) UnmarshalJSON(data []byte) (err error) { +func (r *RouteRuleActionParametersSNI) UnmarshalJSON(data []byte) (err error) { return apijson.UnmarshalRoot(data, r) } -func (r routeRuleActionParametersSniJSON) RawJSON() string { +func (r routeRuleActionParametersSNIJSON) RawJSON() string { return r.raw } @@ -2629,7 +2629,7 @@ type RouteRuleActionParametersParam struct { // Override the IP/TCP destination. Origin param.Field[RouteRuleActionParametersOriginParam] `json:"origin"` // Override the Server Name Indication (SNI). - Sni param.Field[RouteRuleActionParametersSniParam] `json:"sni"` + SNI param.Field[RouteRuleActionParametersSNIParam] `json:"sni"` } func (r RouteRuleActionParametersParam) MarshalJSON() (data []byte, err error) { @@ -2649,12 +2649,12 @@ func (r RouteRuleActionParametersOriginParam) MarshalJSON() (data []byte, err er } // Override the Server Name Indication (SNI). -type RouteRuleActionParametersSniParam struct { +type RouteRuleActionParametersSNIParam struct { // The SNI override. Value param.Field[string] `json:"value,required"` } -func (r RouteRuleActionParametersSniParam) MarshalJSON() (data []byte, err error) { +func (r RouteRuleActionParametersSNIParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } @@ -4336,7 +4336,7 @@ func (r SkipRuleAction) IsKnown() bool { type SkipRuleActionParameters struct { // A list of phases to skip the execution of. This option is incompatible with the // ruleset and rulesets options. - Phases []SkipRuleActionParametersPhase `json:"phases"` + Phases []Phase `json:"phases"` // A list of legacy security products to skip the execution of. Products []SkipRuleActionParametersProduct `json:"products"` // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the @@ -4371,43 +4371,6 @@ func (r skipRuleActionParametersJSON) RawJSON() string { return r.raw } -// A phase to skip the execution of. -type SkipRuleActionParametersPhase string - -const ( - SkipRuleActionParametersPhaseDDoSL4 SkipRuleActionParametersPhase = "ddos_l4" - SkipRuleActionParametersPhaseDDoSL7 SkipRuleActionParametersPhase = "ddos_l7" - SkipRuleActionParametersPhaseHTTPConfigSettings SkipRuleActionParametersPhase = "http_config_settings" - SkipRuleActionParametersPhaseHTTPCustomErrors SkipRuleActionParametersPhase = "http_custom_errors" - SkipRuleActionParametersPhaseHTTPLogCustomFields SkipRuleActionParametersPhase = "http_log_custom_fields" - SkipRuleActionParametersPhaseHTTPRatelimit SkipRuleActionParametersPhase = "http_ratelimit" - SkipRuleActionParametersPhaseHTTPRequestCacheSettings SkipRuleActionParametersPhase = "http_request_cache_settings" - SkipRuleActionParametersPhaseHTTPRequestDynamicRedirect SkipRuleActionParametersPhase = "http_request_dynamic_redirect" - SkipRuleActionParametersPhaseHTTPRequestFirewallCustom SkipRuleActionParametersPhase = "http_request_firewall_custom" - SkipRuleActionParametersPhaseHTTPRequestFirewallManaged SkipRuleActionParametersPhase = "http_request_firewall_managed" - SkipRuleActionParametersPhaseHTTPRequestLateTransform SkipRuleActionParametersPhase = "http_request_late_transform" - SkipRuleActionParametersPhaseHTTPRequestOrigin SkipRuleActionParametersPhase = "http_request_origin" - SkipRuleActionParametersPhaseHTTPRequestRedirect SkipRuleActionParametersPhase = "http_request_redirect" - SkipRuleActionParametersPhaseHTTPRequestSanitize SkipRuleActionParametersPhase = "http_request_sanitize" - SkipRuleActionParametersPhaseHTTPRequestSBFM SkipRuleActionParametersPhase = "http_request_sbfm" - SkipRuleActionParametersPhaseHTTPRequestSelectConfiguration SkipRuleActionParametersPhase = "http_request_select_configuration" - SkipRuleActionParametersPhaseHTTPRequestTransform SkipRuleActionParametersPhase = "http_request_transform" - SkipRuleActionParametersPhaseHTTPResponseCompression SkipRuleActionParametersPhase = "http_response_compression" - SkipRuleActionParametersPhaseHTTPResponseFirewallManaged SkipRuleActionParametersPhase = "http_response_firewall_managed" - SkipRuleActionParametersPhaseHTTPResponseHeadersTransform SkipRuleActionParametersPhase = "http_response_headers_transform" - SkipRuleActionParametersPhaseMagicTransit SkipRuleActionParametersPhase = "magic_transit" - SkipRuleActionParametersPhaseMagicTransitIDsManaged SkipRuleActionParametersPhase = "magic_transit_ids_managed" - SkipRuleActionParametersPhaseMagicTransitManaged SkipRuleActionParametersPhase = "magic_transit_managed" -) - -func (r SkipRuleActionParametersPhase) IsKnown() bool { - switch r { - case SkipRuleActionParametersPhaseDDoSL4, SkipRuleActionParametersPhaseDDoSL7, SkipRuleActionParametersPhaseHTTPConfigSettings, SkipRuleActionParametersPhaseHTTPCustomErrors, SkipRuleActionParametersPhaseHTTPLogCustomFields, SkipRuleActionParametersPhaseHTTPRatelimit, SkipRuleActionParametersPhaseHTTPRequestCacheSettings, SkipRuleActionParametersPhaseHTTPRequestDynamicRedirect, SkipRuleActionParametersPhaseHTTPRequestFirewallCustom, SkipRuleActionParametersPhaseHTTPRequestFirewallManaged, SkipRuleActionParametersPhaseHTTPRequestLateTransform, SkipRuleActionParametersPhaseHTTPRequestOrigin, SkipRuleActionParametersPhaseHTTPRequestRedirect, SkipRuleActionParametersPhaseHTTPRequestSanitize, SkipRuleActionParametersPhaseHTTPRequestSBFM, SkipRuleActionParametersPhaseHTTPRequestSelectConfiguration, SkipRuleActionParametersPhaseHTTPRequestTransform, SkipRuleActionParametersPhaseHTTPResponseCompression, SkipRuleActionParametersPhaseHTTPResponseFirewallManaged, SkipRuleActionParametersPhaseHTTPResponseHeadersTransform, SkipRuleActionParametersPhaseMagicTransit, SkipRuleActionParametersPhaseMagicTransitIDsManaged, SkipRuleActionParametersPhaseMagicTransitManaged: - return true - } - return false -} - // The name of a legacy security product to skip the execution of. type SkipRuleActionParametersProduct string @@ -4478,7 +4441,7 @@ func (r SkipRuleParam) implementsRulesetsPhaseUpdateParamsRuleUnion() {} type SkipRuleActionParametersParam struct { // A list of phases to skip the execution of. This option is incompatible with the // ruleset and rulesets options. - Phases param.Field[[]SkipRuleActionParametersPhase] `json:"phases"` + Phases param.Field[[]Phase] `json:"phases"` // A list of legacy security products to skip the execution of. Products param.Field[[]SkipRuleActionParametersProduct] `json:"products"` // A mapping of ruleset IDs to a list of rule IDs in that ruleset to skip the @@ -4501,13 +4464,13 @@ type RuleNewResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind RuleNewResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase RuleNewResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []RuleNewResponseRule `json:"rules,required"` // The version of the ruleset. @@ -4539,61 +4502,6 @@ func (r ruleNewResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type RuleNewResponseKind string - -const ( - RuleNewResponseKindManaged RuleNewResponseKind = "managed" - RuleNewResponseKindCustom RuleNewResponseKind = "custom" - RuleNewResponseKindRoot RuleNewResponseKind = "root" - RuleNewResponseKindZone RuleNewResponseKind = "zone" -) - -func (r RuleNewResponseKind) IsKnown() bool { - switch r { - case RuleNewResponseKindManaged, RuleNewResponseKindCustom, RuleNewResponseKindRoot, RuleNewResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RuleNewResponsePhase string - -const ( - RuleNewResponsePhaseDDoSL4 RuleNewResponsePhase = "ddos_l4" - RuleNewResponsePhaseDDoSL7 RuleNewResponsePhase = "ddos_l7" - RuleNewResponsePhaseHTTPConfigSettings RuleNewResponsePhase = "http_config_settings" - RuleNewResponsePhaseHTTPCustomErrors RuleNewResponsePhase = "http_custom_errors" - RuleNewResponsePhaseHTTPLogCustomFields RuleNewResponsePhase = "http_log_custom_fields" - RuleNewResponsePhaseHTTPRatelimit RuleNewResponsePhase = "http_ratelimit" - RuleNewResponsePhaseHTTPRequestCacheSettings RuleNewResponsePhase = "http_request_cache_settings" - RuleNewResponsePhaseHTTPRequestDynamicRedirect RuleNewResponsePhase = "http_request_dynamic_redirect" - RuleNewResponsePhaseHTTPRequestFirewallCustom RuleNewResponsePhase = "http_request_firewall_custom" - RuleNewResponsePhaseHTTPRequestFirewallManaged RuleNewResponsePhase = "http_request_firewall_managed" - RuleNewResponsePhaseHTTPRequestLateTransform RuleNewResponsePhase = "http_request_late_transform" - RuleNewResponsePhaseHTTPRequestOrigin RuleNewResponsePhase = "http_request_origin" - RuleNewResponsePhaseHTTPRequestRedirect RuleNewResponsePhase = "http_request_redirect" - RuleNewResponsePhaseHTTPRequestSanitize RuleNewResponsePhase = "http_request_sanitize" - RuleNewResponsePhaseHTTPRequestSBFM RuleNewResponsePhase = "http_request_sbfm" - RuleNewResponsePhaseHTTPRequestSelectConfiguration RuleNewResponsePhase = "http_request_select_configuration" - RuleNewResponsePhaseHTTPRequestTransform RuleNewResponsePhase = "http_request_transform" - RuleNewResponsePhaseHTTPResponseCompression RuleNewResponsePhase = "http_response_compression" - RuleNewResponsePhaseHTTPResponseFirewallManaged RuleNewResponsePhase = "http_response_firewall_managed" - RuleNewResponsePhaseHTTPResponseHeadersTransform RuleNewResponsePhase = "http_response_headers_transform" - RuleNewResponsePhaseMagicTransit RuleNewResponsePhase = "magic_transit" - RuleNewResponsePhaseMagicTransitIDsManaged RuleNewResponsePhase = "magic_transit_ids_managed" - RuleNewResponsePhaseMagicTransitManaged RuleNewResponsePhase = "magic_transit_managed" -) - -func (r RuleNewResponsePhase) IsKnown() bool { - switch r { - case RuleNewResponsePhaseDDoSL4, RuleNewResponsePhaseDDoSL7, RuleNewResponsePhaseHTTPConfigSettings, RuleNewResponsePhaseHTTPCustomErrors, RuleNewResponsePhaseHTTPLogCustomFields, RuleNewResponsePhaseHTTPRatelimit, RuleNewResponsePhaseHTTPRequestCacheSettings, RuleNewResponsePhaseHTTPRequestDynamicRedirect, RuleNewResponsePhaseHTTPRequestFirewallCustom, RuleNewResponsePhaseHTTPRequestFirewallManaged, RuleNewResponsePhaseHTTPRequestLateTransform, RuleNewResponsePhaseHTTPRequestOrigin, RuleNewResponsePhaseHTTPRequestRedirect, RuleNewResponsePhaseHTTPRequestSanitize, RuleNewResponsePhaseHTTPRequestSBFM, RuleNewResponsePhaseHTTPRequestSelectConfiguration, RuleNewResponsePhaseHTTPRequestTransform, RuleNewResponsePhaseHTTPResponseCompression, RuleNewResponsePhaseHTTPResponseFirewallManaged, RuleNewResponsePhaseHTTPResponseHeadersTransform, RuleNewResponsePhaseMagicTransit, RuleNewResponsePhaseMagicTransitIDsManaged, RuleNewResponsePhaseMagicTransitManaged: - return true - } - return false -} - type RuleNewResponseRule struct { // The action to perform when the rule matches. Action RuleNewResponseRulesAction `json:"action"` @@ -4779,13 +4687,13 @@ type RuleDeleteResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind RuleDeleteResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase RuleDeleteResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []RuleDeleteResponseRule `json:"rules,required"` // The version of the ruleset. @@ -4818,61 +4726,6 @@ func (r ruleDeleteResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type RuleDeleteResponseKind string - -const ( - RuleDeleteResponseKindManaged RuleDeleteResponseKind = "managed" - RuleDeleteResponseKindCustom RuleDeleteResponseKind = "custom" - RuleDeleteResponseKindRoot RuleDeleteResponseKind = "root" - RuleDeleteResponseKindZone RuleDeleteResponseKind = "zone" -) - -func (r RuleDeleteResponseKind) IsKnown() bool { - switch r { - case RuleDeleteResponseKindManaged, RuleDeleteResponseKindCustom, RuleDeleteResponseKindRoot, RuleDeleteResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RuleDeleteResponsePhase string - -const ( - RuleDeleteResponsePhaseDDoSL4 RuleDeleteResponsePhase = "ddos_l4" - RuleDeleteResponsePhaseDDoSL7 RuleDeleteResponsePhase = "ddos_l7" - RuleDeleteResponsePhaseHTTPConfigSettings RuleDeleteResponsePhase = "http_config_settings" - RuleDeleteResponsePhaseHTTPCustomErrors RuleDeleteResponsePhase = "http_custom_errors" - RuleDeleteResponsePhaseHTTPLogCustomFields RuleDeleteResponsePhase = "http_log_custom_fields" - RuleDeleteResponsePhaseHTTPRatelimit RuleDeleteResponsePhase = "http_ratelimit" - RuleDeleteResponsePhaseHTTPRequestCacheSettings RuleDeleteResponsePhase = "http_request_cache_settings" - RuleDeleteResponsePhaseHTTPRequestDynamicRedirect RuleDeleteResponsePhase = "http_request_dynamic_redirect" - RuleDeleteResponsePhaseHTTPRequestFirewallCustom RuleDeleteResponsePhase = "http_request_firewall_custom" - RuleDeleteResponsePhaseHTTPRequestFirewallManaged RuleDeleteResponsePhase = "http_request_firewall_managed" - RuleDeleteResponsePhaseHTTPRequestLateTransform RuleDeleteResponsePhase = "http_request_late_transform" - RuleDeleteResponsePhaseHTTPRequestOrigin RuleDeleteResponsePhase = "http_request_origin" - RuleDeleteResponsePhaseHTTPRequestRedirect RuleDeleteResponsePhase = "http_request_redirect" - RuleDeleteResponsePhaseHTTPRequestSanitize RuleDeleteResponsePhase = "http_request_sanitize" - RuleDeleteResponsePhaseHTTPRequestSBFM RuleDeleteResponsePhase = "http_request_sbfm" - RuleDeleteResponsePhaseHTTPRequestSelectConfiguration RuleDeleteResponsePhase = "http_request_select_configuration" - RuleDeleteResponsePhaseHTTPRequestTransform RuleDeleteResponsePhase = "http_request_transform" - RuleDeleteResponsePhaseHTTPResponseCompression RuleDeleteResponsePhase = "http_response_compression" - RuleDeleteResponsePhaseHTTPResponseFirewallManaged RuleDeleteResponsePhase = "http_response_firewall_managed" - RuleDeleteResponsePhaseHTTPResponseHeadersTransform RuleDeleteResponsePhase = "http_response_headers_transform" - RuleDeleteResponsePhaseMagicTransit RuleDeleteResponsePhase = "magic_transit" - RuleDeleteResponsePhaseMagicTransitIDsManaged RuleDeleteResponsePhase = "magic_transit_ids_managed" - RuleDeleteResponsePhaseMagicTransitManaged RuleDeleteResponsePhase = "magic_transit_managed" -) - -func (r RuleDeleteResponsePhase) IsKnown() bool { - switch r { - case RuleDeleteResponsePhaseDDoSL4, RuleDeleteResponsePhaseDDoSL7, RuleDeleteResponsePhaseHTTPConfigSettings, RuleDeleteResponsePhaseHTTPCustomErrors, RuleDeleteResponsePhaseHTTPLogCustomFields, RuleDeleteResponsePhaseHTTPRatelimit, RuleDeleteResponsePhaseHTTPRequestCacheSettings, RuleDeleteResponsePhaseHTTPRequestDynamicRedirect, RuleDeleteResponsePhaseHTTPRequestFirewallCustom, RuleDeleteResponsePhaseHTTPRequestFirewallManaged, RuleDeleteResponsePhaseHTTPRequestLateTransform, RuleDeleteResponsePhaseHTTPRequestOrigin, RuleDeleteResponsePhaseHTTPRequestRedirect, RuleDeleteResponsePhaseHTTPRequestSanitize, RuleDeleteResponsePhaseHTTPRequestSBFM, RuleDeleteResponsePhaseHTTPRequestSelectConfiguration, RuleDeleteResponsePhaseHTTPRequestTransform, RuleDeleteResponsePhaseHTTPResponseCompression, RuleDeleteResponsePhaseHTTPResponseFirewallManaged, RuleDeleteResponsePhaseHTTPResponseHeadersTransform, RuleDeleteResponsePhaseMagicTransit, RuleDeleteResponsePhaseMagicTransitIDsManaged, RuleDeleteResponsePhaseMagicTransitManaged: - return true - } - return false -} - type RuleDeleteResponseRule struct { // The action to perform when the rule matches. Action RuleDeleteResponseRulesAction `json:"action"` @@ -5058,13 +4911,13 @@ type RuleEditResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind RuleEditResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase RuleEditResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []RuleEditResponseRule `json:"rules,required"` // The version of the ruleset. @@ -5097,61 +4950,6 @@ func (r ruleEditResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type RuleEditResponseKind string - -const ( - RuleEditResponseKindManaged RuleEditResponseKind = "managed" - RuleEditResponseKindCustom RuleEditResponseKind = "custom" - RuleEditResponseKindRoot RuleEditResponseKind = "root" - RuleEditResponseKindZone RuleEditResponseKind = "zone" -) - -func (r RuleEditResponseKind) IsKnown() bool { - switch r { - case RuleEditResponseKindManaged, RuleEditResponseKindCustom, RuleEditResponseKindRoot, RuleEditResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RuleEditResponsePhase string - -const ( - RuleEditResponsePhaseDDoSL4 RuleEditResponsePhase = "ddos_l4" - RuleEditResponsePhaseDDoSL7 RuleEditResponsePhase = "ddos_l7" - RuleEditResponsePhaseHTTPConfigSettings RuleEditResponsePhase = "http_config_settings" - RuleEditResponsePhaseHTTPCustomErrors RuleEditResponsePhase = "http_custom_errors" - RuleEditResponsePhaseHTTPLogCustomFields RuleEditResponsePhase = "http_log_custom_fields" - RuleEditResponsePhaseHTTPRatelimit RuleEditResponsePhase = "http_ratelimit" - RuleEditResponsePhaseHTTPRequestCacheSettings RuleEditResponsePhase = "http_request_cache_settings" - RuleEditResponsePhaseHTTPRequestDynamicRedirect RuleEditResponsePhase = "http_request_dynamic_redirect" - RuleEditResponsePhaseHTTPRequestFirewallCustom RuleEditResponsePhase = "http_request_firewall_custom" - RuleEditResponsePhaseHTTPRequestFirewallManaged RuleEditResponsePhase = "http_request_firewall_managed" - RuleEditResponsePhaseHTTPRequestLateTransform RuleEditResponsePhase = "http_request_late_transform" - RuleEditResponsePhaseHTTPRequestOrigin RuleEditResponsePhase = "http_request_origin" - RuleEditResponsePhaseHTTPRequestRedirect RuleEditResponsePhase = "http_request_redirect" - RuleEditResponsePhaseHTTPRequestSanitize RuleEditResponsePhase = "http_request_sanitize" - RuleEditResponsePhaseHTTPRequestSBFM RuleEditResponsePhase = "http_request_sbfm" - RuleEditResponsePhaseHTTPRequestSelectConfiguration RuleEditResponsePhase = "http_request_select_configuration" - RuleEditResponsePhaseHTTPRequestTransform RuleEditResponsePhase = "http_request_transform" - RuleEditResponsePhaseHTTPResponseCompression RuleEditResponsePhase = "http_response_compression" - RuleEditResponsePhaseHTTPResponseFirewallManaged RuleEditResponsePhase = "http_response_firewall_managed" - RuleEditResponsePhaseHTTPResponseHeadersTransform RuleEditResponsePhase = "http_response_headers_transform" - RuleEditResponsePhaseMagicTransit RuleEditResponsePhase = "magic_transit" - RuleEditResponsePhaseMagicTransitIDsManaged RuleEditResponsePhase = "magic_transit_ids_managed" - RuleEditResponsePhaseMagicTransitManaged RuleEditResponsePhase = "magic_transit_managed" -) - -func (r RuleEditResponsePhase) IsKnown() bool { - switch r { - case RuleEditResponsePhaseDDoSL4, RuleEditResponsePhaseDDoSL7, RuleEditResponsePhaseHTTPConfigSettings, RuleEditResponsePhaseHTTPCustomErrors, RuleEditResponsePhaseHTTPLogCustomFields, RuleEditResponsePhaseHTTPRatelimit, RuleEditResponsePhaseHTTPRequestCacheSettings, RuleEditResponsePhaseHTTPRequestDynamicRedirect, RuleEditResponsePhaseHTTPRequestFirewallCustom, RuleEditResponsePhaseHTTPRequestFirewallManaged, RuleEditResponsePhaseHTTPRequestLateTransform, RuleEditResponsePhaseHTTPRequestOrigin, RuleEditResponsePhaseHTTPRequestRedirect, RuleEditResponsePhaseHTTPRequestSanitize, RuleEditResponsePhaseHTTPRequestSBFM, RuleEditResponsePhaseHTTPRequestSelectConfiguration, RuleEditResponsePhaseHTTPRequestTransform, RuleEditResponsePhaseHTTPResponseCompression, RuleEditResponsePhaseHTTPResponseFirewallManaged, RuleEditResponsePhaseHTTPResponseHeadersTransform, RuleEditResponsePhaseMagicTransit, RuleEditResponsePhaseMagicTransitIDsManaged, RuleEditResponsePhaseMagicTransitManaged: - return true - } - return false -} - type RuleEditResponseRule struct { // The action to perform when the rule matches. Action RuleEditResponseRulesAction `json:"action"` diff --git a/rulesets/rule_test.go b/rulesets/rule_test.go index d50048511c2..e652dedbbf1 100644 --- a/rulesets/rule_test.go +++ b/rulesets/rule_test.go @@ -15,7 +15,7 @@ import ( ) func TestRuleNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +49,7 @@ func TestRuleNewWithOptionalParams(t *testing.T) { } func TestRuleDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -81,7 +81,7 @@ func TestRuleDeleteWithOptionalParams(t *testing.T) { } func TestRuleEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rulesets/ruleset.go b/rulesets/ruleset.go index 1084ed2a79a..262f443c136 100644 --- a/rulesets/ruleset.go +++ b/rulesets/ruleset.go @@ -99,7 +99,7 @@ func (r *RulesetService) List(ctx context.Context, query RulesetListParams, opts accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/rulesets", accountOrZone, accountOrZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -156,6 +156,61 @@ func (r *RulesetService) Get(ctx context.Context, rulesetID string, query Rulese return } +// The kind of the ruleset. +type Kind string + +const ( + KindManaged Kind = "managed" + KindCustom Kind = "custom" + KindRoot Kind = "root" + KindZone Kind = "zone" +) + +func (r Kind) IsKnown() bool { + switch r { + case KindManaged, KindCustom, KindRoot, KindZone: + return true + } + return false +} + +// The phase of the ruleset. +type Phase string + +const ( + PhaseDDoSL4 Phase = "ddos_l4" + PhaseDDoSL7 Phase = "ddos_l7" + PhaseHTTPConfigSettings Phase = "http_config_settings" + PhaseHTTPCustomErrors Phase = "http_custom_errors" + PhaseHTTPLogCustomFields Phase = "http_log_custom_fields" + PhaseHTTPRatelimit Phase = "http_ratelimit" + PhaseHTTPRequestCacheSettings Phase = "http_request_cache_settings" + PhaseHTTPRequestDynamicRedirect Phase = "http_request_dynamic_redirect" + PhaseHTTPRequestFirewallCustom Phase = "http_request_firewall_custom" + PhaseHTTPRequestFirewallManaged Phase = "http_request_firewall_managed" + PhaseHTTPRequestLateTransform Phase = "http_request_late_transform" + PhaseHTTPRequestOrigin Phase = "http_request_origin" + PhaseHTTPRequestRedirect Phase = "http_request_redirect" + PhaseHTTPRequestSanitize Phase = "http_request_sanitize" + PhaseHTTPRequestSBFM Phase = "http_request_sbfm" + PhaseHTTPRequestSelectConfiguration Phase = "http_request_select_configuration" + PhaseHTTPRequestTransform Phase = "http_request_transform" + PhaseHTTPResponseCompression Phase = "http_response_compression" + PhaseHTTPResponseFirewallManaged Phase = "http_response_firewall_managed" + PhaseHTTPResponseHeadersTransform Phase = "http_response_headers_transform" + PhaseMagicTransit Phase = "magic_transit" + PhaseMagicTransitIDsManaged Phase = "magic_transit_ids_managed" + PhaseMagicTransitManaged Phase = "magic_transit_managed" +) + +func (r Phase) IsKnown() bool { + switch r { + case PhaseDDoSL4, PhaseDDoSL7, PhaseHTTPConfigSettings, PhaseHTTPCustomErrors, PhaseHTTPLogCustomFields, PhaseHTTPRatelimit, PhaseHTTPRequestCacheSettings, PhaseHTTPRequestDynamicRedirect, PhaseHTTPRequestFirewallCustom, PhaseHTTPRequestFirewallManaged, PhaseHTTPRequestLateTransform, PhaseHTTPRequestOrigin, PhaseHTTPRequestRedirect, PhaseHTTPRequestSanitize, PhaseHTTPRequestSBFM, PhaseHTTPRequestSelectConfiguration, PhaseHTTPRequestTransform, PhaseHTTPResponseCompression, PhaseHTTPResponseFirewallManaged, PhaseHTTPResponseHeadersTransform, PhaseMagicTransit, PhaseMagicTransitIDsManaged, PhaseMagicTransitManaged: + return true + } + return false +} + // A ruleset object. type Ruleset struct { // The unique ID of the ruleset. @@ -167,12 +222,12 @@ type Ruleset struct { // An informative description of the ruleset. Description string `json:"description"` // The kind of the ruleset. - Kind RulesetKind `json:"kind"` + Kind Kind `json:"kind"` // The human-readable name of the ruleset. Name string `json:"name"` // The phase of the ruleset. - Phase RulesetPhase `json:"phase"` - JSON rulesetJSON `json:"-"` + Phase Phase `json:"phase"` + JSON rulesetJSON `json:"-"` } // rulesetJSON contains the JSON metadata for the struct [Ruleset] @@ -196,73 +251,18 @@ func (r rulesetJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type RulesetKind string - -const ( - RulesetKindManaged RulesetKind = "managed" - RulesetKindCustom RulesetKind = "custom" - RulesetKindRoot RulesetKind = "root" - RulesetKindZone RulesetKind = "zone" -) - -func (r RulesetKind) IsKnown() bool { - switch r { - case RulesetKindManaged, RulesetKindCustom, RulesetKindRoot, RulesetKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RulesetPhase string - -const ( - RulesetPhaseDDoSL4 RulesetPhase = "ddos_l4" - RulesetPhaseDDoSL7 RulesetPhase = "ddos_l7" - RulesetPhaseHTTPConfigSettings RulesetPhase = "http_config_settings" - RulesetPhaseHTTPCustomErrors RulesetPhase = "http_custom_errors" - RulesetPhaseHTTPLogCustomFields RulesetPhase = "http_log_custom_fields" - RulesetPhaseHTTPRatelimit RulesetPhase = "http_ratelimit" - RulesetPhaseHTTPRequestCacheSettings RulesetPhase = "http_request_cache_settings" - RulesetPhaseHTTPRequestDynamicRedirect RulesetPhase = "http_request_dynamic_redirect" - RulesetPhaseHTTPRequestFirewallCustom RulesetPhase = "http_request_firewall_custom" - RulesetPhaseHTTPRequestFirewallManaged RulesetPhase = "http_request_firewall_managed" - RulesetPhaseHTTPRequestLateTransform RulesetPhase = "http_request_late_transform" - RulesetPhaseHTTPRequestOrigin RulesetPhase = "http_request_origin" - RulesetPhaseHTTPRequestRedirect RulesetPhase = "http_request_redirect" - RulesetPhaseHTTPRequestSanitize RulesetPhase = "http_request_sanitize" - RulesetPhaseHTTPRequestSBFM RulesetPhase = "http_request_sbfm" - RulesetPhaseHTTPRequestSelectConfiguration RulesetPhase = "http_request_select_configuration" - RulesetPhaseHTTPRequestTransform RulesetPhase = "http_request_transform" - RulesetPhaseHTTPResponseCompression RulesetPhase = "http_response_compression" - RulesetPhaseHTTPResponseFirewallManaged RulesetPhase = "http_response_firewall_managed" - RulesetPhaseHTTPResponseHeadersTransform RulesetPhase = "http_response_headers_transform" - RulesetPhaseMagicTransit RulesetPhase = "magic_transit" - RulesetPhaseMagicTransitIDsManaged RulesetPhase = "magic_transit_ids_managed" - RulesetPhaseMagicTransitManaged RulesetPhase = "magic_transit_managed" -) - -func (r RulesetPhase) IsKnown() bool { - switch r { - case RulesetPhaseDDoSL4, RulesetPhaseDDoSL7, RulesetPhaseHTTPConfigSettings, RulesetPhaseHTTPCustomErrors, RulesetPhaseHTTPLogCustomFields, RulesetPhaseHTTPRatelimit, RulesetPhaseHTTPRequestCacheSettings, RulesetPhaseHTTPRequestDynamicRedirect, RulesetPhaseHTTPRequestFirewallCustom, RulesetPhaseHTTPRequestFirewallManaged, RulesetPhaseHTTPRequestLateTransform, RulesetPhaseHTTPRequestOrigin, RulesetPhaseHTTPRequestRedirect, RulesetPhaseHTTPRequestSanitize, RulesetPhaseHTTPRequestSBFM, RulesetPhaseHTTPRequestSelectConfiguration, RulesetPhaseHTTPRequestTransform, RulesetPhaseHTTPResponseCompression, RulesetPhaseHTTPResponseFirewallManaged, RulesetPhaseHTTPResponseHeadersTransform, RulesetPhaseMagicTransit, RulesetPhaseMagicTransitIDsManaged, RulesetPhaseMagicTransitManaged: - return true - } - return false -} - // A ruleset object. type RulesetNewResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind RulesetNewResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase RulesetNewResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []RulesetNewResponseRule `json:"rules,required"` // The version of the ruleset. @@ -295,61 +295,6 @@ func (r rulesetNewResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type RulesetNewResponseKind string - -const ( - RulesetNewResponseKindManaged RulesetNewResponseKind = "managed" - RulesetNewResponseKindCustom RulesetNewResponseKind = "custom" - RulesetNewResponseKindRoot RulesetNewResponseKind = "root" - RulesetNewResponseKindZone RulesetNewResponseKind = "zone" -) - -func (r RulesetNewResponseKind) IsKnown() bool { - switch r { - case RulesetNewResponseKindManaged, RulesetNewResponseKindCustom, RulesetNewResponseKindRoot, RulesetNewResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RulesetNewResponsePhase string - -const ( - RulesetNewResponsePhaseDDoSL4 RulesetNewResponsePhase = "ddos_l4" - RulesetNewResponsePhaseDDoSL7 RulesetNewResponsePhase = "ddos_l7" - RulesetNewResponsePhaseHTTPConfigSettings RulesetNewResponsePhase = "http_config_settings" - RulesetNewResponsePhaseHTTPCustomErrors RulesetNewResponsePhase = "http_custom_errors" - RulesetNewResponsePhaseHTTPLogCustomFields RulesetNewResponsePhase = "http_log_custom_fields" - RulesetNewResponsePhaseHTTPRatelimit RulesetNewResponsePhase = "http_ratelimit" - RulesetNewResponsePhaseHTTPRequestCacheSettings RulesetNewResponsePhase = "http_request_cache_settings" - RulesetNewResponsePhaseHTTPRequestDynamicRedirect RulesetNewResponsePhase = "http_request_dynamic_redirect" - RulesetNewResponsePhaseHTTPRequestFirewallCustom RulesetNewResponsePhase = "http_request_firewall_custom" - RulesetNewResponsePhaseHTTPRequestFirewallManaged RulesetNewResponsePhase = "http_request_firewall_managed" - RulesetNewResponsePhaseHTTPRequestLateTransform RulesetNewResponsePhase = "http_request_late_transform" - RulesetNewResponsePhaseHTTPRequestOrigin RulesetNewResponsePhase = "http_request_origin" - RulesetNewResponsePhaseHTTPRequestRedirect RulesetNewResponsePhase = "http_request_redirect" - RulesetNewResponsePhaseHTTPRequestSanitize RulesetNewResponsePhase = "http_request_sanitize" - RulesetNewResponsePhaseHTTPRequestSBFM RulesetNewResponsePhase = "http_request_sbfm" - RulesetNewResponsePhaseHTTPRequestSelectConfiguration RulesetNewResponsePhase = "http_request_select_configuration" - RulesetNewResponsePhaseHTTPRequestTransform RulesetNewResponsePhase = "http_request_transform" - RulesetNewResponsePhaseHTTPResponseCompression RulesetNewResponsePhase = "http_response_compression" - RulesetNewResponsePhaseHTTPResponseFirewallManaged RulesetNewResponsePhase = "http_response_firewall_managed" - RulesetNewResponsePhaseHTTPResponseHeadersTransform RulesetNewResponsePhase = "http_response_headers_transform" - RulesetNewResponsePhaseMagicTransit RulesetNewResponsePhase = "magic_transit" - RulesetNewResponsePhaseMagicTransitIDsManaged RulesetNewResponsePhase = "magic_transit_ids_managed" - RulesetNewResponsePhaseMagicTransitManaged RulesetNewResponsePhase = "magic_transit_managed" -) - -func (r RulesetNewResponsePhase) IsKnown() bool { - switch r { - case RulesetNewResponsePhaseDDoSL4, RulesetNewResponsePhaseDDoSL7, RulesetNewResponsePhaseHTTPConfigSettings, RulesetNewResponsePhaseHTTPCustomErrors, RulesetNewResponsePhaseHTTPLogCustomFields, RulesetNewResponsePhaseHTTPRatelimit, RulesetNewResponsePhaseHTTPRequestCacheSettings, RulesetNewResponsePhaseHTTPRequestDynamicRedirect, RulesetNewResponsePhaseHTTPRequestFirewallCustom, RulesetNewResponsePhaseHTTPRequestFirewallManaged, RulesetNewResponsePhaseHTTPRequestLateTransform, RulesetNewResponsePhaseHTTPRequestOrigin, RulesetNewResponsePhaseHTTPRequestRedirect, RulesetNewResponsePhaseHTTPRequestSanitize, RulesetNewResponsePhaseHTTPRequestSBFM, RulesetNewResponsePhaseHTTPRequestSelectConfiguration, RulesetNewResponsePhaseHTTPRequestTransform, RulesetNewResponsePhaseHTTPResponseCompression, RulesetNewResponsePhaseHTTPResponseFirewallManaged, RulesetNewResponsePhaseHTTPResponseHeadersTransform, RulesetNewResponsePhaseMagicTransit, RulesetNewResponsePhaseMagicTransitIDsManaged, RulesetNewResponsePhaseMagicTransitManaged: - return true - } - return false -} - type RulesetNewResponseRule struct { // The action to perform when the rule matches. Action RulesetNewResponseRulesAction `json:"action"` @@ -535,13 +480,13 @@ type RulesetUpdateResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind RulesetUpdateResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase RulesetUpdateResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []RulesetUpdateResponseRule `json:"rules,required"` // The version of the ruleset. @@ -574,61 +519,6 @@ func (r rulesetUpdateResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type RulesetUpdateResponseKind string - -const ( - RulesetUpdateResponseKindManaged RulesetUpdateResponseKind = "managed" - RulesetUpdateResponseKindCustom RulesetUpdateResponseKind = "custom" - RulesetUpdateResponseKindRoot RulesetUpdateResponseKind = "root" - RulesetUpdateResponseKindZone RulesetUpdateResponseKind = "zone" -) - -func (r RulesetUpdateResponseKind) IsKnown() bool { - switch r { - case RulesetUpdateResponseKindManaged, RulesetUpdateResponseKindCustom, RulesetUpdateResponseKindRoot, RulesetUpdateResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RulesetUpdateResponsePhase string - -const ( - RulesetUpdateResponsePhaseDDoSL4 RulesetUpdateResponsePhase = "ddos_l4" - RulesetUpdateResponsePhaseDDoSL7 RulesetUpdateResponsePhase = "ddos_l7" - RulesetUpdateResponsePhaseHTTPConfigSettings RulesetUpdateResponsePhase = "http_config_settings" - RulesetUpdateResponsePhaseHTTPCustomErrors RulesetUpdateResponsePhase = "http_custom_errors" - RulesetUpdateResponsePhaseHTTPLogCustomFields RulesetUpdateResponsePhase = "http_log_custom_fields" - RulesetUpdateResponsePhaseHTTPRatelimit RulesetUpdateResponsePhase = "http_ratelimit" - RulesetUpdateResponsePhaseHTTPRequestCacheSettings RulesetUpdateResponsePhase = "http_request_cache_settings" - RulesetUpdateResponsePhaseHTTPRequestDynamicRedirect RulesetUpdateResponsePhase = "http_request_dynamic_redirect" - RulesetUpdateResponsePhaseHTTPRequestFirewallCustom RulesetUpdateResponsePhase = "http_request_firewall_custom" - RulesetUpdateResponsePhaseHTTPRequestFirewallManaged RulesetUpdateResponsePhase = "http_request_firewall_managed" - RulesetUpdateResponsePhaseHTTPRequestLateTransform RulesetUpdateResponsePhase = "http_request_late_transform" - RulesetUpdateResponsePhaseHTTPRequestOrigin RulesetUpdateResponsePhase = "http_request_origin" - RulesetUpdateResponsePhaseHTTPRequestRedirect RulesetUpdateResponsePhase = "http_request_redirect" - RulesetUpdateResponsePhaseHTTPRequestSanitize RulesetUpdateResponsePhase = "http_request_sanitize" - RulesetUpdateResponsePhaseHTTPRequestSBFM RulesetUpdateResponsePhase = "http_request_sbfm" - RulesetUpdateResponsePhaseHTTPRequestSelectConfiguration RulesetUpdateResponsePhase = "http_request_select_configuration" - RulesetUpdateResponsePhaseHTTPRequestTransform RulesetUpdateResponsePhase = "http_request_transform" - RulesetUpdateResponsePhaseHTTPResponseCompression RulesetUpdateResponsePhase = "http_response_compression" - RulesetUpdateResponsePhaseHTTPResponseFirewallManaged RulesetUpdateResponsePhase = "http_response_firewall_managed" - RulesetUpdateResponsePhaseHTTPResponseHeadersTransform RulesetUpdateResponsePhase = "http_response_headers_transform" - RulesetUpdateResponsePhaseMagicTransit RulesetUpdateResponsePhase = "magic_transit" - RulesetUpdateResponsePhaseMagicTransitIDsManaged RulesetUpdateResponsePhase = "magic_transit_ids_managed" - RulesetUpdateResponsePhaseMagicTransitManaged RulesetUpdateResponsePhase = "magic_transit_managed" -) - -func (r RulesetUpdateResponsePhase) IsKnown() bool { - switch r { - case RulesetUpdateResponsePhaseDDoSL4, RulesetUpdateResponsePhaseDDoSL7, RulesetUpdateResponsePhaseHTTPConfigSettings, RulesetUpdateResponsePhaseHTTPCustomErrors, RulesetUpdateResponsePhaseHTTPLogCustomFields, RulesetUpdateResponsePhaseHTTPRatelimit, RulesetUpdateResponsePhaseHTTPRequestCacheSettings, RulesetUpdateResponsePhaseHTTPRequestDynamicRedirect, RulesetUpdateResponsePhaseHTTPRequestFirewallCustom, RulesetUpdateResponsePhaseHTTPRequestFirewallManaged, RulesetUpdateResponsePhaseHTTPRequestLateTransform, RulesetUpdateResponsePhaseHTTPRequestOrigin, RulesetUpdateResponsePhaseHTTPRequestRedirect, RulesetUpdateResponsePhaseHTTPRequestSanitize, RulesetUpdateResponsePhaseHTTPRequestSBFM, RulesetUpdateResponsePhaseHTTPRequestSelectConfiguration, RulesetUpdateResponsePhaseHTTPRequestTransform, RulesetUpdateResponsePhaseHTTPResponseCompression, RulesetUpdateResponsePhaseHTTPResponseFirewallManaged, RulesetUpdateResponsePhaseHTTPResponseHeadersTransform, RulesetUpdateResponsePhaseMagicTransit, RulesetUpdateResponsePhaseMagicTransitIDsManaged, RulesetUpdateResponsePhaseMagicTransitManaged: - return true - } - return false -} - type RulesetUpdateResponseRule struct { // The action to perform when the rule matches. Action RulesetUpdateResponseRulesAction `json:"action"` @@ -814,13 +704,13 @@ type RulesetGetResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind RulesetGetResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase RulesetGetResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []RulesetGetResponseRule `json:"rules,required"` // The version of the ruleset. @@ -853,61 +743,6 @@ func (r rulesetGetResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type RulesetGetResponseKind string - -const ( - RulesetGetResponseKindManaged RulesetGetResponseKind = "managed" - RulesetGetResponseKindCustom RulesetGetResponseKind = "custom" - RulesetGetResponseKindRoot RulesetGetResponseKind = "root" - RulesetGetResponseKindZone RulesetGetResponseKind = "zone" -) - -func (r RulesetGetResponseKind) IsKnown() bool { - switch r { - case RulesetGetResponseKindManaged, RulesetGetResponseKindCustom, RulesetGetResponseKindRoot, RulesetGetResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RulesetGetResponsePhase string - -const ( - RulesetGetResponsePhaseDDoSL4 RulesetGetResponsePhase = "ddos_l4" - RulesetGetResponsePhaseDDoSL7 RulesetGetResponsePhase = "ddos_l7" - RulesetGetResponsePhaseHTTPConfigSettings RulesetGetResponsePhase = "http_config_settings" - RulesetGetResponsePhaseHTTPCustomErrors RulesetGetResponsePhase = "http_custom_errors" - RulesetGetResponsePhaseHTTPLogCustomFields RulesetGetResponsePhase = "http_log_custom_fields" - RulesetGetResponsePhaseHTTPRatelimit RulesetGetResponsePhase = "http_ratelimit" - RulesetGetResponsePhaseHTTPRequestCacheSettings RulesetGetResponsePhase = "http_request_cache_settings" - RulesetGetResponsePhaseHTTPRequestDynamicRedirect RulesetGetResponsePhase = "http_request_dynamic_redirect" - RulesetGetResponsePhaseHTTPRequestFirewallCustom RulesetGetResponsePhase = "http_request_firewall_custom" - RulesetGetResponsePhaseHTTPRequestFirewallManaged RulesetGetResponsePhase = "http_request_firewall_managed" - RulesetGetResponsePhaseHTTPRequestLateTransform RulesetGetResponsePhase = "http_request_late_transform" - RulesetGetResponsePhaseHTTPRequestOrigin RulesetGetResponsePhase = "http_request_origin" - RulesetGetResponsePhaseHTTPRequestRedirect RulesetGetResponsePhase = "http_request_redirect" - RulesetGetResponsePhaseHTTPRequestSanitize RulesetGetResponsePhase = "http_request_sanitize" - RulesetGetResponsePhaseHTTPRequestSBFM RulesetGetResponsePhase = "http_request_sbfm" - RulesetGetResponsePhaseHTTPRequestSelectConfiguration RulesetGetResponsePhase = "http_request_select_configuration" - RulesetGetResponsePhaseHTTPRequestTransform RulesetGetResponsePhase = "http_request_transform" - RulesetGetResponsePhaseHTTPResponseCompression RulesetGetResponsePhase = "http_response_compression" - RulesetGetResponsePhaseHTTPResponseFirewallManaged RulesetGetResponsePhase = "http_response_firewall_managed" - RulesetGetResponsePhaseHTTPResponseHeadersTransform RulesetGetResponsePhase = "http_response_headers_transform" - RulesetGetResponsePhaseMagicTransit RulesetGetResponsePhase = "magic_transit" - RulesetGetResponsePhaseMagicTransitIDsManaged RulesetGetResponsePhase = "magic_transit_ids_managed" - RulesetGetResponsePhaseMagicTransitManaged RulesetGetResponsePhase = "magic_transit_managed" -) - -func (r RulesetGetResponsePhase) IsKnown() bool { - switch r { - case RulesetGetResponsePhaseDDoSL4, RulesetGetResponsePhaseDDoSL7, RulesetGetResponsePhaseHTTPConfigSettings, RulesetGetResponsePhaseHTTPCustomErrors, RulesetGetResponsePhaseHTTPLogCustomFields, RulesetGetResponsePhaseHTTPRatelimit, RulesetGetResponsePhaseHTTPRequestCacheSettings, RulesetGetResponsePhaseHTTPRequestDynamicRedirect, RulesetGetResponsePhaseHTTPRequestFirewallCustom, RulesetGetResponsePhaseHTTPRequestFirewallManaged, RulesetGetResponsePhaseHTTPRequestLateTransform, RulesetGetResponsePhaseHTTPRequestOrigin, RulesetGetResponsePhaseHTTPRequestRedirect, RulesetGetResponsePhaseHTTPRequestSanitize, RulesetGetResponsePhaseHTTPRequestSBFM, RulesetGetResponsePhaseHTTPRequestSelectConfiguration, RulesetGetResponsePhaseHTTPRequestTransform, RulesetGetResponsePhaseHTTPResponseCompression, RulesetGetResponsePhaseHTTPResponseFirewallManaged, RulesetGetResponsePhaseHTTPResponseHeadersTransform, RulesetGetResponsePhaseMagicTransit, RulesetGetResponsePhaseMagicTransitIDsManaged, RulesetGetResponsePhaseMagicTransitManaged: - return true - } - return false -} - type RulesetGetResponseRule struct { // The action to perform when the rule matches. Action RulesetGetResponseRulesAction `json:"action"` @@ -1090,11 +925,11 @@ func (r RulesetGetResponseRulesAction) IsKnown() bool { type RulesetNewParams struct { // The kind of the ruleset. - Kind param.Field[RulesetNewParamsKind] `json:"kind,required"` + Kind param.Field[Kind] `json:"kind,required"` // The human-readable name of the ruleset. Name param.Field[string] `json:"name,required"` // The phase of the ruleset. - Phase param.Field[RulesetNewParamsPhase] `json:"phase,required"` + Phase param.Field[Phase] `json:"phase,required"` // The list of rules in the ruleset. Rules param.Field[[]RulesetNewParamsRuleUnion] `json:"rules,required"` // The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -1109,61 +944,6 @@ func (r RulesetNewParams) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// The kind of the ruleset. -type RulesetNewParamsKind string - -const ( - RulesetNewParamsKindManaged RulesetNewParamsKind = "managed" - RulesetNewParamsKindCustom RulesetNewParamsKind = "custom" - RulesetNewParamsKindRoot RulesetNewParamsKind = "root" - RulesetNewParamsKindZone RulesetNewParamsKind = "zone" -) - -func (r RulesetNewParamsKind) IsKnown() bool { - switch r { - case RulesetNewParamsKindManaged, RulesetNewParamsKindCustom, RulesetNewParamsKindRoot, RulesetNewParamsKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RulesetNewParamsPhase string - -const ( - RulesetNewParamsPhaseDDoSL4 RulesetNewParamsPhase = "ddos_l4" - RulesetNewParamsPhaseDDoSL7 RulesetNewParamsPhase = "ddos_l7" - RulesetNewParamsPhaseHTTPConfigSettings RulesetNewParamsPhase = "http_config_settings" - RulesetNewParamsPhaseHTTPCustomErrors RulesetNewParamsPhase = "http_custom_errors" - RulesetNewParamsPhaseHTTPLogCustomFields RulesetNewParamsPhase = "http_log_custom_fields" - RulesetNewParamsPhaseHTTPRatelimit RulesetNewParamsPhase = "http_ratelimit" - RulesetNewParamsPhaseHTTPRequestCacheSettings RulesetNewParamsPhase = "http_request_cache_settings" - RulesetNewParamsPhaseHTTPRequestDynamicRedirect RulesetNewParamsPhase = "http_request_dynamic_redirect" - RulesetNewParamsPhaseHTTPRequestFirewallCustom RulesetNewParamsPhase = "http_request_firewall_custom" - RulesetNewParamsPhaseHTTPRequestFirewallManaged RulesetNewParamsPhase = "http_request_firewall_managed" - RulesetNewParamsPhaseHTTPRequestLateTransform RulesetNewParamsPhase = "http_request_late_transform" - RulesetNewParamsPhaseHTTPRequestOrigin RulesetNewParamsPhase = "http_request_origin" - RulesetNewParamsPhaseHTTPRequestRedirect RulesetNewParamsPhase = "http_request_redirect" - RulesetNewParamsPhaseHTTPRequestSanitize RulesetNewParamsPhase = "http_request_sanitize" - RulesetNewParamsPhaseHTTPRequestSBFM RulesetNewParamsPhase = "http_request_sbfm" - RulesetNewParamsPhaseHTTPRequestSelectConfiguration RulesetNewParamsPhase = "http_request_select_configuration" - RulesetNewParamsPhaseHTTPRequestTransform RulesetNewParamsPhase = "http_request_transform" - RulesetNewParamsPhaseHTTPResponseCompression RulesetNewParamsPhase = "http_response_compression" - RulesetNewParamsPhaseHTTPResponseFirewallManaged RulesetNewParamsPhase = "http_response_firewall_managed" - RulesetNewParamsPhaseHTTPResponseHeadersTransform RulesetNewParamsPhase = "http_response_headers_transform" - RulesetNewParamsPhaseMagicTransit RulesetNewParamsPhase = "magic_transit" - RulesetNewParamsPhaseMagicTransitIDsManaged RulesetNewParamsPhase = "magic_transit_ids_managed" - RulesetNewParamsPhaseMagicTransitManaged RulesetNewParamsPhase = "magic_transit_managed" -) - -func (r RulesetNewParamsPhase) IsKnown() bool { - switch r { - case RulesetNewParamsPhaseDDoSL4, RulesetNewParamsPhaseDDoSL7, RulesetNewParamsPhaseHTTPConfigSettings, RulesetNewParamsPhaseHTTPCustomErrors, RulesetNewParamsPhaseHTTPLogCustomFields, RulesetNewParamsPhaseHTTPRatelimit, RulesetNewParamsPhaseHTTPRequestCacheSettings, RulesetNewParamsPhaseHTTPRequestDynamicRedirect, RulesetNewParamsPhaseHTTPRequestFirewallCustom, RulesetNewParamsPhaseHTTPRequestFirewallManaged, RulesetNewParamsPhaseHTTPRequestLateTransform, RulesetNewParamsPhaseHTTPRequestOrigin, RulesetNewParamsPhaseHTTPRequestRedirect, RulesetNewParamsPhaseHTTPRequestSanitize, RulesetNewParamsPhaseHTTPRequestSBFM, RulesetNewParamsPhaseHTTPRequestSelectConfiguration, RulesetNewParamsPhaseHTTPRequestTransform, RulesetNewParamsPhaseHTTPResponseCompression, RulesetNewParamsPhaseHTTPResponseFirewallManaged, RulesetNewParamsPhaseHTTPResponseHeadersTransform, RulesetNewParamsPhaseMagicTransit, RulesetNewParamsPhaseMagicTransitIDsManaged, RulesetNewParamsPhaseMagicTransitManaged: - return true - } - return false -} - type RulesetNewParamsRule struct { // The action to perform when the rule matches. Action param.Field[RulesetNewParamsRulesAction] `json:"action"` @@ -1391,11 +1171,11 @@ type RulesetUpdateParams struct { // An informative description of the ruleset. Description param.Field[string] `json:"description"` // The kind of the ruleset. - Kind param.Field[RulesetUpdateParamsKind] `json:"kind"` + Kind param.Field[Kind] `json:"kind"` // The human-readable name of the ruleset. Name param.Field[string] `json:"name"` // The phase of the ruleset. - Phase param.Field[RulesetUpdateParamsPhase] `json:"phase"` + Phase param.Field[Phase] `json:"phase"` } func (r RulesetUpdateParams) MarshalJSON() (data []byte, err error) { @@ -1468,61 +1248,6 @@ func (r RulesetUpdateParamsRulesAction) IsKnown() bool { return false } -// The kind of the ruleset. -type RulesetUpdateParamsKind string - -const ( - RulesetUpdateParamsKindManaged RulesetUpdateParamsKind = "managed" - RulesetUpdateParamsKindCustom RulesetUpdateParamsKind = "custom" - RulesetUpdateParamsKindRoot RulesetUpdateParamsKind = "root" - RulesetUpdateParamsKindZone RulesetUpdateParamsKind = "zone" -) - -func (r RulesetUpdateParamsKind) IsKnown() bool { - switch r { - case RulesetUpdateParamsKindManaged, RulesetUpdateParamsKindCustom, RulesetUpdateParamsKindRoot, RulesetUpdateParamsKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type RulesetUpdateParamsPhase string - -const ( - RulesetUpdateParamsPhaseDDoSL4 RulesetUpdateParamsPhase = "ddos_l4" - RulesetUpdateParamsPhaseDDoSL7 RulesetUpdateParamsPhase = "ddos_l7" - RulesetUpdateParamsPhaseHTTPConfigSettings RulesetUpdateParamsPhase = "http_config_settings" - RulesetUpdateParamsPhaseHTTPCustomErrors RulesetUpdateParamsPhase = "http_custom_errors" - RulesetUpdateParamsPhaseHTTPLogCustomFields RulesetUpdateParamsPhase = "http_log_custom_fields" - RulesetUpdateParamsPhaseHTTPRatelimit RulesetUpdateParamsPhase = "http_ratelimit" - RulesetUpdateParamsPhaseHTTPRequestCacheSettings RulesetUpdateParamsPhase = "http_request_cache_settings" - RulesetUpdateParamsPhaseHTTPRequestDynamicRedirect RulesetUpdateParamsPhase = "http_request_dynamic_redirect" - RulesetUpdateParamsPhaseHTTPRequestFirewallCustom RulesetUpdateParamsPhase = "http_request_firewall_custom" - RulesetUpdateParamsPhaseHTTPRequestFirewallManaged RulesetUpdateParamsPhase = "http_request_firewall_managed" - RulesetUpdateParamsPhaseHTTPRequestLateTransform RulesetUpdateParamsPhase = "http_request_late_transform" - RulesetUpdateParamsPhaseHTTPRequestOrigin RulesetUpdateParamsPhase = "http_request_origin" - RulesetUpdateParamsPhaseHTTPRequestRedirect RulesetUpdateParamsPhase = "http_request_redirect" - RulesetUpdateParamsPhaseHTTPRequestSanitize RulesetUpdateParamsPhase = "http_request_sanitize" - RulesetUpdateParamsPhaseHTTPRequestSBFM RulesetUpdateParamsPhase = "http_request_sbfm" - RulesetUpdateParamsPhaseHTTPRequestSelectConfiguration RulesetUpdateParamsPhase = "http_request_select_configuration" - RulesetUpdateParamsPhaseHTTPRequestTransform RulesetUpdateParamsPhase = "http_request_transform" - RulesetUpdateParamsPhaseHTTPResponseCompression RulesetUpdateParamsPhase = "http_response_compression" - RulesetUpdateParamsPhaseHTTPResponseFirewallManaged RulesetUpdateParamsPhase = "http_response_firewall_managed" - RulesetUpdateParamsPhaseHTTPResponseHeadersTransform RulesetUpdateParamsPhase = "http_response_headers_transform" - RulesetUpdateParamsPhaseMagicTransit RulesetUpdateParamsPhase = "magic_transit" - RulesetUpdateParamsPhaseMagicTransitIDsManaged RulesetUpdateParamsPhase = "magic_transit_ids_managed" - RulesetUpdateParamsPhaseMagicTransitManaged RulesetUpdateParamsPhase = "magic_transit_managed" -) - -func (r RulesetUpdateParamsPhase) IsKnown() bool { - switch r { - case RulesetUpdateParamsPhaseDDoSL4, RulesetUpdateParamsPhaseDDoSL7, RulesetUpdateParamsPhaseHTTPConfigSettings, RulesetUpdateParamsPhaseHTTPCustomErrors, RulesetUpdateParamsPhaseHTTPLogCustomFields, RulesetUpdateParamsPhaseHTTPRatelimit, RulesetUpdateParamsPhaseHTTPRequestCacheSettings, RulesetUpdateParamsPhaseHTTPRequestDynamicRedirect, RulesetUpdateParamsPhaseHTTPRequestFirewallCustom, RulesetUpdateParamsPhaseHTTPRequestFirewallManaged, RulesetUpdateParamsPhaseHTTPRequestLateTransform, RulesetUpdateParamsPhaseHTTPRequestOrigin, RulesetUpdateParamsPhaseHTTPRequestRedirect, RulesetUpdateParamsPhaseHTTPRequestSanitize, RulesetUpdateParamsPhaseHTTPRequestSBFM, RulesetUpdateParamsPhaseHTTPRequestSelectConfiguration, RulesetUpdateParamsPhaseHTTPRequestTransform, RulesetUpdateParamsPhaseHTTPResponseCompression, RulesetUpdateParamsPhaseHTTPResponseFirewallManaged, RulesetUpdateParamsPhaseHTTPResponseHeadersTransform, RulesetUpdateParamsPhaseMagicTransit, RulesetUpdateParamsPhaseMagicTransitIDsManaged, RulesetUpdateParamsPhaseMagicTransitManaged: - return true - } - return false -} - // A response object. type RulesetUpdateResponseEnvelope struct { // A list of error messages. diff --git a/rulesets/ruleset_test.go b/rulesets/ruleset_test.go index 56bc36baf44..2a247ef2333 100644 --- a/rulesets/ruleset_test.go +++ b/rulesets/ruleset_test.go @@ -15,7 +15,7 @@ import ( ) func TestRulesetNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -29,9 +29,9 @@ func TestRulesetNewWithOptionalParams(t *testing.T) { option.WithAPIEmail("user@example.com"), ) _, err := client.Rulesets.New(context.TODO(), rulesets.RulesetNewParams{ - Kind: cloudflare.F(rulesets.RulesetNewParamsKindRoot), + Kind: cloudflare.F(rulesets.KindRoot), Name: cloudflare.F("My ruleset"), - Phase: cloudflare.F(rulesets.RulesetNewParamsPhaseHTTPRequestFirewallCustom), + Phase: cloudflare.F(rulesets.PhaseHTTPRequestFirewallCustom), Rules: cloudflare.F([]rulesets.RulesetNewParamsRuleUnion{rulesets.BlockRuleParam{ Action: cloudflare.F(rulesets.BlockRuleActionBlock), ActionParameters: cloudflare.F(rulesets.BlockRuleActionParametersParam{ @@ -98,7 +98,7 @@ func TestRulesetNewWithOptionalParams(t *testing.T) { } func TestRulesetUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -170,9 +170,9 @@ func TestRulesetUpdateWithOptionalParams(t *testing.T) { AccountID: cloudflare.F("string"), ZoneID: cloudflare.F("string"), Description: cloudflare.F("My ruleset to execute managed rulesets"), - Kind: cloudflare.F(rulesets.RulesetUpdateParamsKindRoot), + Kind: cloudflare.F(rulesets.KindRoot), Name: cloudflare.F("My ruleset"), - Phase: cloudflare.F(rulesets.RulesetUpdateParamsPhaseHTTPRequestFirewallCustom), + Phase: cloudflare.F(rulesets.PhaseHTTPRequestFirewallCustom), }, ) if err != nil { @@ -185,7 +185,7 @@ func TestRulesetUpdateWithOptionalParams(t *testing.T) { } func TestRulesetListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -212,7 +212,7 @@ func TestRulesetListWithOptionalParams(t *testing.T) { } func TestRulesetDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -243,7 +243,7 @@ func TestRulesetDeleteWithOptionalParams(t *testing.T) { } func TestRulesetGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rulesets/version.go b/rulesets/version.go index f664a61c909..a973e839699 100644 --- a/rulesets/version.go +++ b/rulesets/version.go @@ -51,7 +51,7 @@ func (r *VersionService) List(ctx context.Context, rulesetID string, query Versi accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/rulesets/%s/versions", accountOrZone, accountOrZoneID, rulesetID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -113,13 +113,13 @@ type VersionGetResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind VersionGetResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase VersionGetResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []VersionGetResponseRule `json:"rules,required"` // The version of the ruleset. @@ -152,61 +152,6 @@ func (r versionGetResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type VersionGetResponseKind string - -const ( - VersionGetResponseKindManaged VersionGetResponseKind = "managed" - VersionGetResponseKindCustom VersionGetResponseKind = "custom" - VersionGetResponseKindRoot VersionGetResponseKind = "root" - VersionGetResponseKindZone VersionGetResponseKind = "zone" -) - -func (r VersionGetResponseKind) IsKnown() bool { - switch r { - case VersionGetResponseKindManaged, VersionGetResponseKindCustom, VersionGetResponseKindRoot, VersionGetResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type VersionGetResponsePhase string - -const ( - VersionGetResponsePhaseDDoSL4 VersionGetResponsePhase = "ddos_l4" - VersionGetResponsePhaseDDoSL7 VersionGetResponsePhase = "ddos_l7" - VersionGetResponsePhaseHTTPConfigSettings VersionGetResponsePhase = "http_config_settings" - VersionGetResponsePhaseHTTPCustomErrors VersionGetResponsePhase = "http_custom_errors" - VersionGetResponsePhaseHTTPLogCustomFields VersionGetResponsePhase = "http_log_custom_fields" - VersionGetResponsePhaseHTTPRatelimit VersionGetResponsePhase = "http_ratelimit" - VersionGetResponsePhaseHTTPRequestCacheSettings VersionGetResponsePhase = "http_request_cache_settings" - VersionGetResponsePhaseHTTPRequestDynamicRedirect VersionGetResponsePhase = "http_request_dynamic_redirect" - VersionGetResponsePhaseHTTPRequestFirewallCustom VersionGetResponsePhase = "http_request_firewall_custom" - VersionGetResponsePhaseHTTPRequestFirewallManaged VersionGetResponsePhase = "http_request_firewall_managed" - VersionGetResponsePhaseHTTPRequestLateTransform VersionGetResponsePhase = "http_request_late_transform" - VersionGetResponsePhaseHTTPRequestOrigin VersionGetResponsePhase = "http_request_origin" - VersionGetResponsePhaseHTTPRequestRedirect VersionGetResponsePhase = "http_request_redirect" - VersionGetResponsePhaseHTTPRequestSanitize VersionGetResponsePhase = "http_request_sanitize" - VersionGetResponsePhaseHTTPRequestSBFM VersionGetResponsePhase = "http_request_sbfm" - VersionGetResponsePhaseHTTPRequestSelectConfiguration VersionGetResponsePhase = "http_request_select_configuration" - VersionGetResponsePhaseHTTPRequestTransform VersionGetResponsePhase = "http_request_transform" - VersionGetResponsePhaseHTTPResponseCompression VersionGetResponsePhase = "http_response_compression" - VersionGetResponsePhaseHTTPResponseFirewallManaged VersionGetResponsePhase = "http_response_firewall_managed" - VersionGetResponsePhaseHTTPResponseHeadersTransform VersionGetResponsePhase = "http_response_headers_transform" - VersionGetResponsePhaseMagicTransit VersionGetResponsePhase = "magic_transit" - VersionGetResponsePhaseMagicTransitIDsManaged VersionGetResponsePhase = "magic_transit_ids_managed" - VersionGetResponsePhaseMagicTransitManaged VersionGetResponsePhase = "magic_transit_managed" -) - -func (r VersionGetResponsePhase) IsKnown() bool { - switch r { - case VersionGetResponsePhaseDDoSL4, VersionGetResponsePhaseDDoSL7, VersionGetResponsePhaseHTTPConfigSettings, VersionGetResponsePhaseHTTPCustomErrors, VersionGetResponsePhaseHTTPLogCustomFields, VersionGetResponsePhaseHTTPRatelimit, VersionGetResponsePhaseHTTPRequestCacheSettings, VersionGetResponsePhaseHTTPRequestDynamicRedirect, VersionGetResponsePhaseHTTPRequestFirewallCustom, VersionGetResponsePhaseHTTPRequestFirewallManaged, VersionGetResponsePhaseHTTPRequestLateTransform, VersionGetResponsePhaseHTTPRequestOrigin, VersionGetResponsePhaseHTTPRequestRedirect, VersionGetResponsePhaseHTTPRequestSanitize, VersionGetResponsePhaseHTTPRequestSBFM, VersionGetResponsePhaseHTTPRequestSelectConfiguration, VersionGetResponsePhaseHTTPRequestTransform, VersionGetResponsePhaseHTTPResponseCompression, VersionGetResponsePhaseHTTPResponseFirewallManaged, VersionGetResponsePhaseHTTPResponseHeadersTransform, VersionGetResponsePhaseMagicTransit, VersionGetResponsePhaseMagicTransitIDsManaged, VersionGetResponsePhaseMagicTransitManaged: - return true - } - return false -} - type VersionGetResponseRule struct { // The action to perform when the rule matches. Action VersionGetResponseRulesAction `json:"action"` diff --git a/rulesets/version_test.go b/rulesets/version_test.go index d8104913890..1530094666b 100644 --- a/rulesets/version_test.go +++ b/rulesets/version_test.go @@ -15,7 +15,7 @@ import ( ) func TestVersionListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +46,7 @@ func TestVersionListWithOptionalParams(t *testing.T) { } func TestVersionDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -78,7 +78,7 @@ func TestVersionDeleteWithOptionalParams(t *testing.T) { } func TestVersionGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rulesets/versionbytag.go b/rulesets/versionbytag.go index 6ac3a82af3a..ca5d8523dac 100644 --- a/rulesets/versionbytag.go +++ b/rulesets/versionbytag.go @@ -52,13 +52,13 @@ type VersionByTagGetResponse struct { // The unique ID of the ruleset. ID string `json:"id,required"` // The kind of the ruleset. - Kind VersionByTagGetResponseKind `json:"kind,required"` + Kind Kind `json:"kind,required"` // The timestamp of when the ruleset was last modified. LastUpdated time.Time `json:"last_updated,required" format:"date-time"` // The human-readable name of the ruleset. Name string `json:"name,required"` // The phase of the ruleset. - Phase VersionByTagGetResponsePhase `json:"phase,required"` + Phase Phase `json:"phase,required"` // The list of rules in the ruleset. Rules []VersionByTagGetResponseRule `json:"rules,required"` // The version of the ruleset. @@ -91,61 +91,6 @@ func (r versionByTagGetResponseJSON) RawJSON() string { return r.raw } -// The kind of the ruleset. -type VersionByTagGetResponseKind string - -const ( - VersionByTagGetResponseKindManaged VersionByTagGetResponseKind = "managed" - VersionByTagGetResponseKindCustom VersionByTagGetResponseKind = "custom" - VersionByTagGetResponseKindRoot VersionByTagGetResponseKind = "root" - VersionByTagGetResponseKindZone VersionByTagGetResponseKind = "zone" -) - -func (r VersionByTagGetResponseKind) IsKnown() bool { - switch r { - case VersionByTagGetResponseKindManaged, VersionByTagGetResponseKindCustom, VersionByTagGetResponseKindRoot, VersionByTagGetResponseKindZone: - return true - } - return false -} - -// The phase of the ruleset. -type VersionByTagGetResponsePhase string - -const ( - VersionByTagGetResponsePhaseDDoSL4 VersionByTagGetResponsePhase = "ddos_l4" - VersionByTagGetResponsePhaseDDoSL7 VersionByTagGetResponsePhase = "ddos_l7" - VersionByTagGetResponsePhaseHTTPConfigSettings VersionByTagGetResponsePhase = "http_config_settings" - VersionByTagGetResponsePhaseHTTPCustomErrors VersionByTagGetResponsePhase = "http_custom_errors" - VersionByTagGetResponsePhaseHTTPLogCustomFields VersionByTagGetResponsePhase = "http_log_custom_fields" - VersionByTagGetResponsePhaseHTTPRatelimit VersionByTagGetResponsePhase = "http_ratelimit" - VersionByTagGetResponsePhaseHTTPRequestCacheSettings VersionByTagGetResponsePhase = "http_request_cache_settings" - VersionByTagGetResponsePhaseHTTPRequestDynamicRedirect VersionByTagGetResponsePhase = "http_request_dynamic_redirect" - VersionByTagGetResponsePhaseHTTPRequestFirewallCustom VersionByTagGetResponsePhase = "http_request_firewall_custom" - VersionByTagGetResponsePhaseHTTPRequestFirewallManaged VersionByTagGetResponsePhase = "http_request_firewall_managed" - VersionByTagGetResponsePhaseHTTPRequestLateTransform VersionByTagGetResponsePhase = "http_request_late_transform" - VersionByTagGetResponsePhaseHTTPRequestOrigin VersionByTagGetResponsePhase = "http_request_origin" - VersionByTagGetResponsePhaseHTTPRequestRedirect VersionByTagGetResponsePhase = "http_request_redirect" - VersionByTagGetResponsePhaseHTTPRequestSanitize VersionByTagGetResponsePhase = "http_request_sanitize" - VersionByTagGetResponsePhaseHTTPRequestSBFM VersionByTagGetResponsePhase = "http_request_sbfm" - VersionByTagGetResponsePhaseHTTPRequestSelectConfiguration VersionByTagGetResponsePhase = "http_request_select_configuration" - VersionByTagGetResponsePhaseHTTPRequestTransform VersionByTagGetResponsePhase = "http_request_transform" - VersionByTagGetResponsePhaseHTTPResponseCompression VersionByTagGetResponsePhase = "http_response_compression" - VersionByTagGetResponsePhaseHTTPResponseFirewallManaged VersionByTagGetResponsePhase = "http_response_firewall_managed" - VersionByTagGetResponsePhaseHTTPResponseHeadersTransform VersionByTagGetResponsePhase = "http_response_headers_transform" - VersionByTagGetResponsePhaseMagicTransit VersionByTagGetResponsePhase = "magic_transit" - VersionByTagGetResponsePhaseMagicTransitIDsManaged VersionByTagGetResponsePhase = "magic_transit_ids_managed" - VersionByTagGetResponsePhaseMagicTransitManaged VersionByTagGetResponsePhase = "magic_transit_managed" -) - -func (r VersionByTagGetResponsePhase) IsKnown() bool { - switch r { - case VersionByTagGetResponsePhaseDDoSL4, VersionByTagGetResponsePhaseDDoSL7, VersionByTagGetResponsePhaseHTTPConfigSettings, VersionByTagGetResponsePhaseHTTPCustomErrors, VersionByTagGetResponsePhaseHTTPLogCustomFields, VersionByTagGetResponsePhaseHTTPRatelimit, VersionByTagGetResponsePhaseHTTPRequestCacheSettings, VersionByTagGetResponsePhaseHTTPRequestDynamicRedirect, VersionByTagGetResponsePhaseHTTPRequestFirewallCustom, VersionByTagGetResponsePhaseHTTPRequestFirewallManaged, VersionByTagGetResponsePhaseHTTPRequestLateTransform, VersionByTagGetResponsePhaseHTTPRequestOrigin, VersionByTagGetResponsePhaseHTTPRequestRedirect, VersionByTagGetResponsePhaseHTTPRequestSanitize, VersionByTagGetResponsePhaseHTTPRequestSBFM, VersionByTagGetResponsePhaseHTTPRequestSelectConfiguration, VersionByTagGetResponsePhaseHTTPRequestTransform, VersionByTagGetResponsePhaseHTTPResponseCompression, VersionByTagGetResponsePhaseHTTPResponseFirewallManaged, VersionByTagGetResponsePhaseHTTPResponseHeadersTransform, VersionByTagGetResponsePhaseMagicTransit, VersionByTagGetResponsePhaseMagicTransitIDsManaged, VersionByTagGetResponsePhaseMagicTransitManaged: - return true - } - return false -} - type VersionByTagGetResponseRule struct { // The action to perform when the rule matches. Action VersionByTagGetResponseRulesAction `json:"action"` diff --git a/rulesets/versionbytag_test.go b/rulesets/versionbytag_test.go index 6b3ef6aa726..29a8a6ee7be 100644 --- a/rulesets/versionbytag_test.go +++ b/rulesets/versionbytag_test.go @@ -15,7 +15,6 @@ import ( ) func TestVersionByTagGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rum/aliases.go b/rum/aliases.go index 4449cec432c..62d91bd1be0 100644 --- a/rum/aliases.go +++ b/rum/aliases.go @@ -4,7 +4,7 @@ package rum import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/rum/rule.go b/rum/rule.go index c23f7b26c23..def79fb8450 100644 --- a/rum/rule.go +++ b/rum/rule.go @@ -212,19 +212,13 @@ func (r RuleNewParams) MarshalJSON() (data []byte, err error) { } type RuleNewResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result RUMRule `json:"result"` - JSON ruleNewResponseEnvelopeJSON `json:"-"` + Result RUMRule `json:"result"` + JSON ruleNewResponseEnvelopeJSON `json:"-"` } // ruleNewResponseEnvelopeJSON contains the JSON metadata for the struct // [RuleNewResponseEnvelope] type ruleNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field Result apijson.Field raw string ExtraFields map[string]apijson.Field @@ -254,19 +248,13 @@ func (r RuleUpdateParams) MarshalJSON() (data []byte, err error) { } type RuleUpdateResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result RUMRule `json:"result"` - JSON ruleUpdateResponseEnvelopeJSON `json:"-"` + Result RUMRule `json:"result"` + JSON ruleUpdateResponseEnvelopeJSON `json:"-"` } // ruleUpdateResponseEnvelopeJSON contains the JSON metadata for the struct // [RuleUpdateResponseEnvelope] type ruleUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field Result apijson.Field raw string ExtraFields map[string]apijson.Field @@ -286,19 +274,13 @@ type RuleListParams struct { } type RuleListResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result RuleListResponse `json:"result"` - JSON ruleListResponseEnvelopeJSON `json:"-"` + Result RuleListResponse `json:"result"` + JSON ruleListResponseEnvelopeJSON `json:"-"` } // ruleListResponseEnvelopeJSON contains the JSON metadata for the struct // [RuleListResponseEnvelope] type ruleListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field Result apijson.Field raw string ExtraFields map[string]apijson.Field @@ -318,19 +300,13 @@ type RuleDeleteParams struct { } type RuleDeleteResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result RuleDeleteResponse `json:"result"` - JSON ruleDeleteResponseEnvelopeJSON `json:"-"` + Result RuleDeleteResponse `json:"result"` + JSON ruleDeleteResponseEnvelopeJSON `json:"-"` } // ruleDeleteResponseEnvelopeJSON contains the JSON metadata for the struct // [RuleDeleteResponseEnvelope] type ruleDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field Result apijson.Field raw string ExtraFields map[string]apijson.Field diff --git a/rum/rule_test.go b/rum/rule_test.go index 7c0d7e27457..eefb48565f1 100644 --- a/rum/rule_test.go +++ b/rum/rule_test.go @@ -15,7 +15,6 @@ import ( ) func TestRuleNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestRuleNewWithOptionalParams(t *testing.T) { } func TestRuleUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -84,7 +82,6 @@ func TestRuleUpdateWithOptionalParams(t *testing.T) { } func TestRuleList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -114,7 +111,6 @@ func TestRuleList(t *testing.T) { } func TestRuleDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/rum/siteinfo.go b/rum/siteinfo.go index 75f11805110..321d8ca4e26 100644 --- a/rum/siteinfo.go +++ b/rum/siteinfo.go @@ -215,19 +215,13 @@ func (r SiteInfoNewParams) MarshalJSON() (data []byte, err error) { } type SiteInfoNewResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result Site `json:"result"` - JSON siteInfoNewResponseEnvelopeJSON `json:"-"` + Result Site `json:"result"` + JSON siteInfoNewResponseEnvelopeJSON `json:"-"` } // siteInfoNewResponseEnvelopeJSON contains the JSON metadata for the struct // [SiteInfoNewResponseEnvelope] type siteInfoNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field Result apijson.Field raw string ExtraFields map[string]apijson.Field @@ -258,19 +252,13 @@ func (r SiteInfoUpdateParams) MarshalJSON() (data []byte, err error) { } type SiteInfoUpdateResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result Site `json:"result"` - JSON siteInfoUpdateResponseEnvelopeJSON `json:"-"` + Result Site `json:"result"` + JSON siteInfoUpdateResponseEnvelopeJSON `json:"-"` } // siteInfoUpdateResponseEnvelopeJSON contains the JSON metadata for the struct // [SiteInfoUpdateResponseEnvelope] type siteInfoUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field Result apijson.Field raw string ExtraFields map[string]apijson.Field @@ -325,19 +313,13 @@ type SiteInfoDeleteParams struct { } type SiteInfoDeleteResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result SiteInfoDeleteResponse `json:"result"` - JSON siteInfoDeleteResponseEnvelopeJSON `json:"-"` + Result SiteInfoDeleteResponse `json:"result"` + JSON siteInfoDeleteResponseEnvelopeJSON `json:"-"` } // siteInfoDeleteResponseEnvelopeJSON contains the JSON metadata for the struct // [SiteInfoDeleteResponseEnvelope] type siteInfoDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field Result apijson.Field raw string ExtraFields map[string]apijson.Field @@ -357,19 +339,13 @@ type SiteInfoGetParams struct { } type SiteInfoGetResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result Site `json:"result"` - JSON siteInfoGetResponseEnvelopeJSON `json:"-"` + Result Site `json:"result"` + JSON siteInfoGetResponseEnvelopeJSON `json:"-"` } // siteInfoGetResponseEnvelopeJSON contains the JSON metadata for the struct // [SiteInfoGetResponseEnvelope] type siteInfoGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field Result apijson.Field raw string ExtraFields map[string]apijson.Field diff --git a/rum/siteinfo_test.go b/rum/siteinfo_test.go index 08f01cc11bd..fe85401bffd 100644 --- a/rum/siteinfo_test.go +++ b/rum/siteinfo_test.go @@ -15,7 +15,6 @@ import ( ) func TestSiteInfoNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestSiteInfoNewWithOptionalParams(t *testing.T) { } func TestSiteInfoUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +75,6 @@ func TestSiteInfoUpdateWithOptionalParams(t *testing.T) { } func TestSiteInfoListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -106,7 +103,6 @@ func TestSiteInfoListWithOptionalParams(t *testing.T) { } func TestSiteInfoDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -136,7 +132,6 @@ func TestSiteInfoDelete(t *testing.T) { } func TestSiteInfoGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100755 index 00000000000..ed03e527a4d --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then + brew bundle check >/dev/null 2>&1 || { + echo "==> Installing Homebrew dependencies…" + brew bundle + } +fi + +echo "==> Installing Go dependencies…" + +go mod tidy diff --git a/scripts/format b/scripts/format new file mode 100755 index 00000000000..96a586faa27 --- /dev/null +++ b/scripts/format @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +gofmt ./... + diff --git a/scripts/mock b/scripts/mock new file mode 100755 index 00000000000..fe89a1d084f --- /dev/null +++ b/scripts/mock @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [[ -n "$1" && "$1" != '--'* ]]; then + URL="$1" + shift +else + URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" +fi + +# Check if the URL is empty +if [ -z "$URL" ]; then + echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" + exit 1 +fi + +echo "==> Starting mock server with URL ${URL}" + +# Run prism mock on the given spec +if [ "$1" == "--daemon" ]; then + npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log & + + # Wait for server to come online + echo -n "Waiting for server" + while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + echo -n "." + sleep 0.1 + done + + if grep -q "✖ fatal" ".prism.log"; then + cat .prism.log + exit 1 + fi + + echo +else + npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" +fi diff --git a/scripts/test b/scripts/test new file mode 100755 index 00000000000..b762a63707a --- /dev/null +++ b/scripts/test @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +function prism_is_running() { + curl --silent "http://localhost:4010" >/dev/null 2>&1 +} + +kill_server_on_port() { + pids=$(lsof -t -i tcp:"$1" || echo "") + if [ "$pids" != "" ]; then + kill "$pids" + echo "Stopped $pids." + fi +} + +function is_overriding_api_base_url() { + [ -n "$TEST_API_BASE_URL" ] +} + +if ! is_overriding_api_base_url && ! prism_is_running ; then + # When we exit this script, make sure to kill the background mock server process + trap 'kill_server_on_port 4010' EXIT + + # Start the dev server + ./scripts/mock --daemon +fi + +if is_overriding_api_base_url ; then + echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" + echo +elif ! prism_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" + echo -e "running against your OpenAPI spec." + echo + echo -e "To run the server, pass in the path or url of your OpenAPI" + echo -e "spec to the prism command:" + echo + echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" + echo + + exit 1 +else + echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo +fi + +# Run tests +echo "==> Running tests" +go test ./... "$@" diff --git a/secondary_dns/acl.go b/secondary_dns/acl.go index 1631e014aa7..a16b3e3fc5d 100644 --- a/secondary_dns/acl.go +++ b/secondary_dns/acl.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ACLService contains methods and other services that help with interacting with @@ -64,7 +64,7 @@ func (r *ACLService) List(ctx context.Context, query ACLListParams, opts ...opti opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/secondary_dns/acls", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -82,10 +82,10 @@ func (r *ACLService) ListAutoPaging(ctx context.Context, query ACLListParams, op } // Delete ACL. -func (r *ACLService) Delete(ctx context.Context, aclID string, params ACLDeleteParams, opts ...option.RequestOption) (res *ACLDeleteResponse, err error) { +func (r *ACLService) Delete(ctx context.Context, aclID string, body ACLDeleteParams, opts ...option.RequestOption) (res *ACLDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env ACLDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/secondary_dns/acls/%s", params.AccountID, aclID) + path := fmt.Sprintf("accounts/%s/secondary_dns/acls/%s", body.AccountID, aclID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -283,11 +283,6 @@ type ACLListParams struct { type ACLDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r ACLDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type ACLDeleteResponseEnvelope struct { diff --git a/secondary_dns/acl_test.go b/secondary_dns/acl_test.go index c63989f7f30..3edf85b2d9d 100644 --- a/secondary_dns/acl_test.go +++ b/secondary_dns/acl_test.go @@ -15,7 +15,7 @@ import ( ) func TestACLNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +42,6 @@ func TestACLNew(t *testing.T) { } func TestACLUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +75,6 @@ func TestACLUpdate(t *testing.T) { } func TestACLList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -102,7 +100,6 @@ func TestACLList(t *testing.T) { } func TestACLDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -120,7 +117,6 @@ func TestACLDelete(t *testing.T) { "23ff594956f20c2a721606e94745a8aa", secondary_dns.ACLDeleteParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -133,7 +129,6 @@ func TestACLDelete(t *testing.T) { } func TestACLGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/secondary_dns/aliases.go b/secondary_dns/aliases.go index badae850257..f1a24bdbfe8 100644 --- a/secondary_dns/aliases.go +++ b/secondary_dns/aliases.go @@ -4,7 +4,7 @@ package secondary_dns import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/secondary_dns/forceaxfr.go b/secondary_dns/forceaxfr.go index 062942ae145..8d28c18ced8 100644 --- a/secondary_dns/forceaxfr.go +++ b/secondary_dns/forceaxfr.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ForceAXFRService contains methods and other services that help with interacting @@ -36,7 +36,7 @@ func (r *ForceAXFRService) New(ctx context.Context, params ForceAXFRNewParams, o opts = append(r.Options[:], opts...) var env ForceAXFRNewResponseEnvelope path := fmt.Sprintf("zones/%s/secondary_dns/force_axfr", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } diff --git a/secondary_dns/forceaxfr_test.go b/secondary_dns/forceaxfr_test.go index ca75a7e43bc..1321d44aebe 100644 --- a/secondary_dns/forceaxfr_test.go +++ b/secondary_dns/forceaxfr_test.go @@ -15,7 +15,6 @@ import ( ) func TestForceAXFRNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/secondary_dns/incoming.go b/secondary_dns/incoming.go index 035ee3e0978..f215f88c2d5 100644 --- a/secondary_dns/incoming.go +++ b/secondary_dns/incoming.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // IncomingService contains methods and other services that help with interacting @@ -58,10 +58,10 @@ func (r *IncomingService) Update(ctx context.Context, params IncomingUpdateParam } // Delete secondary zone configuration for incoming zone transfers. -func (r *IncomingService) Delete(ctx context.Context, params IncomingDeleteParams, opts ...option.RequestOption) (res *IncomingDeleteResponse, err error) { +func (r *IncomingService) Delete(ctx context.Context, body IncomingDeleteParams, opts ...option.RequestOption) (res *IncomingDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env IncomingDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/secondary_dns/incoming", params.ZoneID) + path := fmt.Sprintf("zones/%s/secondary_dns/incoming", body.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -351,11 +351,6 @@ func (r IncomingUpdateResponseEnvelopeSuccess) IsKnown() bool { type IncomingDeleteParams struct { ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r IncomingDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type IncomingDeleteResponseEnvelope struct { diff --git a/secondary_dns/incoming_test.go b/secondary_dns/incoming_test.go index 14759a57c91..4facdc1be5b 100644 --- a/secondary_dns/incoming_test.go +++ b/secondary_dns/incoming_test.go @@ -15,7 +15,6 @@ import ( ) func TestIncomingNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestIncomingNew(t *testing.T) { } func TestIncomingUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -73,7 +71,6 @@ func TestIncomingUpdate(t *testing.T) { } func TestIncomingDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -88,7 +85,6 @@ func TestIncomingDelete(t *testing.T) { ) _, err := client.SecondaryDNS.Incoming.Delete(context.TODO(), secondary_dns.IncomingDeleteParams{ ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"), - Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -100,7 +96,6 @@ func TestIncomingDelete(t *testing.T) { } func TestIncomingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/secondary_dns/outgoing.go b/secondary_dns/outgoing.go index 07fbc7492de..890d5af87f7 100644 --- a/secondary_dns/outgoing.go +++ b/secondary_dns/outgoing.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // OutgoingService contains methods and other services that help with interacting @@ -60,10 +60,10 @@ func (r *OutgoingService) Update(ctx context.Context, params OutgoingUpdateParam } // Delete primary zone configuration for outgoing zone transfers. -func (r *OutgoingService) Delete(ctx context.Context, params OutgoingDeleteParams, opts ...option.RequestOption) (res *OutgoingDeleteResponse, err error) { +func (r *OutgoingService) Delete(ctx context.Context, body OutgoingDeleteParams, opts ...option.RequestOption) (res *OutgoingDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env OutgoingDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/secondary_dns/outgoing", params.ZoneID) + path := fmt.Sprintf("zones/%s/secondary_dns/outgoing", body.ZoneID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -78,7 +78,7 @@ func (r *OutgoingService) Disable(ctx context.Context, params OutgoingDisablePar opts = append(r.Options[:], opts...) var env OutgoingDisableResponseEnvelope path := fmt.Sprintf("zones/%s/secondary_dns/outgoing/disable", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -91,7 +91,7 @@ func (r *OutgoingService) Enable(ctx context.Context, params OutgoingEnableParam opts = append(r.Options[:], opts...) var env OutgoingEnableResponseEnvelope path := fmt.Sprintf("zones/%s/secondary_dns/outgoing/enable", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -104,7 +104,7 @@ func (r *OutgoingService) ForceNotify(ctx context.Context, params OutgoingForceN opts = append(r.Options[:], opts...) var env OutgoingForceNotifyResponseEnvelope path := fmt.Sprintf("zones/%s/secondary_dns/outgoing/force_notify", params.ZoneID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -379,11 +379,6 @@ func (r OutgoingUpdateResponseEnvelopeSuccess) IsKnown() bool { type OutgoingDeleteParams struct { ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r OutgoingDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type OutgoingDeleteResponseEnvelope struct { diff --git a/secondary_dns/outgoing_test.go b/secondary_dns/outgoing_test.go index b8354c90450..3636a010b76 100644 --- a/secondary_dns/outgoing_test.go +++ b/secondary_dns/outgoing_test.go @@ -15,7 +15,6 @@ import ( ) func TestOutgoingNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestOutgoingNew(t *testing.T) { } func TestOutgoingUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -71,7 +69,6 @@ func TestOutgoingUpdate(t *testing.T) { } func TestOutgoingDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -86,7 +83,6 @@ func TestOutgoingDelete(t *testing.T) { ) _, err := client.SecondaryDNS.Outgoing.Delete(context.TODO(), secondary_dns.OutgoingDeleteParams{ ZoneID: cloudflare.F("269d8f4853475ca241c4e730be286b20"), - Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -98,7 +94,6 @@ func TestOutgoingDelete(t *testing.T) { } func TestOutgoingDisable(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -125,7 +120,6 @@ func TestOutgoingDisable(t *testing.T) { } func TestOutgoingEnable(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -152,7 +146,6 @@ func TestOutgoingEnable(t *testing.T) { } func TestOutgoingForceNotify(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -179,7 +172,6 @@ func TestOutgoingForceNotify(t *testing.T) { } func TestOutgoingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/secondary_dns/outgoingstatus.go b/secondary_dns/outgoingstatus.go index 98adf9d7071..e8f05f8ca97 100644 --- a/secondary_dns/outgoingstatus.go +++ b/secondary_dns/outgoingstatus.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // OutgoingStatusService contains methods and other services that help with diff --git a/secondary_dns/outgoingstatus_test.go b/secondary_dns/outgoingstatus_test.go index 006c0576ee6..88359633d7c 100644 --- a/secondary_dns/outgoingstatus_test.go +++ b/secondary_dns/outgoingstatus_test.go @@ -15,7 +15,6 @@ import ( ) func TestOutgoingStatusGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/secondary_dns/peer.go b/secondary_dns/peer.go index b5b4009f3bf..a4757733dfb 100644 --- a/secondary_dns/peer.go +++ b/secondary_dns/peer.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // PeerService contains methods and other services that help with interacting with @@ -64,7 +64,7 @@ func (r *PeerService) List(ctx context.Context, query PeerListParams, opts ...op opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/secondary_dns/peers", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -82,10 +82,10 @@ func (r *PeerService) ListAutoPaging(ctx context.Context, query PeerListParams, } // Delete Peer. -func (r *PeerService) Delete(ctx context.Context, peerID string, params PeerDeleteParams, opts ...option.RequestOption) (res *PeerDeleteResponse, err error) { +func (r *PeerService) Delete(ctx context.Context, peerID string, body PeerDeleteParams, opts ...option.RequestOption) (res *PeerDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env PeerDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/secondary_dns/peers/%s", params.AccountID, peerID) + path := fmt.Sprintf("accounts/%s/secondary_dns/peers/%s", body.AccountID, peerID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -302,11 +302,6 @@ type PeerListParams struct { type PeerDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r PeerDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type PeerDeleteResponseEnvelope struct { diff --git a/secondary_dns/peer_test.go b/secondary_dns/peer_test.go index 0142a0d7aef..727d3948175 100644 --- a/secondary_dns/peer_test.go +++ b/secondary_dns/peer_test.go @@ -15,7 +15,7 @@ import ( ) func TestPeerNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +42,6 @@ func TestPeerNew(t *testing.T) { } func TestPeerUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -79,7 +78,6 @@ func TestPeerUpdateWithOptionalParams(t *testing.T) { } func TestPeerList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -105,7 +103,6 @@ func TestPeerList(t *testing.T) { } func TestPeerDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -123,7 +120,6 @@ func TestPeerDelete(t *testing.T) { "23ff594956f20c2a721606e94745a8aa", secondary_dns.PeerDeleteParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -136,7 +132,6 @@ func TestPeerDelete(t *testing.T) { } func TestPeerGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/secondary_dns/tsig.go b/secondary_dns/tsig.go index 53fcb94cb73..6acb8a4e68e 100644 --- a/secondary_dns/tsig.go +++ b/secondary_dns/tsig.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // TSIGService contains methods and other services that help with interacting with @@ -64,7 +64,7 @@ func (r *TSIGService) List(ctx context.Context, query TSIGListParams, opts ...op opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/secondary_dns/tsigs", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -82,10 +82,10 @@ func (r *TSIGService) ListAutoPaging(ctx context.Context, query TSIGListParams, } // Delete TSIG. -func (r *TSIGService) Delete(ctx context.Context, tsigID string, params TSIGDeleteParams, opts ...option.RequestOption) (res *TSIGDeleteResponse, err error) { +func (r *TSIGService) Delete(ctx context.Context, tsigID string, body TSIGDeleteParams, opts ...option.RequestOption) (res *TSIGDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env TSIGDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/secondary_dns/tsigs/%s", params.AccountID, tsigID) + path := fmt.Sprintf("accounts/%s/secondary_dns/tsigs/%s", body.AccountID, tsigID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -280,11 +280,6 @@ type TSIGListParams struct { type TSIGDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r TSIGDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type TSIGDeleteResponseEnvelope struct { diff --git a/secondary_dns/tsig_test.go b/secondary_dns/tsig_test.go index a3777afb610..1dffc94744b 100644 --- a/secondary_dns/tsig_test.go +++ b/secondary_dns/tsig_test.go @@ -15,7 +15,6 @@ import ( ) func TestTSIGNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestTSIGNew(t *testing.T) { } func TestTSIGUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -81,7 +79,6 @@ func TestTSIGUpdate(t *testing.T) { } func TestTSIGList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -107,7 +104,6 @@ func TestTSIGList(t *testing.T) { } func TestTSIGDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -125,7 +121,6 @@ func TestTSIGDelete(t *testing.T) { "69cd1e104af3e6ed3cb344f263fd0d5a", secondary_dns.TSIGDeleteParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -138,7 +133,6 @@ func TestTSIGDelete(t *testing.T) { } func TestTSIGGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/internal/shared/shared.go b/shared/shared.go similarity index 93% rename from internal/shared/shared.go rename to shared/shared.go index cba6e01452e..78be75f67db 100644 --- a/internal/shared/shared.go +++ b/shared/shared.go @@ -176,6 +176,41 @@ func (r auditLogResourceJSON) RawJSON() string { return r.raw } +// The Certificate Authority that will issue the certificate +type CertificateCA string + +const ( + CertificateCADigicert CertificateCA = "digicert" + CertificateCAGoogle CertificateCA = "google" + CertificateCALetsEncrypt CertificateCA = "lets_encrypt" +) + +func (r CertificateCA) IsKnown() bool { + switch r { + case CertificateCADigicert, CertificateCAGoogle, CertificateCALetsEncrypt: + return true + } + return false +} + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +type CertificateRequestType string + +const ( + CertificateRequestTypeOriginRSA CertificateRequestType = "origin-rsa" + CertificateRequestTypeOriginECC CertificateRequestType = "origin-ecc" + CertificateRequestTypeKeylessCertificate CertificateRequestType = "keyless-certificate" +) + +func (r CertificateRequestType) IsKnown() bool { + switch r { + case CertificateRequestTypeOriginRSA, CertificateRequestTypeOriginECC, CertificateRequestTypeKeylessCertificate: + return true + } + return false +} + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. type CloudflareTunnel struct { // UUID of the tunnel. @@ -608,3 +643,19 @@ func (r *Role) UnmarshalJSON(data []byte) (err error) { func (r roleJSON) RawJSON() string { return r.raw } + +// Direction to order DNS records in. +type SortDirection string + +const ( + SortDirectionAsc SortDirection = "asc" + SortDirectionDesc SortDirection = "desc" +) + +func (r SortDirection) IsKnown() bool { + switch r { + case SortDirectionAsc, SortDirectionDesc: + return true + } + return false +} diff --git a/internal/shared/union.go b/shared/union.go similarity index 95% rename from internal/shared/union.go rename to shared/union.go index ce0501634e7..00ab7eb2d61 100644 --- a/internal/shared/union.go +++ b/shared/union.go @@ -22,8 +22,6 @@ func (UnionString) ImplementsUserSubscriptionUpdateResponseUnion() func (UnionString) ImplementsUserSubscriptionEditResponseUnion() {} func (UnionString) ImplementsUserTokenUpdateResponseUnion() {} func (UnionString) ImplementsUserTokenGetResponseUnion() {} -func (UnionString) ImplementsZonesCustomNameserverUpdateResponseUnion() {} -func (UnionString) ImplementsZonesCustomNameserverGetResponseUnion() {} func (UnionString) ImplementsZonesSubscriptionNewResponseUnion() {} func (UnionString) ImplementsZonesSubscriptionGetResponseUnion() {} func (UnionString) ImplementsLoadBalancersPoolHealthGetResponseUnion() {} @@ -48,7 +46,6 @@ func (UnionString) ImplementsCustomCertificatesCustomCertificateGetResponseUnion func (UnionString) ImplementsCustomHostnamesFallbackOriginUpdateResponseUnion() {} func (UnionString) ImplementsCustomHostnamesFallbackOriginDeleteResponseUnion() {} func (UnionString) ImplementsCustomHostnamesFallbackOriginGetResponseUnion() {} -func (UnionString) ImplementsCustomNameserversCustomNameserverDeleteResponseUnion() {} func (UnionString) ImplementsDNSFirewallIPsUnionParam() {} func (UnionString) ImplementsDNSFirewallIPsUnion() {} func (UnionString) ImplementsDNSUpstreamIPsUnionParam() {} @@ -127,8 +124,8 @@ func (UnionString) ImplementsAlertingAvailableAlertListResponseUnion() func (UnionString) ImplementsAlertingDestinationEligibleGetResponseUnion() {} func (UnionString) ImplementsAlertingDestinationPagerdutyDeleteResponseUnion() {} func (UnionString) ImplementsAlertingDestinationWebhookDeleteResponseUnion() {} -func (UnionString) ImplementsAlertingMechanismIDUnionParam() {} -func (UnionString) ImplementsAlertingMechanismIDUnion() {} +func (UnionString) ImplementsAlertingMechanismItemIDUnionParam() {} +func (UnionString) ImplementsAlertingMechanismItemIDUnion() {} func (UnionString) ImplementsAlertingPolicyDeleteResponseUnion() {} func (UnionString) ImplementsD1DatabaseDeleteResponseUnion() {} func (UnionString) ImplementsWARPConnectorWARPConnectorTokenResponseUnion() {} @@ -165,10 +162,6 @@ func (UnionString) ImplementsOriginPostQuantumEncryptionOriginPostQuantumEncrypt } func (UnionString) ImplementsHostnamesSettingValueUnionParam() {} func (UnionString) ImplementsHostnamesSettingValueUnion() {} -func (UnionString) ImplementsSnippetsSnippetDeleteResponseUnion() {} -func (UnionString) ImplementsCloudforceOneRequestDeleteResponseUnion() {} -func (UnionString) ImplementsCloudforceOneRequestMessageDeleteResponseUnion() {} -func (UnionString) ImplementsCloudforceOneRequestPriorityDeleteResponseUnion() {} func (UnionString) ImplementsEventNotificationsR2ConfigurationQueueDeleteResponseUnion() {} type UnionInt int64 diff --git a/snippets/aliases.go b/snippets/aliases.go index 8434e360880..298459e47de 100644 --- a/snippets/aliases.go +++ b/snippets/aliases.go @@ -4,7 +4,7 @@ package snippets import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/snippets/content.go b/snippets/content.go index 887a34ee66d..71339be23fd 100644 --- a/snippets/content.go +++ b/snippets/content.go @@ -7,6 +7,7 @@ import ( "fmt" "net/http" + "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/option" ) @@ -29,10 +30,15 @@ func NewContentService(opts ...option.RequestOption) (r *ContentService) { } // Snippet Content -func (r *ContentService) Get(ctx context.Context, zoneIdentifier string, snippetName string, opts ...option.RequestOption) (res *http.Response, err error) { +func (r *ContentService) Get(ctx context.Context, snippetName string, query ContentGetParams, opts ...option.RequestOption) (res *http.Response, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("Accept", "multipart/form-data")}, opts...) - path := fmt.Sprintf("zones/%s/snippets/%s/content", zoneIdentifier, snippetName) + path := fmt.Sprintf("zones/%s/snippets/%s/content", query.ZoneID, snippetName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...) return } + +type ContentGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} diff --git a/snippets/content_test.go b/snippets/content_test.go index b62bfc933b7..6c7d2d0c649 100644 --- a/snippets/content_test.go +++ b/snippets/content_test.go @@ -13,10 +13,11 @@ import ( "github.com/cloudflare/cloudflare-go/v2" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/snippets" ) func TestContentGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("throwing HTTP 415") server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) w.Write([]byte("abc")) @@ -30,8 +31,10 @@ func TestContentGet(t *testing.T) { ) resp, err := client.Snippets.Content.Get( context.TODO(), - "023e105f4ecef8ad9ca31a8372d0c353", "snippet_name_01", + snippets.ContentGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }, ) if err != nil { var apierr *cloudflare.Error diff --git a/snippets/rule.go b/snippets/rule.go index 49334ec5b96..3065fd02f3a 100644 --- a/snippets/rule.go +++ b/snippets/rule.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RuleService contains methods and other services that help with interacting with @@ -33,11 +33,11 @@ func NewRuleService(opts ...option.RequestOption) (r *RuleService) { } // Put Rules -func (r *RuleService) Update(ctx context.Context, zoneIdentifier string, body RuleUpdateParams, opts ...option.RequestOption) (res *[]RuleUpdateResponse, err error) { +func (r *RuleService) Update(ctx context.Context, params RuleUpdateParams, opts ...option.RequestOption) (res *[]RuleUpdateResponse, err error) { opts = append(r.Options[:], opts...) var env RuleUpdateResponseEnvelope - path := fmt.Sprintf("zones/%s/snippets/snippet_rules", zoneIdentifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) + path := fmt.Sprintf("zones/%s/snippets/snippet_rules", params.ZoneID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return } @@ -46,11 +46,11 @@ func (r *RuleService) Update(ctx context.Context, zoneIdentifier string, body Ru } // Rules -func (r *RuleService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *pagination.SinglePage[RuleListResponse], err error) { +func (r *RuleService) List(ctx context.Context, query RuleListParams, opts ...option.RequestOption) (res *pagination.SinglePage[RuleListResponse], err error) { var raw *http.Response opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) - path := fmt.Sprintf("zones/%s/snippets/snippet_rules", zoneIdentifier) + path := fmt.Sprintf("zones/%s/snippets/snippet_rules", query.ZoneID) cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err @@ -64,8 +64,8 @@ func (r *RuleService) List(ctx context.Context, zoneIdentifier string, opts ...o } // Rules -func (r *RuleService) ListAutoPaging(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) *pagination.SinglePageAutoPager[RuleListResponse] { - return pagination.NewSinglePageAutoPager(r.List(ctx, zoneIdentifier, opts...)) +func (r *RuleService) ListAutoPaging(ctx context.Context, query RuleListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[RuleListResponse] { + return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...)) } type RuleUpdateResponse struct { @@ -125,6 +125,8 @@ func (r ruleListResponseJSON) RawJSON() string { } type RuleUpdateParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` // List of snippet rules Rules param.Field[[]RuleUpdateParamsRule] `json:"rules"` } @@ -148,11 +150,11 @@ func (r RuleUpdateParamsRule) MarshalJSON() (data []byte, err error) { type RuleUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - // List of snippet rules - Result []RuleUpdateResponse `json:"result,required"` // Whether the API call was successful Success RuleUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON ruleUpdateResponseEnvelopeJSON `json:"-"` + // List of snippet rules + Result []RuleUpdateResponse `json:"result"` + JSON ruleUpdateResponseEnvelopeJSON `json:"-"` } // ruleUpdateResponseEnvelopeJSON contains the JSON metadata for the struct @@ -160,8 +162,8 @@ type RuleUpdateResponseEnvelope struct { type ruleUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -188,3 +190,8 @@ func (r RuleUpdateResponseEnvelopeSuccess) IsKnown() bool { } return false } + +type RuleListParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} diff --git a/snippets/rule_test.go b/snippets/rule_test.go index 297ff781718..4ffb27c49c7 100644 --- a/snippets/rule_test.go +++ b/snippets/rule_test.go @@ -15,7 +15,6 @@ import ( ) func TestRuleUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -28,28 +27,25 @@ func TestRuleUpdateWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Snippets.Rules.Update( - context.TODO(), - "023e105f4ecef8ad9ca31a8372d0c353", - snippets.RuleUpdateParams{ - Rules: cloudflare.F([]snippets.RuleUpdateParamsRule{{ - Description: cloudflare.F("Rule description"), - Enabled: cloudflare.F(true), - Expression: cloudflare.F("http.cookie eq \"a=b\""), - SnippetName: cloudflare.F("snippet_name_01"), - }, { - Description: cloudflare.F("Rule description"), - Enabled: cloudflare.F(true), - Expression: cloudflare.F("http.cookie eq \"a=b\""), - SnippetName: cloudflare.F("snippet_name_01"), - }, { - Description: cloudflare.F("Rule description"), - Enabled: cloudflare.F(true), - Expression: cloudflare.F("http.cookie eq \"a=b\""), - SnippetName: cloudflare.F("snippet_name_01"), - }}), - }, - ) + _, err := client.Snippets.Rules.Update(context.TODO(), snippets.RuleUpdateParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Rules: cloudflare.F([]snippets.RuleUpdateParamsRule{{ + Description: cloudflare.F("Rule description"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("http.cookie eq \"a=b\""), + SnippetName: cloudflare.F("snippet_name_01"), + }, { + Description: cloudflare.F("Rule description"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("http.cookie eq \"a=b\""), + SnippetName: cloudflare.F("snippet_name_01"), + }, { + Description: cloudflare.F("Rule description"), + Enabled: cloudflare.F(true), + Expression: cloudflare.F("http.cookie eq \"a=b\""), + SnippetName: cloudflare.F("snippet_name_01"), + }}), + }) if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -60,7 +56,6 @@ func TestRuleUpdateWithOptionalParams(t *testing.T) { } func TestRuleList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -73,7 +68,9 @@ func TestRuleList(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Snippets.Rules.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") + _, err := client.Snippets.Rules.List(context.TODO(), snippets.RuleListParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { diff --git a/snippets/snippet.go b/snippets/snippet.go index 42096a61468..3b69497cb57 100644 --- a/snippets/snippet.go +++ b/snippets/snippet.go @@ -6,15 +6,13 @@ import ( "context" "fmt" "net/http" - "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/tidwall/gjson" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SnippetService contains methods and other services that help with interacting @@ -39,11 +37,11 @@ func NewSnippetService(opts ...option.RequestOption) (r *SnippetService) { } // Put Snippet -func (r *SnippetService) Update(ctx context.Context, zoneIdentifier string, snippetName string, body SnippetUpdateParams, opts ...option.RequestOption) (res *Snippet, err error) { +func (r *SnippetService) Update(ctx context.Context, snippetName string, params SnippetUpdateParams, opts ...option.RequestOption) (res *Snippet, err error) { opts = append(r.Options[:], opts...) var env SnippetUpdateResponseEnvelope - path := fmt.Sprintf("zones/%s/snippets/%s", zoneIdentifier, snippetName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) + path := fmt.Sprintf("zones/%s/snippets/%s", params.ZoneID, snippetName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, params, &env, opts...) if err != nil { return } @@ -52,11 +50,11 @@ func (r *SnippetService) Update(ctx context.Context, zoneIdentifier string, snip } // All Snippets -func (r *SnippetService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *pagination.SinglePage[Snippet], err error) { +func (r *SnippetService) List(ctx context.Context, query SnippetListParams, opts ...option.RequestOption) (res *pagination.SinglePage[Snippet], err error) { var raw *http.Response opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) - path := fmt.Sprintf("zones/%s/snippets", zoneIdentifier) + path := fmt.Sprintf("zones/%s/snippets", query.ZoneID) cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err @@ -70,28 +68,23 @@ func (r *SnippetService) List(ctx context.Context, zoneIdentifier string, opts . } // All Snippets -func (r *SnippetService) ListAutoPaging(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) *pagination.SinglePageAutoPager[Snippet] { - return pagination.NewSinglePageAutoPager(r.List(ctx, zoneIdentifier, opts...)) +func (r *SnippetService) ListAutoPaging(ctx context.Context, query SnippetListParams, opts ...option.RequestOption) *pagination.SinglePageAutoPager[Snippet] { + return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...)) } // Delete Snippet -func (r *SnippetService) Delete(ctx context.Context, zoneIdentifier string, snippetName string, opts ...option.RequestOption) (res *SnippetDeleteResponseUnion, err error) { +func (r *SnippetService) Delete(ctx context.Context, snippetName string, body SnippetDeleteParams, opts ...option.RequestOption) (res *SnippetDeleteResponse, err error) { opts = append(r.Options[:], opts...) - var env SnippetDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/snippets/%s", zoneIdentifier, snippetName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result + path := fmt.Sprintf("zones/%s/snippets/%s", body.ZoneID, snippetName) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } // Snippet -func (r *SnippetService) Get(ctx context.Context, zoneIdentifier string, snippetName string, opts ...option.RequestOption) (res *Snippet, err error) { +func (r *SnippetService) Get(ctx context.Context, snippetName string, query SnippetGetParams, opts ...option.RequestOption) (res *Snippet, err error) { opts = append(r.Options[:], opts...) var env SnippetGetResponseEnvelope - path := fmt.Sprintf("zones/%s/snippets/%s", zoneIdentifier, snippetName) + path := fmt.Sprintf("zones/%s/snippets/%s", query.ZoneID, snippetName) err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) if err != nil { return @@ -128,32 +121,50 @@ func (r snippetJSON) RawJSON() string { return r.raw } -// Union satisfied by [snippets.SnippetDeleteResponseUnknown], -// [snippets.SnippetDeleteResponseArray] or [shared.UnionString]. -type SnippetDeleteResponseUnion interface { - ImplementsSnippetsSnippetDeleteResponseUnion() +type SnippetDeleteResponse struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // Whether the API call was successful + Success SnippetDeleteResponseSuccess `json:"success,required"` + JSON snippetDeleteResponseJSON `json:"-"` } -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*SnippetDeleteResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(SnippetDeleteResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) +// snippetDeleteResponseJSON contains the JSON metadata for the struct +// [SnippetDeleteResponse] +type snippetDeleteResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + raw string + ExtraFields map[string]apijson.Field } -type SnippetDeleteResponseArray []interface{} +func (r *SnippetDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} -func (r SnippetDeleteResponseArray) ImplementsSnippetsSnippetDeleteResponseUnion() {} +func (r snippetDeleteResponseJSON) RawJSON() string { + return r.raw +} + +// Whether the API call was successful +type SnippetDeleteResponseSuccess bool + +const ( + SnippetDeleteResponseSuccessTrue SnippetDeleteResponseSuccess = true +) + +func (r SnippetDeleteResponseSuccess) IsKnown() bool { + switch r { + case SnippetDeleteResponseSuccessTrue: + return true + } + return false +} type SnippetUpdateParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` // Content files of uploaded snippet Files param.Field[string] `json:"files"` Metadata param.Field[SnippetUpdateParamsMetadata] `json:"metadata"` @@ -175,11 +186,11 @@ func (r SnippetUpdateParamsMetadata) MarshalJSON() (data []byte, err error) { type SnippetUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - // Snippet Information - Result Snippet `json:"result,required"` // Whether the API call was successful Success SnippetUpdateResponseEnvelopeSuccess `json:"success,required"` - JSON snippetUpdateResponseEnvelopeJSON `json:"-"` + // Snippet Information + Result Snippet `json:"result"` + JSON snippetUpdateResponseEnvelopeJSON `json:"-"` } // snippetUpdateResponseEnvelopeJSON contains the JSON metadata for the struct @@ -187,8 +198,8 @@ type SnippetUpdateResponseEnvelope struct { type snippetUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -216,57 +227,29 @@ func (r SnippetUpdateResponseEnvelopeSuccess) IsKnown() bool { return false } -type SnippetDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result SnippetDeleteResponseUnion `json:"result,required"` - // Whether the API call was successful - Success SnippetDeleteResponseEnvelopeSuccess `json:"success,required"` - JSON snippetDeleteResponseEnvelopeJSON `json:"-"` -} - -// snippetDeleteResponseEnvelopeJSON contains the JSON metadata for the struct -// [SnippetDeleteResponseEnvelope] -type snippetDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Result apijson.Field - Success apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SnippetDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) +type SnippetListParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` } -func (r snippetDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw +type SnippetDeleteParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` } -// Whether the API call was successful -type SnippetDeleteResponseEnvelopeSuccess bool - -const ( - SnippetDeleteResponseEnvelopeSuccessTrue SnippetDeleteResponseEnvelopeSuccess = true -) - -func (r SnippetDeleteResponseEnvelopeSuccess) IsKnown() bool { - switch r { - case SnippetDeleteResponseEnvelopeSuccessTrue: - return true - } - return false +type SnippetGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` } type SnippetGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - // Snippet Information - Result Snippet `json:"result,required"` // Whether the API call was successful Success SnippetGetResponseEnvelopeSuccess `json:"success,required"` - JSON snippetGetResponseEnvelopeJSON `json:"-"` + // Snippet Information + Result Snippet `json:"result"` + JSON snippetGetResponseEnvelopeJSON `json:"-"` } // snippetGetResponseEnvelopeJSON contains the JSON metadata for the struct @@ -274,8 +257,8 @@ type SnippetGetResponseEnvelope struct { type snippetGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/snippets/snippet_test.go b/snippets/snippet_test.go index a549e952c05..25dd01fcfac 100644 --- a/snippets/snippet_test.go +++ b/snippets/snippet_test.go @@ -15,7 +15,7 @@ import ( ) func TestSnippetUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("throwing HTTP 415") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -30,10 +30,10 @@ func TestSnippetUpdateWithOptionalParams(t *testing.T) { ) _, err := client.Snippets.Update( context.TODO(), - "023e105f4ecef8ad9ca31a8372d0c353", "snippet_name_01", snippets.SnippetUpdateParams{ - Files: cloudflare.F("export { async function fetch(request, env) {return new Response('some_response') } }"), + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Files: cloudflare.F("export { async function fetch(request, env) {return new Response('some_response') } }"), Metadata: cloudflare.F(snippets.SnippetUpdateParamsMetadata{ MainModule: cloudflare.F("main.js"), }), @@ -49,7 +49,6 @@ func TestSnippetUpdateWithOptionalParams(t *testing.T) { } func TestSnippetList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -62,7 +61,9 @@ func TestSnippetList(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Snippets.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") + _, err := client.Snippets.List(context.TODO(), snippets.SnippetListParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }) if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -73,7 +74,6 @@ func TestSnippetList(t *testing.T) { } func TestSnippetDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -88,8 +88,10 @@ func TestSnippetDelete(t *testing.T) { ) _, err := client.Snippets.Delete( context.TODO(), - "023e105f4ecef8ad9ca31a8372d0c353", "snippet_name_01", + snippets.SnippetDeleteParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }, ) if err != nil { var apierr *cloudflare.Error @@ -101,7 +103,6 @@ func TestSnippetDelete(t *testing.T) { } func TestSnippetGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -116,8 +117,10 @@ func TestSnippetGet(t *testing.T) { ) _, err := client.Snippets.Get( context.TODO(), - "023e105f4ecef8ad9ca31a8372d0c353", "snippet_name_01", + snippets.SnippetGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + }, ) if err != nil { var apierr *cloudflare.Error diff --git a/spectrum/aliases.go b/spectrum/aliases.go index 1f52ccd3de1..bf743976cf2 100644 --- a/spectrum/aliases.go +++ b/spectrum/aliases.go @@ -4,7 +4,7 @@ package spectrum import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/spectrum/analyticsaggregatecurrent.go b/spectrum/analyticsaggregatecurrent.go index 6672c89eb34..a01611cc50d 100644 --- a/spectrum/analyticsaggregatecurrent.go +++ b/spectrum/analyticsaggregatecurrent.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AnalyticsAggregateCurrentService contains methods and other services that help diff --git a/spectrum/analyticsaggregatecurrent_test.go b/spectrum/analyticsaggregatecurrent_test.go index 4fa0010f455..eee8693ddcf 100644 --- a/spectrum/analyticsaggregatecurrent_test.go +++ b/spectrum/analyticsaggregatecurrent_test.go @@ -15,7 +15,6 @@ import ( ) func TestAnalyticsAggregateCurrentGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/spectrum/analyticseventbytime.go b/spectrum/analyticseventbytime.go index 4edef0db69c..a28e680e44f 100644 --- a/spectrum/analyticseventbytime.go +++ b/spectrum/analyticseventbytime.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/spectrum/analyticseventbytime_test.go b/spectrum/analyticseventbytime_test.go index e6071b1d045..554424a723d 100644 --- a/spectrum/analyticseventbytime_test.go +++ b/spectrum/analyticseventbytime_test.go @@ -16,7 +16,6 @@ import ( ) func TestAnalyticsEventBytimeGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/spectrum/analyticseventsummary.go b/spectrum/analyticseventsummary.go index ce125d821a5..97dd6702a8d 100644 --- a/spectrum/analyticseventsummary.go +++ b/spectrum/analyticseventsummary.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/spectrum/analyticseventsummary_test.go b/spectrum/analyticseventsummary_test.go index 9cdd3838c86..4fe9a0a956e 100644 --- a/spectrum/analyticseventsummary_test.go +++ b/spectrum/analyticseventsummary_test.go @@ -16,7 +16,6 @@ import ( ) func TestAnalyticsEventSummaryGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/spectrum/app.go b/spectrum/app.go index 7bc29137044..ff8eeac4020 100644 --- a/spectrum/app.go +++ b/spectrum/app.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -89,7 +89,7 @@ func (r *AppService) ListAutoPaging(ctx context.Context, zone string, query AppL } // Deletes a previously existing application. -func (r *AppService) Delete(ctx context.Context, zone string, appID string, body AppDeleteParams, opts ...option.RequestOption) (res *AppDeleteResponse, err error) { +func (r *AppService) Delete(ctx context.Context, zone string, appID string, opts ...option.RequestOption) (res *AppDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env AppDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/spectrum/apps/%s", zone, appID) @@ -761,14 +761,6 @@ func (r AppListParamsOrder) IsKnown() bool { return false } -type AppDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r AppDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type AppDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/spectrum/app_test.go b/spectrum/app_test.go index ed334b07c38..a242a8d0944 100644 --- a/spectrum/app_test.go +++ b/spectrum/app_test.go @@ -9,14 +9,13 @@ import ( "testing" "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/cloudflare/cloudflare-go/v2/spectrum" ) func TestAppNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -65,7 +64,6 @@ func TestAppNewWithOptionalParams(t *testing.T) { } func TestAppUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -115,7 +113,6 @@ func TestAppUpdateWithOptionalParams(t *testing.T) { } func TestAppListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -148,7 +145,6 @@ func TestAppListWithOptionalParams(t *testing.T) { } func TestAppDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -165,9 +161,6 @@ func TestAppDelete(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "ea95132c15732412d22c1476fa83f27a", - spectrum.AppDeleteParams{ - Body: map[string]interface{}{}, - }, ) if err != nil { var apierr *cloudflare.Error @@ -179,7 +172,6 @@ func TestAppDelete(t *testing.T) { } func TestAppGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/spectrum/spectrum.go b/spectrum/spectrum.go index 05453385604..3610116b96b 100644 --- a/spectrum/spectrum.go +++ b/spectrum/spectrum.go @@ -7,8 +7,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/speed/aliases.go b/speed/aliases.go index 14e2012f251..1bbe686c1cc 100644 --- a/speed/aliases.go +++ b/speed/aliases.go @@ -4,7 +4,7 @@ package speed import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/speed/availability.go b/speed/availability.go index d8884c78797..d9c72ddce60 100644 --- a/speed/availability.go +++ b/speed/availability.go @@ -108,19 +108,13 @@ type AvailabilityListParams struct { } type AvailabilityListResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result Availability `json:"result"` - JSON availabilityListResponseEnvelopeJSON `json:"-"` + Result Availability `json:"result"` + JSON availabilityListResponseEnvelopeJSON `json:"-"` } // availabilityListResponseEnvelopeJSON contains the JSON metadata for the struct // [AvailabilityListResponseEnvelope] type availabilityListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field Result apijson.Field raw string ExtraFields map[string]apijson.Field diff --git a/speed/availability_test.go b/speed/availability_test.go index c64095714e7..bf55df75073 100644 --- a/speed/availability_test.go +++ b/speed/availability_test.go @@ -15,7 +15,6 @@ import ( ) func TestAvailabilityList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/speed/page.go b/speed/page.go index e47d8762e9a..a3424243467 100644 --- a/speed/page.go +++ b/speed/page.go @@ -6,8 +6,11 @@ import ( "context" "fmt" "net/http" + "net/url" + "time" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" + "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" @@ -20,6 +23,7 @@ import ( // directly, and instead use the [NewPageService] method instead. type PageService struct { Options []option.RequestOption + Tests *PageTestService } // NewPageService generates a new service that applies the given options to each @@ -28,6 +32,7 @@ type PageService struct { func NewPageService(opts ...option.RequestOption) (r *PageService) { r = &PageService{} r.Options = opts + r.Tests = NewPageTestService(opts...) return } @@ -37,7 +42,7 @@ func (r *PageService) List(ctx context.Context, query PageListParams, opts ...op opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("zones/%s/speed_api/pages", query.ZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -54,6 +59,19 @@ func (r *PageService) ListAutoPaging(ctx context.Context, query PageListParams, return pagination.NewSinglePageAutoPager(r.List(ctx, query, opts...)) } +// Lists the core web vital metrics trend over time for a specific page. +func (r *PageService) Trend(ctx context.Context, url string, params PageTrendParams, opts ...option.RequestOption) (res *Trend, err error) { + opts = append(r.Options[:], opts...) + var env PageTrendResponseEnvelope + path := fmt.Sprintf("zones/%s/speed_api/pages/%s/trend", params.ZoneID, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + type PageListResponse struct { // A test region with a label. Region LabeledRegion `json:"region"` @@ -104,3 +122,98 @@ type PageListParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` } + +type PageTrendParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // The type of device. + DeviceType param.Field[PageTrendParamsDeviceType] `query:"deviceType,required"` + // A comma-separated list of metrics to include in the results. + Metrics param.Field[string] `query:"metrics,required"` + // A test region. + Region param.Field[PageTrendParamsRegion] `query:"region,required"` + Start param.Field[time.Time] `query:"start,required" format:"date-time"` + // The timezone of the start and end timestamps. + Tz param.Field[string] `query:"tz,required"` + End param.Field[time.Time] `query:"end" format:"date-time"` +} + +// URLQuery serializes [PageTrendParams]'s query parameters as `url.Values`. +func (r PageTrendParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// The type of device. +type PageTrendParamsDeviceType string + +const ( + PageTrendParamsDeviceTypeDesktop PageTrendParamsDeviceType = "DESKTOP" + PageTrendParamsDeviceTypeMobile PageTrendParamsDeviceType = "MOBILE" +) + +func (r PageTrendParamsDeviceType) IsKnown() bool { + switch r { + case PageTrendParamsDeviceTypeDesktop, PageTrendParamsDeviceTypeMobile: + return true + } + return false +} + +// A test region. +type PageTrendParamsRegion string + +const ( + PageTrendParamsRegionAsiaEast1 PageTrendParamsRegion = "asia-east1" + PageTrendParamsRegionAsiaNortheast1 PageTrendParamsRegion = "asia-northeast1" + PageTrendParamsRegionAsiaNortheast2 PageTrendParamsRegion = "asia-northeast2" + PageTrendParamsRegionAsiaSouth1 PageTrendParamsRegion = "asia-south1" + PageTrendParamsRegionAsiaSoutheast1 PageTrendParamsRegion = "asia-southeast1" + PageTrendParamsRegionAustraliaSoutheast1 PageTrendParamsRegion = "australia-southeast1" + PageTrendParamsRegionEuropeNorth1 PageTrendParamsRegion = "europe-north1" + PageTrendParamsRegionEuropeSouthwest1 PageTrendParamsRegion = "europe-southwest1" + PageTrendParamsRegionEuropeWest1 PageTrendParamsRegion = "europe-west1" + PageTrendParamsRegionEuropeWest2 PageTrendParamsRegion = "europe-west2" + PageTrendParamsRegionEuropeWest3 PageTrendParamsRegion = "europe-west3" + PageTrendParamsRegionEuropeWest4 PageTrendParamsRegion = "europe-west4" + PageTrendParamsRegionEuropeWest8 PageTrendParamsRegion = "europe-west8" + PageTrendParamsRegionEuropeWest9 PageTrendParamsRegion = "europe-west9" + PageTrendParamsRegionMeWest1 PageTrendParamsRegion = "me-west1" + PageTrendParamsRegionSouthamericaEast1 PageTrendParamsRegion = "southamerica-east1" + PageTrendParamsRegionUsCentral1 PageTrendParamsRegion = "us-central1" + PageTrendParamsRegionUsEast1 PageTrendParamsRegion = "us-east1" + PageTrendParamsRegionUsEast4 PageTrendParamsRegion = "us-east4" + PageTrendParamsRegionUsSouth1 PageTrendParamsRegion = "us-south1" + PageTrendParamsRegionUsWest1 PageTrendParamsRegion = "us-west1" +) + +func (r PageTrendParamsRegion) IsKnown() bool { + switch r { + case PageTrendParamsRegionAsiaEast1, PageTrendParamsRegionAsiaNortheast1, PageTrendParamsRegionAsiaNortheast2, PageTrendParamsRegionAsiaSouth1, PageTrendParamsRegionAsiaSoutheast1, PageTrendParamsRegionAustraliaSoutheast1, PageTrendParamsRegionEuropeNorth1, PageTrendParamsRegionEuropeSouthwest1, PageTrendParamsRegionEuropeWest1, PageTrendParamsRegionEuropeWest2, PageTrendParamsRegionEuropeWest3, PageTrendParamsRegionEuropeWest4, PageTrendParamsRegionEuropeWest8, PageTrendParamsRegionEuropeWest9, PageTrendParamsRegionMeWest1, PageTrendParamsRegionSouthamericaEast1, PageTrendParamsRegionUsCentral1, PageTrendParamsRegionUsEast1, PageTrendParamsRegionUsEast4, PageTrendParamsRegionUsSouth1, PageTrendParamsRegionUsWest1: + return true + } + return false +} + +type PageTrendResponseEnvelope struct { + Result Trend `json:"result"` + JSON pageTrendResponseEnvelopeJSON `json:"-"` +} + +// pageTrendResponseEnvelopeJSON contains the JSON metadata for the struct +// [PageTrendResponseEnvelope] +type pageTrendResponseEnvelopeJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageTrendResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r pageTrendResponseEnvelopeJSON) RawJSON() string { + return r.raw +} diff --git a/speed/page_test.go b/speed/page_test.go index a3fe62157b0..266fdd11517 100644 --- a/speed/page_test.go +++ b/speed/page_test.go @@ -7,6 +7,7 @@ import ( "errors" "os" "testing" + "time" "github.com/cloudflare/cloudflare-go/v2" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" @@ -15,7 +16,6 @@ import ( ) func TestPageList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -39,3 +39,39 @@ func TestPageList(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } + +func TestPageTrendWithOptionalParams(t *testing.T) { + t.Skip("TODO: investigate broken test") + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.Speed.Pages.Trend( + context.TODO(), + "example.com", + speed.PageTrendParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + DeviceType: cloudflare.F(speed.PageTrendParamsDeviceTypeDesktop), + Metrics: cloudflare.F("performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls"), + Region: cloudflare.F(speed.PageTrendParamsRegionUsCentral1), + Start: cloudflare.F(time.Now()), + Tz: cloudflare.F("string"), + End: cloudflare.F(time.Now()), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/speed/pagetest.go b/speed/pagetest.go new file mode 100644 index 00000000000..16bc74400b8 --- /dev/null +++ b/speed/pagetest.go @@ -0,0 +1,430 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +package speed + +import ( + "context" + "fmt" + "net/http" + "net/url" + "time" + + "github.com/cloudflare/cloudflare-go/v2/internal/apijson" + "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" + "github.com/cloudflare/cloudflare-go/v2/internal/param" + "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" + "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" +) + +// PageTestService contains methods and other services that help with interacting +// with the cloudflare API. Note, unlike clients, this service does not read +// variables from the environment automatically. You should not instantiate this +// service directly, and instead use the [NewPageTestService] method instead. +type PageTestService struct { + Options []option.RequestOption +} + +// NewPageTestService generates a new service that applies the given options to +// each request. These options are applied after the parent client's options (if +// there is one), and before any request-specific options. +func NewPageTestService(opts ...option.RequestOption) (r *PageTestService) { + r = &PageTestService{} + r.Options = opts + return +} + +// Starts a test for a specific webpage, in a specific region. +func (r *PageTestService) New(ctx context.Context, url string, params PageTestNewParams, opts ...option.RequestOption) (res *Test, err error) { + opts = append(r.Options[:], opts...) + var env PageTestNewResponseEnvelope + path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests", params.ZoneID, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Test history (list of tests) for a specific webpage. +func (r *PageTestService) List(ctx context.Context, url string, params PageTestListParams, opts ...option.RequestOption) (res *PageTestListResponse, err error) { + opts = append(r.Options[:], opts...) + path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests", params.ZoneID, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &res, opts...) + return +} + +// Deletes all tests for a specific webpage from a specific region. Deleted tests +// are still counted as part of the quota. +func (r *PageTestService) Delete(ctx context.Context, url string, params PageTestDeleteParams, opts ...option.RequestOption) (res *PageTestDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env PageTestDeleteResponseEnvelope + path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests", params.ZoneID, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Retrieves the result of a specific test. +func (r *PageTestService) Get(ctx context.Context, url string, testID string, query PageTestGetParams, opts ...option.RequestOption) (res *Test, err error) { + opts = append(r.Options[:], opts...) + var env PageTestGetResponseEnvelope + path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests/%s", query.ZoneID, url, testID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +type Test struct { + // UUID + ID string `json:"id"` + Date time.Time `json:"date" format:"date-time"` + // The Lighthouse report. + DesktopReport LighthouseReport `json:"desktopReport"` + // The Lighthouse report. + MobileReport LighthouseReport `json:"mobileReport"` + // A test region with a label. + Region LabeledRegion `json:"region"` + // The frequency of the test. + ScheduleFrequency TestScheduleFrequency `json:"scheduleFrequency"` + // A URL. + URL string `json:"url"` + JSON testJSON `json:"-"` +} + +// testJSON contains the JSON metadata for the struct [Test] +type testJSON struct { + ID apijson.Field + Date apijson.Field + DesktopReport apijson.Field + MobileReport apijson.Field + Region apijson.Field + ScheduleFrequency apijson.Field + URL apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *Test) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r testJSON) RawJSON() string { + return r.raw +} + +// The frequency of the test. +type TestScheduleFrequency string + +const ( + TestScheduleFrequencyDaily TestScheduleFrequency = "DAILY" + TestScheduleFrequencyWeekly TestScheduleFrequency = "WEEKLY" +) + +func (r TestScheduleFrequency) IsKnown() bool { + switch r { + case TestScheduleFrequencyDaily, TestScheduleFrequencyWeekly: + return true + } + return false +} + +type PageTestListResponse struct { + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` + // Whether the API call was successful. + Success bool `json:"success,required"` + ResultInfo PageTestListResponseResultInfo `json:"result_info"` + JSON pageTestListResponseJSON `json:"-"` +} + +// pageTestListResponseJSON contains the JSON metadata for the struct +// [PageTestListResponse] +type pageTestListResponseJSON struct { + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + ResultInfo apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageTestListResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r pageTestListResponseJSON) RawJSON() string { + return r.raw +} + +type PageTestListResponseResultInfo struct { + Count int64 `json:"count"` + Page int64 `json:"page"` + PerPage int64 `json:"per_page"` + TotalCount int64 `json:"total_count"` + JSON pageTestListResponseResultInfoJSON `json:"-"` +} + +// pageTestListResponseResultInfoJSON contains the JSON metadata for the struct +// [PageTestListResponseResultInfo] +type pageTestListResponseResultInfoJSON struct { + Count apijson.Field + Page apijson.Field + PerPage apijson.Field + TotalCount apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageTestListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r pageTestListResponseResultInfoJSON) RawJSON() string { + return r.raw +} + +type PageTestDeleteResponse struct { + // Number of items affected. + Count float64 `json:"count"` + JSON pageTestDeleteResponseJSON `json:"-"` +} + +// pageTestDeleteResponseJSON contains the JSON metadata for the struct +// [PageTestDeleteResponse] +type pageTestDeleteResponseJSON struct { + Count apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageTestDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r pageTestDeleteResponseJSON) RawJSON() string { + return r.raw +} + +type PageTestNewParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A test region. + Region param.Field[PageTestNewParamsRegion] `json:"region"` +} + +func (r PageTestNewParams) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) +} + +// A test region. +type PageTestNewParamsRegion string + +const ( + PageTestNewParamsRegionAsiaEast1 PageTestNewParamsRegion = "asia-east1" + PageTestNewParamsRegionAsiaNortheast1 PageTestNewParamsRegion = "asia-northeast1" + PageTestNewParamsRegionAsiaNortheast2 PageTestNewParamsRegion = "asia-northeast2" + PageTestNewParamsRegionAsiaSouth1 PageTestNewParamsRegion = "asia-south1" + PageTestNewParamsRegionAsiaSoutheast1 PageTestNewParamsRegion = "asia-southeast1" + PageTestNewParamsRegionAustraliaSoutheast1 PageTestNewParamsRegion = "australia-southeast1" + PageTestNewParamsRegionEuropeNorth1 PageTestNewParamsRegion = "europe-north1" + PageTestNewParamsRegionEuropeSouthwest1 PageTestNewParamsRegion = "europe-southwest1" + PageTestNewParamsRegionEuropeWest1 PageTestNewParamsRegion = "europe-west1" + PageTestNewParamsRegionEuropeWest2 PageTestNewParamsRegion = "europe-west2" + PageTestNewParamsRegionEuropeWest3 PageTestNewParamsRegion = "europe-west3" + PageTestNewParamsRegionEuropeWest4 PageTestNewParamsRegion = "europe-west4" + PageTestNewParamsRegionEuropeWest8 PageTestNewParamsRegion = "europe-west8" + PageTestNewParamsRegionEuropeWest9 PageTestNewParamsRegion = "europe-west9" + PageTestNewParamsRegionMeWest1 PageTestNewParamsRegion = "me-west1" + PageTestNewParamsRegionSouthamericaEast1 PageTestNewParamsRegion = "southamerica-east1" + PageTestNewParamsRegionUsCentral1 PageTestNewParamsRegion = "us-central1" + PageTestNewParamsRegionUsEast1 PageTestNewParamsRegion = "us-east1" + PageTestNewParamsRegionUsEast4 PageTestNewParamsRegion = "us-east4" + PageTestNewParamsRegionUsSouth1 PageTestNewParamsRegion = "us-south1" + PageTestNewParamsRegionUsWest1 PageTestNewParamsRegion = "us-west1" +) + +func (r PageTestNewParamsRegion) IsKnown() bool { + switch r { + case PageTestNewParamsRegionAsiaEast1, PageTestNewParamsRegionAsiaNortheast1, PageTestNewParamsRegionAsiaNortheast2, PageTestNewParamsRegionAsiaSouth1, PageTestNewParamsRegionAsiaSoutheast1, PageTestNewParamsRegionAustraliaSoutheast1, PageTestNewParamsRegionEuropeNorth1, PageTestNewParamsRegionEuropeSouthwest1, PageTestNewParamsRegionEuropeWest1, PageTestNewParamsRegionEuropeWest2, PageTestNewParamsRegionEuropeWest3, PageTestNewParamsRegionEuropeWest4, PageTestNewParamsRegionEuropeWest8, PageTestNewParamsRegionEuropeWest9, PageTestNewParamsRegionMeWest1, PageTestNewParamsRegionSouthamericaEast1, PageTestNewParamsRegionUsCentral1, PageTestNewParamsRegionUsEast1, PageTestNewParamsRegionUsEast4, PageTestNewParamsRegionUsSouth1, PageTestNewParamsRegionUsWest1: + return true + } + return false +} + +type PageTestNewResponseEnvelope struct { + Result Test `json:"result"` + JSON pageTestNewResponseEnvelopeJSON `json:"-"` +} + +// pageTestNewResponseEnvelopeJSON contains the JSON metadata for the struct +// [PageTestNewResponseEnvelope] +type pageTestNewResponseEnvelopeJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageTestNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r pageTestNewResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type PageTestListParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + Page param.Field[int64] `query:"page"` + PerPage param.Field[int64] `query:"per_page"` + // A test region. + Region param.Field[PageTestListParamsRegion] `query:"region"` +} + +// URLQuery serializes [PageTestListParams]'s query parameters as `url.Values`. +func (r PageTestListParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// A test region. +type PageTestListParamsRegion string + +const ( + PageTestListParamsRegionAsiaEast1 PageTestListParamsRegion = "asia-east1" + PageTestListParamsRegionAsiaNortheast1 PageTestListParamsRegion = "asia-northeast1" + PageTestListParamsRegionAsiaNortheast2 PageTestListParamsRegion = "asia-northeast2" + PageTestListParamsRegionAsiaSouth1 PageTestListParamsRegion = "asia-south1" + PageTestListParamsRegionAsiaSoutheast1 PageTestListParamsRegion = "asia-southeast1" + PageTestListParamsRegionAustraliaSoutheast1 PageTestListParamsRegion = "australia-southeast1" + PageTestListParamsRegionEuropeNorth1 PageTestListParamsRegion = "europe-north1" + PageTestListParamsRegionEuropeSouthwest1 PageTestListParamsRegion = "europe-southwest1" + PageTestListParamsRegionEuropeWest1 PageTestListParamsRegion = "europe-west1" + PageTestListParamsRegionEuropeWest2 PageTestListParamsRegion = "europe-west2" + PageTestListParamsRegionEuropeWest3 PageTestListParamsRegion = "europe-west3" + PageTestListParamsRegionEuropeWest4 PageTestListParamsRegion = "europe-west4" + PageTestListParamsRegionEuropeWest8 PageTestListParamsRegion = "europe-west8" + PageTestListParamsRegionEuropeWest9 PageTestListParamsRegion = "europe-west9" + PageTestListParamsRegionMeWest1 PageTestListParamsRegion = "me-west1" + PageTestListParamsRegionSouthamericaEast1 PageTestListParamsRegion = "southamerica-east1" + PageTestListParamsRegionUsCentral1 PageTestListParamsRegion = "us-central1" + PageTestListParamsRegionUsEast1 PageTestListParamsRegion = "us-east1" + PageTestListParamsRegionUsEast4 PageTestListParamsRegion = "us-east4" + PageTestListParamsRegionUsSouth1 PageTestListParamsRegion = "us-south1" + PageTestListParamsRegionUsWest1 PageTestListParamsRegion = "us-west1" +) + +func (r PageTestListParamsRegion) IsKnown() bool { + switch r { + case PageTestListParamsRegionAsiaEast1, PageTestListParamsRegionAsiaNortheast1, PageTestListParamsRegionAsiaNortheast2, PageTestListParamsRegionAsiaSouth1, PageTestListParamsRegionAsiaSoutheast1, PageTestListParamsRegionAustraliaSoutheast1, PageTestListParamsRegionEuropeNorth1, PageTestListParamsRegionEuropeSouthwest1, PageTestListParamsRegionEuropeWest1, PageTestListParamsRegionEuropeWest2, PageTestListParamsRegionEuropeWest3, PageTestListParamsRegionEuropeWest4, PageTestListParamsRegionEuropeWest8, PageTestListParamsRegionEuropeWest9, PageTestListParamsRegionMeWest1, PageTestListParamsRegionSouthamericaEast1, PageTestListParamsRegionUsCentral1, PageTestListParamsRegionUsEast1, PageTestListParamsRegionUsEast4, PageTestListParamsRegionUsSouth1, PageTestListParamsRegionUsWest1: + return true + } + return false +} + +type PageTestDeleteParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A test region. + Region param.Field[PageTestDeleteParamsRegion] `query:"region"` +} + +// URLQuery serializes [PageTestDeleteParams]'s query parameters as `url.Values`. +func (r PageTestDeleteParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// A test region. +type PageTestDeleteParamsRegion string + +const ( + PageTestDeleteParamsRegionAsiaEast1 PageTestDeleteParamsRegion = "asia-east1" + PageTestDeleteParamsRegionAsiaNortheast1 PageTestDeleteParamsRegion = "asia-northeast1" + PageTestDeleteParamsRegionAsiaNortheast2 PageTestDeleteParamsRegion = "asia-northeast2" + PageTestDeleteParamsRegionAsiaSouth1 PageTestDeleteParamsRegion = "asia-south1" + PageTestDeleteParamsRegionAsiaSoutheast1 PageTestDeleteParamsRegion = "asia-southeast1" + PageTestDeleteParamsRegionAustraliaSoutheast1 PageTestDeleteParamsRegion = "australia-southeast1" + PageTestDeleteParamsRegionEuropeNorth1 PageTestDeleteParamsRegion = "europe-north1" + PageTestDeleteParamsRegionEuropeSouthwest1 PageTestDeleteParamsRegion = "europe-southwest1" + PageTestDeleteParamsRegionEuropeWest1 PageTestDeleteParamsRegion = "europe-west1" + PageTestDeleteParamsRegionEuropeWest2 PageTestDeleteParamsRegion = "europe-west2" + PageTestDeleteParamsRegionEuropeWest3 PageTestDeleteParamsRegion = "europe-west3" + PageTestDeleteParamsRegionEuropeWest4 PageTestDeleteParamsRegion = "europe-west4" + PageTestDeleteParamsRegionEuropeWest8 PageTestDeleteParamsRegion = "europe-west8" + PageTestDeleteParamsRegionEuropeWest9 PageTestDeleteParamsRegion = "europe-west9" + PageTestDeleteParamsRegionMeWest1 PageTestDeleteParamsRegion = "me-west1" + PageTestDeleteParamsRegionSouthamericaEast1 PageTestDeleteParamsRegion = "southamerica-east1" + PageTestDeleteParamsRegionUsCentral1 PageTestDeleteParamsRegion = "us-central1" + PageTestDeleteParamsRegionUsEast1 PageTestDeleteParamsRegion = "us-east1" + PageTestDeleteParamsRegionUsEast4 PageTestDeleteParamsRegion = "us-east4" + PageTestDeleteParamsRegionUsSouth1 PageTestDeleteParamsRegion = "us-south1" + PageTestDeleteParamsRegionUsWest1 PageTestDeleteParamsRegion = "us-west1" +) + +func (r PageTestDeleteParamsRegion) IsKnown() bool { + switch r { + case PageTestDeleteParamsRegionAsiaEast1, PageTestDeleteParamsRegionAsiaNortheast1, PageTestDeleteParamsRegionAsiaNortheast2, PageTestDeleteParamsRegionAsiaSouth1, PageTestDeleteParamsRegionAsiaSoutheast1, PageTestDeleteParamsRegionAustraliaSoutheast1, PageTestDeleteParamsRegionEuropeNorth1, PageTestDeleteParamsRegionEuropeSouthwest1, PageTestDeleteParamsRegionEuropeWest1, PageTestDeleteParamsRegionEuropeWest2, PageTestDeleteParamsRegionEuropeWest3, PageTestDeleteParamsRegionEuropeWest4, PageTestDeleteParamsRegionEuropeWest8, PageTestDeleteParamsRegionEuropeWest9, PageTestDeleteParamsRegionMeWest1, PageTestDeleteParamsRegionSouthamericaEast1, PageTestDeleteParamsRegionUsCentral1, PageTestDeleteParamsRegionUsEast1, PageTestDeleteParamsRegionUsEast4, PageTestDeleteParamsRegionUsSouth1, PageTestDeleteParamsRegionUsWest1: + return true + } + return false +} + +type PageTestDeleteResponseEnvelope struct { + Result PageTestDeleteResponse `json:"result"` + JSON pageTestDeleteResponseEnvelopeJSON `json:"-"` +} + +// pageTestDeleteResponseEnvelopeJSON contains the JSON metadata for the struct +// [PageTestDeleteResponseEnvelope] +type pageTestDeleteResponseEnvelopeJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageTestDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r pageTestDeleteResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type PageTestGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` +} + +type PageTestGetResponseEnvelope struct { + Result Test `json:"result"` + JSON pageTestGetResponseEnvelopeJSON `json:"-"` +} + +// pageTestGetResponseEnvelopeJSON contains the JSON metadata for the struct +// [PageTestGetResponseEnvelope] +type pageTestGetResponseEnvelopeJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *PageTestGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r pageTestGetResponseEnvelopeJSON) RawJSON() string { + return r.raw +} diff --git a/speed/test_test.go b/speed/pagetest_test.go similarity index 77% rename from speed/test_test.go rename to speed/pagetest_test.go index 417968e3fae..1ddefc7bb67 100644 --- a/speed/test_test.go +++ b/speed/pagetest_test.go @@ -14,8 +14,7 @@ import ( "github.com/cloudflare/cloudflare-go/v2/speed" ) -func TestTestNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") +func TestPageTestNewWithOptionalParams(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -28,12 +27,12 @@ func TestTestNewWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Speed.Tests.New( + _, err := client.Speed.Pages.Tests.New( context.TODO(), "example.com", - speed.TestNewParams{ + speed.PageTestNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Region: cloudflare.F(speed.TestNewParamsRegionUsCentral1), + Region: cloudflare.F(speed.PageTestNewParamsRegionUsCentral1), }, ) if err != nil { @@ -45,8 +44,7 @@ func TestTestNewWithOptionalParams(t *testing.T) { } } -func TestTestListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") +func TestPageTestListWithOptionalParams(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -59,14 +57,14 @@ func TestTestListWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Speed.Tests.List( + _, err := client.Speed.Pages.Tests.List( context.TODO(), "example.com", - speed.TestListParams{ + speed.PageTestListParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Page: cloudflare.F(int64(1)), PerPage: cloudflare.F(int64(20)), - Region: cloudflare.F(speed.TestListParamsRegionUsCentral1), + Region: cloudflare.F(speed.PageTestListParamsRegionUsCentral1), }, ) if err != nil { @@ -78,8 +76,7 @@ func TestTestListWithOptionalParams(t *testing.T) { } } -func TestTestDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") +func TestPageTestDeleteWithOptionalParams(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -92,12 +89,12 @@ func TestTestDeleteWithOptionalParams(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Speed.Tests.Delete( + _, err := client.Speed.Pages.Tests.Delete( context.TODO(), "example.com", - speed.TestDeleteParams{ + speed.PageTestDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Region: cloudflare.F(speed.TestDeleteParamsRegionUsCentral1), + Region: cloudflare.F(speed.PageTestDeleteParamsRegionUsCentral1), }, ) if err != nil { @@ -109,8 +106,7 @@ func TestTestDeleteWithOptionalParams(t *testing.T) { } } -func TestTestGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") +func TestPageTestGet(t *testing.T) { baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -123,11 +119,11 @@ func TestTestGet(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.Speed.Tests.Get( + _, err := client.Speed.Pages.Tests.Get( context.TODO(), "example.com", "string", - speed.TestGetParams{ + speed.PageTestGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) diff --git a/speed/schedule.go b/speed/schedule.go index 70641f20311..52d9dc14d48 100644 --- a/speed/schedule.go +++ b/speed/schedule.go @@ -45,6 +45,32 @@ func (r *ScheduleService) New(ctx context.Context, url string, params ScheduleNe return } +// Deletes a scheduled test for a page. +func (r *ScheduleService) Delete(ctx context.Context, url string, params ScheduleDeleteParams, opts ...option.RequestOption) (res *ScheduleDeleteResponse, err error) { + opts = append(r.Options[:], opts...) + var env ScheduleDeleteResponseEnvelope + path := fmt.Sprintf("zones/%s/speed_api/schedule/%s", params.ZoneID, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + +// Retrieves the test schedule for a page in a specific region. +func (r *ScheduleService) Get(ctx context.Context, url string, params ScheduleGetParams, opts ...option.RequestOption) (res *Schedule, err error) { + opts = append(r.Options[:], opts...) + var env ScheduleGetResponseEnvelope + path := fmt.Sprintf("zones/%s/speed_api/schedule/%s", params.ZoneID, url) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...) + if err != nil { + return + } + res = &env.Result + return +} + // The test schedule. type Schedule struct { // The frequency of the test. @@ -124,20 +150,6 @@ func (r ScheduleRegion) IsKnown() bool { return false } -// The test schedule. -type ScheduleParam struct { - // The frequency of the test. - Frequency param.Field[ScheduleFrequency] `json:"frequency"` - // A test region. - Region param.Field[ScheduleRegion] `json:"region"` - // A URL. - URL param.Field[string] `json:"url"` -} - -func (r ScheduleParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type ScheduleNewResponse struct { // The test schedule. Schedule Schedule `json:"schedule"` @@ -162,6 +174,28 @@ func (r scheduleNewResponseJSON) RawJSON() string { return r.raw } +type ScheduleDeleteResponse struct { + // Number of items affected. + Count float64 `json:"count"` + JSON scheduleDeleteResponseJSON `json:"-"` +} + +// scheduleDeleteResponseJSON contains the JSON metadata for the struct +// [ScheduleDeleteResponse] +type scheduleDeleteResponseJSON struct { + Count apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ScheduleDeleteResponse) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r scheduleDeleteResponseJSON) RawJSON() string { + return r.raw +} + type ScheduleNewParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` @@ -213,19 +247,13 @@ func (r ScheduleNewParamsRegion) IsKnown() bool { } type ScheduleNewResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result ScheduleNewResponse `json:"result"` - JSON scheduleNewResponseEnvelopeJSON `json:"-"` + Result ScheduleNewResponse `json:"result"` + JSON scheduleNewResponseEnvelopeJSON `json:"-"` } // scheduleNewResponseEnvelopeJSON contains the JSON metadata for the struct // [ScheduleNewResponseEnvelope] type scheduleNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field Result apijson.Field raw string ExtraFields map[string]apijson.Field @@ -238,3 +266,146 @@ func (r *ScheduleNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { func (r scheduleNewResponseEnvelopeJSON) RawJSON() string { return r.raw } + +type ScheduleDeleteParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A test region. + Region param.Field[ScheduleDeleteParamsRegion] `query:"region"` +} + +// URLQuery serializes [ScheduleDeleteParams]'s query parameters as `url.Values`. +func (r ScheduleDeleteParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// A test region. +type ScheduleDeleteParamsRegion string + +const ( + ScheduleDeleteParamsRegionAsiaEast1 ScheduleDeleteParamsRegion = "asia-east1" + ScheduleDeleteParamsRegionAsiaNortheast1 ScheduleDeleteParamsRegion = "asia-northeast1" + ScheduleDeleteParamsRegionAsiaNortheast2 ScheduleDeleteParamsRegion = "asia-northeast2" + ScheduleDeleteParamsRegionAsiaSouth1 ScheduleDeleteParamsRegion = "asia-south1" + ScheduleDeleteParamsRegionAsiaSoutheast1 ScheduleDeleteParamsRegion = "asia-southeast1" + ScheduleDeleteParamsRegionAustraliaSoutheast1 ScheduleDeleteParamsRegion = "australia-southeast1" + ScheduleDeleteParamsRegionEuropeNorth1 ScheduleDeleteParamsRegion = "europe-north1" + ScheduleDeleteParamsRegionEuropeSouthwest1 ScheduleDeleteParamsRegion = "europe-southwest1" + ScheduleDeleteParamsRegionEuropeWest1 ScheduleDeleteParamsRegion = "europe-west1" + ScheduleDeleteParamsRegionEuropeWest2 ScheduleDeleteParamsRegion = "europe-west2" + ScheduleDeleteParamsRegionEuropeWest3 ScheduleDeleteParamsRegion = "europe-west3" + ScheduleDeleteParamsRegionEuropeWest4 ScheduleDeleteParamsRegion = "europe-west4" + ScheduleDeleteParamsRegionEuropeWest8 ScheduleDeleteParamsRegion = "europe-west8" + ScheduleDeleteParamsRegionEuropeWest9 ScheduleDeleteParamsRegion = "europe-west9" + ScheduleDeleteParamsRegionMeWest1 ScheduleDeleteParamsRegion = "me-west1" + ScheduleDeleteParamsRegionSouthamericaEast1 ScheduleDeleteParamsRegion = "southamerica-east1" + ScheduleDeleteParamsRegionUsCentral1 ScheduleDeleteParamsRegion = "us-central1" + ScheduleDeleteParamsRegionUsEast1 ScheduleDeleteParamsRegion = "us-east1" + ScheduleDeleteParamsRegionUsEast4 ScheduleDeleteParamsRegion = "us-east4" + ScheduleDeleteParamsRegionUsSouth1 ScheduleDeleteParamsRegion = "us-south1" + ScheduleDeleteParamsRegionUsWest1 ScheduleDeleteParamsRegion = "us-west1" +) + +func (r ScheduleDeleteParamsRegion) IsKnown() bool { + switch r { + case ScheduleDeleteParamsRegionAsiaEast1, ScheduleDeleteParamsRegionAsiaNortheast1, ScheduleDeleteParamsRegionAsiaNortheast2, ScheduleDeleteParamsRegionAsiaSouth1, ScheduleDeleteParamsRegionAsiaSoutheast1, ScheduleDeleteParamsRegionAustraliaSoutheast1, ScheduleDeleteParamsRegionEuropeNorth1, ScheduleDeleteParamsRegionEuropeSouthwest1, ScheduleDeleteParamsRegionEuropeWest1, ScheduleDeleteParamsRegionEuropeWest2, ScheduleDeleteParamsRegionEuropeWest3, ScheduleDeleteParamsRegionEuropeWest4, ScheduleDeleteParamsRegionEuropeWest8, ScheduleDeleteParamsRegionEuropeWest9, ScheduleDeleteParamsRegionMeWest1, ScheduleDeleteParamsRegionSouthamericaEast1, ScheduleDeleteParamsRegionUsCentral1, ScheduleDeleteParamsRegionUsEast1, ScheduleDeleteParamsRegionUsEast4, ScheduleDeleteParamsRegionUsSouth1, ScheduleDeleteParamsRegionUsWest1: + return true + } + return false +} + +type ScheduleDeleteResponseEnvelope struct { + Result ScheduleDeleteResponse `json:"result"` + JSON scheduleDeleteResponseEnvelopeJSON `json:"-"` +} + +// scheduleDeleteResponseEnvelopeJSON contains the JSON metadata for the struct +// [ScheduleDeleteResponseEnvelope] +type scheduleDeleteResponseEnvelopeJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ScheduleDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r scheduleDeleteResponseEnvelopeJSON) RawJSON() string { + return r.raw +} + +type ScheduleGetParams struct { + // Identifier + ZoneID param.Field[string] `path:"zone_id,required"` + // A test region. + Region param.Field[ScheduleGetParamsRegion] `query:"region"` +} + +// URLQuery serializes [ScheduleGetParams]'s query parameters as `url.Values`. +func (r ScheduleGetParams) URLQuery() (v url.Values) { + return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ + ArrayFormat: apiquery.ArrayQueryFormatRepeat, + NestedFormat: apiquery.NestedQueryFormatBrackets, + }) +} + +// A test region. +type ScheduleGetParamsRegion string + +const ( + ScheduleGetParamsRegionAsiaEast1 ScheduleGetParamsRegion = "asia-east1" + ScheduleGetParamsRegionAsiaNortheast1 ScheduleGetParamsRegion = "asia-northeast1" + ScheduleGetParamsRegionAsiaNortheast2 ScheduleGetParamsRegion = "asia-northeast2" + ScheduleGetParamsRegionAsiaSouth1 ScheduleGetParamsRegion = "asia-south1" + ScheduleGetParamsRegionAsiaSoutheast1 ScheduleGetParamsRegion = "asia-southeast1" + ScheduleGetParamsRegionAustraliaSoutheast1 ScheduleGetParamsRegion = "australia-southeast1" + ScheduleGetParamsRegionEuropeNorth1 ScheduleGetParamsRegion = "europe-north1" + ScheduleGetParamsRegionEuropeSouthwest1 ScheduleGetParamsRegion = "europe-southwest1" + ScheduleGetParamsRegionEuropeWest1 ScheduleGetParamsRegion = "europe-west1" + ScheduleGetParamsRegionEuropeWest2 ScheduleGetParamsRegion = "europe-west2" + ScheduleGetParamsRegionEuropeWest3 ScheduleGetParamsRegion = "europe-west3" + ScheduleGetParamsRegionEuropeWest4 ScheduleGetParamsRegion = "europe-west4" + ScheduleGetParamsRegionEuropeWest8 ScheduleGetParamsRegion = "europe-west8" + ScheduleGetParamsRegionEuropeWest9 ScheduleGetParamsRegion = "europe-west9" + ScheduleGetParamsRegionMeWest1 ScheduleGetParamsRegion = "me-west1" + ScheduleGetParamsRegionSouthamericaEast1 ScheduleGetParamsRegion = "southamerica-east1" + ScheduleGetParamsRegionUsCentral1 ScheduleGetParamsRegion = "us-central1" + ScheduleGetParamsRegionUsEast1 ScheduleGetParamsRegion = "us-east1" + ScheduleGetParamsRegionUsEast4 ScheduleGetParamsRegion = "us-east4" + ScheduleGetParamsRegionUsSouth1 ScheduleGetParamsRegion = "us-south1" + ScheduleGetParamsRegionUsWest1 ScheduleGetParamsRegion = "us-west1" +) + +func (r ScheduleGetParamsRegion) IsKnown() bool { + switch r { + case ScheduleGetParamsRegionAsiaEast1, ScheduleGetParamsRegionAsiaNortheast1, ScheduleGetParamsRegionAsiaNortheast2, ScheduleGetParamsRegionAsiaSouth1, ScheduleGetParamsRegionAsiaSoutheast1, ScheduleGetParamsRegionAustraliaSoutheast1, ScheduleGetParamsRegionEuropeNorth1, ScheduleGetParamsRegionEuropeSouthwest1, ScheduleGetParamsRegionEuropeWest1, ScheduleGetParamsRegionEuropeWest2, ScheduleGetParamsRegionEuropeWest3, ScheduleGetParamsRegionEuropeWest4, ScheduleGetParamsRegionEuropeWest8, ScheduleGetParamsRegionEuropeWest9, ScheduleGetParamsRegionMeWest1, ScheduleGetParamsRegionSouthamericaEast1, ScheduleGetParamsRegionUsCentral1, ScheduleGetParamsRegionUsEast1, ScheduleGetParamsRegionUsEast4, ScheduleGetParamsRegionUsSouth1, ScheduleGetParamsRegionUsWest1: + return true + } + return false +} + +type ScheduleGetResponseEnvelope struct { + // The test schedule. + Result Schedule `json:"result"` + JSON scheduleGetResponseEnvelopeJSON `json:"-"` +} + +// scheduleGetResponseEnvelopeJSON contains the JSON metadata for the struct +// [ScheduleGetResponseEnvelope] +type scheduleGetResponseEnvelopeJSON struct { + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ScheduleGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r scheduleGetResponseEnvelopeJSON) RawJSON() string { + return r.raw +} diff --git a/speed/schedule_test.go b/speed/schedule_test.go index 21684911025..41e87e63c38 100644 --- a/speed/schedule_test.go +++ b/speed/schedule_test.go @@ -15,7 +15,6 @@ import ( ) func TestScheduleNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,3 +43,63 @@ func TestScheduleNewWithOptionalParams(t *testing.T) { t.Fatalf("err should be nil: %s", err.Error()) } } + +func TestScheduleDeleteWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.Speed.Schedule.Delete( + context.TODO(), + "example.com", + speed.ScheduleDeleteParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Region: cloudflare.F(speed.ScheduleDeleteParamsRegionUsCentral1), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + +func TestScheduleGetWithOptionalParams(t *testing.T) { + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := cloudflare.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), + option.WithAPIEmail("user@example.com"), + ) + _, err := client.Speed.Schedule.Get( + context.TODO(), + "example.com", + speed.ScheduleGetParams{ + ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), + Region: cloudflare.F(speed.ScheduleGetParamsRegionUsCentral1), + }, + ) + if err != nil { + var apierr *cloudflare.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} diff --git a/speed/speed.go b/speed/speed.go index e35127dbe43..20617e2ca3b 100644 --- a/speed/speed.go +++ b/speed/speed.go @@ -3,16 +3,7 @@ package speed import ( - "context" - "fmt" - "net/http" - "net/url" - "time" - "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" - "github.com/cloudflare/cloudflare-go/v2/internal/param" - "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" "github.com/cloudflare/cloudflare-go/v2/option" ) @@ -22,7 +13,6 @@ import ( // directly, and instead use the [NewSpeedService] method instead. type SpeedService struct { Options []option.RequestOption - Tests *TestService Schedule *ScheduleService Availabilities *AvailabilityService Pages *PageService @@ -34,52 +24,12 @@ type SpeedService struct { func NewSpeedService(opts ...option.RequestOption) (r *SpeedService) { r = &SpeedService{} r.Options = opts - r.Tests = NewTestService(opts...) r.Schedule = NewScheduleService(opts...) r.Availabilities = NewAvailabilityService(opts...) r.Pages = NewPageService(opts...) return } -// Deletes a scheduled test for a page. -func (r *SpeedService) Delete(ctx context.Context, url string, params SpeedDeleteParams, opts ...option.RequestOption) (res *SpeedDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env SpeedDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/speed_api/schedule/%s", params.ZoneID, url) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Retrieves the test schedule for a page in a specific region. -func (r *SpeedService) ScheduleGet(ctx context.Context, url string, params SpeedScheduleGetParams, opts ...option.RequestOption) (res *Schedule, err error) { - opts = append(r.Options[:], opts...) - var env SpeedScheduleGetResponseEnvelope - path := fmt.Sprintf("zones/%s/speed_api/schedule/%s", params.ZoneID, url) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Lists the core web vital metrics trend over time for a specific page. -func (r *SpeedService) TrendsList(ctx context.Context, url string, params SpeedTrendsListParams, opts ...option.RequestOption) (res *Trend, err error) { - opts = append(r.Options[:], opts...) - var env SpeedTrendsListResponseEnvelope - path := fmt.Sprintf("zones/%s/speed_api/pages/%s/trend", params.ZoneID, url) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - // A test region with a label. type LabeledRegion struct { Label string `json:"label"` @@ -315,281 +265,3 @@ func (r *Trend) UnmarshalJSON(data []byte) (err error) { func (r trendJSON) RawJSON() string { return r.raw } - -type SpeedDeleteResponse struct { - // Number of items affected. - Count float64 `json:"count"` - JSON speedDeleteResponseJSON `json:"-"` -} - -// speedDeleteResponseJSON contains the JSON metadata for the struct -// [SpeedDeleteResponse] -type speedDeleteResponseJSON struct { - Count apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SpeedDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r speedDeleteResponseJSON) RawJSON() string { - return r.raw -} - -type SpeedDeleteParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // A test region. - Region param.Field[SpeedDeleteParamsRegion] `query:"region"` -} - -// URLQuery serializes [SpeedDeleteParams]'s query parameters as `url.Values`. -func (r SpeedDeleteParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatRepeat, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// A test region. -type SpeedDeleteParamsRegion string - -const ( - SpeedDeleteParamsRegionAsiaEast1 SpeedDeleteParamsRegion = "asia-east1" - SpeedDeleteParamsRegionAsiaNortheast1 SpeedDeleteParamsRegion = "asia-northeast1" - SpeedDeleteParamsRegionAsiaNortheast2 SpeedDeleteParamsRegion = "asia-northeast2" - SpeedDeleteParamsRegionAsiaSouth1 SpeedDeleteParamsRegion = "asia-south1" - SpeedDeleteParamsRegionAsiaSoutheast1 SpeedDeleteParamsRegion = "asia-southeast1" - SpeedDeleteParamsRegionAustraliaSoutheast1 SpeedDeleteParamsRegion = "australia-southeast1" - SpeedDeleteParamsRegionEuropeNorth1 SpeedDeleteParamsRegion = "europe-north1" - SpeedDeleteParamsRegionEuropeSouthwest1 SpeedDeleteParamsRegion = "europe-southwest1" - SpeedDeleteParamsRegionEuropeWest1 SpeedDeleteParamsRegion = "europe-west1" - SpeedDeleteParamsRegionEuropeWest2 SpeedDeleteParamsRegion = "europe-west2" - SpeedDeleteParamsRegionEuropeWest3 SpeedDeleteParamsRegion = "europe-west3" - SpeedDeleteParamsRegionEuropeWest4 SpeedDeleteParamsRegion = "europe-west4" - SpeedDeleteParamsRegionEuropeWest8 SpeedDeleteParamsRegion = "europe-west8" - SpeedDeleteParamsRegionEuropeWest9 SpeedDeleteParamsRegion = "europe-west9" - SpeedDeleteParamsRegionMeWest1 SpeedDeleteParamsRegion = "me-west1" - SpeedDeleteParamsRegionSouthamericaEast1 SpeedDeleteParamsRegion = "southamerica-east1" - SpeedDeleteParamsRegionUsCentral1 SpeedDeleteParamsRegion = "us-central1" - SpeedDeleteParamsRegionUsEast1 SpeedDeleteParamsRegion = "us-east1" - SpeedDeleteParamsRegionUsEast4 SpeedDeleteParamsRegion = "us-east4" - SpeedDeleteParamsRegionUsSouth1 SpeedDeleteParamsRegion = "us-south1" - SpeedDeleteParamsRegionUsWest1 SpeedDeleteParamsRegion = "us-west1" -) - -func (r SpeedDeleteParamsRegion) IsKnown() bool { - switch r { - case SpeedDeleteParamsRegionAsiaEast1, SpeedDeleteParamsRegionAsiaNortheast1, SpeedDeleteParamsRegionAsiaNortheast2, SpeedDeleteParamsRegionAsiaSouth1, SpeedDeleteParamsRegionAsiaSoutheast1, SpeedDeleteParamsRegionAustraliaSoutheast1, SpeedDeleteParamsRegionEuropeNorth1, SpeedDeleteParamsRegionEuropeSouthwest1, SpeedDeleteParamsRegionEuropeWest1, SpeedDeleteParamsRegionEuropeWest2, SpeedDeleteParamsRegionEuropeWest3, SpeedDeleteParamsRegionEuropeWest4, SpeedDeleteParamsRegionEuropeWest8, SpeedDeleteParamsRegionEuropeWest9, SpeedDeleteParamsRegionMeWest1, SpeedDeleteParamsRegionSouthamericaEast1, SpeedDeleteParamsRegionUsCentral1, SpeedDeleteParamsRegionUsEast1, SpeedDeleteParamsRegionUsEast4, SpeedDeleteParamsRegionUsSouth1, SpeedDeleteParamsRegionUsWest1: - return true - } - return false -} - -type SpeedDeleteResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result SpeedDeleteResponse `json:"result"` - JSON speedDeleteResponseEnvelopeJSON `json:"-"` -} - -// speedDeleteResponseEnvelopeJSON contains the JSON metadata for the struct -// [SpeedDeleteResponseEnvelope] -type speedDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SpeedDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r speedDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -type SpeedScheduleGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // A test region. - Region param.Field[SpeedScheduleGetParamsRegion] `query:"region"` -} - -// URLQuery serializes [SpeedScheduleGetParams]'s query parameters as `url.Values`. -func (r SpeedScheduleGetParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatRepeat, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// A test region. -type SpeedScheduleGetParamsRegion string - -const ( - SpeedScheduleGetParamsRegionAsiaEast1 SpeedScheduleGetParamsRegion = "asia-east1" - SpeedScheduleGetParamsRegionAsiaNortheast1 SpeedScheduleGetParamsRegion = "asia-northeast1" - SpeedScheduleGetParamsRegionAsiaNortheast2 SpeedScheduleGetParamsRegion = "asia-northeast2" - SpeedScheduleGetParamsRegionAsiaSouth1 SpeedScheduleGetParamsRegion = "asia-south1" - SpeedScheduleGetParamsRegionAsiaSoutheast1 SpeedScheduleGetParamsRegion = "asia-southeast1" - SpeedScheduleGetParamsRegionAustraliaSoutheast1 SpeedScheduleGetParamsRegion = "australia-southeast1" - SpeedScheduleGetParamsRegionEuropeNorth1 SpeedScheduleGetParamsRegion = "europe-north1" - SpeedScheduleGetParamsRegionEuropeSouthwest1 SpeedScheduleGetParamsRegion = "europe-southwest1" - SpeedScheduleGetParamsRegionEuropeWest1 SpeedScheduleGetParamsRegion = "europe-west1" - SpeedScheduleGetParamsRegionEuropeWest2 SpeedScheduleGetParamsRegion = "europe-west2" - SpeedScheduleGetParamsRegionEuropeWest3 SpeedScheduleGetParamsRegion = "europe-west3" - SpeedScheduleGetParamsRegionEuropeWest4 SpeedScheduleGetParamsRegion = "europe-west4" - SpeedScheduleGetParamsRegionEuropeWest8 SpeedScheduleGetParamsRegion = "europe-west8" - SpeedScheduleGetParamsRegionEuropeWest9 SpeedScheduleGetParamsRegion = "europe-west9" - SpeedScheduleGetParamsRegionMeWest1 SpeedScheduleGetParamsRegion = "me-west1" - SpeedScheduleGetParamsRegionSouthamericaEast1 SpeedScheduleGetParamsRegion = "southamerica-east1" - SpeedScheduleGetParamsRegionUsCentral1 SpeedScheduleGetParamsRegion = "us-central1" - SpeedScheduleGetParamsRegionUsEast1 SpeedScheduleGetParamsRegion = "us-east1" - SpeedScheduleGetParamsRegionUsEast4 SpeedScheduleGetParamsRegion = "us-east4" - SpeedScheduleGetParamsRegionUsSouth1 SpeedScheduleGetParamsRegion = "us-south1" - SpeedScheduleGetParamsRegionUsWest1 SpeedScheduleGetParamsRegion = "us-west1" -) - -func (r SpeedScheduleGetParamsRegion) IsKnown() bool { - switch r { - case SpeedScheduleGetParamsRegionAsiaEast1, SpeedScheduleGetParamsRegionAsiaNortheast1, SpeedScheduleGetParamsRegionAsiaNortheast2, SpeedScheduleGetParamsRegionAsiaSouth1, SpeedScheduleGetParamsRegionAsiaSoutheast1, SpeedScheduleGetParamsRegionAustraliaSoutheast1, SpeedScheduleGetParamsRegionEuropeNorth1, SpeedScheduleGetParamsRegionEuropeSouthwest1, SpeedScheduleGetParamsRegionEuropeWest1, SpeedScheduleGetParamsRegionEuropeWest2, SpeedScheduleGetParamsRegionEuropeWest3, SpeedScheduleGetParamsRegionEuropeWest4, SpeedScheduleGetParamsRegionEuropeWest8, SpeedScheduleGetParamsRegionEuropeWest9, SpeedScheduleGetParamsRegionMeWest1, SpeedScheduleGetParamsRegionSouthamericaEast1, SpeedScheduleGetParamsRegionUsCentral1, SpeedScheduleGetParamsRegionUsEast1, SpeedScheduleGetParamsRegionUsEast4, SpeedScheduleGetParamsRegionUsSouth1, SpeedScheduleGetParamsRegionUsWest1: - return true - } - return false -} - -type SpeedScheduleGetResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - // The test schedule. - Result Schedule `json:"result"` - JSON speedScheduleGetResponseEnvelopeJSON `json:"-"` -} - -// speedScheduleGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [SpeedScheduleGetResponseEnvelope] -type speedScheduleGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SpeedScheduleGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r speedScheduleGetResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -type SpeedTrendsListParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // The type of device. - DeviceType param.Field[SpeedTrendsListParamsDeviceType] `query:"deviceType,required"` - // A comma-separated list of metrics to include in the results. - Metrics param.Field[string] `query:"metrics,required"` - // A test region. - Region param.Field[SpeedTrendsListParamsRegion] `query:"region,required"` - Start param.Field[time.Time] `query:"start,required" format:"date-time"` - // The timezone of the start and end timestamps. - Tz param.Field[string] `query:"tz,required"` - End param.Field[time.Time] `query:"end" format:"date-time"` -} - -// URLQuery serializes [SpeedTrendsListParams]'s query parameters as `url.Values`. -func (r SpeedTrendsListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatRepeat, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// The type of device. -type SpeedTrendsListParamsDeviceType string - -const ( - SpeedTrendsListParamsDeviceTypeDesktop SpeedTrendsListParamsDeviceType = "DESKTOP" - SpeedTrendsListParamsDeviceTypeMobile SpeedTrendsListParamsDeviceType = "MOBILE" -) - -func (r SpeedTrendsListParamsDeviceType) IsKnown() bool { - switch r { - case SpeedTrendsListParamsDeviceTypeDesktop, SpeedTrendsListParamsDeviceTypeMobile: - return true - } - return false -} - -// A test region. -type SpeedTrendsListParamsRegion string - -const ( - SpeedTrendsListParamsRegionAsiaEast1 SpeedTrendsListParamsRegion = "asia-east1" - SpeedTrendsListParamsRegionAsiaNortheast1 SpeedTrendsListParamsRegion = "asia-northeast1" - SpeedTrendsListParamsRegionAsiaNortheast2 SpeedTrendsListParamsRegion = "asia-northeast2" - SpeedTrendsListParamsRegionAsiaSouth1 SpeedTrendsListParamsRegion = "asia-south1" - SpeedTrendsListParamsRegionAsiaSoutheast1 SpeedTrendsListParamsRegion = "asia-southeast1" - SpeedTrendsListParamsRegionAustraliaSoutheast1 SpeedTrendsListParamsRegion = "australia-southeast1" - SpeedTrendsListParamsRegionEuropeNorth1 SpeedTrendsListParamsRegion = "europe-north1" - SpeedTrendsListParamsRegionEuropeSouthwest1 SpeedTrendsListParamsRegion = "europe-southwest1" - SpeedTrendsListParamsRegionEuropeWest1 SpeedTrendsListParamsRegion = "europe-west1" - SpeedTrendsListParamsRegionEuropeWest2 SpeedTrendsListParamsRegion = "europe-west2" - SpeedTrendsListParamsRegionEuropeWest3 SpeedTrendsListParamsRegion = "europe-west3" - SpeedTrendsListParamsRegionEuropeWest4 SpeedTrendsListParamsRegion = "europe-west4" - SpeedTrendsListParamsRegionEuropeWest8 SpeedTrendsListParamsRegion = "europe-west8" - SpeedTrendsListParamsRegionEuropeWest9 SpeedTrendsListParamsRegion = "europe-west9" - SpeedTrendsListParamsRegionMeWest1 SpeedTrendsListParamsRegion = "me-west1" - SpeedTrendsListParamsRegionSouthamericaEast1 SpeedTrendsListParamsRegion = "southamerica-east1" - SpeedTrendsListParamsRegionUsCentral1 SpeedTrendsListParamsRegion = "us-central1" - SpeedTrendsListParamsRegionUsEast1 SpeedTrendsListParamsRegion = "us-east1" - SpeedTrendsListParamsRegionUsEast4 SpeedTrendsListParamsRegion = "us-east4" - SpeedTrendsListParamsRegionUsSouth1 SpeedTrendsListParamsRegion = "us-south1" - SpeedTrendsListParamsRegionUsWest1 SpeedTrendsListParamsRegion = "us-west1" -) - -func (r SpeedTrendsListParamsRegion) IsKnown() bool { - switch r { - case SpeedTrendsListParamsRegionAsiaEast1, SpeedTrendsListParamsRegionAsiaNortheast1, SpeedTrendsListParamsRegionAsiaNortheast2, SpeedTrendsListParamsRegionAsiaSouth1, SpeedTrendsListParamsRegionAsiaSoutheast1, SpeedTrendsListParamsRegionAustraliaSoutheast1, SpeedTrendsListParamsRegionEuropeNorth1, SpeedTrendsListParamsRegionEuropeSouthwest1, SpeedTrendsListParamsRegionEuropeWest1, SpeedTrendsListParamsRegionEuropeWest2, SpeedTrendsListParamsRegionEuropeWest3, SpeedTrendsListParamsRegionEuropeWest4, SpeedTrendsListParamsRegionEuropeWest8, SpeedTrendsListParamsRegionEuropeWest9, SpeedTrendsListParamsRegionMeWest1, SpeedTrendsListParamsRegionSouthamericaEast1, SpeedTrendsListParamsRegionUsCentral1, SpeedTrendsListParamsRegionUsEast1, SpeedTrendsListParamsRegionUsEast4, SpeedTrendsListParamsRegionUsSouth1, SpeedTrendsListParamsRegionUsWest1: - return true - } - return false -} - -type SpeedTrendsListResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result Trend `json:"result"` - JSON speedTrendsListResponseEnvelopeJSON `json:"-"` -} - -// speedTrendsListResponseEnvelopeJSON contains the JSON metadata for the struct -// [SpeedTrendsListResponseEnvelope] -type speedTrendsListResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *SpeedTrendsListResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r speedTrendsListResponseEnvelopeJSON) RawJSON() string { - return r.raw -} diff --git a/speed/speed_test.go b/speed/speed_test.go deleted file mode 100644 index 4aed55eef8a..00000000000 --- a/speed/speed_test.go +++ /dev/null @@ -1,114 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package speed_test - -import ( - "context" - "errors" - "os" - "testing" - "time" - - "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/testutil" - "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/cloudflare/cloudflare-go/v2/speed" -) - -func TestSpeedDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.Speed.Delete( - context.TODO(), - "example.com", - speed.SpeedDeleteParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Region: cloudflare.F(speed.SpeedDeleteParamsRegionUsCentral1), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} - -func TestSpeedScheduleGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.Speed.ScheduleGet( - context.TODO(), - "example.com", - speed.SpeedScheduleGetParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Region: cloudflare.F(speed.SpeedScheduleGetParamsRegionUsCentral1), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} - -func TestSpeedTrendsListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") - baseURL := "http://localhost:4010" - if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { - baseURL = envURL - } - if !testutil.CheckTestServer(t, baseURL) { - return - } - client := cloudflare.NewClient( - option.WithBaseURL(baseURL), - option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), - option.WithAPIEmail("user@example.com"), - ) - _, err := client.Speed.TrendsList( - context.TODO(), - "example.com", - speed.SpeedTrendsListParams{ - ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - DeviceType: cloudflare.F(speed.SpeedTrendsListParamsDeviceTypeDesktop), - Metrics: cloudflare.F("performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls"), - Region: cloudflare.F(speed.SpeedTrendsListParamsRegionUsCentral1), - Start: cloudflare.F(time.Now()), - Tz: cloudflare.F("string"), - End: cloudflare.F(time.Now()), - }, - ) - if err != nil { - var apierr *cloudflare.Error - if errors.As(err, &apierr) { - t.Log(string(apierr.DumpRequest(true))) - } - t.Fatalf("err should be nil: %s", err.Error()) - } -} diff --git a/speed/test.go b/speed/test.go deleted file mode 100644 index 5b96920fb2c..00000000000 --- a/speed/test.go +++ /dev/null @@ -1,448 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -package speed - -import ( - "context" - "fmt" - "net/http" - "net/url" - "time" - - "github.com/cloudflare/cloudflare-go/v2/internal/apijson" - "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" - "github.com/cloudflare/cloudflare-go/v2/internal/param" - "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" - "github.com/cloudflare/cloudflare-go/v2/option" -) - -// TestService contains methods and other services that help with interacting with -// the cloudflare API. Note, unlike clients, this service does not read variables -// from the environment automatically. You should not instantiate this service -// directly, and instead use the [NewTestService] method instead. -type TestService struct { - Options []option.RequestOption -} - -// NewTestService generates a new service that applies the given options to each -// request. These options are applied after the parent client's options (if there -// is one), and before any request-specific options. -func NewTestService(opts ...option.RequestOption) (r *TestService) { - r = &TestService{} - r.Options = opts - return -} - -// Starts a test for a specific webpage, in a specific region. -func (r *TestService) New(ctx context.Context, url string, params TestNewParams, opts ...option.RequestOption) (res *Test, err error) { - opts = append(r.Options[:], opts...) - var env TestNewResponseEnvelope - path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests", params.ZoneID, url) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Test history (list of tests) for a specific webpage. -func (r *TestService) List(ctx context.Context, url string, params TestListParams, opts ...option.RequestOption) (res *TestListResponse, err error) { - opts = append(r.Options[:], opts...) - path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests", params.ZoneID, url) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &res, opts...) - return -} - -// Deletes all tests for a specific webpage from a specific region. Deleted tests -// are still counted as part of the quota. -func (r *TestService) Delete(ctx context.Context, url string, params TestDeleteParams, opts ...option.RequestOption) (res *TestDeleteResponse, err error) { - opts = append(r.Options[:], opts...) - var env TestDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests", params.ZoneID, url) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -// Retrieves the result of a specific test. -func (r *TestService) Get(ctx context.Context, url string, testID string, query TestGetParams, opts ...option.RequestOption) (res *Test, err error) { - opts = append(r.Options[:], opts...) - var env TestGetResponseEnvelope - path := fmt.Sprintf("zones/%s/speed_api/pages/%s/tests/%s", query.ZoneID, url, testID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...) - if err != nil { - return - } - res = &env.Result - return -} - -type Test struct { - // UUID - ID string `json:"id"` - Date time.Time `json:"date" format:"date-time"` - // The Lighthouse report. - DesktopReport LighthouseReport `json:"desktopReport"` - // The Lighthouse report. - MobileReport LighthouseReport `json:"mobileReport"` - // A test region with a label. - Region LabeledRegion `json:"region"` - // The frequency of the test. - ScheduleFrequency TestScheduleFrequency `json:"scheduleFrequency"` - // A URL. - URL string `json:"url"` - JSON testJSON `json:"-"` -} - -// testJSON contains the JSON metadata for the struct [Test] -type testJSON struct { - ID apijson.Field - Date apijson.Field - DesktopReport apijson.Field - MobileReport apijson.Field - Region apijson.Field - ScheduleFrequency apijson.Field - URL apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *Test) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r testJSON) RawJSON() string { - return r.raw -} - -// The frequency of the test. -type TestScheduleFrequency string - -const ( - TestScheduleFrequencyDaily TestScheduleFrequency = "DAILY" - TestScheduleFrequencyWeekly TestScheduleFrequency = "WEEKLY" -) - -func (r TestScheduleFrequency) IsKnown() bool { - switch r { - case TestScheduleFrequencyDaily, TestScheduleFrequencyWeekly: - return true - } - return false -} - -type TestListResponse struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - // Whether the API call was successful. - Success bool `json:"success,required"` - ResultInfo TestListResponseResultInfo `json:"result_info"` - JSON testListResponseJSON `json:"-"` -} - -// testListResponseJSON contains the JSON metadata for the struct -// [TestListResponse] -type testListResponseJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - ResultInfo apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *TestListResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r testListResponseJSON) RawJSON() string { - return r.raw -} - -type TestListResponseResultInfo struct { - Count int64 `json:"count"` - Page int64 `json:"page"` - PerPage int64 `json:"per_page"` - TotalCount int64 `json:"total_count"` - JSON testListResponseResultInfoJSON `json:"-"` -} - -// testListResponseResultInfoJSON contains the JSON metadata for the struct -// [TestListResponseResultInfo] -type testListResponseResultInfoJSON struct { - Count apijson.Field - Page apijson.Field - PerPage apijson.Field - TotalCount apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *TestListResponseResultInfo) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r testListResponseResultInfoJSON) RawJSON() string { - return r.raw -} - -type TestDeleteResponse struct { - // Number of items affected. - Count float64 `json:"count"` - JSON testDeleteResponseJSON `json:"-"` -} - -// testDeleteResponseJSON contains the JSON metadata for the struct -// [TestDeleteResponse] -type testDeleteResponseJSON struct { - Count apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *TestDeleteResponse) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r testDeleteResponseJSON) RawJSON() string { - return r.raw -} - -type TestNewParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // A test region. - Region param.Field[TestNewParamsRegion] `json:"region"` -} - -func (r TestNewParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - -// A test region. -type TestNewParamsRegion string - -const ( - TestNewParamsRegionAsiaEast1 TestNewParamsRegion = "asia-east1" - TestNewParamsRegionAsiaNortheast1 TestNewParamsRegion = "asia-northeast1" - TestNewParamsRegionAsiaNortheast2 TestNewParamsRegion = "asia-northeast2" - TestNewParamsRegionAsiaSouth1 TestNewParamsRegion = "asia-south1" - TestNewParamsRegionAsiaSoutheast1 TestNewParamsRegion = "asia-southeast1" - TestNewParamsRegionAustraliaSoutheast1 TestNewParamsRegion = "australia-southeast1" - TestNewParamsRegionEuropeNorth1 TestNewParamsRegion = "europe-north1" - TestNewParamsRegionEuropeSouthwest1 TestNewParamsRegion = "europe-southwest1" - TestNewParamsRegionEuropeWest1 TestNewParamsRegion = "europe-west1" - TestNewParamsRegionEuropeWest2 TestNewParamsRegion = "europe-west2" - TestNewParamsRegionEuropeWest3 TestNewParamsRegion = "europe-west3" - TestNewParamsRegionEuropeWest4 TestNewParamsRegion = "europe-west4" - TestNewParamsRegionEuropeWest8 TestNewParamsRegion = "europe-west8" - TestNewParamsRegionEuropeWest9 TestNewParamsRegion = "europe-west9" - TestNewParamsRegionMeWest1 TestNewParamsRegion = "me-west1" - TestNewParamsRegionSouthamericaEast1 TestNewParamsRegion = "southamerica-east1" - TestNewParamsRegionUsCentral1 TestNewParamsRegion = "us-central1" - TestNewParamsRegionUsEast1 TestNewParamsRegion = "us-east1" - TestNewParamsRegionUsEast4 TestNewParamsRegion = "us-east4" - TestNewParamsRegionUsSouth1 TestNewParamsRegion = "us-south1" - TestNewParamsRegionUsWest1 TestNewParamsRegion = "us-west1" -) - -func (r TestNewParamsRegion) IsKnown() bool { - switch r { - case TestNewParamsRegionAsiaEast1, TestNewParamsRegionAsiaNortheast1, TestNewParamsRegionAsiaNortheast2, TestNewParamsRegionAsiaSouth1, TestNewParamsRegionAsiaSoutheast1, TestNewParamsRegionAustraliaSoutheast1, TestNewParamsRegionEuropeNorth1, TestNewParamsRegionEuropeSouthwest1, TestNewParamsRegionEuropeWest1, TestNewParamsRegionEuropeWest2, TestNewParamsRegionEuropeWest3, TestNewParamsRegionEuropeWest4, TestNewParamsRegionEuropeWest8, TestNewParamsRegionEuropeWest9, TestNewParamsRegionMeWest1, TestNewParamsRegionSouthamericaEast1, TestNewParamsRegionUsCentral1, TestNewParamsRegionUsEast1, TestNewParamsRegionUsEast4, TestNewParamsRegionUsSouth1, TestNewParamsRegionUsWest1: - return true - } - return false -} - -type TestNewResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result Test `json:"result"` - JSON testNewResponseEnvelopeJSON `json:"-"` -} - -// testNewResponseEnvelopeJSON contains the JSON metadata for the struct -// [TestNewResponseEnvelope] -type testNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *TestNewResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r testNewResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -type TestListParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - Page param.Field[int64] `query:"page"` - PerPage param.Field[int64] `query:"per_page"` - // A test region. - Region param.Field[TestListParamsRegion] `query:"region"` -} - -// URLQuery serializes [TestListParams]'s query parameters as `url.Values`. -func (r TestListParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatRepeat, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// A test region. -type TestListParamsRegion string - -const ( - TestListParamsRegionAsiaEast1 TestListParamsRegion = "asia-east1" - TestListParamsRegionAsiaNortheast1 TestListParamsRegion = "asia-northeast1" - TestListParamsRegionAsiaNortheast2 TestListParamsRegion = "asia-northeast2" - TestListParamsRegionAsiaSouth1 TestListParamsRegion = "asia-south1" - TestListParamsRegionAsiaSoutheast1 TestListParamsRegion = "asia-southeast1" - TestListParamsRegionAustraliaSoutheast1 TestListParamsRegion = "australia-southeast1" - TestListParamsRegionEuropeNorth1 TestListParamsRegion = "europe-north1" - TestListParamsRegionEuropeSouthwest1 TestListParamsRegion = "europe-southwest1" - TestListParamsRegionEuropeWest1 TestListParamsRegion = "europe-west1" - TestListParamsRegionEuropeWest2 TestListParamsRegion = "europe-west2" - TestListParamsRegionEuropeWest3 TestListParamsRegion = "europe-west3" - TestListParamsRegionEuropeWest4 TestListParamsRegion = "europe-west4" - TestListParamsRegionEuropeWest8 TestListParamsRegion = "europe-west8" - TestListParamsRegionEuropeWest9 TestListParamsRegion = "europe-west9" - TestListParamsRegionMeWest1 TestListParamsRegion = "me-west1" - TestListParamsRegionSouthamericaEast1 TestListParamsRegion = "southamerica-east1" - TestListParamsRegionUsCentral1 TestListParamsRegion = "us-central1" - TestListParamsRegionUsEast1 TestListParamsRegion = "us-east1" - TestListParamsRegionUsEast4 TestListParamsRegion = "us-east4" - TestListParamsRegionUsSouth1 TestListParamsRegion = "us-south1" - TestListParamsRegionUsWest1 TestListParamsRegion = "us-west1" -) - -func (r TestListParamsRegion) IsKnown() bool { - switch r { - case TestListParamsRegionAsiaEast1, TestListParamsRegionAsiaNortheast1, TestListParamsRegionAsiaNortheast2, TestListParamsRegionAsiaSouth1, TestListParamsRegionAsiaSoutheast1, TestListParamsRegionAustraliaSoutheast1, TestListParamsRegionEuropeNorth1, TestListParamsRegionEuropeSouthwest1, TestListParamsRegionEuropeWest1, TestListParamsRegionEuropeWest2, TestListParamsRegionEuropeWest3, TestListParamsRegionEuropeWest4, TestListParamsRegionEuropeWest8, TestListParamsRegionEuropeWest9, TestListParamsRegionMeWest1, TestListParamsRegionSouthamericaEast1, TestListParamsRegionUsCentral1, TestListParamsRegionUsEast1, TestListParamsRegionUsEast4, TestListParamsRegionUsSouth1, TestListParamsRegionUsWest1: - return true - } - return false -} - -type TestDeleteParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` - // A test region. - Region param.Field[TestDeleteParamsRegion] `query:"region"` -} - -// URLQuery serializes [TestDeleteParams]'s query parameters as `url.Values`. -func (r TestDeleteParams) URLQuery() (v url.Values) { - return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ - ArrayFormat: apiquery.ArrayQueryFormatRepeat, - NestedFormat: apiquery.NestedQueryFormatBrackets, - }) -} - -// A test region. -type TestDeleteParamsRegion string - -const ( - TestDeleteParamsRegionAsiaEast1 TestDeleteParamsRegion = "asia-east1" - TestDeleteParamsRegionAsiaNortheast1 TestDeleteParamsRegion = "asia-northeast1" - TestDeleteParamsRegionAsiaNortheast2 TestDeleteParamsRegion = "asia-northeast2" - TestDeleteParamsRegionAsiaSouth1 TestDeleteParamsRegion = "asia-south1" - TestDeleteParamsRegionAsiaSoutheast1 TestDeleteParamsRegion = "asia-southeast1" - TestDeleteParamsRegionAustraliaSoutheast1 TestDeleteParamsRegion = "australia-southeast1" - TestDeleteParamsRegionEuropeNorth1 TestDeleteParamsRegion = "europe-north1" - TestDeleteParamsRegionEuropeSouthwest1 TestDeleteParamsRegion = "europe-southwest1" - TestDeleteParamsRegionEuropeWest1 TestDeleteParamsRegion = "europe-west1" - TestDeleteParamsRegionEuropeWest2 TestDeleteParamsRegion = "europe-west2" - TestDeleteParamsRegionEuropeWest3 TestDeleteParamsRegion = "europe-west3" - TestDeleteParamsRegionEuropeWest4 TestDeleteParamsRegion = "europe-west4" - TestDeleteParamsRegionEuropeWest8 TestDeleteParamsRegion = "europe-west8" - TestDeleteParamsRegionEuropeWest9 TestDeleteParamsRegion = "europe-west9" - TestDeleteParamsRegionMeWest1 TestDeleteParamsRegion = "me-west1" - TestDeleteParamsRegionSouthamericaEast1 TestDeleteParamsRegion = "southamerica-east1" - TestDeleteParamsRegionUsCentral1 TestDeleteParamsRegion = "us-central1" - TestDeleteParamsRegionUsEast1 TestDeleteParamsRegion = "us-east1" - TestDeleteParamsRegionUsEast4 TestDeleteParamsRegion = "us-east4" - TestDeleteParamsRegionUsSouth1 TestDeleteParamsRegion = "us-south1" - TestDeleteParamsRegionUsWest1 TestDeleteParamsRegion = "us-west1" -) - -func (r TestDeleteParamsRegion) IsKnown() bool { - switch r { - case TestDeleteParamsRegionAsiaEast1, TestDeleteParamsRegionAsiaNortheast1, TestDeleteParamsRegionAsiaNortheast2, TestDeleteParamsRegionAsiaSouth1, TestDeleteParamsRegionAsiaSoutheast1, TestDeleteParamsRegionAustraliaSoutheast1, TestDeleteParamsRegionEuropeNorth1, TestDeleteParamsRegionEuropeSouthwest1, TestDeleteParamsRegionEuropeWest1, TestDeleteParamsRegionEuropeWest2, TestDeleteParamsRegionEuropeWest3, TestDeleteParamsRegionEuropeWest4, TestDeleteParamsRegionEuropeWest8, TestDeleteParamsRegionEuropeWest9, TestDeleteParamsRegionMeWest1, TestDeleteParamsRegionSouthamericaEast1, TestDeleteParamsRegionUsCentral1, TestDeleteParamsRegionUsEast1, TestDeleteParamsRegionUsEast4, TestDeleteParamsRegionUsSouth1, TestDeleteParamsRegionUsWest1: - return true - } - return false -} - -type TestDeleteResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result TestDeleteResponse `json:"result"` - JSON testDeleteResponseEnvelopeJSON `json:"-"` -} - -// testDeleteResponseEnvelopeJSON contains the JSON metadata for the struct -// [TestDeleteResponseEnvelope] -type testDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *TestDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r testDeleteResponseEnvelopeJSON) RawJSON() string { - return r.raw -} - -type TestGetParams struct { - // Identifier - ZoneID param.Field[string] `path:"zone_id,required"` -} - -type TestGetResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Success interface{} `json:"success,required"` - Result Test `json:"result"` - JSON testGetResponseEnvelopeJSON `json:"-"` -} - -// testGetResponseEnvelopeJSON contains the JSON metadata for the struct -// [TestGetResponseEnvelope] -type testGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *TestGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r testGetResponseEnvelopeJSON) RawJSON() string { - return r.raw -} diff --git a/ssl/aliases.go b/ssl/aliases.go index d522763bc4f..472b2c411a3 100644 --- a/ssl/aliases.go +++ b/ssl/aliases.go @@ -4,7 +4,7 @@ package ssl import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/ssl/analyze.go b/ssl/analyze.go index a75c6056413..be238844e71 100644 --- a/ssl/analyze.go +++ b/ssl/analyze.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -81,11 +81,11 @@ func (r AnalyzeNewParams) MarshalJSON() (data []byte, err error) { } type AnalyzeNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result AnalyzeNewResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success AnalyzeNewResponseEnvelopeSuccess `json:"success,required"` + Result AnalyzeNewResponseUnion `json:"result"` JSON analyzeNewResponseEnvelopeJSON `json:"-"` } @@ -94,8 +94,8 @@ type AnalyzeNewResponseEnvelope struct { type analyzeNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/ssl/analyze_test.go b/ssl/analyze_test.go index 85029b4549b..a2a9cc5f4de 100644 --- a/ssl/analyze_test.go +++ b/ssl/analyze_test.go @@ -16,7 +16,6 @@ import ( ) func TestAnalyzeNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/ssl/certificatepack.go b/ssl/certificatepack.go index ce48fca68fc..b9bdf489746 100644 --- a/ssl/certificatepack.go +++ b/ssl/certificatepack.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -65,10 +65,10 @@ func (r *CertificatePackService) ListAutoPaging(ctx context.Context, params Cert } // For a given zone, delete an advanced certificate pack. -func (r *CertificatePackService) Delete(ctx context.Context, certificatePackID string, params CertificatePackDeleteParams, opts ...option.RequestOption) (res *CertificatePackDeleteResponse, err error) { +func (r *CertificatePackService) Delete(ctx context.Context, certificatePackID string, body CertificatePackDeleteParams, opts ...option.RequestOption) (res *CertificatePackDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env CertificatePackDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/ssl/certificate_packs/%s", params.ZoneID, certificatePackID) + path := fmt.Sprintf("zones/%s/ssl/certificate_packs/%s", body.ZoneID, certificatePackID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -84,7 +84,7 @@ func (r *CertificatePackService) Edit(ctx context.Context, certificatePackID str opts = append(r.Options[:], opts...) var env CertificatePackEditResponseEnvelope path := fmt.Sprintf("zones/%s/ssl/certificate_packs/%s", params.ZoneID, certificatePackID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, params, &env, opts...) if err != nil { return } @@ -109,6 +109,79 @@ type Host = string type HostParam = string +// The number of days for which the certificate should be valid. +type RequestValidity float64 + +const ( + RequestValidity7 RequestValidity = 7 + RequestValidity30 RequestValidity = 30 + RequestValidity90 RequestValidity = 90 + RequestValidity365 RequestValidity = 365 + RequestValidity730 RequestValidity = 730 + RequestValidity1095 RequestValidity = 1095 + RequestValidity5475 RequestValidity = 5475 +) + +func (r RequestValidity) IsKnown() bool { + switch r { + case RequestValidity7, RequestValidity30, RequestValidity90, RequestValidity365, RequestValidity730, RequestValidity1095, RequestValidity5475: + return true + } + return false +} + +// Status of certificate pack. +type Status string + +const ( + StatusInitializing Status = "initializing" + StatusPendingValidation Status = "pending_validation" + StatusDeleted Status = "deleted" + StatusPendingIssuance Status = "pending_issuance" + StatusPendingDeployment Status = "pending_deployment" + StatusPendingDeletion Status = "pending_deletion" + StatusPendingExpiration Status = "pending_expiration" + StatusExpired Status = "expired" + StatusActive Status = "active" + StatusInitializingTimedOut Status = "initializing_timed_out" + StatusValidationTimedOut Status = "validation_timed_out" + StatusIssuanceTimedOut Status = "issuance_timed_out" + StatusDeploymentTimedOut Status = "deployment_timed_out" + StatusDeletionTimedOut Status = "deletion_timed_out" + StatusPendingCleanup Status = "pending_cleanup" + StatusStagingDeployment Status = "staging_deployment" + StatusStagingActive Status = "staging_active" + StatusDeactivating Status = "deactivating" + StatusInactive Status = "inactive" + StatusBackupIssued Status = "backup_issued" + StatusHoldingDeployment Status = "holding_deployment" +) + +func (r Status) IsKnown() bool { + switch r { + case StatusInitializing, StatusPendingValidation, StatusDeleted, StatusPendingIssuance, StatusPendingDeployment, StatusPendingDeletion, StatusPendingExpiration, StatusExpired, StatusActive, StatusInitializingTimedOut, StatusValidationTimedOut, StatusIssuanceTimedOut, StatusDeploymentTimedOut, StatusDeletionTimedOut, StatusPendingCleanup, StatusStagingDeployment, StatusStagingActive, StatusDeactivating, StatusInactive, StatusBackupIssued, StatusHoldingDeployment: + return true + } + return false +} + +// Validation method in use for a certificate pack order. +type ValidationMethod string + +const ( + ValidationMethodHTTP ValidationMethod = "http" + ValidationMethodCNAME ValidationMethod = "cname" + ValidationMethodTXT ValidationMethod = "txt" +) + +func (r ValidationMethod) IsKnown() bool { + switch r { + case ValidationMethodHTTP, ValidationMethodCNAME, ValidationMethodTXT: + return true + } + return false +} + type CertificatePackListResponse = interface{} type CertificatePackDeleteResponse struct { @@ -147,7 +220,7 @@ type CertificatePackEditResponse struct { // the zone apex, may not contain more than 50 hosts, and may not be empty. Hosts []Host `json:"hosts"` // Status of certificate pack. - Status CertificatePackEditResponseStatus `json:"status"` + Status Status `json:"status"` // Type of certificate pack. Type CertificatePackEditResponseType `json:"type"` // Validation Method selected for the order. @@ -198,41 +271,6 @@ func (r CertificatePackEditResponseCertificateAuthority) IsKnown() bool { return false } -// Status of certificate pack. -type CertificatePackEditResponseStatus string - -const ( - CertificatePackEditResponseStatusInitializing CertificatePackEditResponseStatus = "initializing" - CertificatePackEditResponseStatusPendingValidation CertificatePackEditResponseStatus = "pending_validation" - CertificatePackEditResponseStatusDeleted CertificatePackEditResponseStatus = "deleted" - CertificatePackEditResponseStatusPendingIssuance CertificatePackEditResponseStatus = "pending_issuance" - CertificatePackEditResponseStatusPendingDeployment CertificatePackEditResponseStatus = "pending_deployment" - CertificatePackEditResponseStatusPendingDeletion CertificatePackEditResponseStatus = "pending_deletion" - CertificatePackEditResponseStatusPendingExpiration CertificatePackEditResponseStatus = "pending_expiration" - CertificatePackEditResponseStatusExpired CertificatePackEditResponseStatus = "expired" - CertificatePackEditResponseStatusActive CertificatePackEditResponseStatus = "active" - CertificatePackEditResponseStatusInitializingTimedOut CertificatePackEditResponseStatus = "initializing_timed_out" - CertificatePackEditResponseStatusValidationTimedOut CertificatePackEditResponseStatus = "validation_timed_out" - CertificatePackEditResponseStatusIssuanceTimedOut CertificatePackEditResponseStatus = "issuance_timed_out" - CertificatePackEditResponseStatusDeploymentTimedOut CertificatePackEditResponseStatus = "deployment_timed_out" - CertificatePackEditResponseStatusDeletionTimedOut CertificatePackEditResponseStatus = "deletion_timed_out" - CertificatePackEditResponseStatusPendingCleanup CertificatePackEditResponseStatus = "pending_cleanup" - CertificatePackEditResponseStatusStagingDeployment CertificatePackEditResponseStatus = "staging_deployment" - CertificatePackEditResponseStatusStagingActive CertificatePackEditResponseStatus = "staging_active" - CertificatePackEditResponseStatusDeactivating CertificatePackEditResponseStatus = "deactivating" - CertificatePackEditResponseStatusInactive CertificatePackEditResponseStatus = "inactive" - CertificatePackEditResponseStatusBackupIssued CertificatePackEditResponseStatus = "backup_issued" - CertificatePackEditResponseStatusHoldingDeployment CertificatePackEditResponseStatus = "holding_deployment" -) - -func (r CertificatePackEditResponseStatus) IsKnown() bool { - switch r { - case CertificatePackEditResponseStatusInitializing, CertificatePackEditResponseStatusPendingValidation, CertificatePackEditResponseStatusDeleted, CertificatePackEditResponseStatusPendingIssuance, CertificatePackEditResponseStatusPendingDeployment, CertificatePackEditResponseStatusPendingDeletion, CertificatePackEditResponseStatusPendingExpiration, CertificatePackEditResponseStatusExpired, CertificatePackEditResponseStatusActive, CertificatePackEditResponseStatusInitializingTimedOut, CertificatePackEditResponseStatusValidationTimedOut, CertificatePackEditResponseStatusIssuanceTimedOut, CertificatePackEditResponseStatusDeploymentTimedOut, CertificatePackEditResponseStatusDeletionTimedOut, CertificatePackEditResponseStatusPendingCleanup, CertificatePackEditResponseStatusStagingDeployment, CertificatePackEditResponseStatusStagingActive, CertificatePackEditResponseStatusDeactivating, CertificatePackEditResponseStatusInactive, CertificatePackEditResponseStatusBackupIssued, CertificatePackEditResponseStatusHoldingDeployment: - return true - } - return false -} - // Type of certificate pack. type CertificatePackEditResponseType string @@ -334,19 +372,14 @@ func (r CertificatePackListParamsStatus) IsKnown() bool { type CertificatePackDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r CertificatePackDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type CertificatePackDeleteResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CertificatePackDeleteResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CertificatePackDeleteResponseEnvelopeSuccess `json:"success,required"` + Result CertificatePackDeleteResponse `json:"result"` JSON certificatePackDeleteResponseEnvelopeJSON `json:"-"` } @@ -355,8 +388,8 @@ type CertificatePackDeleteResponseEnvelope struct { type certificatePackDeleteResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -395,11 +428,11 @@ func (r CertificatePackEditParams) MarshalJSON() (data []byte, err error) { } type CertificatePackEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CertificatePackEditResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CertificatePackEditResponseEnvelopeSuccess `json:"success,required"` + Result CertificatePackEditResponse `json:"result"` JSON certificatePackEditResponseEnvelopeJSON `json:"-"` } @@ -408,8 +441,8 @@ type CertificatePackEditResponseEnvelope struct { type certificatePackEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -443,11 +476,11 @@ type CertificatePackGetParams struct { } type CertificatePackGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CertificatePackGetResponseUnion `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CertificatePackGetResponseEnvelopeSuccess `json:"success,required"` + Result CertificatePackGetResponseUnion `json:"result"` JSON certificatePackGetResponseEnvelopeJSON `json:"-"` } @@ -456,8 +489,8 @@ type CertificatePackGetResponseEnvelope struct { type certificatePackGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/ssl/certificatepack_test.go b/ssl/certificatepack_test.go index b4b22045431..94f437efe44 100644 --- a/ssl/certificatepack_test.go +++ b/ssl/certificatepack_test.go @@ -15,7 +15,6 @@ import ( ) func TestCertificatePackListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestCertificatePackListWithOptionalParams(t *testing.T) { } func TestCertificatePackDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -60,7 +58,6 @@ func TestCertificatePackDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", ssl.CertificatePackDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -73,7 +70,6 @@ func TestCertificatePackDelete(t *testing.T) { } func TestCertificatePackEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -104,7 +100,6 @@ func TestCertificatePackEdit(t *testing.T) { } func TestCertificatePackGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/ssl/certificatepackorder.go b/ssl/certificatepackorder.go index 7a2d6c53930..2c892dc23ea 100644 --- a/ssl/certificatepackorder.go +++ b/ssl/certificatepackorder.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CertificatePackOrderService contains methods and other services that help with @@ -59,7 +59,7 @@ type CertificatePackOrderNewResponse struct { // the zone apex, may not contain more than 50 hosts, and may not be empty. Hosts []Host `json:"hosts"` // Status of certificate pack. - Status CertificatePackOrderNewResponseStatus `json:"status"` + Status Status `json:"status"` // Type of certificate pack. Type CertificatePackOrderNewResponseType `json:"type"` // Validation Method selected for the order. @@ -110,41 +110,6 @@ func (r CertificatePackOrderNewResponseCertificateAuthority) IsKnown() bool { return false } -// Status of certificate pack. -type CertificatePackOrderNewResponseStatus string - -const ( - CertificatePackOrderNewResponseStatusInitializing CertificatePackOrderNewResponseStatus = "initializing" - CertificatePackOrderNewResponseStatusPendingValidation CertificatePackOrderNewResponseStatus = "pending_validation" - CertificatePackOrderNewResponseStatusDeleted CertificatePackOrderNewResponseStatus = "deleted" - CertificatePackOrderNewResponseStatusPendingIssuance CertificatePackOrderNewResponseStatus = "pending_issuance" - CertificatePackOrderNewResponseStatusPendingDeployment CertificatePackOrderNewResponseStatus = "pending_deployment" - CertificatePackOrderNewResponseStatusPendingDeletion CertificatePackOrderNewResponseStatus = "pending_deletion" - CertificatePackOrderNewResponseStatusPendingExpiration CertificatePackOrderNewResponseStatus = "pending_expiration" - CertificatePackOrderNewResponseStatusExpired CertificatePackOrderNewResponseStatus = "expired" - CertificatePackOrderNewResponseStatusActive CertificatePackOrderNewResponseStatus = "active" - CertificatePackOrderNewResponseStatusInitializingTimedOut CertificatePackOrderNewResponseStatus = "initializing_timed_out" - CertificatePackOrderNewResponseStatusValidationTimedOut CertificatePackOrderNewResponseStatus = "validation_timed_out" - CertificatePackOrderNewResponseStatusIssuanceTimedOut CertificatePackOrderNewResponseStatus = "issuance_timed_out" - CertificatePackOrderNewResponseStatusDeploymentTimedOut CertificatePackOrderNewResponseStatus = "deployment_timed_out" - CertificatePackOrderNewResponseStatusDeletionTimedOut CertificatePackOrderNewResponseStatus = "deletion_timed_out" - CertificatePackOrderNewResponseStatusPendingCleanup CertificatePackOrderNewResponseStatus = "pending_cleanup" - CertificatePackOrderNewResponseStatusStagingDeployment CertificatePackOrderNewResponseStatus = "staging_deployment" - CertificatePackOrderNewResponseStatusStagingActive CertificatePackOrderNewResponseStatus = "staging_active" - CertificatePackOrderNewResponseStatusDeactivating CertificatePackOrderNewResponseStatus = "deactivating" - CertificatePackOrderNewResponseStatusInactive CertificatePackOrderNewResponseStatus = "inactive" - CertificatePackOrderNewResponseStatusBackupIssued CertificatePackOrderNewResponseStatus = "backup_issued" - CertificatePackOrderNewResponseStatusHoldingDeployment CertificatePackOrderNewResponseStatus = "holding_deployment" -) - -func (r CertificatePackOrderNewResponseStatus) IsKnown() bool { - switch r { - case CertificatePackOrderNewResponseStatusInitializing, CertificatePackOrderNewResponseStatusPendingValidation, CertificatePackOrderNewResponseStatusDeleted, CertificatePackOrderNewResponseStatusPendingIssuance, CertificatePackOrderNewResponseStatusPendingDeployment, CertificatePackOrderNewResponseStatusPendingDeletion, CertificatePackOrderNewResponseStatusPendingExpiration, CertificatePackOrderNewResponseStatusExpired, CertificatePackOrderNewResponseStatusActive, CertificatePackOrderNewResponseStatusInitializingTimedOut, CertificatePackOrderNewResponseStatusValidationTimedOut, CertificatePackOrderNewResponseStatusIssuanceTimedOut, CertificatePackOrderNewResponseStatusDeploymentTimedOut, CertificatePackOrderNewResponseStatusDeletionTimedOut, CertificatePackOrderNewResponseStatusPendingCleanup, CertificatePackOrderNewResponseStatusStagingDeployment, CertificatePackOrderNewResponseStatusStagingActive, CertificatePackOrderNewResponseStatusDeactivating, CertificatePackOrderNewResponseStatusInactive, CertificatePackOrderNewResponseStatusBackupIssued, CertificatePackOrderNewResponseStatusHoldingDeployment: - return true - } - return false -} - // Type of certificate pack. type CertificatePackOrderNewResponseType string @@ -289,11 +254,11 @@ func (r CertificatePackOrderNewParamsValidityDays) IsKnown() bool { } type CertificatePackOrderNewResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CertificatePackOrderNewResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CertificatePackOrderNewResponseEnvelopeSuccess `json:"success,required"` + Result CertificatePackOrderNewResponse `json:"result"` JSON certificatePackOrderNewResponseEnvelopeJSON `json:"-"` } @@ -302,8 +267,8 @@ type CertificatePackOrderNewResponseEnvelope struct { type certificatePackOrderNewResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/ssl/certificatepackorder_test.go b/ssl/certificatepackorder_test.go index 65ac40c08d3..99721abd8c1 100644 --- a/ssl/certificatepackorder_test.go +++ b/ssl/certificatepackorder_test.go @@ -15,7 +15,6 @@ import ( ) func TestCertificatePackOrderNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/ssl/certificatepackquota.go b/ssl/certificatepackquota.go index 3f4f44cc9fc..f9542749be6 100644 --- a/ssl/certificatepackquota.go +++ b/ssl/certificatepackquota.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CertificatePackQuotaService contains methods and other services that help with @@ -97,11 +97,11 @@ type CertificatePackQuotaGetParams struct { } type CertificatePackQuotaGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CertificatePackQuotaGetResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CertificatePackQuotaGetResponseEnvelopeSuccess `json:"success,required"` + Result CertificatePackQuotaGetResponse `json:"result"` JSON certificatePackQuotaGetResponseEnvelopeJSON `json:"-"` } @@ -110,8 +110,8 @@ type CertificatePackQuotaGetResponseEnvelope struct { type certificatePackQuotaGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/ssl/certificatepackquota_test.go b/ssl/certificatepackquota_test.go index 194fe681b44..85b513c562c 100644 --- a/ssl/certificatepackquota_test.go +++ b/ssl/certificatepackquota_test.go @@ -15,7 +15,6 @@ import ( ) func TestCertificatePackQuotaGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/ssl/recommendation.go b/ssl/recommendation.go index 9bdbed3b4c4..834b9054630 100644 --- a/ssl/recommendation.go +++ b/ssl/recommendation.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RecommendationService contains methods and other services that help with diff --git a/ssl/recommendation_test.go b/ssl/recommendation_test.go index 24872615c9c..9b15183cae9 100644 --- a/ssl/recommendation_test.go +++ b/ssl/recommendation_test.go @@ -14,7 +14,6 @@ import ( ) func TestRecommendationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/ssl/universalsetting.go b/ssl/universalsetting.go index 680b55681c8..419ae5c5ef1 100644 --- a/ssl/universalsetting.go +++ b/ssl/universalsetting.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // UniversalSettingService contains methods and other services that help with @@ -150,9 +150,9 @@ func (r UniversalSettingEditParams) MarshalJSON() (data []byte, err error) { type UniversalSettingEditResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result UniversalSSLSettings `json:"result,required"` // Whether the API call was successful Success UniversalSettingEditResponseEnvelopeSuccess `json:"success,required"` + Result UniversalSSLSettings `json:"result"` JSON universalSettingEditResponseEnvelopeJSON `json:"-"` } @@ -161,8 +161,8 @@ type UniversalSettingEditResponseEnvelope struct { type universalSettingEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -198,9 +198,9 @@ type UniversalSettingGetParams struct { type UniversalSettingGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` - Result UniversalSSLSettings `json:"result,required"` // Whether the API call was successful Success UniversalSettingGetResponseEnvelopeSuccess `json:"success,required"` + Result UniversalSSLSettings `json:"result"` JSON universalSettingGetResponseEnvelopeJSON `json:"-"` } @@ -209,8 +209,8 @@ type UniversalSettingGetResponseEnvelope struct { type universalSettingGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/ssl/universalsetting_test.go b/ssl/universalsetting_test.go index 75145922e9d..16fd5ba2454 100644 --- a/ssl/universalsetting_test.go +++ b/ssl/universalsetting_test.go @@ -15,7 +15,6 @@ import ( ) func TestUniversalSettingEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestUniversalSettingEditWithOptionalParams(t *testing.T) { } func TestUniversalSettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/ssl/verification.go b/ssl/verification.go index 26679480537..a3070deb4cf 100644 --- a/ssl/verification.go +++ b/ssl/verification.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // VerificationService contains methods and other services that help with @@ -73,7 +73,7 @@ type Verification struct { // Certificate's signature algorithm. Signature VerificationSignature `json:"signature"` // Validation method in use for a certificate pack order. - ValidationMethod VerificationValidationMethod `json:"validation_method"` + ValidationMethod ValidationMethod `json:"validation_method"` // Certificate's required verification information. VerificationInfo VerificationVerificationInfo `json:"verification_info"` // Status of the required verification information, omitted if verification status @@ -132,30 +132,13 @@ type VerificationSignature string const ( VerificationSignatureEcdsaWithSha256 VerificationSignature = "ECDSAWithSHA256" - VerificationSignatureSha1WithRsa VerificationSignature = "SHA1WithRSA" - VerificationSignatureSha256WithRsa VerificationSignature = "SHA256WithRSA" + VerificationSignatureSha1WithRSA VerificationSignature = "SHA1WithRSA" + VerificationSignatureSha256WithRSA VerificationSignature = "SHA256WithRSA" ) func (r VerificationSignature) IsKnown() bool { switch r { - case VerificationSignatureEcdsaWithSha256, VerificationSignatureSha1WithRsa, VerificationSignatureSha256WithRsa: - return true - } - return false -} - -// Validation method in use for a certificate pack order. -type VerificationValidationMethod string - -const ( - VerificationValidationMethodHTTP VerificationValidationMethod = "http" - VerificationValidationMethodCNAME VerificationValidationMethod = "cname" - VerificationValidationMethodTXT VerificationValidationMethod = "txt" -) - -func (r VerificationValidationMethod) IsKnown() bool { - switch r { - case VerificationValidationMethodHTTP, VerificationValidationMethodCNAME, VerificationValidationMethodTXT: + case VerificationSignatureEcdsaWithSha256, VerificationSignatureSha1WithRSA, VerificationSignatureSha256WithRSA: return true } return false @@ -312,11 +295,11 @@ func (r VerificationEditParamsValidationMethod) IsKnown() bool { } type VerificationEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result VerificationEditResponse `json:"result,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success VerificationEditResponseEnvelopeSuccess `json:"success,required"` + Result VerificationEditResponse `json:"result"` JSON verificationEditResponseEnvelopeJSON `json:"-"` } @@ -325,8 +308,8 @@ type VerificationEditResponseEnvelope struct { type verificationEditResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/ssl/verification_test.go b/ssl/verification_test.go index 584a415c91d..a53c9a7a6b3 100644 --- a/ssl/verification_test.go +++ b/ssl/verification_test.go @@ -15,7 +15,6 @@ import ( ) func TestVerificationEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestVerificationEdit(t *testing.T) { } func TestVerificationGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/storage/aliases.go b/storage/aliases.go index 8c1547d8d7a..33d610aecde 100644 --- a/storage/aliases.go +++ b/storage/aliases.go @@ -4,7 +4,7 @@ package storage import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/storage/analytics.go b/storage/analytics.go index f499ba582ac..722b2f19276 100644 --- a/storage/analytics.go +++ b/storage/analytics.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AnalyticsService contains methods and other services that help with interacting diff --git a/storage/analytics_test.go b/storage/analytics_test.go index f08803a1be2..1d8b1bf1a29 100644 --- a/storage/analytics_test.go +++ b/storage/analytics_test.go @@ -16,7 +16,6 @@ import ( ) func TestAnalyticsListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -51,7 +50,6 @@ func TestAnalyticsListWithOptionalParams(t *testing.T) { } func TestAnalyticsStoredWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/aliases.go b/stream/aliases.go index 3fb40fe13ba..abd0ab7dd40 100644 --- a/stream/aliases.go +++ b/stream/aliases.go @@ -4,7 +4,7 @@ package stream import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/stream/audiotrack.go b/stream/audiotrack.go index 20c8e4e8164..4a8a004367c 100644 --- a/stream/audiotrack.go +++ b/stream/audiotrack.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/stream/audiotrack_test.go b/stream/audiotrack_test.go index 36eaad6f237..a1d9d1aee24 100644 --- a/stream/audiotrack_test.go +++ b/stream/audiotrack_test.go @@ -15,7 +15,6 @@ import ( ) func TestAudioTrackDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestAudioTrackDelete(t *testing.T) { } func TestAudioTrackCopyWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -78,7 +76,6 @@ func TestAudioTrackCopyWithOptionalParams(t *testing.T) { } func TestAudioTrackEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -111,7 +108,6 @@ func TestAudioTrackEditWithOptionalParams(t *testing.T) { } func TestAudioTrackGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/caption.go b/stream/caption.go index f1c395b5ccc..741ce32dd8d 100644 --- a/stream/caption.go +++ b/stream/caption.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CaptionService contains methods and other services that help with interacting diff --git a/stream/caption_test.go b/stream/caption_test.go index e5d30189325..be4c348c9ed 100644 --- a/stream/caption_test.go +++ b/stream/caption_test.go @@ -15,7 +15,6 @@ import ( ) func TestCaptionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/captionlanguage.go b/stream/captionlanguage.go index b43d91ad177..ea2dc3b76b6 100644 --- a/stream/captionlanguage.go +++ b/stream/captionlanguage.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CaptionLanguageService contains methods and other services that help with @@ -49,10 +49,10 @@ func (r *CaptionLanguageService) Update(ctx context.Context, identifier string, } // Removes the captions or subtitles from a video. -func (r *CaptionLanguageService) Delete(ctx context.Context, identifier string, language string, params CaptionLanguageDeleteParams, opts ...option.RequestOption) (res *string, err error) { +func (r *CaptionLanguageService) Delete(ctx context.Context, identifier string, language string, body CaptionLanguageDeleteParams, opts ...option.RequestOption) (res *string, err error) { opts = append(r.Options[:], opts...) var env CaptionLanguageDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/stream/%s/captions/%s", params.AccountID, identifier, language) + path := fmt.Sprintf("accounts/%s/stream/%s/captions/%s", body.AccountID, identifier, language) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -131,11 +131,6 @@ func (r CaptionLanguageUpdateResponseEnvelopeSuccess) IsKnown() bool { type CaptionLanguageDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r CaptionLanguageDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type CaptionLanguageDeleteResponseEnvelope struct { diff --git a/stream/captionlanguage_test.go b/stream/captionlanguage_test.go index 6ee9346253e..36fe79c2830 100644 --- a/stream/captionlanguage_test.go +++ b/stream/captionlanguage_test.go @@ -15,7 +15,7 @@ import ( ) func TestCaptionLanguageUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +47,6 @@ func TestCaptionLanguageUpdate(t *testing.T) { } func TestCaptionLanguageDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -66,7 +65,6 @@ func TestCaptionLanguageDelete(t *testing.T) { "tr", stream.CaptionLanguageDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -79,7 +77,6 @@ func TestCaptionLanguageDelete(t *testing.T) { } func TestCaptionLanguageGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/captionlanguagevtt_test.go b/stream/captionlanguagevtt_test.go index 1430896fada..1533378e6c7 100644 --- a/stream/captionlanguagevtt_test.go +++ b/stream/captionlanguagevtt_test.go @@ -15,7 +15,6 @@ import ( ) func TestCaptionLanguageVttGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/clip.go b/stream/clip.go index fdea7a7af67..19f7a1d019a 100644 --- a/stream/clip.go +++ b/stream/clip.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ClipService contains methods and other services that help with interacting with diff --git a/stream/clip_test.go b/stream/clip_test.go index 496ca22b274..7ef21ccba40 100644 --- a/stream/clip_test.go +++ b/stream/clip_test.go @@ -15,7 +15,6 @@ import ( ) func TestClipNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/copy.go b/stream/copy.go index 18da331a347..917614f5332 100644 --- a/stream/copy.go +++ b/stream/copy.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CopyService contains methods and other services that help with interacting with diff --git a/stream/copy_test.go b/stream/copy_test.go index f2a3a2718c4..309b3e909e1 100644 --- a/stream/copy_test.go +++ b/stream/copy_test.go @@ -16,7 +16,6 @@ import ( ) func TestCopyNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/directupload.go b/stream/directupload.go index 736a8ebdf95..7cd447f725a 100644 --- a/stream/directupload.go +++ b/stream/directupload.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DirectUploadService contains methods and other services that help with diff --git a/stream/directupload_test.go b/stream/directupload_test.go index 3fc1770ce75..4082e2d74fc 100644 --- a/stream/directupload_test.go +++ b/stream/directupload_test.go @@ -16,7 +16,6 @@ import ( ) func TestDirectUploadNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/download.go b/stream/download.go index a3ba065e337..e9d52ec101e 100644 --- a/stream/download.go +++ b/stream/download.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -38,7 +38,7 @@ func (r *DownloadService) New(ctx context.Context, identifier string, params Dow opts = append(r.Options[:], opts...) var env DownloadNewResponseEnvelope path := fmt.Sprintf("accounts/%s/stream/%s/downloads", params.AccountID, identifier) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } diff --git a/stream/download_test.go b/stream/download_test.go index 692636defb4..fa2660ef411 100644 --- a/stream/download_test.go +++ b/stream/download_test.go @@ -15,7 +15,6 @@ import ( ) func TestDownloadNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestDownloadNew(t *testing.T) { } func TestDownloadDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +74,6 @@ func TestDownloadDelete(t *testing.T) { } func TestDownloadGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/embed_test.go b/stream/embed_test.go index f27f672c2fd..2fc8ef79f8b 100644 --- a/stream/embed_test.go +++ b/stream/embed_test.go @@ -15,7 +15,6 @@ import ( ) func TestEmbedGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/key.go b/stream/key.go index 83440e41b75..cc56dcb0ebb 100644 --- a/stream/key.go +++ b/stream/key.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -41,7 +41,7 @@ func (r *KeyService) New(ctx context.Context, params KeyNewParams, opts ...optio opts = append(r.Options[:], opts...) var env KeyNewResponseEnvelope path := fmt.Sprintf("accounts/%s/stream/keys", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -50,10 +50,10 @@ func (r *KeyService) New(ctx context.Context, params KeyNewParams, opts ...optio } // Deletes signing keys and revokes all signed URLs generated with the key. -func (r *KeyService) Delete(ctx context.Context, identifier string, params KeyDeleteParams, opts ...option.RequestOption) (res *KeyDeleteResponseUnion, err error) { +func (r *KeyService) Delete(ctx context.Context, identifier string, body KeyDeleteParams, opts ...option.RequestOption) (res *KeyDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env KeyDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/stream/keys/%s", params.AccountID, identifier) + path := fmt.Sprintf("accounts/%s/stream/keys/%s", body.AccountID, identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -201,11 +201,6 @@ func (r KeyNewResponseEnvelopeSuccess) IsKnown() bool { type KeyDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r KeyDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type KeyDeleteResponseEnvelope struct { diff --git a/stream/key_test.go b/stream/key_test.go index b644d70ddf7..03784c79ccb 100644 --- a/stream/key_test.go +++ b/stream/key_test.go @@ -15,7 +15,6 @@ import ( ) func TestKeyNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestKeyNew(t *testing.T) { } func TestKeyDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -60,7 +58,6 @@ func TestKeyDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", stream.KeyDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -73,7 +70,6 @@ func TestKeyDelete(t *testing.T) { } func TestKeyGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/liveinput.go b/stream/liveinput.go index f3fe6c66467..5348ed5240d 100644 --- a/stream/liveinput.go +++ b/stream/liveinput.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // LiveInputService contains methods and other services that help with interacting @@ -79,10 +79,10 @@ func (r *LiveInputService) List(ctx context.Context, params LiveInputListParams, // Prevents a live input from being streamed to and makes the live input // inaccessible to any future API calls. -func (r *LiveInputService) Delete(ctx context.Context, liveInputIdentifier string, params LiveInputDeleteParams, opts ...option.RequestOption) (err error) { +func (r *LiveInputService) Delete(ctx context.Context, liveInputIdentifier string, body LiveInputDeleteParams, opts ...option.RequestOption) (err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) - path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s", params.AccountID, liveInputIdentifier) + path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s", body.AccountID, liveInputIdentifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) return } @@ -752,11 +752,6 @@ func (r LiveInputListResponseEnvelopeSuccess) IsKnown() bool { type LiveInputDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r LiveInputDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type LiveInputGetParams struct { diff --git a/stream/liveinput_test.go b/stream/liveinput_test.go index 60c0c11215a..dfe3cf90a54 100644 --- a/stream/liveinput_test.go +++ b/stream/liveinput_test.go @@ -15,7 +15,6 @@ import ( ) func TestLiveInputNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -52,7 +51,6 @@ func TestLiveInputNewWithOptionalParams(t *testing.T) { } func TestLiveInputUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -93,7 +91,6 @@ func TestLiveInputUpdateWithOptionalParams(t *testing.T) { } func TestLiveInputListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -120,7 +117,6 @@ func TestLiveInputListWithOptionalParams(t *testing.T) { } func TestLiveInputDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -138,7 +134,6 @@ func TestLiveInputDelete(t *testing.T) { "66be4bf738797e01e1fca35a7bdecdcd", stream.LiveInputDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -151,7 +146,6 @@ func TestLiveInputDelete(t *testing.T) { } func TestLiveInputGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/liveinputoutput.go b/stream/liveinputoutput.go index 979da0c6530..8334c955417 100644 --- a/stream/liveinputoutput.go +++ b/stream/liveinputoutput.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // LiveInputOutputService contains methods and other services that help with @@ -67,7 +67,7 @@ func (r *LiveInputOutputService) List(ctx context.Context, liveInputIdentifier s opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s/outputs", query.AccountID, liveInputIdentifier) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -85,10 +85,10 @@ func (r *LiveInputOutputService) ListAutoPaging(ctx context.Context, liveInputId } // Deletes an output and removes it from the associated live input. -func (r *LiveInputOutputService) Delete(ctx context.Context, liveInputIdentifier string, outputIdentifier string, params LiveInputOutputDeleteParams, opts ...option.RequestOption) (err error) { +func (r *LiveInputOutputService) Delete(ctx context.Context, liveInputIdentifier string, outputIdentifier string, body LiveInputOutputDeleteParams, opts ...option.RequestOption) (err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) - path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s/outputs/%s", params.AccountID, liveInputIdentifier, outputIdentifier) + path := fmt.Sprintf("accounts/%s/stream/live_inputs/%s/outputs/%s", body.AccountID, liveInputIdentifier, outputIdentifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) return } @@ -255,9 +255,4 @@ type LiveInputOutputListParams struct { type LiveInputOutputDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r LiveInputOutputDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } diff --git a/stream/liveinputoutput_test.go b/stream/liveinputoutput_test.go index 91f851fb5ee..7070f22914e 100644 --- a/stream/liveinputoutput_test.go +++ b/stream/liveinputoutput_test.go @@ -15,7 +15,6 @@ import ( ) func TestLiveInputOutputNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -48,7 +47,6 @@ func TestLiveInputOutputNewWithOptionalParams(t *testing.T) { } func TestLiveInputOutputUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -80,7 +78,6 @@ func TestLiveInputOutputUpdate(t *testing.T) { } func TestLiveInputOutputList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -110,7 +107,6 @@ func TestLiveInputOutputList(t *testing.T) { } func TestLiveInputOutputDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -129,7 +125,6 @@ func TestLiveInputOutputDelete(t *testing.T) { "baea4d9c515887b80289d5c33cf01145", stream.LiveInputOutputDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { diff --git a/stream/stream.go b/stream/stream.go index 122bb94cebc..79f649bba16 100644 --- a/stream/stream.go +++ b/stream/stream.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // StreamService contains methods and other services that help with interacting @@ -69,7 +69,7 @@ func (r *StreamService) New(ctx context.Context, params StreamNewParams, opts .. opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) path := fmt.Sprintf("accounts/%s/stream", params.AccountID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, nil, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, nil, opts...) return } @@ -99,10 +99,10 @@ func (r *StreamService) ListAutoPaging(ctx context.Context, params StreamListPar } // Deletes a video and its copies from Cloudflare Stream. -func (r *StreamService) Delete(ctx context.Context, identifier string, params StreamDeleteParams, opts ...option.RequestOption) (err error) { +func (r *StreamService) Delete(ctx context.Context, identifier string, body StreamDeleteParams, opts ...option.RequestOption) (err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) - path := fmt.Sprintf("accounts/%s/stream/%s", params.AccountID, identifier) + path := fmt.Sprintf("accounts/%s/stream/%s", body.AccountID, identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) return } @@ -430,11 +430,6 @@ func (r StreamListParamsStatus) IsKnown() bool { type StreamDeleteParams struct { // The account identifier tag. AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r StreamDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type StreamGetParams struct { diff --git a/stream/stream_test.go b/stream/stream_test.go index 5cffd011340..f100772559d 100644 --- a/stream/stream_test.go +++ b/stream/stream_test.go @@ -16,7 +16,7 @@ import ( ) func TestStreamNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +47,6 @@ func TestStreamNewWithOptionalParams(t *testing.T) { } func TestStreamListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -81,7 +80,6 @@ func TestStreamListWithOptionalParams(t *testing.T) { } func TestStreamDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -99,7 +97,6 @@ func TestStreamDelete(t *testing.T) { "ea95132c15732412d22c1476fa83f27a", stream.StreamDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -112,7 +109,6 @@ func TestStreamDelete(t *testing.T) { } func TestStreamGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/token.go b/stream/token.go index 7b4ba4e7d9c..3e2aab2c9eb 100644 --- a/stream/token.go +++ b/stream/token.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // TokenService contains methods and other services that help with interacting with diff --git a/stream/token_test.go b/stream/token_test.go index cf721675f5b..a8920078985 100644 --- a/stream/token_test.go +++ b/stream/token_test.go @@ -15,7 +15,6 @@ import ( ) func TestTokenNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/video.go b/stream/video.go index 35675997c2e..f57a3efb593 100644 --- a/stream/video.go +++ b/stream/video.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // VideoService contains methods and other services that help with interacting with diff --git a/stream/video_test.go b/stream/video_test.go index f96088bb0d3..a2826e95af7 100644 --- a/stream/video_test.go +++ b/stream/video_test.go @@ -15,7 +15,6 @@ import ( ) func TestVideoStorageUsageWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/watermark.go b/stream/watermark.go index 188470410ae..3bae47a596d 100644 --- a/stream/watermark.go +++ b/stream/watermark.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -55,7 +55,7 @@ func (r *WatermarkService) List(ctx context.Context, query WatermarkListParams, opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/stream/watermarks", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -73,10 +73,10 @@ func (r *WatermarkService) ListAutoPaging(ctx context.Context, query WatermarkLi } // Deletes a watermark profile. -func (r *WatermarkService) Delete(ctx context.Context, identifier string, params WatermarkDeleteParams, opts ...option.RequestOption) (res *WatermarkDeleteResponseUnion, err error) { +func (r *WatermarkService) Delete(ctx context.Context, identifier string, body WatermarkDeleteParams, opts ...option.RequestOption) (res *WatermarkDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env WatermarkDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/stream/watermarks/%s", params.AccountID, identifier) + path := fmt.Sprintf("accounts/%s/stream/watermarks/%s", body.AccountID, identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -257,11 +257,6 @@ type WatermarkListParams struct { type WatermarkDeleteParams struct { // The account identifier tag. AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r WatermarkDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type WatermarkDeleteResponseEnvelope struct { diff --git a/stream/watermark_test.go b/stream/watermark_test.go index 325aa80c310..73dd888e3d8 100644 --- a/stream/watermark_test.go +++ b/stream/watermark_test.go @@ -15,7 +15,7 @@ import ( ) func TestWatermarkNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +47,6 @@ func TestWatermarkNewWithOptionalParams(t *testing.T) { } func TestWatermarkList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -73,7 +72,6 @@ func TestWatermarkList(t *testing.T) { } func TestWatermarkDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -91,7 +89,6 @@ func TestWatermarkDelete(t *testing.T) { "ea95132c15732412d22c1476fa83f27a", stream.WatermarkDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -104,7 +101,6 @@ func TestWatermarkDelete(t *testing.T) { } func TestWatermarkGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/stream/webhook.go b/stream/webhook.go index 6ebdf1846a4..59d254e81b0 100644 --- a/stream/webhook.go +++ b/stream/webhook.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -47,10 +47,10 @@ func (r *WebhookService) Update(ctx context.Context, params WebhookUpdateParams, } // Deletes a webhook. -func (r *WebhookService) Delete(ctx context.Context, params WebhookDeleteParams, opts ...option.RequestOption) (res *WebhookDeleteResponseUnion, err error) { +func (r *WebhookService) Delete(ctx context.Context, body WebhookDeleteParams, opts ...option.RequestOption) (res *WebhookDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env WebhookDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/stream/webhook", params.AccountID) + path := fmt.Sprintf("accounts/%s/stream/webhook", body.AccountID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -179,11 +179,6 @@ func (r WebhookUpdateResponseEnvelopeSuccess) IsKnown() bool { type WebhookDeleteParams struct { // The account identifier tag. AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r WebhookDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type WebhookDeleteResponseEnvelope struct { diff --git a/stream/webhook_test.go b/stream/webhook_test.go index 2f7d92d5bd1..5bc6daa465b 100644 --- a/stream/webhook_test.go +++ b/stream/webhook_test.go @@ -15,7 +15,6 @@ import ( ) func TestWebhookUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestWebhookUpdate(t *testing.T) { } func TestWebhookDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -57,7 +55,6 @@ func TestWebhookDelete(t *testing.T) { ) _, err := client.Stream.Webhooks.Delete(context.TODO(), stream.WebhookDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }) if err != nil { var apierr *cloudflare.Error @@ -69,7 +66,6 @@ func TestWebhookDelete(t *testing.T) { } func TestWebhookGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/subscriptions/aliases.go b/subscriptions/aliases.go index 9fd719e4e5b..6c00368ed7d 100644 --- a/subscriptions/aliases.go +++ b/subscriptions/aliases.go @@ -4,7 +4,7 @@ package subscriptions import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/subscriptions/subscription.go b/subscriptions/subscription.go index ab4eda87083..84e209e5b75 100644 --- a/subscriptions/subscription.go +++ b/subscriptions/subscription.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/cloudflare/cloudflare-go/v2/user" "github.com/tidwall/gjson" ) @@ -85,7 +85,7 @@ func (r *SubscriptionService) ListAutoPaging(ctx context.Context, accountIdentif } // Deletes an account's subscription. -func (r *SubscriptionService) Delete(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, body SubscriptionDeleteParams, opts ...option.RequestOption) (res *SubscriptionDeleteResponse, err error) { +func (r *SubscriptionService) Delete(ctx context.Context, accountIdentifier string, subscriptionIdentifier string, opts ...option.RequestOption) (res *SubscriptionDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env SubscriptionDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/subscriptions/%s", accountIdentifier, subscriptionIdentifier) @@ -285,14 +285,6 @@ func (r SubscriptionUpdateResponseEnvelopeSuccess) IsKnown() bool { return false } -type SubscriptionDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r SubscriptionDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type SubscriptionDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/subscriptions/subscription_test.go b/subscriptions/subscription_test.go index 13885f10cb1..0eaa4365740 100644 --- a/subscriptions/subscription_test.go +++ b/subscriptions/subscription_test.go @@ -16,7 +16,6 @@ import ( ) func TestSubscriptionNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +76,6 @@ func TestSubscriptionNewWithOptionalParams(t *testing.T) { } func TestSubscriptionUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -139,7 +137,6 @@ func TestSubscriptionUpdateWithOptionalParams(t *testing.T) { } func TestSubscriptionList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -163,7 +160,6 @@ func TestSubscriptionList(t *testing.T) { } func TestSubscriptionDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -180,9 +176,6 @@ func TestSubscriptionDelete(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "506e3185e9c882d175a2d0cb0093d9f2", - subscriptions.SubscriptionDeleteParams{ - Body: map[string]interface{}{}, - }, ) if err != nil { var apierr *cloudflare.Error @@ -194,7 +187,6 @@ func TestSubscriptionDelete(t *testing.T) { } func TestSubscriptionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/url_normalization/aliases.go b/url_normalization/aliases.go index 9cde81ec891..f6212994491 100644 --- a/url_normalization/aliases.go +++ b/url_normalization/aliases.go @@ -4,7 +4,7 @@ package url_normalization import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/url_normalization/urlnormalization_test.go b/url_normalization/urlnormalization_test.go index d5d4671fd72..33841b09b2d 100644 --- a/url_normalization/urlnormalization_test.go +++ b/url_normalization/urlnormalization_test.go @@ -15,7 +15,6 @@ import ( ) func TestURLNormalizationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestURLNormalizationUpdateWithOptionalParams(t *testing.T) { } func TestURLNormalizationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/url_scanner/aliases.go b/url_scanner/aliases.go index d795833420d..38a0806aec7 100644 --- a/url_scanner/aliases.go +++ b/url_scanner/aliases.go @@ -4,7 +4,7 @@ package url_scanner import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/url_scanner/scan_test.go b/url_scanner/scan_test.go index ae419688339..13e9f07c903 100644 --- a/url_scanner/scan_test.go +++ b/url_scanner/scan_test.go @@ -19,7 +19,6 @@ import ( ) func TestScanNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -54,7 +53,6 @@ func TestScanNewWithOptionalParams(t *testing.T) { } func TestScanGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -82,7 +80,6 @@ func TestScanGet(t *testing.T) { } func TestScanHar(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -110,7 +107,6 @@ func TestScanHar(t *testing.T) { } func TestScanScreenshotWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) w.Write([]byte("abc")) diff --git a/url_scanner/urlscanner.go b/url_scanner/urlscanner.go index 793430f5067..7d1de544086 100644 --- a/url_scanner/urlscanner.go +++ b/url_scanner/urlscanner.go @@ -135,19 +135,19 @@ type URLScannerScanParams struct { NextCursor param.Field[string] `query:"next_cursor"` // Filter scans by main page Autonomous System Number (ASN). PageASN param.Field[string] `query:"page_asn"` - // Filter scans by main page hostname . + // Filter scans by main page hostname (domain of effective URL). PageHostname param.Field[string] `query:"page_hostname"` // Filter scans by main page IP address (IPv4 or IPv6). PageIP param.Field[string] `query:"page_ip"` - // Filter scans by exact match URL path (also supports suffix search). + // Filter scans by exact match of effective URL path (also supports suffix search). PagePath param.Field[string] `query:"page_path"` - // Filter scans by exact match to scanned URL (_after redirects_) + // Filter scans by submitted or scanned URL PageURL param.Field[string] `query:"page_url"` // Filter scans by url path of _any_ request made by the webpage. Path param.Field[string] `query:"path"` // Scan uuid ScanID param.Field[string] `query:"scanId" format:"uuid"` - // Filter scans by exact match URL of _any_ request made by the webpage + // Filter scans by URL of _any_ request made by the webpage URL param.Field[string] `query:"url"` } diff --git a/url_scanner/urlscanner_test.go b/url_scanner/urlscanner_test.go index 189738e72d2..70a76681821 100644 --- a/url_scanner/urlscanner_test.go +++ b/url_scanner/urlscanner_test.go @@ -16,7 +16,6 @@ import ( ) func TestURLScannerScanWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/usage_test.go b/usage_test.go index 91eaa496915..0d66ec4a335 100644 --- a/usage_test.go +++ b/usage_test.go @@ -31,7 +31,7 @@ func TestUsage(t *testing.T) { ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }), Name: cloudflare.F("example.com"), - Type: cloudflare.F(zones.ZoneNewParamsTypeFull), + Type: cloudflare.F(zones.TypeFull), }) if err != nil { t.Error(err) diff --git a/user/aliases.go b/user/aliases.go index c41ea934533..362ab319802 100644 --- a/user/aliases.go +++ b/user/aliases.go @@ -4,7 +4,7 @@ package user import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/user/auditlog.go b/user/auditlog.go index 79c3271681d..69860ed5a67 100644 --- a/user/auditlog.go +++ b/user/auditlog.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AuditLogService contains methods and other services that help with interacting diff --git a/user/auditlog_test.go b/user/auditlog_test.go index a5029711dc8..ac03c101542 100644 --- a/user/auditlog_test.go +++ b/user/auditlog_test.go @@ -16,7 +16,6 @@ import ( ) func TestAuditLogListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/user/billinghistory_test.go b/user/billinghistory_test.go index bdd4b1dd3fd..94fd9df0099 100644 --- a/user/billinghistory_test.go +++ b/user/billinghistory_test.go @@ -16,7 +16,6 @@ import ( ) func TestBillingHistoryListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/user/billingprofile.go b/user/billingprofile.go index c5df0865879..a8bb4b844cb 100644 --- a/user/billingprofile.go +++ b/user/billingprofile.go @@ -9,8 +9,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/user/billingprofile_test.go b/user/billingprofile_test.go index a7d857c0a46..dc35b2248f0 100644 --- a/user/billingprofile_test.go +++ b/user/billingprofile_test.go @@ -14,7 +14,6 @@ import ( ) func TestBillingProfileGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/user/invite.go b/user/invite.go index 2922a20cd05..d983835f153 100644 --- a/user/invite.go +++ b/user/invite.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/user/invite_test.go b/user/invite_test.go index 82feca650a9..608d63d04d5 100644 --- a/user/invite_test.go +++ b/user/invite_test.go @@ -15,7 +15,6 @@ import ( ) func TestInviteList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -39,7 +38,6 @@ func TestInviteList(t *testing.T) { } func TestInviteEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestInviteEdit(t *testing.T) { } func TestInviteGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/user/organization.go b/user/organization.go index 56bcfa54846..fa9a95c5c72 100644 --- a/user/organization.go +++ b/user/organization.go @@ -9,13 +9,14 @@ import ( "net/url" "reflect" + "github.com/cloudflare/cloudflare-go/v2/accounts" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -61,7 +62,7 @@ func (r *OrganizationService) ListAutoPaging(ctx context.Context, query Organiza } // Removes association to an organization. -func (r *OrganizationService) Delete(ctx context.Context, organizationID string, body OrganizationDeleteParams, opts ...option.RequestOption) (res *OrganizationDeleteResponse, err error) { +func (r *OrganizationService) Delete(ctx context.Context, organizationID string, opts ...option.RequestOption) (res *OrganizationDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := fmt.Sprintf("user/organizations/%s", organizationID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) @@ -91,8 +92,8 @@ type Organization struct { // List of roles that a user has within an organization. Roles []string `json:"roles"` // Whether the user is a member of the organization or has an inivitation pending. - Status OrganizationStatus `json:"status"` - JSON organizationJSON `json:"-"` + Status accounts.Status `json:"status"` + JSON organizationJSON `json:"-"` } // organizationJSON contains the JSON metadata for the struct [Organization] @@ -114,22 +115,6 @@ func (r organizationJSON) RawJSON() string { return r.raw } -// Whether the user is a member of the organization or has an inivitation pending. -type OrganizationStatus string - -const ( - OrganizationStatusMember OrganizationStatus = "member" - OrganizationStatusInvited OrganizationStatus = "invited" -) - -func (r OrganizationStatus) IsKnown() bool { - switch r { - case OrganizationStatusMember, OrganizationStatusInvited: - return true - } - return false -} - type OrganizationDeleteResponse struct { // Identifier ID string `json:"id"` @@ -259,14 +244,6 @@ func (r OrganizationListParamsStatus) IsKnown() bool { return false } -type OrganizationDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r OrganizationDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type OrganizationGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/user/organization_test.go b/user/organization_test.go index bb3adc45ea2..478d351e3c5 100644 --- a/user/organization_test.go +++ b/user/organization_test.go @@ -15,7 +15,6 @@ import ( ) func TestOrganizationListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestOrganizationListWithOptionalParams(t *testing.T) { } func TestOrganizationDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -60,13 +58,7 @@ func TestOrganizationDelete(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.User.Organizations.Delete( - context.TODO(), - "023e105f4ecef8ad9ca31a8372d0c353", - user.OrganizationDeleteParams{ - Body: map[string]interface{}{}, - }, - ) + _, err := client.User.Organizations.Delete(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -77,7 +69,6 @@ func TestOrganizationDelete(t *testing.T) { } func TestOrganizationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/user/subscription.go b/user/subscription.go index 7e37ade6c79..bffbb6e8056 100644 --- a/user/subscription.go +++ b/user/subscription.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -49,7 +49,7 @@ func (r *SubscriptionService) Update(ctx context.Context, identifier string, bod } // Deletes a user's subscription. -func (r *SubscriptionService) Delete(ctx context.Context, identifier string, body SubscriptionDeleteParams, opts ...option.RequestOption) (res *SubscriptionDeleteResponse, err error) { +func (r *SubscriptionService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (res *SubscriptionDeleteResponse, err error) { opts = append(r.Options[:], opts...) path := fmt.Sprintf("user/subscriptions/%s", identifier) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) @@ -469,14 +469,6 @@ func (r SubscriptionUpdateResponseEnvelopeSuccess) IsKnown() bool { return false } -type SubscriptionDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r SubscriptionDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type SubscriptionEditParams struct { Subscription SubscriptionParam `json:"subscription,required"` } diff --git a/user/subscription_test.go b/user/subscription_test.go index d4462742dd0..5b8e0201e52 100644 --- a/user/subscription_test.go +++ b/user/subscription_test.go @@ -15,7 +15,6 @@ import ( ) func TestSubscriptionUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +75,6 @@ func TestSubscriptionUpdateWithOptionalParams(t *testing.T) { } func TestSubscriptionDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -89,13 +87,7 @@ func TestSubscriptionDelete(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.User.Subscriptions.Delete( - context.TODO(), - "506e3185e9c882d175a2d0cb0093d9f2", - user.SubscriptionDeleteParams{ - Body: map[string]interface{}{}, - }, - ) + _, err := client.User.Subscriptions.Delete(context.TODO(), "506e3185e9c882d175a2d0cb0093d9f2") if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -106,7 +98,6 @@ func TestSubscriptionDelete(t *testing.T) { } func TestSubscriptionEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -167,7 +158,6 @@ func TestSubscriptionEditWithOptionalParams(t *testing.T) { } func TestSubscriptionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/user/token.go b/user/token.go index 0fcec0a4b5e..75be3ccb1a2 100644 --- a/user/token.go +++ b/user/token.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -91,7 +91,7 @@ func (r *TokenService) ListAutoPaging(ctx context.Context, query TokenListParams } // Destroy a token. -func (r *TokenService) Delete(ctx context.Context, tokenID interface{}, body TokenDeleteParams, opts ...option.RequestOption) (res *TokenDeleteResponse, err error) { +func (r *TokenService) Delete(ctx context.Context, tokenID interface{}, opts ...option.RequestOption) (res *TokenDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env TokenDeleteResponseEnvelope path := fmt.Sprintf("user/tokens/%v", tokenID) @@ -131,34 +131,17 @@ func (r *TokenService) Verify(ctx context.Context, opts ...option.RequestOption) type CIDRListParam = string -type Policy struct { - // Policy identifier. - ID string `json:"id,required"` +type PolicyParam struct { // Allow or deny operations against the resources. - Effect PolicyEffect `json:"effect,required"` + Effect param.Field[PolicyEffect] `json:"effect,required"` // A set of permission groups that are specified to the policy. - PermissionGroups []PolicyPermissionGroup `json:"permission_groups,required"` + PermissionGroups param.Field[[]PolicyPermissionGroupParam] `json:"permission_groups,required"` // A list of resource names that the policy applies to. - Resources interface{} `json:"resources,required"` - JSON policyJSON `json:"-"` -} - -// policyJSON contains the JSON metadata for the struct [Policy] -type policyJSON struct { - ID apijson.Field - Effect apijson.Field - PermissionGroups apijson.Field - Resources apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *Policy) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) + Resources param.Field[interface{}] `json:"resources,required"` } -func (r policyJSON) RawJSON() string { - return r.raw +func (r PolicyParam) MarshalJSON() (data []byte, err error) { + return apijson.MarshalRoot(r) } // Allow or deny operations against the resources. @@ -177,46 +160,6 @@ func (r PolicyEffect) IsKnown() bool { return false } -// A named group of permissions that map to a group of operations against -// resources. -type PolicyPermissionGroup struct { - // Identifier of the group. - ID string `json:"id,required"` - // Name of the group. - Name string `json:"name"` - JSON policyPermissionGroupJSON `json:"-"` -} - -// policyPermissionGroupJSON contains the JSON metadata for the struct -// [PolicyPermissionGroup] -type policyPermissionGroupJSON struct { - ID apijson.Field - Name apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *PolicyPermissionGroup) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r policyPermissionGroupJSON) RawJSON() string { - return r.raw -} - -type PolicyParam struct { - // Allow or deny operations against the resources. - Effect param.Field[PolicyEffect] `json:"effect,required"` - // A set of permission groups that are specified to the policy. - PermissionGroups param.Field[[]PolicyPermissionGroupParam] `json:"permission_groups,required"` - // A list of resource names that the policy applies to. - Resources param.Field[interface{}] `json:"resources,required"` -} - -func (r PolicyParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - // A named group of permissions that map to a group of operations against // resources. type PolicyPermissionGroupParam struct { @@ -575,14 +518,6 @@ func (r TokenListParamsDirection) IsKnown() bool { return false } -type TokenDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r TokenDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type TokenDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/user/token_test.go b/user/token_test.go index 39570f78386..451c88e6e9b 100644 --- a/user/token_test.go +++ b/user/token_test.go @@ -16,7 +16,7 @@ import ( ) func TestTokenNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -72,7 +72,7 @@ func TestTokenNewWithOptionalParams(t *testing.T) { } func TestTokenUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -135,7 +135,6 @@ func TestTokenUpdateWithOptionalParams(t *testing.T) { } func TestTokenListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -163,7 +162,6 @@ func TestTokenListWithOptionalParams(t *testing.T) { } func TestTokenDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -176,13 +174,7 @@ func TestTokenDelete(t *testing.T) { option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) - _, err := client.User.Tokens.Delete( - context.TODO(), - map[string]interface{}{}, - user.TokenDeleteParams{ - Body: map[string]interface{}{}, - }, - ) + _, err := client.User.Tokens.Delete(context.TODO(), map[string]interface{}{}) if err != nil { var apierr *cloudflare.Error if errors.As(err, &apierr) { @@ -193,7 +185,6 @@ func TestTokenDelete(t *testing.T) { } func TestTokenGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -217,7 +208,6 @@ func TestTokenGet(t *testing.T) { } func TestTokenVerify(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/user/tokenpermissiongroup_test.go b/user/tokenpermissiongroup_test.go index 60b89fe21e7..324dde10dfc 100644 --- a/user/tokenpermissiongroup_test.go +++ b/user/tokenpermissiongroup_test.go @@ -14,7 +14,6 @@ import ( ) func TestTokenPermissionGroupList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/user/tokenvalue.go b/user/tokenvalue.go index 5b599a4c7e3..fb8acf0ba69 100644 --- a/user/tokenvalue.go +++ b/user/tokenvalue.go @@ -9,8 +9,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // TokenValueService contains methods and other services that help with interacting diff --git a/user/tokenvalue_test.go b/user/tokenvalue_test.go index 1aa17c69a0d..cd3e11b6d93 100644 --- a/user/tokenvalue_test.go +++ b/user/tokenvalue_test.go @@ -15,7 +15,6 @@ import ( ) func TestTokenValueUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/user/user.go b/user/user.go index 6fdc60fb555..901363d4215 100644 --- a/user/user.go +++ b/user/user.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/user/user_test.go b/user/user_test.go index 007212bcd66..17646f777e1 100644 --- a/user/user_test.go +++ b/user/user_test.go @@ -15,7 +15,6 @@ import ( ) func TestUserEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestUserEditWithOptionalParams(t *testing.T) { } func TestUserGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/vectorize/aliases.go b/vectorize/aliases.go index 0ac5d9b3519..8ac7bae3106 100644 --- a/vectorize/aliases.go +++ b/vectorize/aliases.go @@ -4,7 +4,7 @@ package vectorize import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/vectorize/index.go b/vectorize/index.go index 9002e014660..75b4fd47a96 100644 --- a/vectorize/index.go +++ b/vectorize/index.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -66,7 +66,7 @@ func (r *IndexService) List(ctx context.Context, query IndexListParams, opts ... opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/vectorize/indexes", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/vectorize/index_test.go b/vectorize/index_test.go index 8b2b7e37c98..412b2a81fc2 100644 --- a/vectorize/index_test.go +++ b/vectorize/index_test.go @@ -15,7 +15,6 @@ import ( ) func TestIndexNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestIndexNewWithOptionalParams(t *testing.T) { } func TestIndexUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -78,7 +76,6 @@ func TestIndexUpdate(t *testing.T) { } func TestIndexList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -104,7 +101,6 @@ func TestIndexList(t *testing.T) { } func TestIndexDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -134,7 +130,6 @@ func TestIndexDelete(t *testing.T) { } func TestIndexDeleteByIDsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -165,7 +160,6 @@ func TestIndexDeleteByIDsWithOptionalParams(t *testing.T) { } func TestIndexGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -195,7 +189,6 @@ func TestIndexGet(t *testing.T) { } func TestIndexGetByIDsWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -226,7 +219,7 @@ func TestIndexGetByIDsWithOptionalParams(t *testing.T) { } func TestIndexInsert(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -257,7 +250,6 @@ func TestIndexInsert(t *testing.T) { } func TestIndexQueryWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -297,7 +289,7 @@ func TestIndexQueryWithOptionalParams(t *testing.T) { } func TestIndexUpsert(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/waiting_rooms/aliases.go b/waiting_rooms/aliases.go index 45113caf6f6..11e5ff01117 100644 --- a/waiting_rooms/aliases.go +++ b/waiting_rooms/aliases.go @@ -4,7 +4,7 @@ package waiting_rooms import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/waiting_rooms/event.go b/waiting_rooms/event.go index 1faff34ac57..02e045686b8 100644 --- a/waiting_rooms/event.go +++ b/waiting_rooms/event.go @@ -91,10 +91,10 @@ func (r *EventService) ListAutoPaging(ctx context.Context, waitingRoomID string, } // Deletes an event for a waiting room. -func (r *EventService) Delete(ctx context.Context, waitingRoomID string, eventID string, params EventDeleteParams, opts ...option.RequestOption) (res *EventDeleteResponse, err error) { +func (r *EventService) Delete(ctx context.Context, waitingRoomID string, eventID string, body EventDeleteParams, opts ...option.RequestOption) (res *EventDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env EventDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/waiting_rooms/%s/events/%s", params.ZoneID, waitingRoomID, eventID) + path := fmt.Sprintf("zones/%s/waiting_rooms/%s/events/%s", body.ZoneID, waitingRoomID, eventID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -243,20 +243,14 @@ func (r EventNewParams) MarshalJSON() (data []byte, err error) { } type EventNewResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result Event `json:"result,required"` - Success interface{} `json:"success,required"` - JSON eventNewResponseEnvelopeJSON `json:"-"` + Result Event `json:"result,required"` + JSON eventNewResponseEnvelopeJSON `json:"-"` } // eventNewResponseEnvelopeJSON contains the JSON metadata for the struct // [EventNewResponseEnvelope] type eventNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -280,20 +274,14 @@ func (r EventUpdateParams) MarshalJSON() (data []byte, err error) { } type EventUpdateResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result Event `json:"result,required"` - Success interface{} `json:"success,required"` - JSON eventUpdateResponseEnvelopeJSON `json:"-"` + Result Event `json:"result,required"` + JSON eventUpdateResponseEnvelopeJSON `json:"-"` } // eventUpdateResponseEnvelopeJSON contains the JSON metadata for the struct // [EventUpdateResponseEnvelope] type eventUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -326,28 +314,17 @@ func (r EventListParams) URLQuery() (v url.Values) { type EventDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r EventDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type EventDeleteResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result EventDeleteResponse `json:"result,required"` - Success interface{} `json:"success,required"` - JSON eventDeleteResponseEnvelopeJSON `json:"-"` + Result EventDeleteResponse `json:"result,required"` + JSON eventDeleteResponseEnvelopeJSON `json:"-"` } // eventDeleteResponseEnvelopeJSON contains the JSON metadata for the struct // [EventDeleteResponseEnvelope] type eventDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -371,20 +348,14 @@ func (r EventEditParams) MarshalJSON() (data []byte, err error) { } type EventEditResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result Event `json:"result,required"` - Success interface{} `json:"success,required"` - JSON eventEditResponseEnvelopeJSON `json:"-"` + Result Event `json:"result,required"` + JSON eventEditResponseEnvelopeJSON `json:"-"` } // eventEditResponseEnvelopeJSON contains the JSON metadata for the struct // [EventEditResponseEnvelope] type eventEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -403,20 +374,14 @@ type EventGetParams struct { } type EventGetResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result Event `json:"result,required"` - Success interface{} `json:"success,required"` - JSON eventGetResponseEnvelopeJSON `json:"-"` + Result Event `json:"result,required"` + JSON eventGetResponseEnvelopeJSON `json:"-"` } // eventGetResponseEnvelopeJSON contains the JSON metadata for the struct // [EventGetResponseEnvelope] type eventGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/waiting_rooms/event_test.go b/waiting_rooms/event_test.go index df298de4efb..750ed2fca67 100644 --- a/waiting_rooms/event_test.go +++ b/waiting_rooms/event_test.go @@ -15,7 +15,6 @@ import ( ) func TestEventNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -60,7 +59,6 @@ func TestEventNewWithOptionalParams(t *testing.T) { } func TestEventUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -106,7 +104,6 @@ func TestEventUpdateWithOptionalParams(t *testing.T) { } func TestEventListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -138,7 +135,6 @@ func TestEventListWithOptionalParams(t *testing.T) { } func TestEventDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -157,7 +153,6 @@ func TestEventDelete(t *testing.T) { "25756b2dfe6e378a06b033b670413757", waiting_rooms.EventDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -170,7 +165,6 @@ func TestEventDelete(t *testing.T) { } func TestEventEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -216,7 +210,6 @@ func TestEventEditWithOptionalParams(t *testing.T) { } func TestEventGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/waiting_rooms/eventdetail.go b/waiting_rooms/eventdetail.go index 03911c33361..ff972378a1d 100644 --- a/waiting_rooms/eventdetail.go +++ b/waiting_rooms/eventdetail.go @@ -173,20 +173,14 @@ type EventDetailGetParams struct { } type EventDetailGetResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result EventDetailGetResponse `json:"result,required"` - Success interface{} `json:"success,required"` - JSON eventDetailGetResponseEnvelopeJSON `json:"-"` + Result EventDetailGetResponse `json:"result,required"` + JSON eventDetailGetResponseEnvelopeJSON `json:"-"` } // eventDetailGetResponseEnvelopeJSON contains the JSON metadata for the struct // [EventDetailGetResponseEnvelope] type eventDetailGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/waiting_rooms/eventdetail_test.go b/waiting_rooms/eventdetail_test.go index 47c7788fa2f..80d97938e97 100644 --- a/waiting_rooms/eventdetail_test.go +++ b/waiting_rooms/eventdetail_test.go @@ -15,7 +15,6 @@ import ( ) func TestEventDetailGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/waiting_rooms/page.go b/waiting_rooms/page.go index e2b0623a94a..f75d20d5a2c 100644 --- a/waiting_rooms/page.go +++ b/waiting_rooms/page.go @@ -132,20 +132,14 @@ func (r PagePreviewParams) MarshalJSON() (data []byte, err error) { } type PagePreviewResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result PagePreviewResponse `json:"result,required"` - Success interface{} `json:"success,required"` - JSON pagePreviewResponseEnvelopeJSON `json:"-"` + Result PagePreviewResponse `json:"result,required"` + JSON pagePreviewResponseEnvelopeJSON `json:"-"` } // pagePreviewResponseEnvelopeJSON contains the JSON metadata for the struct // [PagePreviewResponseEnvelope] type pagePreviewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/waiting_rooms/page_test.go b/waiting_rooms/page_test.go index abb0703abbf..7fd6c9964fd 100644 --- a/waiting_rooms/page_test.go +++ b/waiting_rooms/page_test.go @@ -15,7 +15,6 @@ import ( ) func TestPagePreview(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/waiting_rooms/rule.go b/waiting_rooms/rule.go index 9e3df896258..11640ea5c15 100644 --- a/waiting_rooms/rule.go +++ b/waiting_rooms/rule.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RuleService contains methods and other services that help with interacting with @@ -67,7 +67,7 @@ func (r *RuleService) List(ctx context.Context, waitingRoomID string, query Rule opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("zones/%s/waiting_rooms/%s/rules", query.ZoneID, waitingRoomID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -85,10 +85,10 @@ func (r *RuleService) ListAutoPaging(ctx context.Context, waitingRoomID string, } // Deletes a rule for a waiting room. -func (r *RuleService) Delete(ctx context.Context, waitingRoomID string, ruleID string, params RuleDeleteParams, opts ...option.RequestOption) (res *[]WaitingRoomRule, err error) { +func (r *RuleService) Delete(ctx context.Context, waitingRoomID string, ruleID string, body RuleDeleteParams, opts ...option.RequestOption) (res *[]WaitingRoomRule, err error) { opts = append(r.Options[:], opts...) var env RuleDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/waiting_rooms/%s/rules/%s", params.ZoneID, waitingRoomID, ruleID) + path := fmt.Sprintf("zones/%s/waiting_rooms/%s/rules/%s", body.ZoneID, waitingRoomID, ruleID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -395,11 +395,6 @@ type RuleListParams struct { type RuleDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r RuleDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type RuleDeleteResponseEnvelope struct { diff --git a/waiting_rooms/rule_test.go b/waiting_rooms/rule_test.go index 5535ce64dfd..10a41ce7eaf 100644 --- a/waiting_rooms/rule_test.go +++ b/waiting_rooms/rule_test.go @@ -15,7 +15,6 @@ import ( ) func TestRuleNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestRuleNewWithOptionalParams(t *testing.T) { } func TestRuleUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -95,7 +93,6 @@ func TestRuleUpdate(t *testing.T) { } func TestRuleList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -125,7 +122,6 @@ func TestRuleList(t *testing.T) { } func TestRuleDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -144,7 +140,6 @@ func TestRuleDelete(t *testing.T) { "25756b2dfe6e378a06b033b670413757", waiting_rooms.RuleDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -157,7 +152,6 @@ func TestRuleDelete(t *testing.T) { } func TestRuleEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/waiting_rooms/setting.go b/waiting_rooms/setting.go index 9f48d707406..06377697b06 100644 --- a/waiting_rooms/setting.go +++ b/waiting_rooms/setting.go @@ -69,29 +69,6 @@ func (r *SettingService) Get(ctx context.Context, query SettingGetParams, opts . return } -type Setting struct { - // Whether to allow verified search engine crawlers to bypass all waiting rooms on - // this zone. Verified search engine crawlers will not be tracked or counted by the - // waiting room system, and will not appear in waiting room analytics. - SearchEngineCrawlerBypass bool `json:"search_engine_crawler_bypass,required"` - JSON settingJSON `json:"-"` -} - -// settingJSON contains the JSON metadata for the struct [Setting] -type settingJSON struct { - SearchEngineCrawlerBypass apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *Setting) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r settingJSON) RawJSON() string { - return r.raw -} - type SettingUpdateResponse struct { // Whether to allow verified search engine crawlers to bypass all waiting rooms on // this zone. Verified search engine crawlers will not be tracked or counted by the @@ -178,20 +155,14 @@ func (r SettingUpdateParams) MarshalJSON() (data []byte, err error) { } type SettingUpdateResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result SettingUpdateResponse `json:"result,required"` - Success interface{} `json:"success,required"` - JSON settingUpdateResponseEnvelopeJSON `json:"-"` + Result SettingUpdateResponse `json:"result,required"` + JSON settingUpdateResponseEnvelopeJSON `json:"-"` } // settingUpdateResponseEnvelopeJSON contains the JSON metadata for the struct // [SettingUpdateResponseEnvelope] type settingUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -218,20 +189,14 @@ func (r SettingEditParams) MarshalJSON() (data []byte, err error) { } type SettingEditResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result SettingEditResponse `json:"result,required"` - Success interface{} `json:"success,required"` - JSON settingEditResponseEnvelopeJSON `json:"-"` + Result SettingEditResponse `json:"result,required"` + JSON settingEditResponseEnvelopeJSON `json:"-"` } // settingEditResponseEnvelopeJSON contains the JSON metadata for the struct // [SettingEditResponseEnvelope] type settingEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -250,20 +215,14 @@ type SettingGetParams struct { } type SettingGetResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result SettingGetResponse `json:"result,required"` - Success interface{} `json:"success,required"` - JSON settingGetResponseEnvelopeJSON `json:"-"` + Result SettingGetResponse `json:"result,required"` + JSON settingGetResponseEnvelopeJSON `json:"-"` } // settingGetResponseEnvelopeJSON contains the JSON metadata for the struct // [SettingGetResponseEnvelope] type settingGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/waiting_rooms/setting_test.go b/waiting_rooms/setting_test.go index 08788935bdb..a22ea935567 100644 --- a/waiting_rooms/setting_test.go +++ b/waiting_rooms/setting_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingUpdateWithOptionalParams(t *testing.T) { } func TestSettingEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestSettingEditWithOptionalParams(t *testing.T) { } func TestSettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/waiting_rooms/status.go b/waiting_rooms/status.go index f16460b1566..75984eb2a1e 100644 --- a/waiting_rooms/status.go +++ b/waiting_rooms/status.go @@ -111,20 +111,14 @@ type StatusGetParams struct { } type StatusGetResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result StatusGetResponse `json:"result,required"` - Success interface{} `json:"success,required"` - JSON statusGetResponseEnvelopeJSON `json:"-"` + Result StatusGetResponse `json:"result,required"` + JSON statusGetResponseEnvelopeJSON `json:"-"` } // statusGetResponseEnvelopeJSON contains the JSON metadata for the struct // [StatusGetResponseEnvelope] type statusGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/waiting_rooms/status_test.go b/waiting_rooms/status_test.go index 5bb98a83189..5afd0499c08 100644 --- a/waiting_rooms/status_test.go +++ b/waiting_rooms/status_test.go @@ -15,7 +15,6 @@ import ( ) func TestStatusGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/waiting_rooms/waitingroom.go b/waiting_rooms/waitingroom.go index 164249c28af..9ec2e78d64a 100644 --- a/waiting_rooms/waitingroom.go +++ b/waiting_rooms/waitingroom.go @@ -95,10 +95,10 @@ func (r *WaitingRoomService) ListAutoPaging(ctx context.Context, params WaitingR } // Deletes a waiting room. -func (r *WaitingRoomService) Delete(ctx context.Context, waitingRoomID string, params WaitingRoomDeleteParams, opts ...option.RequestOption) (res *WaitingRoomDeleteResponse, err error) { +func (r *WaitingRoomService) Delete(ctx context.Context, waitingRoomID string, body WaitingRoomDeleteParams, opts ...option.RequestOption) (res *WaitingRoomDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env WaitingRoomDeleteResponseEnvelope - path := fmt.Sprintf("zones/%s/waiting_rooms/%s", params.ZoneID, waitingRoomID) + path := fmt.Sprintf("zones/%s/waiting_rooms/%s", body.ZoneID, waitingRoomID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -1057,20 +1057,14 @@ func (r WaitingRoomNewParams) MarshalJSON() (data []byte, err error) { } type WaitingRoomNewResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result WaitingRoom `json:"result,required"` - Success interface{} `json:"success,required"` - JSON waitingRoomNewResponseEnvelopeJSON `json:"-"` + Result WaitingRoom `json:"result,required"` + JSON waitingRoomNewResponseEnvelopeJSON `json:"-"` } // waitingRoomNewResponseEnvelopeJSON contains the JSON metadata for the struct // [WaitingRoomNewResponseEnvelope] type waitingRoomNewResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -1094,20 +1088,14 @@ func (r WaitingRoomUpdateParams) MarshalJSON() (data []byte, err error) { } type WaitingRoomUpdateResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result WaitingRoom `json:"result,required"` - Success interface{} `json:"success,required"` - JSON waitingRoomUpdateResponseEnvelopeJSON `json:"-"` + Result WaitingRoom `json:"result,required"` + JSON waitingRoomUpdateResponseEnvelopeJSON `json:"-"` } // waitingRoomUpdateResponseEnvelopeJSON contains the JSON metadata for the struct // [WaitingRoomUpdateResponseEnvelope] type waitingRoomUpdateResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -1140,28 +1128,17 @@ func (r WaitingRoomListParams) URLQuery() (v url.Values) { type WaitingRoomDeleteParams struct { // Identifier ZoneID param.Field[string] `path:"zone_id,required"` - Body interface{} `json:"body,required"` -} - -func (r WaitingRoomDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type WaitingRoomDeleteResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result WaitingRoomDeleteResponse `json:"result,required"` - Success interface{} `json:"success,required"` - JSON waitingRoomDeleteResponseEnvelopeJSON `json:"-"` + Result WaitingRoomDeleteResponse `json:"result,required"` + JSON waitingRoomDeleteResponseEnvelopeJSON `json:"-"` } // waitingRoomDeleteResponseEnvelopeJSON contains the JSON metadata for the struct // [WaitingRoomDeleteResponseEnvelope] type waitingRoomDeleteResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -1185,20 +1162,14 @@ func (r WaitingRoomEditParams) MarshalJSON() (data []byte, err error) { } type WaitingRoomEditResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result WaitingRoom `json:"result,required"` - Success interface{} `json:"success,required"` - JSON waitingRoomEditResponseEnvelopeJSON `json:"-"` + Result WaitingRoom `json:"result,required"` + JSON waitingRoomEditResponseEnvelopeJSON `json:"-"` } // waitingRoomEditResponseEnvelopeJSON contains the JSON metadata for the struct // [WaitingRoomEditResponseEnvelope] type waitingRoomEditResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -1217,20 +1188,14 @@ type WaitingRoomGetParams struct { } type WaitingRoomGetResponseEnvelope struct { - Errors interface{} `json:"errors,required"` - Messages interface{} `json:"messages,required"` - Result WaitingRoom `json:"result,required"` - Success interface{} `json:"success,required"` - JSON waitingRoomGetResponseEnvelopeJSON `json:"-"` + Result WaitingRoom `json:"result,required"` + JSON waitingRoomGetResponseEnvelopeJSON `json:"-"` } // waitingRoomGetResponseEnvelopeJSON contains the JSON metadata for the struct // [WaitingRoomGetResponseEnvelope] type waitingRoomGetResponseEnvelopeJSON struct { - Errors apijson.Field - Messages apijson.Field Result apijson.Field - Success apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/waiting_rooms/waitingroom_test.go b/waiting_rooms/waitingroom_test.go index c67d532b914..2ba34ea68b8 100644 --- a/waiting_rooms/waitingroom_test.go +++ b/waiting_rooms/waitingroom_test.go @@ -15,7 +15,6 @@ import ( ) func TestWaitingRoomNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -73,7 +72,6 @@ func TestWaitingRoomNewWithOptionalParams(t *testing.T) { } func TestWaitingRoomUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -135,7 +133,6 @@ func TestWaitingRoomUpdateWithOptionalParams(t *testing.T) { } func TestWaitingRoomListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -163,7 +160,6 @@ func TestWaitingRoomListWithOptionalParams(t *testing.T) { } func TestWaitingRoomDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -181,7 +177,6 @@ func TestWaitingRoomDelete(t *testing.T) { "699d98642c564d2e855e9661899b7252", waiting_rooms.WaitingRoomDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -194,7 +189,6 @@ func TestWaitingRoomDelete(t *testing.T) { } func TestWaitingRoomEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -256,7 +250,6 @@ func TestWaitingRoomEditWithOptionalParams(t *testing.T) { } func TestWaitingRoomGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/warp_connector/aliases.go b/warp_connector/aliases.go index 4789a8ca552..beb247731f1 100644 --- a/warp_connector/aliases.go +++ b/warp_connector/aliases.go @@ -4,7 +4,7 @@ package warp_connector import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/warp_connector/warpconnector.go b/warp_connector/warpconnector.go index 0f931219581..1d514c318fe 100644 --- a/warp_connector/warpconnector.go +++ b/warp_connector/warpconnector.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -75,11 +75,11 @@ func (r *WARPConnectorService) ListAutoPaging(ctx context.Context, params WARPCo } // Deletes a Warp Connector Tunnel from an account. -func (r *WARPConnectorService) Delete(ctx context.Context, tunnelID string, params WARPConnectorDeleteParams, opts ...option.RequestOption) (res *WARPConnectorDeleteResponse, err error) { +func (r *WARPConnectorService) Delete(ctx context.Context, tunnelID string, body WARPConnectorDeleteParams, opts ...option.RequestOption) (res *WARPConnectorDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env WARPConnectorDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/warp_connector/%s", params.AccountID, tunnelID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + path := fmt.Sprintf("accounts/%s/warp_connector/%s", body.AccountID, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return } @@ -1442,11 +1442,6 @@ func (r WARPConnectorListParams) URLQuery() (v url.Values) { type WARPConnectorDeleteParams struct { // Cloudflare account ID AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r WARPConnectorDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type WARPConnectorDeleteResponseEnvelope struct { diff --git a/warp_connector/warpconnector_test.go b/warp_connector/warpconnector_test.go index 4a52ce9e494..68953cd88b9 100644 --- a/warp_connector/warpconnector_test.go +++ b/warp_connector/warpconnector_test.go @@ -16,7 +16,6 @@ import ( ) func TestWARPConnectorNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestWARPConnectorNew(t *testing.T) { } func TestWARPConnectorListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -79,7 +77,6 @@ func TestWARPConnectorListWithOptionalParams(t *testing.T) { } func TestWARPConnectorDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -97,7 +94,6 @@ func TestWARPConnectorDelete(t *testing.T) { "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", warp_connector.WARPConnectorDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -110,7 +106,6 @@ func TestWARPConnectorDelete(t *testing.T) { } func TestWARPConnectorEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -142,7 +137,6 @@ func TestWARPConnectorEditWithOptionalParams(t *testing.T) { } func TestWARPConnectorGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -172,7 +166,6 @@ func TestWARPConnectorGet(t *testing.T) { } func TestWARPConnectorToken(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/web3/aliases.go b/web3/aliases.go index 1a275d05078..26f29f7a73f 100644 --- a/web3/aliases.go +++ b/web3/aliases.go @@ -4,7 +4,7 @@ package web3 import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/web3/hostname.go b/web3/hostname.go index 6258eb9b789..1580dbdba33 100644 --- a/web3/hostname.go +++ b/web3/hostname.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // HostnameService contains methods and other services that help with interacting @@ -72,7 +72,7 @@ func (r *HostnameService) ListAutoPaging(ctx context.Context, zoneIdentifier str } // Delete Web3 Hostname -func (r *HostnameService) Delete(ctx context.Context, zoneIdentifier string, identifier string, body HostnameDeleteParams, opts ...option.RequestOption) (res *HostnameDeleteResponse, err error) { +func (r *HostnameService) Delete(ctx context.Context, zoneIdentifier string, identifier string, opts ...option.RequestOption) (res *HostnameDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env HostnameDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/web3/hostnames/%s", zoneIdentifier, identifier) @@ -187,19 +187,6 @@ func (r HostnameTarget) IsKnown() bool { return false } -type HostnameParam struct { - // An optional description of the hostname. - Description param.Field[string] `json:"description"` - // DNSLink value used if the target is ipfs. - Dnslink param.Field[string] `json:"dnslink"` - // Target gateway of the hostname. - Target param.Field[HostnameTarget] `json:"target"` -} - -func (r HostnameParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type HostnameDeleteResponse struct { // Identifier ID string `json:"id,required"` @@ -295,14 +282,6 @@ func (r HostnameNewResponseEnvelopeSuccess) IsKnown() bool { return false } -type HostnameDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r HostnameDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type HostnameDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/web3/hostname_test.go b/web3/hostname_test.go index f8881dd8584..b86b193678a 100644 --- a/web3/hostname_test.go +++ b/web3/hostname_test.go @@ -15,7 +15,6 @@ import ( ) func TestHostnameNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestHostnameNewWithOptionalParams(t *testing.T) { } func TestHostnameList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -71,7 +69,6 @@ func TestHostnameList(t *testing.T) { } func TestHostnameDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -88,9 +85,6 @@ func TestHostnameDelete(t *testing.T) { context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", - web3.HostnameDeleteParams{ - Body: map[string]interface{}{}, - }, ) if err != nil { var apierr *cloudflare.Error @@ -102,7 +96,6 @@ func TestHostnameDelete(t *testing.T) { } func TestHostnameEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -134,7 +127,6 @@ func TestHostnameEditWithOptionalParams(t *testing.T) { } func TestHostnameGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/web3/hostnameipfsuniversalpathcontentlist.go b/web3/hostnameipfsuniversalpathcontentlist.go index dfb3add0f6f..9ea2cdec0e3 100644 --- a/web3/hostnameipfsuniversalpathcontentlist.go +++ b/web3/hostnameipfsuniversalpathcontentlist.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // HostnameIPFSUniversalPathContentListService contains methods and other services diff --git a/web3/hostnameipfsuniversalpathcontentlist_test.go b/web3/hostnameipfsuniversalpathcontentlist_test.go index f04882f17d1..662ce5b4254 100644 --- a/web3/hostnameipfsuniversalpathcontentlist_test.go +++ b/web3/hostnameipfsuniversalpathcontentlist_test.go @@ -15,7 +15,6 @@ import ( ) func TestHostnameIPFSUniversalPathContentListUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -59,7 +58,6 @@ func TestHostnameIPFSUniversalPathContentListUpdate(t *testing.T) { } func TestHostnameIPFSUniversalPathContentListGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/web3/hostnameipfsuniversalpathcontentlistentry.go b/web3/hostnameipfsuniversalpathcontentlistentry.go index b47006fe67c..384c9dc57cd 100644 --- a/web3/hostnameipfsuniversalpathcontentlistentry.go +++ b/web3/hostnameipfsuniversalpathcontentlistentry.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // HostnameIPFSUniversalPathContentListEntryService contains methods and other @@ -74,7 +74,7 @@ func (r *HostnameIPFSUniversalPathContentListEntryService) List(ctx context.Cont } // Delete IPFS Universal Path Gateway Content List Entry -func (r *HostnameIPFSUniversalPathContentListEntryService) Delete(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string, body HostnameIPFSUniversalPathContentListEntryDeleteParams, opts ...option.RequestOption) (res *HostnameIPFSUniversalPathContentListEntryDeleteResponse, err error) { +func (r *HostnameIPFSUniversalPathContentListEntryService) Delete(ctx context.Context, zoneIdentifier string, identifier string, contentListEntryIdentifier string, opts ...option.RequestOption) (res *HostnameIPFSUniversalPathContentListEntryDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env HostnameIPFSUniversalPathContentListEntryDeleteResponseEnvelope path := fmt.Sprintf("zones/%s/web3/hostnames/%s/ipfs_universal_path/content_list/entries/%s", zoneIdentifier, identifier, contentListEntryIdentifier) @@ -580,14 +580,6 @@ func (r hostnameIPFSUniversalPathContentListEntryListResponseEnvelopeResultInfoJ return r.raw } -type HostnameIPFSUniversalPathContentListEntryDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r HostnameIPFSUniversalPathContentListEntryDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type HostnameIPFSUniversalPathContentListEntryDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/web3/hostnameipfsuniversalpathcontentlistentry_test.go b/web3/hostnameipfsuniversalpathcontentlistentry_test.go index be6989fa6d6..6ff32221248 100644 --- a/web3/hostnameipfsuniversalpathcontentlistentry_test.go +++ b/web3/hostnameipfsuniversalpathcontentlistentry_test.go @@ -15,7 +15,6 @@ import ( ) func TestHostnameIPFSUniversalPathContentListEntryNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -48,7 +47,6 @@ func TestHostnameIPFSUniversalPathContentListEntryNewWithOptionalParams(t *testi } func TestHostnameIPFSUniversalPathContentListEntryUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -82,7 +80,6 @@ func TestHostnameIPFSUniversalPathContentListEntryUpdateWithOptionalParams(t *te } func TestHostnameIPFSUniversalPathContentListEntryList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -110,7 +107,6 @@ func TestHostnameIPFSUniversalPathContentListEntryList(t *testing.T) { } func TestHostnameIPFSUniversalPathContentListEntryDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -128,9 +124,6 @@ func TestHostnameIPFSUniversalPathContentListEntryDelete(t *testing.T) { "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", "023e105f4ecef8ad9ca31a8372d0c353", - web3.HostnameIPFSUniversalPathContentListEntryDeleteParams{ - Body: map[string]interface{}{}, - }, ) if err != nil { var apierr *cloudflare.Error @@ -142,7 +135,6 @@ func TestHostnameIPFSUniversalPathContentListEntryDelete(t *testing.T) { } func TestHostnameIPFSUniversalPathContentListEntryGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers/accountsetting.go b/workers/accountsetting.go index 42bda6ba2d0..c9414d96d07 100644 --- a/workers/accountsetting.go +++ b/workers/accountsetting.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccountSettingService contains methods and other services that help with diff --git a/workers/accountsetting_test.go b/workers/accountsetting_test.go index 08d436c142a..edb57590c74 100644 --- a/workers/accountsetting_test.go +++ b/workers/accountsetting_test.go @@ -15,7 +15,6 @@ import ( ) func TestAccountSettingUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestAccountSettingUpdate(t *testing.T) { } func TestAccountSettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers/ai.go b/workers/ai.go index 89f20dedfed..dda8ef18f62 100644 --- a/workers/ai.go +++ b/workers/ai.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -417,7 +417,7 @@ func (r AIRunParamsBodyTextEmbeddingsTextArray) ImplementsWorkersAIRunParamsBody } type AIRunParamsBodySpeechRecognition struct { - Audio param.Field[[]float64] `json:"audio"` + Audio param.Field[[]float64] `json:"audio,required"` } func (r AIRunParamsBodySpeechRecognition) MarshalJSON() (data []byte, err error) { @@ -427,7 +427,7 @@ func (r AIRunParamsBodySpeechRecognition) MarshalJSON() (data []byte, err error) func (r AIRunParamsBodySpeechRecognition) implementsWorkersAIRunParamsBodyUnion() {} type AIRunParamsBodyImageClassification struct { - Image param.Field[[]float64] `json:"image"` + Image param.Field[[]float64] `json:"image,required"` } func (r AIRunParamsBodyImageClassification) MarshalJSON() (data []byte, err error) { diff --git a/workers/ai_test.go b/workers/ai_test.go index ece41338400..cac661162d0 100644 --- a/workers/ai_test.go +++ b/workers/ai_test.go @@ -15,7 +15,6 @@ import ( ) func TestAIRunWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers/aliases.go b/workers/aliases.go index 1e8b8a2cc10..e37d47a2c00 100644 --- a/workers/aliases.go +++ b/workers/aliases.go @@ -4,7 +4,7 @@ package workers import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/workers/domain.go b/workers/domain.go index f4b5984b1b3..29204c3d728 100644 --- a/workers/domain.go +++ b/workers/domain.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DomainService contains methods and other services that help with interacting @@ -71,10 +71,10 @@ func (r *DomainService) ListAutoPaging(ctx context.Context, params DomainListPar } // Detaches a Worker from a zone and hostname. -func (r *DomainService) Delete(ctx context.Context, domainID string, params DomainDeleteParams, opts ...option.RequestOption) (err error) { +func (r *DomainService) Delete(ctx context.Context, domainID string, body DomainDeleteParams, opts ...option.RequestOption) (err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...) - path := fmt.Sprintf("accounts/%s/workers/domains/%s", params.AccountID, domainID) + path := fmt.Sprintf("accounts/%s/workers/domains/%s", body.AccountID, domainID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...) return } @@ -211,11 +211,6 @@ func (r DomainListParams) URLQuery() (v url.Values) { type DomainDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r DomainDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type DomainGetParams struct { diff --git a/workers/domain_test.go b/workers/domain_test.go index a2a6e5ba3c8..9347785f4c9 100644 --- a/workers/domain_test.go +++ b/workers/domain_test.go @@ -15,7 +15,6 @@ import ( ) func TestDomainUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestDomainUpdate(t *testing.T) { } func TestDomainListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +74,6 @@ func TestDomainListWithOptionalParams(t *testing.T) { } func TestDomainDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -94,7 +91,6 @@ func TestDomainDelete(t *testing.T) { "dbe10b4bc17c295377eabd600e1787fd", workers.DomainDeleteParams{ AccountID: cloudflare.F("9a7806061c88ada191ed06f989cc3dac"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -107,7 +103,6 @@ func TestDomainDelete(t *testing.T) { } func TestDomainGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers/script.go b/workers/script.go index 9d61c719e1d..87c2a8f4dbb 100644 --- a/workers/script.go +++ b/workers/script.go @@ -18,8 +18,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ScriptService contains methods and other services that help with interacting @@ -70,7 +70,7 @@ func (r *ScriptService) List(ctx context.Context, query ScriptListParams, opts . opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/workers/scripts", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -389,17 +389,12 @@ type ScriptListParams struct { type ScriptDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` // If set to true, delete will not be stopped by associated service binding, // durable object, or other binding. Any of these associated bindings/durable // objects will be deleted along with the script. Force param.Field[bool] `query:"force"` } -func (r ScriptDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - // URLQuery serializes [ScriptDeleteParams]'s query parameters as `url.Values`. func (r ScriptDeleteParams) URLQuery() (v url.Values) { return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{ diff --git a/workers/script_test.go b/workers/script_test.go index 95c8c9fd2d6..b4dcab98e28 100644 --- a/workers/script_test.go +++ b/workers/script_test.go @@ -19,7 +19,7 @@ import ( ) func TestScriptUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -114,7 +114,6 @@ func TestScriptUpdateWithOptionalParams(t *testing.T) { } func TestScriptList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -140,7 +139,6 @@ func TestScriptList(t *testing.T) { } func TestScriptDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -158,7 +156,6 @@ func TestScriptDeleteWithOptionalParams(t *testing.T) { "this-is_my_script-01", workers.ScriptDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, Force: cloudflare.F(true), }, ) @@ -172,7 +169,6 @@ func TestScriptDeleteWithOptionalParams(t *testing.T) { } func TestScriptGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) w.Write([]byte("abc")) diff --git a/workers/scriptcontent.go b/workers/scriptcontent.go index 646520b0cb7..79a9192aac1 100644 --- a/workers/scriptcontent.go +++ b/workers/scriptcontent.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ScriptContentService contains methods and other services that help with diff --git a/workers/scriptcontent_test.go b/workers/scriptcontent_test.go index ec7fd6f6802..6d9aba77138 100644 --- a/workers/scriptcontent_test.go +++ b/workers/scriptcontent_test.go @@ -19,7 +19,7 @@ import ( ) func TestScriptContentUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -56,7 +56,6 @@ func TestScriptContentUpdateWithOptionalParams(t *testing.T) { } func TestScriptContentGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) w.Write([]byte("abc")) diff --git a/workers/scriptdeployment.go b/workers/scriptdeployment.go index 3a57927f9a5..20f0cc1c8fa 100644 --- a/workers/scriptdeployment.go +++ b/workers/scriptdeployment.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ScriptDeploymentService contains methods and other services that help with diff --git a/workers/scriptdeployment_test.go b/workers/scriptdeployment_test.go index bd146259bbf..79e670d8a32 100644 --- a/workers/scriptdeployment_test.go +++ b/workers/scriptdeployment_test.go @@ -15,7 +15,6 @@ import ( ) func TestScriptDeploymentNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestScriptDeploymentNewWithOptionalParams(t *testing.T) { } func TestScriptDeploymentGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers/scriptschedule.go b/workers/scriptschedule.go index 6c6bdb17ed4..fead8c460d4 100644 --- a/workers/scriptschedule.go +++ b/workers/scriptschedule.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ScriptScheduleService contains methods and other services that help with @@ -82,13 +82,6 @@ func (r scheduleJSON) RawJSON() string { return r.raw } -type ScheduleParam struct { -} - -func (r ScheduleParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type ScriptScheduleUpdateResponse struct { Schedules []Schedule `json:"schedules"` JSON scriptScheduleUpdateResponseJSON `json:"-"` diff --git a/workers/scriptschedule_test.go b/workers/scriptschedule_test.go index a14d50ae951..4e30f52b161 100644 --- a/workers/scriptschedule_test.go +++ b/workers/scriptschedule_test.go @@ -15,7 +15,6 @@ import ( ) func TestScriptScheduleUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestScriptScheduleUpdate(t *testing.T) { } func TestScriptScheduleGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers/scriptsetting.go b/workers/scriptsetting.go index ba6b484e370..1b087071d30 100644 --- a/workers/scriptsetting.go +++ b/workers/scriptsetting.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ScriptSettingService contains methods and other services that help with diff --git a/workers/scriptsetting_test.go b/workers/scriptsetting_test.go index 939837760f9..2e5e93dc96d 100644 --- a/workers/scriptsetting_test.go +++ b/workers/scriptsetting_test.go @@ -15,7 +15,6 @@ import ( ) func TestScriptSettingEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -61,7 +60,6 @@ func TestScriptSettingEditWithOptionalParams(t *testing.T) { } func TestScriptSettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers/scripttail.go b/workers/scripttail.go index 5abc1c62226..3419b0e5eb3 100644 --- a/workers/scripttail.go +++ b/workers/scripttail.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ScriptTailService contains methods and other services that help with interacting @@ -36,7 +36,7 @@ func (r *ScriptTailService) New(ctx context.Context, scriptName string, params S opts = append(r.Options[:], opts...) var env ScriptTailNewResponseEnvelope path := fmt.Sprintf("accounts/%s/workers/scripts/%s/tails", params.AccountID, scriptName) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &env, opts...) if err != nil { return } @@ -45,9 +45,9 @@ func (r *ScriptTailService) New(ctx context.Context, scriptName string, params S } // Deletes a tail from a Worker. -func (r *ScriptTailService) Delete(ctx context.Context, scriptName string, id string, params ScriptTailDeleteParams, opts ...option.RequestOption) (res *ScriptTailDeleteResponse, err error) { +func (r *ScriptTailService) Delete(ctx context.Context, scriptName string, id string, body ScriptTailDeleteParams, opts ...option.RequestOption) (res *ScriptTailDeleteResponse, err error) { opts = append(r.Options[:], opts...) - path := fmt.Sprintf("accounts/%s/workers/scripts/%s/tails/%s", params.AccountID, scriptName, id) + path := fmt.Sprintf("accounts/%s/workers/scripts/%s/tails/%s", body.AccountID, scriptName, id) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...) return } @@ -254,11 +254,6 @@ func (r ScriptTailNewResponseEnvelopeSuccess) IsKnown() bool { type ScriptTailDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r ScriptTailDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type ScriptTailGetParams struct { diff --git a/workers/scripttail_test.go b/workers/scripttail_test.go index 42b6671626b..7402bd3f01b 100644 --- a/workers/scripttail_test.go +++ b/workers/scripttail_test.go @@ -15,7 +15,6 @@ import ( ) func TestScriptTailNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestScriptTailNew(t *testing.T) { } func TestScriptTailDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -65,7 +63,6 @@ func TestScriptTailDelete(t *testing.T) { "03dc9f77817b488fb26c5861ec18f791", workers.ScriptTailDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -78,7 +75,6 @@ func TestScriptTailDelete(t *testing.T) { } func TestScriptTailGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers/scriptversion.go b/workers/scriptversion.go index 44623661d9b..77015ae95e3 100644 --- a/workers/scriptversion.go +++ b/workers/scriptversion.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ScriptVersionService contains methods and other services that help with diff --git a/workers/scriptversion_test.go b/workers/scriptversion_test.go index 1e3f64d3e07..ea1bbd7d493 100644 --- a/workers/scriptversion_test.go +++ b/workers/scriptversion_test.go @@ -17,7 +17,7 @@ import ( ) func TestScriptVersionNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -64,7 +64,6 @@ func TestScriptVersionNewWithOptionalParams(t *testing.T) { } func TestScriptVersionList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -94,7 +93,6 @@ func TestScriptVersionList(t *testing.T) { } func TestScriptVersionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers/subdomain.go b/workers/subdomain.go index b79b628002f..88f64e81813 100644 --- a/workers/subdomain.go +++ b/workers/subdomain.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SubdomainService contains methods and other services that help with interacting diff --git a/workers/subdomain_test.go b/workers/subdomain_test.go index f659c744ed5..6c37c39c513 100644 --- a/workers/subdomain_test.go +++ b/workers/subdomain_test.go @@ -15,7 +15,6 @@ import ( ) func TestSubdomainUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSubdomainUpdate(t *testing.T) { } func TestSubdomainGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers/worker.go b/workers/worker.go index 23688ec140e..5d447bdf54d 100644 --- a/workers/worker.go +++ b/workers/worker.go @@ -67,7 +67,6 @@ type Binding struct { Outbound interface{} `json:"outbound,required"` // ID of the certificate to bind to CertificateID string `json:"certificate_id"` - Certificate interface{} `json:"certificate,required"` JSON bindingJSON `json:"-"` union BindingUnion } @@ -88,7 +87,6 @@ type bindingJSON struct { Namespace apijson.Field Outbound apijson.Field CertificateID apijson.Field - Certificate apijson.Field raw string ExtraFields map[string]apijson.Field } @@ -247,8 +245,7 @@ type BindingParam struct { Namespace param.Field[string] `json:"namespace"` Outbound param.Field[interface{}] `json:"outbound,required"` // ID of the certificate to bind to - CertificateID param.Field[string] `json:"certificate_id"` - Certificate param.Field[interface{}] `json:"certificate,required"` + CertificateID param.Field[string] `json:"certificate_id"` } func (r BindingParam) MarshalJSON() (data []byte, err error) { @@ -726,7 +723,6 @@ func (r MigrationStepTransferredClassParam) MarshalJSON() (data []byte, err erro } type MTLSCERTBinding struct { - Certificate interface{} `json:"certificate,required"` // A JavaScript variable name for the binding. Name string `json:"name,required"` // The class of resource that the binding provides. @@ -738,7 +734,6 @@ type MTLSCERTBinding struct { // mtlscertBindingJSON contains the JSON metadata for the struct [MTLSCERTBinding] type mtlscertBindingJSON struct { - Certificate apijson.Field Name apijson.Field Type apijson.Field CertificateID apijson.Field @@ -772,7 +767,6 @@ func (r MTLSCERTBindingType) IsKnown() bool { } type MTLSCERTBindingParam struct { - Certificate param.Field[interface{}] `json:"certificate,required"` // The class of resource that the binding provides. Type param.Field[MTLSCERTBindingType] `json:"type,required"` // ID of the certificate to bind to @@ -996,10 +990,10 @@ func (r singleStepMigrationJSON) RawJSON() string { return r.raw } -func (r SingleStepMigration) implementsWorkersForPlatformsDispatchNamespaceScriptSettingEditResponseMigrations() { +func (r SingleStepMigration) ImplementsWorkersForPlatformsDispatchNamespaceScriptSettingEditResponseMigrations() { } -func (r SingleStepMigration) implementsWorkersForPlatformsDispatchNamespaceScriptSettingGetResponseMigrations() { +func (r SingleStepMigration) ImplementsWorkersForPlatformsDispatchNamespaceScriptSettingGetResponseMigrations() { } type SingleStepMigrationRenamedClass struct { @@ -1075,10 +1069,10 @@ func (r SingleStepMigrationParam) MarshalJSON() (data []byte, err error) { func (r SingleStepMigrationParam) implementsWorkersScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { } -func (r SingleStepMigrationParam) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { +func (r SingleStepMigrationParam) ImplementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { } -func (r SingleStepMigrationParam) implementsWorkersForPlatformsDispatchNamespaceScriptSettingEditParamsSettingsMigrationsUnion() { +func (r SingleStepMigrationParam) ImplementsWorkersForPlatformsDispatchNamespaceScriptSettingEditParamsSettingsMigrationsUnion() { } type SingleStepMigrationRenamedClassParam struct { @@ -1129,10 +1123,10 @@ func (r steppedMigrationJSON) RawJSON() string { return r.raw } -func (r SteppedMigration) implementsWorkersForPlatformsDispatchNamespaceScriptSettingEditResponseMigrations() { +func (r SteppedMigration) ImplementsWorkersForPlatformsDispatchNamespaceScriptSettingEditResponseMigrations() { } -func (r SteppedMigration) implementsWorkersForPlatformsDispatchNamespaceScriptSettingGetResponseMigrations() { +func (r SteppedMigration) ImplementsWorkersForPlatformsDispatchNamespaceScriptSettingGetResponseMigrations() { } type SteppedMigrationParam struct { @@ -1152,10 +1146,10 @@ func (r SteppedMigrationParam) MarshalJSON() (data []byte, err error) { func (r SteppedMigrationParam) implementsWorkersScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { } -func (r SteppedMigrationParam) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { +func (r SteppedMigrationParam) ImplementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { } -func (r SteppedMigrationParam) implementsWorkersForPlatformsDispatchNamespaceScriptSettingEditParamsSettingsMigrationsUnion() { +func (r SteppedMigrationParam) ImplementsWorkersForPlatformsDispatchNamespaceScriptSettingEditParamsSettingsMigrationsUnion() { } // JSON encoded metadata about the uploaded parts and Worker configuration. diff --git a/workers_for_platforms/aliases.go b/workers_for_platforms/aliases.go index 2d1d83f4339..16bc69b29fd 100644 --- a/workers_for_platforms/aliases.go +++ b/workers_for_platforms/aliases.go @@ -4,7 +4,7 @@ package workers_for_platforms import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/workers_for_platforms/dispatchnamespace.go b/workers_for_platforms/dispatchnamespace.go index 8335dfecb95..b2bab3fc4c6 100644 --- a/workers_for_platforms/dispatchnamespace.go +++ b/workers_for_platforms/dispatchnamespace.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DispatchNamespaceService contains methods and other services that help with @@ -55,7 +55,7 @@ func (r *DispatchNamespaceService) List(ctx context.Context, query DispatchNames opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/workers_for_platforms/dispatchnamespace_test.go b/workers_for_platforms/dispatchnamespace_test.go index 4e9df31db91..d84e2f962c5 100644 --- a/workers_for_platforms/dispatchnamespace_test.go +++ b/workers_for_platforms/dispatchnamespace_test.go @@ -15,7 +15,6 @@ import ( ) func TestDispatchNamespaceNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestDispatchNamespaceNewWithOptionalParams(t *testing.T) { } func TestDispatchNamespaceList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -68,7 +66,6 @@ func TestDispatchNamespaceList(t *testing.T) { } func TestDispatchNamespaceDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -98,7 +95,6 @@ func TestDispatchNamespaceDelete(t *testing.T) { } func TestDispatchNamespaceGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers_for_platforms/dispatchnamespacescript.go b/workers_for_platforms/dispatchnamespacescript.go index 13de482c183..e9b375a581c 100644 --- a/workers_for_platforms/dispatchnamespacescript.go +++ b/workers_for_platforms/dispatchnamespacescript.go @@ -17,8 +17,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/cloudflare/cloudflare-go/v2/workers" ) @@ -237,7 +237,7 @@ func (r DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrations) Marshal return apijson.MarshalRoot(r) } -func (r DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrations) implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { +func (r DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrations) ImplementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() { } // Migrations to apply for Durable Objects associated with this Worker. @@ -246,7 +246,7 @@ func (r DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrations) impleme // [workers.SteppedMigrationParam], // [DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrations]. type DispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion interface { - implementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() + ImplementsWorkersForPlatformsDispatchNamespaceScriptUpdateParamsBodyObjectMetadataMigrationsUnion() } // Usage model to apply to invocations. @@ -311,17 +311,12 @@ func (r DispatchNamespaceScriptUpdateResponseEnvelopeSuccess) IsKnown() bool { type DispatchNamespaceScriptDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` // If set to true, delete will not be stopped by associated service binding, // durable object, or other binding. Any of these associated bindings/durable // objects will be deleted along with the script. Force param.Field[bool] `query:"force"` } -func (r DispatchNamespaceScriptDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - // URLQuery serializes [DispatchNamespaceScriptDeleteParams]'s query parameters as // `url.Values`. func (r DispatchNamespaceScriptDeleteParams) URLQuery() (v url.Values) { diff --git a/workers_for_platforms/dispatchnamespacescript_test.go b/workers_for_platforms/dispatchnamespacescript_test.go index 5d77cc1d499..52576375d7b 100644 --- a/workers_for_platforms/dispatchnamespacescript_test.go +++ b/workers_for_platforms/dispatchnamespacescript_test.go @@ -18,7 +18,7 @@ import ( ) func TestDispatchNamespaceScriptUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -113,7 +113,6 @@ func TestDispatchNamespaceScriptUpdateWithOptionalParams(t *testing.T) { } func TestDispatchNamespaceScriptDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -132,7 +131,6 @@ func TestDispatchNamespaceScriptDeleteWithOptionalParams(t *testing.T) { "this-is_my_script-01", workers_for_platforms.DispatchNamespaceScriptDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, Force: cloudflare.F(true), }, ) @@ -146,7 +144,6 @@ func TestDispatchNamespaceScriptDeleteWithOptionalParams(t *testing.T) { } func TestDispatchNamespaceScriptGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers_for_platforms/dispatchnamespacescriptbinding.go b/workers_for_platforms/dispatchnamespacescriptbinding.go index b5fa1a12cc0..20064d9f8a7 100644 --- a/workers_for_platforms/dispatchnamespacescriptbinding.go +++ b/workers_for_platforms/dispatchnamespacescriptbinding.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/cloudflare/cloudflare-go/v2/workers" ) diff --git a/workers_for_platforms/dispatchnamespacescriptbinding_test.go b/workers_for_platforms/dispatchnamespacescriptbinding_test.go index c521d44974c..54d0a749bcd 100644 --- a/workers_for_platforms/dispatchnamespacescriptbinding_test.go +++ b/workers_for_platforms/dispatchnamespacescriptbinding_test.go @@ -15,7 +15,6 @@ import ( ) func TestDispatchNamespaceScriptBindingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers_for_platforms/dispatchnamespacescriptcontent.go b/workers_for_platforms/dispatchnamespacescriptcontent.go index e9b858c5fae..b7a29729664 100644 --- a/workers_for_platforms/dispatchnamespacescriptcontent.go +++ b/workers_for_platforms/dispatchnamespacescriptcontent.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/cloudflare/cloudflare-go/v2/workers" ) diff --git a/workers_for_platforms/dispatchnamespacescriptcontent_test.go b/workers_for_platforms/dispatchnamespacescriptcontent_test.go index 3393d0a1e6e..bb13ef56004 100644 --- a/workers_for_platforms/dispatchnamespacescriptcontent_test.go +++ b/workers_for_platforms/dispatchnamespacescriptcontent_test.go @@ -20,7 +20,7 @@ import ( ) func TestDispatchNamespaceScriptContentUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -58,7 +58,6 @@ func TestDispatchNamespaceScriptContentUpdateWithOptionalParams(t *testing.T) { } func TestDispatchNamespaceScriptContentGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) w.Write([]byte("abc")) diff --git a/workers_for_platforms/dispatchnamespacescriptsecret.go b/workers_for_platforms/dispatchnamespacescriptsecret.go index bb5f4bfe9c2..6ba7644f3c3 100644 --- a/workers_for_platforms/dispatchnamespacescriptsecret.go +++ b/workers_for_platforms/dispatchnamespacescriptsecret.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DispatchNamespaceScriptSecretService contains methods and other services that @@ -52,7 +52,7 @@ func (r *DispatchNamespaceScriptSecretService) List(ctx context.Context, dispatc opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s/secrets", query.AccountID, dispatchNamespace, scriptName) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/workers_for_platforms/dispatchnamespacescriptsecret_test.go b/workers_for_platforms/dispatchnamespacescriptsecret_test.go index 2ee9139e1c1..9cd822e8a58 100644 --- a/workers_for_platforms/dispatchnamespacescriptsecret_test.go +++ b/workers_for_platforms/dispatchnamespacescriptsecret_test.go @@ -15,7 +15,6 @@ import ( ) func TestDispatchNamespaceScriptSecretUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestDispatchNamespaceScriptSecretUpdateWithOptionalParams(t *testing.T) { } func TestDispatchNamespaceScriptSecretList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers_for_platforms/dispatchnamespacescriptsetting.go b/workers_for_platforms/dispatchnamespacescriptsetting.go index bd495f39dd4..217fc9f9c80 100644 --- a/workers_for_platforms/dispatchnamespacescriptsetting.go +++ b/workers_for_platforms/dispatchnamespacescriptsetting.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/cloudflare/cloudflare-go/v2/workers" "github.com/tidwall/gjson" ) @@ -182,7 +182,7 @@ func (r DispatchNamespaceScriptSettingEditResponseMigrations) AsUnion() Dispatch // // Union satisfied by [workers.SingleStepMigration] or [workers.SteppedMigration]. type DispatchNamespaceScriptSettingEditResponseMigrationsUnion interface { - implementsWorkersForPlatformsDispatchNamespaceScriptSettingEditResponseMigrations() + ImplementsWorkersForPlatformsDispatchNamespaceScriptSettingEditResponseMigrations() } func init() { @@ -321,7 +321,7 @@ func (r DispatchNamespaceScriptSettingGetResponseMigrations) AsUnion() DispatchN // // Union satisfied by [workers.SingleStepMigration] or [workers.SteppedMigration]. type DispatchNamespaceScriptSettingGetResponseMigrationsUnion interface { - implementsWorkersForPlatformsDispatchNamespaceScriptSettingGetResponseMigrations() + ImplementsWorkersForPlatformsDispatchNamespaceScriptSettingGetResponseMigrations() } func init() { @@ -403,7 +403,7 @@ func (r DispatchNamespaceScriptSettingEditParamsSettingsMigrations) MarshalJSON( return apijson.MarshalRoot(r) } -func (r DispatchNamespaceScriptSettingEditParamsSettingsMigrations) implementsWorkersForPlatformsDispatchNamespaceScriptSettingEditParamsSettingsMigrationsUnion() { +func (r DispatchNamespaceScriptSettingEditParamsSettingsMigrations) ImplementsWorkersForPlatformsDispatchNamespaceScriptSettingEditParamsSettingsMigrationsUnion() { } // Migrations to apply for Durable Objects associated with this Worker. @@ -412,7 +412,7 @@ func (r DispatchNamespaceScriptSettingEditParamsSettingsMigrations) implementsWo // [workers.SteppedMigrationParam], // [DispatchNamespaceScriptSettingEditParamsSettingsMigrations]. type DispatchNamespaceScriptSettingEditParamsSettingsMigrationsUnion interface { - implementsWorkersForPlatformsDispatchNamespaceScriptSettingEditParamsSettingsMigrationsUnion() + ImplementsWorkersForPlatformsDispatchNamespaceScriptSettingEditParamsSettingsMigrationsUnion() } type DispatchNamespaceScriptSettingEditResponseEnvelope struct { diff --git a/workers_for_platforms/dispatchnamespacescriptsetting_test.go b/workers_for_platforms/dispatchnamespacescriptsetting_test.go index d77c9b9088e..46b4f012ec3 100644 --- a/workers_for_platforms/dispatchnamespacescriptsetting_test.go +++ b/workers_for_platforms/dispatchnamespacescriptsetting_test.go @@ -16,7 +16,7 @@ import ( ) func TestDispatchNamespaceScriptSettingEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -109,7 +109,6 @@ func TestDispatchNamespaceScriptSettingEditWithOptionalParams(t *testing.T) { } func TestDispatchNamespaceScriptSettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/workers_for_platforms/dispatchnamespacescripttag.go b/workers_for_platforms/dispatchnamespacescripttag.go index 2cbec1b431a..b976a92b6f6 100644 --- a/workers_for_platforms/dispatchnamespacescripttag.go +++ b/workers_for_platforms/dispatchnamespacescripttag.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DispatchNamespaceScriptTagService contains methods and other services that help @@ -52,7 +52,7 @@ func (r *DispatchNamespaceScriptTagService) List(ctx context.Context, dispatchNa opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/workers/dispatch/namespaces/%s/scripts/%s/tags", query.AccountID, dispatchNamespace, scriptName) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/workers_for_platforms/dispatchnamespacescripttag_test.go b/workers_for_platforms/dispatchnamespacescripttag_test.go index 8e608129604..98a6a08a9fc 100644 --- a/workers_for_platforms/dispatchnamespacescripttag_test.go +++ b/workers_for_platforms/dispatchnamespacescripttag_test.go @@ -15,7 +15,6 @@ import ( ) func TestDispatchNamespaceScriptTagUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestDispatchNamespaceScriptTagUpdate(t *testing.T) { } func TestDispatchNamespaceScriptTagList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -78,7 +76,6 @@ func TestDispatchNamespaceScriptTagList(t *testing.T) { } func TestDispatchNamespaceScriptTagDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessapplication.go b/zero_trust/accessapplication.go index 22e54143dae..44e06ea7ed5 100644 --- a/zero_trust/accessapplication.go +++ b/zero_trust/accessapplication.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -101,7 +101,7 @@ func (r *AccessApplicationService) List(ctx context.Context, query AccessApplica accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/access/apps", accountOrZone, accountOrZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -184,39 +184,39 @@ func (r *AccessApplicationService) RevokeTokens(ctx context.Context, appID AppID return } -type AllowedHeadersh = string +type AllowedHeaders = string -type AllowedHeadershParam = string +type AllowedHeadersParam = string -type AllowedIdpsh = string +type AllowedIdPs = string -type AllowedIdpshParam = string +type AllowedIdPsParam = string -type AllowedMethodsh string +type AllowedMethods string const ( - AllowedMethodshGet AllowedMethodsh = "GET" - AllowedMethodshPost AllowedMethodsh = "POST" - AllowedMethodshHead AllowedMethodsh = "HEAD" - AllowedMethodshPut AllowedMethodsh = "PUT" - AllowedMethodshDelete AllowedMethodsh = "DELETE" - AllowedMethodshConnect AllowedMethodsh = "CONNECT" - AllowedMethodshOptions AllowedMethodsh = "OPTIONS" - AllowedMethodshTrace AllowedMethodsh = "TRACE" - AllowedMethodshPatch AllowedMethodsh = "PATCH" + AllowedMethodsGet AllowedMethods = "GET" + AllowedMethodsPost AllowedMethods = "POST" + AllowedMethodsHead AllowedMethods = "HEAD" + AllowedMethodsPut AllowedMethods = "PUT" + AllowedMethodsDelete AllowedMethods = "DELETE" + AllowedMethodsConnect AllowedMethods = "CONNECT" + AllowedMethodsOptions AllowedMethods = "OPTIONS" + AllowedMethodsTrace AllowedMethods = "TRACE" + AllowedMethodsPatch AllowedMethods = "PATCH" ) -func (r AllowedMethodsh) IsKnown() bool { +func (r AllowedMethods) IsKnown() bool { switch r { - case AllowedMethodshGet, AllowedMethodshPost, AllowedMethodshHead, AllowedMethodshPut, AllowedMethodshDelete, AllowedMethodshConnect, AllowedMethodshOptions, AllowedMethodshTrace, AllowedMethodshPatch: + case AllowedMethodsGet, AllowedMethodsPost, AllowedMethodsHead, AllowedMethodsPut, AllowedMethodsDelete, AllowedMethodsConnect, AllowedMethodsOptions, AllowedMethodsTrace, AllowedMethodsPatch: return true } return false } -type AllowedOriginsh = string +type AllowedOrigins = string -type AllowedOriginshParam = string +type AllowedOriginsParam = string // Identifier // @@ -237,7 +237,7 @@ type Application struct { // authentication. This setting always overrides the organization setting for WARP // authentication. AllowAuthenticateViaWARP bool `json:"allow_authenticate_via_warp"` - AllowedIdps interface{} `json:"allowed_idps,required"` + AllowedIdPs interface{} `json:"allowed_idps,required"` // Displays the application in the App Launcher. AppLauncherVisible bool `json:"app_launcher_visible"` // When set to `true`, users skip the identity provider selection step during @@ -300,7 +300,7 @@ type applicationJSON struct { ID apijson.Field UpdatedAt apijson.Field AllowAuthenticateViaWARP apijson.Field - AllowedIdps apijson.Field + AllowedIdPs apijson.Field AppLauncherVisible apijson.Field AutoRedirectToIdentity apijson.Field CORSHeaders apijson.Field @@ -409,7 +409,7 @@ type ApplicationSelfHostedApplication struct { AllowAuthenticateViaWARP bool `json:"allow_authenticate_via_warp"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps []AllowedIdpsh `json:"allowed_idps"` + AllowedIdPs []AllowedIdPs `json:"allowed_idps"` // Displays the application in the App Launcher. AppLauncherVisible bool `json:"app_launcher_visible"` // Audience tag. @@ -429,7 +429,7 @@ type ApplicationSelfHostedApplication struct { // application when failing non-identity rules. CustomNonIdentityDenyURL string `json:"custom_non_identity_deny_url"` // The custom pages that will be displayed when applicable for this application - CustomPages []CustomPagesh `json:"custom_pages"` + CustomPages []string `json:"custom_pages"` // Enables the binding cookie, which increases security against compromised // authorization tokens and CSRF attacks. EnableBindingCookie bool `json:"enable_binding_cookie"` @@ -450,7 +450,7 @@ type ApplicationSelfHostedApplication struct { // attacks. SameSiteCookieAttribute string `json:"same_site_cookie_attribute"` // List of domains that Access will secure. - SelfHostedDomains []SelfHostedDomainsh `json:"self_hosted_domains"` + SelfHostedDomains []SelfHostedDomains `json:"self_hosted_domains"` // Returns a 401 status code when the request is blocked by a Service Auth policy. ServiceAuth401Redirect bool `json:"service_auth_401_redirect"` // The amount of time that tokens issued for this application will be valid. Must @@ -473,7 +473,7 @@ type applicationSelfHostedApplicationJSON struct { Type apijson.Field ID apijson.Field AllowAuthenticateViaWARP apijson.Field - AllowedIdps apijson.Field + AllowedIdPs apijson.Field AppLauncherVisible apijson.Field AUD apijson.Field AutoRedirectToIdentity apijson.Field @@ -515,7 +515,7 @@ type ApplicationSaaSApplication struct { ID string `json:"id"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps []AllowedIdpsh `json:"allowed_idps"` + AllowedIdPs []AllowedIdPs `json:"allowed_idps"` // Displays the application in the App Launcher. AppLauncherVisible bool `json:"app_launcher_visible"` // Audience tag. @@ -525,7 +525,7 @@ type ApplicationSaaSApplication struct { AutoRedirectToIdentity bool `json:"auto_redirect_to_identity"` CreatedAt time.Time `json:"created_at" format:"date-time"` // The custom pages that will be displayed when applicable for this application - CustomPages []CustomPagesh `json:"custom_pages"` + CustomPages []string `json:"custom_pages"` // The image URL for the logo shown in the App Launcher dashboard. LogoURL string `json:"logo_url"` // The name of the application. @@ -544,7 +544,7 @@ type ApplicationSaaSApplication struct { // [ApplicationSaaSApplication] type applicationSaaSApplicationJSON struct { ID apijson.Field - AllowedIdps apijson.Field + AllowedIdPs apijson.Field AppLauncherVisible apijson.Field AUD apijson.Field AutoRedirectToIdentity apijson.Field @@ -898,7 +898,7 @@ type ApplicationBrowserSSHApplication struct { AllowAuthenticateViaWARP bool `json:"allow_authenticate_via_warp"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps []AllowedIdpsh `json:"allowed_idps"` + AllowedIdPs []AllowedIdPs `json:"allowed_idps"` // Displays the application in the App Launcher. AppLauncherVisible bool `json:"app_launcher_visible"` // Audience tag. @@ -918,7 +918,7 @@ type ApplicationBrowserSSHApplication struct { // application when failing non-identity rules. CustomNonIdentityDenyURL string `json:"custom_non_identity_deny_url"` // The custom pages that will be displayed when applicable for this application - CustomPages []CustomPagesh `json:"custom_pages"` + CustomPages []string `json:"custom_pages"` // Enables the binding cookie, which increases security against compromised // authorization tokens and CSRF attacks. EnableBindingCookie bool `json:"enable_binding_cookie"` @@ -939,7 +939,7 @@ type ApplicationBrowserSSHApplication struct { // attacks. SameSiteCookieAttribute string `json:"same_site_cookie_attribute"` // List of domains that Access will secure. - SelfHostedDomains []SelfHostedDomainsh `json:"self_hosted_domains"` + SelfHostedDomains []SelfHostedDomains `json:"self_hosted_domains"` // Returns a 401 status code when the request is blocked by a Service Auth policy. ServiceAuth401Redirect bool `json:"service_auth_401_redirect"` // The amount of time that tokens issued for this application will be valid. Must @@ -962,7 +962,7 @@ type applicationBrowserSSHApplicationJSON struct { Type apijson.Field ID apijson.Field AllowAuthenticateViaWARP apijson.Field - AllowedIdps apijson.Field + AllowedIdPs apijson.Field AppLauncherVisible apijson.Field AUD apijson.Field AutoRedirectToIdentity apijson.Field @@ -1014,7 +1014,7 @@ type ApplicationBrowserVncApplication struct { AllowAuthenticateViaWARP bool `json:"allow_authenticate_via_warp"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps []AllowedIdpsh `json:"allowed_idps"` + AllowedIdPs []AllowedIdPs `json:"allowed_idps"` // Displays the application in the App Launcher. AppLauncherVisible bool `json:"app_launcher_visible"` // Audience tag. @@ -1034,7 +1034,7 @@ type ApplicationBrowserVncApplication struct { // application when failing non-identity rules. CustomNonIdentityDenyURL string `json:"custom_non_identity_deny_url"` // The custom pages that will be displayed when applicable for this application - CustomPages []CustomPagesh `json:"custom_pages"` + CustomPages []string `json:"custom_pages"` // Enables the binding cookie, which increases security against compromised // authorization tokens and CSRF attacks. EnableBindingCookie bool `json:"enable_binding_cookie"` @@ -1055,7 +1055,7 @@ type ApplicationBrowserVncApplication struct { // attacks. SameSiteCookieAttribute string `json:"same_site_cookie_attribute"` // List of domains that Access will secure. - SelfHostedDomains []SelfHostedDomainsh `json:"self_hosted_domains"` + SelfHostedDomains []SelfHostedDomains `json:"self_hosted_domains"` // Returns a 401 status code when the request is blocked by a Service Auth policy. ServiceAuth401Redirect bool `json:"service_auth_401_redirect"` // The amount of time that tokens issued for this application will be valid. Must @@ -1078,7 +1078,7 @@ type applicationBrowserVncApplicationJSON struct { Type apijson.Field ID apijson.Field AllowAuthenticateViaWARP apijson.Field - AllowedIdps apijson.Field + AllowedIdPs apijson.Field AppLauncherVisible apijson.Field AUD apijson.Field AutoRedirectToIdentity apijson.Field @@ -1117,12 +1117,12 @@ func (r ApplicationBrowserVncApplication) implementsZeroTrustApplication() {} type ApplicationAppLauncherApplication struct { // The application type. - Type ApplicationAppLauncherApplicationType `json:"type,required"` + Type ApplicationType `json:"type,required"` // UUID ID string `json:"id"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps []AllowedIdpsh `json:"allowed_idps"` + AllowedIdPs []AllowedIdPs `json:"allowed_idps"` // Audience tag. AUD string `json:"aud"` // When set to `true`, users skip the identity provider selection step during @@ -1147,7 +1147,7 @@ type ApplicationAppLauncherApplication struct { type applicationAppLauncherApplicationJSON struct { Type apijson.Field ID apijson.Field - AllowedIdps apijson.Field + AllowedIdPs apijson.Field AUD apijson.Field AutoRedirectToIdentity apijson.Field CreatedAt apijson.Field @@ -1169,37 +1169,14 @@ func (r applicationAppLauncherApplicationJSON) RawJSON() string { func (r ApplicationAppLauncherApplication) implementsZeroTrustApplication() {} -// The application type. -type ApplicationAppLauncherApplicationType string - -const ( - ApplicationAppLauncherApplicationTypeSelfHosted ApplicationAppLauncherApplicationType = "self_hosted" - ApplicationAppLauncherApplicationTypeSaaS ApplicationAppLauncherApplicationType = "saas" - ApplicationAppLauncherApplicationTypeSSH ApplicationAppLauncherApplicationType = "ssh" - ApplicationAppLauncherApplicationTypeVnc ApplicationAppLauncherApplicationType = "vnc" - ApplicationAppLauncherApplicationTypeAppLauncher ApplicationAppLauncherApplicationType = "app_launcher" - ApplicationAppLauncherApplicationTypeWARP ApplicationAppLauncherApplicationType = "warp" - ApplicationAppLauncherApplicationTypeBiso ApplicationAppLauncherApplicationType = "biso" - ApplicationAppLauncherApplicationTypeBookmark ApplicationAppLauncherApplicationType = "bookmark" - ApplicationAppLauncherApplicationTypeDashSSO ApplicationAppLauncherApplicationType = "dash_sso" -) - -func (r ApplicationAppLauncherApplicationType) IsKnown() bool { - switch r { - case ApplicationAppLauncherApplicationTypeSelfHosted, ApplicationAppLauncherApplicationTypeSaaS, ApplicationAppLauncherApplicationTypeSSH, ApplicationAppLauncherApplicationTypeVnc, ApplicationAppLauncherApplicationTypeAppLauncher, ApplicationAppLauncherApplicationTypeWARP, ApplicationAppLauncherApplicationTypeBiso, ApplicationAppLauncherApplicationTypeBookmark, ApplicationAppLauncherApplicationTypeDashSSO: - return true - } - return false -} - type ApplicationDeviceEnrollmentPermissionsApplication struct { // The application type. - Type ApplicationDeviceEnrollmentPermissionsApplicationType `json:"type,required"` + Type ApplicationType `json:"type,required"` // UUID ID string `json:"id"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps []AllowedIdpsh `json:"allowed_idps"` + AllowedIdPs []AllowedIdPs `json:"allowed_idps"` // Audience tag. AUD string `json:"aud"` // When set to `true`, users skip the identity provider selection step during @@ -1224,7 +1201,7 @@ type ApplicationDeviceEnrollmentPermissionsApplication struct { type applicationDeviceEnrollmentPermissionsApplicationJSON struct { Type apijson.Field ID apijson.Field - AllowedIdps apijson.Field + AllowedIdPs apijson.Field AUD apijson.Field AutoRedirectToIdentity apijson.Field CreatedAt apijson.Field @@ -1246,37 +1223,14 @@ func (r applicationDeviceEnrollmentPermissionsApplicationJSON) RawJSON() string func (r ApplicationDeviceEnrollmentPermissionsApplication) implementsZeroTrustApplication() {} -// The application type. -type ApplicationDeviceEnrollmentPermissionsApplicationType string - -const ( - ApplicationDeviceEnrollmentPermissionsApplicationTypeSelfHosted ApplicationDeviceEnrollmentPermissionsApplicationType = "self_hosted" - ApplicationDeviceEnrollmentPermissionsApplicationTypeSaaS ApplicationDeviceEnrollmentPermissionsApplicationType = "saas" - ApplicationDeviceEnrollmentPermissionsApplicationTypeSSH ApplicationDeviceEnrollmentPermissionsApplicationType = "ssh" - ApplicationDeviceEnrollmentPermissionsApplicationTypeVnc ApplicationDeviceEnrollmentPermissionsApplicationType = "vnc" - ApplicationDeviceEnrollmentPermissionsApplicationTypeAppLauncher ApplicationDeviceEnrollmentPermissionsApplicationType = "app_launcher" - ApplicationDeviceEnrollmentPermissionsApplicationTypeWARP ApplicationDeviceEnrollmentPermissionsApplicationType = "warp" - ApplicationDeviceEnrollmentPermissionsApplicationTypeBiso ApplicationDeviceEnrollmentPermissionsApplicationType = "biso" - ApplicationDeviceEnrollmentPermissionsApplicationTypeBookmark ApplicationDeviceEnrollmentPermissionsApplicationType = "bookmark" - ApplicationDeviceEnrollmentPermissionsApplicationTypeDashSSO ApplicationDeviceEnrollmentPermissionsApplicationType = "dash_sso" -) - -func (r ApplicationDeviceEnrollmentPermissionsApplicationType) IsKnown() bool { - switch r { - case ApplicationDeviceEnrollmentPermissionsApplicationTypeSelfHosted, ApplicationDeviceEnrollmentPermissionsApplicationTypeSaaS, ApplicationDeviceEnrollmentPermissionsApplicationTypeSSH, ApplicationDeviceEnrollmentPermissionsApplicationTypeVnc, ApplicationDeviceEnrollmentPermissionsApplicationTypeAppLauncher, ApplicationDeviceEnrollmentPermissionsApplicationTypeWARP, ApplicationDeviceEnrollmentPermissionsApplicationTypeBiso, ApplicationDeviceEnrollmentPermissionsApplicationTypeBookmark, ApplicationDeviceEnrollmentPermissionsApplicationTypeDashSSO: - return true - } - return false -} - type ApplicationBrowserIsolationPermissionsApplication struct { // The application type. - Type ApplicationBrowserIsolationPermissionsApplicationType `json:"type,required"` + Type ApplicationType `json:"type,required"` // UUID ID string `json:"id"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps []AllowedIdpsh `json:"allowed_idps"` + AllowedIdPs []AllowedIdPs `json:"allowed_idps"` // Audience tag. AUD string `json:"aud"` // When set to `true`, users skip the identity provider selection step during @@ -1301,7 +1255,7 @@ type ApplicationBrowserIsolationPermissionsApplication struct { type applicationBrowserIsolationPermissionsApplicationJSON struct { Type apijson.Field ID apijson.Field - AllowedIdps apijson.Field + AllowedIdPs apijson.Field AUD apijson.Field AutoRedirectToIdentity apijson.Field CreatedAt apijson.Field @@ -1323,29 +1277,6 @@ func (r applicationBrowserIsolationPermissionsApplicationJSON) RawJSON() string func (r ApplicationBrowserIsolationPermissionsApplication) implementsZeroTrustApplication() {} -// The application type. -type ApplicationBrowserIsolationPermissionsApplicationType string - -const ( - ApplicationBrowserIsolationPermissionsApplicationTypeSelfHosted ApplicationBrowserIsolationPermissionsApplicationType = "self_hosted" - ApplicationBrowserIsolationPermissionsApplicationTypeSaaS ApplicationBrowserIsolationPermissionsApplicationType = "saas" - ApplicationBrowserIsolationPermissionsApplicationTypeSSH ApplicationBrowserIsolationPermissionsApplicationType = "ssh" - ApplicationBrowserIsolationPermissionsApplicationTypeVnc ApplicationBrowserIsolationPermissionsApplicationType = "vnc" - ApplicationBrowserIsolationPermissionsApplicationTypeAppLauncher ApplicationBrowserIsolationPermissionsApplicationType = "app_launcher" - ApplicationBrowserIsolationPermissionsApplicationTypeWARP ApplicationBrowserIsolationPermissionsApplicationType = "warp" - ApplicationBrowserIsolationPermissionsApplicationTypeBiso ApplicationBrowserIsolationPermissionsApplicationType = "biso" - ApplicationBrowserIsolationPermissionsApplicationTypeBookmark ApplicationBrowserIsolationPermissionsApplicationType = "bookmark" - ApplicationBrowserIsolationPermissionsApplicationTypeDashSSO ApplicationBrowserIsolationPermissionsApplicationType = "dash_sso" -) - -func (r ApplicationBrowserIsolationPermissionsApplicationType) IsKnown() bool { - switch r { - case ApplicationBrowserIsolationPermissionsApplicationTypeSelfHosted, ApplicationBrowserIsolationPermissionsApplicationTypeSaaS, ApplicationBrowserIsolationPermissionsApplicationTypeSSH, ApplicationBrowserIsolationPermissionsApplicationTypeVnc, ApplicationBrowserIsolationPermissionsApplicationTypeAppLauncher, ApplicationBrowserIsolationPermissionsApplicationTypeWARP, ApplicationBrowserIsolationPermissionsApplicationTypeBiso, ApplicationBrowserIsolationPermissionsApplicationTypeBookmark, ApplicationBrowserIsolationPermissionsApplicationTypeDashSSO: - return true - } - return false -} - type ApplicationBookmarkApplication struct { // UUID ID string `json:"id"` @@ -1402,7 +1333,7 @@ type ApplicationParam struct { // authentication. This setting always overrides the organization setting for WARP // authentication. AllowAuthenticateViaWARP param.Field[bool] `json:"allow_authenticate_via_warp"` - AllowedIdps param.Field[interface{}] `json:"allowed_idps,required"` + AllowedIdPs param.Field[interface{}] `json:"allowed_idps,required"` // Displays the application in the App Launcher. AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` // When set to `true`, users skip the identity provider selection step during @@ -1487,7 +1418,7 @@ type ApplicationSelfHostedApplicationParam struct { AllowAuthenticateViaWARP param.Field[bool] `json:"allow_authenticate_via_warp"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps param.Field[[]AllowedIdpshParam] `json:"allowed_idps"` + AllowedIdPs param.Field[[]AllowedIdPsParam] `json:"allowed_idps"` // Displays the application in the App Launcher. AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` // When set to `true`, users skip the identity provider selection step during @@ -1504,7 +1435,7 @@ type ApplicationSelfHostedApplicationParam struct { // application when failing non-identity rules. CustomNonIdentityDenyURL param.Field[string] `json:"custom_non_identity_deny_url"` // The custom pages that will be displayed when applicable for this application - CustomPages param.Field[[]CustomPageshParam] `json:"custom_pages"` + CustomPages param.Field[[]string] `json:"custom_pages"` // Enables the binding cookie, which increases security against compromised // authorization tokens and CSRF attacks. EnableBindingCookie param.Field[bool] `json:"enable_binding_cookie"` @@ -1525,7 +1456,7 @@ type ApplicationSelfHostedApplicationParam struct { // attacks. SameSiteCookieAttribute param.Field[string] `json:"same_site_cookie_attribute"` // List of domains that Access will secure. - SelfHostedDomains param.Field[[]SelfHostedDomainshParam] `json:"self_hosted_domains"` + SelfHostedDomains param.Field[[]SelfHostedDomainsParam] `json:"self_hosted_domains"` // Returns a 401 status code when the request is blocked by a Service Auth policy. ServiceAuth401Redirect param.Field[bool] `json:"service_auth_401_redirect"` // The amount of time that tokens issued for this application will be valid. Must @@ -1548,14 +1479,14 @@ func (r ApplicationSelfHostedApplicationParam) implementsZeroTrustApplicationUni type ApplicationSaaSApplicationParam struct { // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps param.Field[[]AllowedIdpshParam] `json:"allowed_idps"` + AllowedIdPs param.Field[[]AllowedIdPsParam] `json:"allowed_idps"` // Displays the application in the App Launcher. AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` // When set to `true`, users skip the identity provider selection step during // login. You must specify only one identity provider in allowed_idps. AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` // The custom pages that will be displayed when applicable for this application - CustomPages param.Field[[]CustomPageshParam] `json:"custom_pages"` + CustomPages param.Field[[]string] `json:"custom_pages"` // The image URL for the logo shown in the App Launcher dashboard. LogoURL param.Field[string] `json:"logo_url"` // The name of the application. @@ -1703,7 +1634,7 @@ type ApplicationBrowserSSHApplicationParam struct { AllowAuthenticateViaWARP param.Field[bool] `json:"allow_authenticate_via_warp"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps param.Field[[]AllowedIdpshParam] `json:"allowed_idps"` + AllowedIdPs param.Field[[]AllowedIdPsParam] `json:"allowed_idps"` // Displays the application in the App Launcher. AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` // When set to `true`, users skip the identity provider selection step during @@ -1720,7 +1651,7 @@ type ApplicationBrowserSSHApplicationParam struct { // application when failing non-identity rules. CustomNonIdentityDenyURL param.Field[string] `json:"custom_non_identity_deny_url"` // The custom pages that will be displayed when applicable for this application - CustomPages param.Field[[]CustomPageshParam] `json:"custom_pages"` + CustomPages param.Field[[]string] `json:"custom_pages"` // Enables the binding cookie, which increases security against compromised // authorization tokens and CSRF attacks. EnableBindingCookie param.Field[bool] `json:"enable_binding_cookie"` @@ -1741,7 +1672,7 @@ type ApplicationBrowserSSHApplicationParam struct { // attacks. SameSiteCookieAttribute param.Field[string] `json:"same_site_cookie_attribute"` // List of domains that Access will secure. - SelfHostedDomains param.Field[[]SelfHostedDomainshParam] `json:"self_hosted_domains"` + SelfHostedDomains param.Field[[]SelfHostedDomainsParam] `json:"self_hosted_domains"` // Returns a 401 status code when the request is blocked by a Service Auth policy. ServiceAuth401Redirect param.Field[bool] `json:"service_auth_401_redirect"` // The amount of time that tokens issued for this application will be valid. Must @@ -1774,7 +1705,7 @@ type ApplicationBrowserVncApplicationParam struct { AllowAuthenticateViaWARP param.Field[bool] `json:"allow_authenticate_via_warp"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps param.Field[[]AllowedIdpshParam] `json:"allowed_idps"` + AllowedIdPs param.Field[[]AllowedIdPsParam] `json:"allowed_idps"` // Displays the application in the App Launcher. AppLauncherVisible param.Field[bool] `json:"app_launcher_visible"` // When set to `true`, users skip the identity provider selection step during @@ -1791,7 +1722,7 @@ type ApplicationBrowserVncApplicationParam struct { // application when failing non-identity rules. CustomNonIdentityDenyURL param.Field[string] `json:"custom_non_identity_deny_url"` // The custom pages that will be displayed when applicable for this application - CustomPages param.Field[[]CustomPageshParam] `json:"custom_pages"` + CustomPages param.Field[[]string] `json:"custom_pages"` // Enables the binding cookie, which increases security against compromised // authorization tokens and CSRF attacks. EnableBindingCookie param.Field[bool] `json:"enable_binding_cookie"` @@ -1812,7 +1743,7 @@ type ApplicationBrowserVncApplicationParam struct { // attacks. SameSiteCookieAttribute param.Field[string] `json:"same_site_cookie_attribute"` // List of domains that Access will secure. - SelfHostedDomains param.Field[[]SelfHostedDomainshParam] `json:"self_hosted_domains"` + SelfHostedDomains param.Field[[]SelfHostedDomainsParam] `json:"self_hosted_domains"` // Returns a 401 status code when the request is blocked by a Service Auth policy. ServiceAuth401Redirect param.Field[bool] `json:"service_auth_401_redirect"` // The amount of time that tokens issued for this application will be valid. Must @@ -1834,10 +1765,10 @@ func (r ApplicationBrowserVncApplicationParam) implementsZeroTrustApplicationUni type ApplicationAppLauncherApplicationParam struct { // The application type. - Type param.Field[ApplicationAppLauncherApplicationType] `json:"type,required"` + Type param.Field[ApplicationType] `json:"type,required"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps param.Field[[]AllowedIdpshParam] `json:"allowed_idps"` + AllowedIdPs param.Field[[]AllowedIdPsParam] `json:"allowed_idps"` // When set to `true`, users skip the identity provider selection step during // login. You must specify only one identity provider in allowed_idps. AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` @@ -1855,10 +1786,10 @@ func (r ApplicationAppLauncherApplicationParam) implementsZeroTrustApplicationUn type ApplicationDeviceEnrollmentPermissionsApplicationParam struct { // The application type. - Type param.Field[ApplicationDeviceEnrollmentPermissionsApplicationType] `json:"type,required"` + Type param.Field[ApplicationType] `json:"type,required"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps param.Field[[]AllowedIdpshParam] `json:"allowed_idps"` + AllowedIdPs param.Field[[]AllowedIdPsParam] `json:"allowed_idps"` // When set to `true`, users skip the identity provider selection step during // login. You must specify only one identity provider in allowed_idps. AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` @@ -1877,10 +1808,10 @@ func (r ApplicationDeviceEnrollmentPermissionsApplicationParam) implementsZeroTr type ApplicationBrowserIsolationPermissionsApplicationParam struct { // The application type. - Type param.Field[ApplicationBrowserIsolationPermissionsApplicationType] `json:"type,required"` + Type param.Field[ApplicationType] `json:"type,required"` // The identity providers your users can select when connecting to this // application. Defaults to all IdPs configured in your account. - AllowedIdps param.Field[[]AllowedIdpshParam] `json:"allowed_idps"` + AllowedIdPs param.Field[[]AllowedIdPsParam] `json:"allowed_idps"` // When set to `true`, users skip the identity provider selection step during // login. You must specify only one identity provider in allowed_idps. AutoRedirectToIdentity param.Field[bool] `json:"auto_redirect_to_identity"` @@ -1919,6 +1850,29 @@ func (r ApplicationBookmarkApplicationParam) MarshalJSON() (data []byte, err err func (r ApplicationBookmarkApplicationParam) implementsZeroTrustApplicationUnionParam() {} +// The application type. +type ApplicationType string + +const ( + ApplicationTypeSelfHosted ApplicationType = "self_hosted" + ApplicationTypeSaaS ApplicationType = "saas" + ApplicationTypeSSH ApplicationType = "ssh" + ApplicationTypeVnc ApplicationType = "vnc" + ApplicationTypeAppLauncher ApplicationType = "app_launcher" + ApplicationTypeWARP ApplicationType = "warp" + ApplicationTypeBiso ApplicationType = "biso" + ApplicationTypeBookmark ApplicationType = "bookmark" + ApplicationTypeDashSSO ApplicationType = "dash_sso" +) + +func (r ApplicationType) IsKnown() bool { + switch r { + case ApplicationTypeSelfHosted, ApplicationTypeSaaS, ApplicationTypeSSH, ApplicationTypeVnc, ApplicationTypeAppLauncher, ApplicationTypeWARP, ApplicationTypeBiso, ApplicationTypeBookmark, ApplicationTypeDashSSO: + return true + } + return false +} + type CORSHeaders struct { // Allows all HTTP request headers. AllowAllHeaders bool `json:"allow_all_headers"` @@ -1930,11 +1884,11 @@ type CORSHeaders struct { // client certificates) with requests. AllowCredentials bool `json:"allow_credentials"` // Allowed HTTP request headers. - AllowedHeaders []AllowedHeadersh `json:"allowed_headers"` + AllowedHeaders []AllowedHeaders `json:"allowed_headers"` // Allowed HTTP request methods. - AllowedMethods []AllowedMethodsh `json:"allowed_methods"` + AllowedMethods []AllowedMethods `json:"allowed_methods"` // Allowed origins. - AllowedOrigins []AllowedOriginsh `json:"allowed_origins"` + AllowedOrigins []AllowedOrigins `json:"allowed_origins"` // The maximum number of seconds the results of a preflight request can be cached. MaxAge float64 `json:"max_age"` JSON corsHeadersJSON `json:"-"` @@ -1973,11 +1927,11 @@ type CORSHeadersParam struct { // client certificates) with requests. AllowCredentials param.Field[bool] `json:"allow_credentials"` // Allowed HTTP request headers. - AllowedHeaders param.Field[[]AllowedHeadershParam] `json:"allowed_headers"` + AllowedHeaders param.Field[[]AllowedHeadersParam] `json:"allowed_headers"` // Allowed HTTP request methods. - AllowedMethods param.Field[[]AllowedMethodsh] `json:"allowed_methods"` + AllowedMethods param.Field[[]AllowedMethods] `json:"allowed_methods"` // Allowed origins. - AllowedOrigins param.Field[[]AllowedOriginshParam] `json:"allowed_origins"` + AllowedOrigins param.Field[[]AllowedOriginsParam] `json:"allowed_origins"` // The maximum number of seconds the results of a preflight request can be cached. MaxAge param.Field[float64] `json:"max_age"` } @@ -1986,10 +1940,6 @@ func (r CORSHeadersParam) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -type CustomPagesh = string - -type CustomPageshParam = string - // A globally unique name for an identity or service provider. type SaaSAppNameFormat string @@ -2230,9 +2180,9 @@ func (r SAMLSaaSAppCustomAttributesParam) MarshalJSON() (data []byte, err error) return apijson.MarshalRoot(r) } -type SelfHostedDomainsh = string +type SelfHostedDomains = string -type SelfHostedDomainshParam = string +type SelfHostedDomainsParam = string type AccessApplicationDeleteResponse struct { // UUID diff --git a/zero_trust/accessapplication_test.go b/zero_trust/accessapplication_test.go index b4e37664705..6256962391a 100644 --- a/zero_trust/accessapplication_test.go +++ b/zero_trust/accessapplication_test.go @@ -9,14 +9,14 @@ import ( "testing" "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/cloudflare/cloudflare-go/v2/zero_trust" ) func TestAccessApplicationNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -32,7 +32,7 @@ func TestAccessApplicationNewWithOptionalParams(t *testing.T) { _, err := client.ZeroTrust.Access.Applications.New(context.TODO(), zero_trust.AccessApplicationNewParams{ Application: zero_trust.ApplicationSelfHostedApplicationParam{ AllowAuthenticateViaWARP: cloudflare.F(true), - AllowedIdps: cloudflare.F([]zero_trust.AllowedIdpshParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), + AllowedIdPs: cloudflare.F([]zero_trust.AllowedIdPsParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), AppLauncherVisible: cloudflare.F(true), AutoRedirectToIdentity: cloudflare.F(true), CORSHeaders: cloudflare.F(zero_trust.CORSHeadersParam{ @@ -40,15 +40,15 @@ func TestAccessApplicationNewWithOptionalParams(t *testing.T) { AllowAllMethods: cloudflare.F(true), AllowAllOrigins: cloudflare.F(true), AllowCredentials: cloudflare.F(true), - AllowedHeaders: cloudflare.F([]zero_trust.AllowedHeadershParam{"string", "string", "string"}), - AllowedMethods: cloudflare.F([]zero_trust.AllowedMethodsh{zero_trust.AllowedMethodshGet}), - AllowedOrigins: cloudflare.F([]zero_trust.AllowedOriginshParam{"https://example.com"}), + AllowedHeaders: cloudflare.F([]zero_trust.AllowedHeadersParam{"string", "string", "string"}), + AllowedMethods: cloudflare.F([]zero_trust.AllowedMethods{zero_trust.AllowedMethodsGet}), + AllowedOrigins: cloudflare.F([]zero_trust.AllowedOriginsParam{"https://example.com"}), MaxAge: cloudflare.F(-1.000000), }), CustomDenyMessage: cloudflare.F("string"), CustomDenyURL: cloudflare.F("string"), CustomNonIdentityDenyURL: cloudflare.F("string"), - CustomPages: cloudflare.F([]zero_trust.CustomPageshParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), + CustomPages: cloudflare.F([]string{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), Domain: cloudflare.F("test.example.com/admin"), EnableBindingCookie: cloudflare.F(true), HTTPOnlyCookieAttribute: cloudflare.F(true), @@ -57,7 +57,7 @@ func TestAccessApplicationNewWithOptionalParams(t *testing.T) { OptionsPreflightBypass: cloudflare.F(true), PathCookieAttribute: cloudflare.F(true), SameSiteCookieAttribute: cloudflare.F("strict"), - SelfHostedDomains: cloudflare.F([]zero_trust.SelfHostedDomainshParam{"test.example.com/admin", "test.anotherexample.com/staff"}), + SelfHostedDomains: cloudflare.F([]zero_trust.SelfHostedDomainsParam{"test.example.com/admin", "test.anotherexample.com/staff"}), ServiceAuth401Redirect: cloudflare.F(true), SessionDuration: cloudflare.F("24h"), SkipInterstitial: cloudflare.F(true), @@ -77,7 +77,7 @@ func TestAccessApplicationNewWithOptionalParams(t *testing.T) { } func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -96,7 +96,7 @@ func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { zero_trust.AccessApplicationUpdateParams{ Application: zero_trust.ApplicationSelfHostedApplicationParam{ AllowAuthenticateViaWARP: cloudflare.F(true), - AllowedIdps: cloudflare.F([]zero_trust.AllowedIdpshParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), + AllowedIdPs: cloudflare.F([]zero_trust.AllowedIdPsParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), AppLauncherVisible: cloudflare.F(true), AutoRedirectToIdentity: cloudflare.F(true), CORSHeaders: cloudflare.F(zero_trust.CORSHeadersParam{ @@ -104,15 +104,15 @@ func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { AllowAllMethods: cloudflare.F(true), AllowAllOrigins: cloudflare.F(true), AllowCredentials: cloudflare.F(true), - AllowedHeaders: cloudflare.F([]zero_trust.AllowedHeadershParam{"string", "string", "string"}), - AllowedMethods: cloudflare.F([]zero_trust.AllowedMethodsh{zero_trust.AllowedMethodshGet}), - AllowedOrigins: cloudflare.F([]zero_trust.AllowedOriginshParam{"https://example.com"}), + AllowedHeaders: cloudflare.F([]zero_trust.AllowedHeadersParam{"string", "string", "string"}), + AllowedMethods: cloudflare.F([]zero_trust.AllowedMethods{zero_trust.AllowedMethodsGet}), + AllowedOrigins: cloudflare.F([]zero_trust.AllowedOriginsParam{"https://example.com"}), MaxAge: cloudflare.F(-1.000000), }), CustomDenyMessage: cloudflare.F("string"), CustomDenyURL: cloudflare.F("string"), CustomNonIdentityDenyURL: cloudflare.F("string"), - CustomPages: cloudflare.F([]zero_trust.CustomPageshParam{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), + CustomPages: cloudflare.F([]string{"699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252", "699d98642c564d2e855e9661899b7252"}), Domain: cloudflare.F("test.example.com/admin"), EnableBindingCookie: cloudflare.F(true), HTTPOnlyCookieAttribute: cloudflare.F(true), @@ -121,7 +121,7 @@ func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { OptionsPreflightBypass: cloudflare.F(true), PathCookieAttribute: cloudflare.F(true), SameSiteCookieAttribute: cloudflare.F("strict"), - SelfHostedDomains: cloudflare.F([]zero_trust.SelfHostedDomainshParam{"test.example.com/admin", "test.anotherexample.com/staff"}), + SelfHostedDomains: cloudflare.F([]zero_trust.SelfHostedDomainsParam{"test.example.com/admin", "test.anotherexample.com/staff"}), ServiceAuth401Redirect: cloudflare.F(true), SessionDuration: cloudflare.F("24h"), SkipInterstitial: cloudflare.F(true), @@ -142,7 +142,7 @@ func TestAccessApplicationUpdateWithOptionalParams(t *testing.T) { } func TestAccessApplicationListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -169,7 +169,7 @@ func TestAccessApplicationListWithOptionalParams(t *testing.T) { } func TestAccessApplicationDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -200,7 +200,7 @@ func TestAccessApplicationDeleteWithOptionalParams(t *testing.T) { } func TestAccessApplicationGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -231,7 +231,7 @@ func TestAccessApplicationGetWithOptionalParams(t *testing.T) { } func TestAccessApplicationRevokeTokensWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessapplicationca.go b/zero_trust/accessapplicationca.go index c5f7a8ea586..f2bc8488573 100644 --- a/zero_trust/accessapplicationca.go +++ b/zero_trust/accessapplicationca.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -72,7 +72,7 @@ func (r *AccessApplicationCAService) List(ctx context.Context, query AccessAppli accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/access/apps/ca", accountOrZone, accountOrZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/accessapplicationca_test.go b/zero_trust/accessapplicationca_test.go index bdb5c36fd73..73ba84f77b7 100644 --- a/zero_trust/accessapplicationca_test.go +++ b/zero_trust/accessapplicationca_test.go @@ -15,7 +15,7 @@ import ( ) func TestAccessApplicationCANewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +46,7 @@ func TestAccessApplicationCANewWithOptionalParams(t *testing.T) { } func TestAccessApplicationCAListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -73,7 +73,7 @@ func TestAccessApplicationCAListWithOptionalParams(t *testing.T) { } func TestAccessApplicationCADeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -104,7 +104,7 @@ func TestAccessApplicationCADeleteWithOptionalParams(t *testing.T) { } func TestAccessApplicationCAGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessapplicationpolicy.go b/zero_trust/accessapplicationpolicy.go index db0fbb3d1c8..15f2d8b9f96 100644 --- a/zero_trust/accessapplicationpolicy.go +++ b/zero_trust/accessapplicationpolicy.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessApplicationPolicyService contains methods and other services that help @@ -93,7 +93,7 @@ func (r *AccessApplicationPolicyService) List(ctx context.Context, uuid string, accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/access/apps/%s/policies", accountOrZone, accountOrZoneID, uuid) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -283,45 +283,6 @@ func (r PolicyDecision) IsKnown() bool { return false } -type PolicyParam struct { - // Administrators who can approve a temporary authentication request. - ApprovalGroups param.Field[[]ApprovalGroupParam] `json:"approval_groups"` - // Requires the user to request access from an administrator at the start of each - // session. - ApprovalRequired param.Field[bool] `json:"approval_required"` - // The action Access will take if a user matches this policy. - Decision param.Field[PolicyDecision] `json:"decision"` - // Rules evaluated with a NOT logical operator. To match the policy, a user cannot - // meet any of the Exclude rules. - Exclude param.Field[[]AccessRuleUnionParam] `json:"exclude"` - // Rules evaluated with an OR logical operator. A user needs to meet only one of - // the Include rules. - Include param.Field[[]AccessRuleUnionParam] `json:"include"` - // 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. - IsolationRequired param.Field[bool] `json:"isolation_required"` - // The name of the Access policy. - Name param.Field[string] `json:"name"` - // The order of execution for this policy. Must be unique for each policy. - Precedence param.Field[int64] `json:"precedence"` - // A custom message that will appear on the purpose justification screen. - PurposeJustificationPrompt param.Field[string] `json:"purpose_justification_prompt"` - // Require users to enter a justification when they log in to the application. - PurposeJustificationRequired param.Field[bool] `json:"purpose_justification_required"` - // Rules evaluated with an AND logical operator. To match the policy, a user must - // meet all of the Require rules. - Require param.Field[[]AccessRuleUnionParam] `json:"require"` - // 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. - SessionDuration param.Field[string] `json:"session_duration"` -} - -func (r PolicyParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type AccessApplicationPolicyDeleteResponse struct { // UUID ID string `json:"id"` diff --git a/zero_trust/accessapplicationpolicy_test.go b/zero_trust/accessapplicationpolicy_test.go index cae43abecca..e25693bf6c6 100644 --- a/zero_trust/accessapplicationpolicy_test.go +++ b/zero_trust/accessapplicationpolicy_test.go @@ -15,7 +15,7 @@ import ( ) func TestAccessApplicationPolicyNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -102,7 +102,7 @@ func TestAccessApplicationPolicyNewWithOptionalParams(t *testing.T) { } func TestAccessApplicationPolicyUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -190,7 +190,7 @@ func TestAccessApplicationPolicyUpdateWithOptionalParams(t *testing.T) { } func TestAccessApplicationPolicyListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -221,7 +221,7 @@ func TestAccessApplicationPolicyListWithOptionalParams(t *testing.T) { } func TestAccessApplicationPolicyDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -253,7 +253,7 @@ func TestAccessApplicationPolicyDeleteWithOptionalParams(t *testing.T) { } func TestAccessApplicationPolicyGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessapplicationuserpolicycheck.go b/zero_trust/accessapplicationuserpolicycheck.go index b87554c7cbe..b45b77a25e0 100644 --- a/zero_trust/accessapplicationuserpolicycheck.go +++ b/zero_trust/accessapplicationuserpolicycheck.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessApplicationUserPolicyCheckService contains methods and other services that diff --git a/zero_trust/accessapplicationuserpolicycheck_test.go b/zero_trust/accessapplicationuserpolicycheck_test.go index 0e5c9ae469a..891db9ad1b3 100644 --- a/zero_trust/accessapplicationuserpolicycheck_test.go +++ b/zero_trust/accessapplicationuserpolicycheck_test.go @@ -9,14 +9,14 @@ import ( "testing" "github.com/cloudflare/cloudflare-go/v2" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/internal/testutil" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/cloudflare/cloudflare-go/v2/zero_trust" ) func TestAccessApplicationUserPolicyCheckListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessbookmark.go b/zero_trust/accessbookmark.go index 0d3bc0c05c2..5258626bace 100644 --- a/zero_trust/accessbookmark.go +++ b/zero_trust/accessbookmark.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessBookmarkService contains methods and other services that help with @@ -38,7 +38,7 @@ func (r *AccessBookmarkService) New(ctx context.Context, identifier string, uuid opts = append(r.Options[:], opts...) var env AccessBookmarkNewResponseEnvelope path := fmt.Sprintf("accounts/%s/access/bookmarks/%s", identifier, uuid) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...) if err != nil { return } @@ -51,7 +51,7 @@ func (r *AccessBookmarkService) Update(ctx context.Context, identifier string, u opts = append(r.Options[:], opts...) var env AccessBookmarkUpdateResponseEnvelope path := fmt.Sprintf("accounts/%s/access/bookmarks/%s", identifier, uuid) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, nil, &env, opts...) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &env, opts...) if err != nil { return } @@ -83,7 +83,7 @@ func (r *AccessBookmarkService) ListAutoPaging(ctx context.Context, identifier s } // Deletes a Bookmark application. -func (r *AccessBookmarkService) Delete(ctx context.Context, identifier string, uuid string, body AccessBookmarkDeleteParams, opts ...option.RequestOption) (res *AccessBookmarkDeleteResponse, err error) { +func (r *AccessBookmarkService) Delete(ctx context.Context, identifier string, uuid string, opts ...option.RequestOption) (res *AccessBookmarkDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env AccessBookmarkDeleteResponseEnvelope path := fmt.Sprintf("accounts/%s/access/bookmarks/%s", identifier, uuid) @@ -269,14 +269,6 @@ func (r AccessBookmarkUpdateResponseEnvelopeSuccess) IsKnown() bool { return false } -type AccessBookmarkDeleteParams struct { - Body interface{} `json:"body,required"` -} - -func (r AccessBookmarkDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) -} - type AccessBookmarkDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/zero_trust/accessbookmark_test.go b/zero_trust/accessbookmark_test.go index 98f7e866fe1..09d559af869 100644 --- a/zero_trust/accessbookmark_test.go +++ b/zero_trust/accessbookmark_test.go @@ -15,7 +15,6 @@ import ( ) func TestAccessBookmarkNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestAccessBookmarkNew(t *testing.T) { } func TestAccessBookmarkUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +75,6 @@ func TestAccessBookmarkUpdate(t *testing.T) { } func TestAccessBookmarkList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -101,7 +98,6 @@ func TestAccessBookmarkList(t *testing.T) { } func TestAccessBookmarkDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -118,9 +114,6 @@ func TestAccessBookmarkDelete(t *testing.T) { context.TODO(), "699d98642c564d2e855e9661899b7252", "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", - zero_trust.AccessBookmarkDeleteParams{ - Body: map[string]interface{}{}, - }, ) if err != nil { var apierr *cloudflare.Error @@ -132,7 +125,6 @@ func TestAccessBookmarkDelete(t *testing.T) { } func TestAccessBookmarkGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accesscertificate.go b/zero_trust/accesscertificate.go index eece81cc343..3fe731ae8e2 100644 --- a/zero_trust/accesscertificate.go +++ b/zero_trust/accesscertificate.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessCertificateService contains methods and other services that help with @@ -95,7 +95,7 @@ func (r *AccessCertificateService) List(ctx context.Context, query AccessCertifi accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/access/certificates", accountOrZone, accountOrZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/accesscertificate_test.go b/zero_trust/accesscertificate_test.go index fcdca9c7659..a2e35e8e1c8 100644 --- a/zero_trust/accesscertificate_test.go +++ b/zero_trust/accesscertificate_test.go @@ -15,7 +15,7 @@ import ( ) func TestAccessCertificateNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +45,7 @@ func TestAccessCertificateNewWithOptionalParams(t *testing.T) { } func TestAccessCertificateUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -78,7 +78,7 @@ func TestAccessCertificateUpdateWithOptionalParams(t *testing.T) { } func TestAccessCertificateListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -105,7 +105,7 @@ func TestAccessCertificateListWithOptionalParams(t *testing.T) { } func TestAccessCertificateDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -136,7 +136,7 @@ func TestAccessCertificateDeleteWithOptionalParams(t *testing.T) { } func TestAccessCertificateGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accesscertificatesetting.go b/zero_trust/accesscertificatesetting.go index 80805149e19..af2b9aee3ae 100644 --- a/zero_trust/accesscertificatesetting.go +++ b/zero_trust/accesscertificatesetting.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessCertificateSettingService contains methods and other services that help diff --git a/zero_trust/accesscertificatesetting_test.go b/zero_trust/accesscertificatesetting_test.go index 3d5510ccf27..265d3366054 100644 --- a/zero_trust/accesscertificatesetting_test.go +++ b/zero_trust/accesscertificatesetting_test.go @@ -15,7 +15,7 @@ import ( ) func TestAccessCertificateSettingUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -55,7 +55,7 @@ func TestAccessCertificateSettingUpdateWithOptionalParams(t *testing.T) { } func TestAccessCertificateSettingGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accesscustompage.go b/zero_trust/accesscustompage.go index 707a91f5246..c74d12418b9 100644 --- a/zero_trust/accesscustompage.go +++ b/zero_trust/accesscustompage.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessCustomPageService contains methods and other services that help with diff --git a/zero_trust/accesscustompage_test.go b/zero_trust/accesscustompage_test.go index 59147eca3f1..235c2c84263 100644 --- a/zero_trust/accesscustompage_test.go +++ b/zero_trust/accesscustompage_test.go @@ -15,7 +15,6 @@ import ( ) func TestAccessCustomPageNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestAccessCustomPageNewWithOptionalParams(t *testing.T) { } func TestAccessCustomPageUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -86,7 +84,6 @@ func TestAccessCustomPageUpdateWithOptionalParams(t *testing.T) { } func TestAccessCustomPageList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -110,7 +107,6 @@ func TestAccessCustomPageList(t *testing.T) { } func TestAccessCustomPageDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -138,7 +134,6 @@ func TestAccessCustomPageDelete(t *testing.T) { } func TestAccessCustomPageGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessgroup.go b/zero_trust/accessgroup.go index 4145e5778e1..6cbdc42c188 100644 --- a/zero_trust/accessgroup.go +++ b/zero_trust/accessgroup.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessGroupService contains methods and other services that help with @@ -93,7 +93,7 @@ func (r *AccessGroupService) List(ctx context.Context, query AccessGroupListPara accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/access/groups", accountOrZone, accountOrZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/accessgroup_test.go b/zero_trust/accessgroup_test.go index 82ae5698f67..cf1eb6d9179 100644 --- a/zero_trust/accessgroup_test.go +++ b/zero_trust/accessgroup_test.go @@ -15,7 +15,7 @@ import ( ) func TestAccessGroupNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -83,7 +83,7 @@ func TestAccessGroupNewWithOptionalParams(t *testing.T) { } func TestAccessGroupUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -155,7 +155,7 @@ func TestAccessGroupUpdateWithOptionalParams(t *testing.T) { } func TestAccessGroupListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -182,7 +182,7 @@ func TestAccessGroupListWithOptionalParams(t *testing.T) { } func TestAccessGroupDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -213,7 +213,7 @@ func TestAccessGroupDeleteWithOptionalParams(t *testing.T) { } func TestAccessGroupGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accesskey.go b/zero_trust/accesskey.go index e054adca374..b03dfbec687 100644 --- a/zero_trust/accesskey.go +++ b/zero_trust/accesskey.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/zero_trust/accesskey_test.go b/zero_trust/accesskey_test.go index ab5adb30187..6447d783096 100644 --- a/zero_trust/accesskey_test.go +++ b/zero_trust/accesskey_test.go @@ -15,7 +15,6 @@ import ( ) func TestAccessKeyUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestAccessKeyUpdate(t *testing.T) { } func TestAccessKeyGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestAccessKeyGet(t *testing.T) { } func TestAccessKeyRotate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accesslogaccessrequest.go b/zero_trust/accesslogaccessrequest.go index 26c1febd616..de2c5b3bbbf 100644 --- a/zero_trust/accesslogaccessrequest.go +++ b/zero_trust/accesslogaccessrequest.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessLogAccessRequestService contains methods and other services that help with diff --git a/zero_trust/accesslogaccessrequest_test.go b/zero_trust/accesslogaccessrequest_test.go index 4f4c600d60d..2483dbf0ce2 100644 --- a/zero_trust/accesslogaccessrequest_test.go +++ b/zero_trust/accesslogaccessrequest_test.go @@ -14,7 +14,6 @@ import ( ) func TestAccessLogAccessRequestList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessservicetoken.go b/zero_trust/accessservicetoken.go index d58de5ac480..8fb6a486a31 100644 --- a/zero_trust/accessservicetoken.go +++ b/zero_trust/accessservicetoken.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessServiceTokenService contains methods and other services that help with @@ -95,7 +95,7 @@ func (r *AccessServiceTokenService) List(ctx context.Context, query AccessServic accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/access/service_tokens", accountOrZone, accountOrZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/accessservicetoken_test.go b/zero_trust/accessservicetoken_test.go index 897fbe14580..ea757dd851c 100644 --- a/zero_trust/accessservicetoken_test.go +++ b/zero_trust/accessservicetoken_test.go @@ -15,7 +15,7 @@ import ( ) func TestAccessServiceTokenNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +44,7 @@ func TestAccessServiceTokenNewWithOptionalParams(t *testing.T) { } func TestAccessServiceTokenUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +77,7 @@ func TestAccessServiceTokenUpdateWithOptionalParams(t *testing.T) { } func TestAccessServiceTokenListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -104,7 +104,7 @@ func TestAccessServiceTokenListWithOptionalParams(t *testing.T) { } func TestAccessServiceTokenDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -135,7 +135,6 @@ func TestAccessServiceTokenDeleteWithOptionalParams(t *testing.T) { } func TestAccessServiceTokenRefresh(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -163,7 +162,6 @@ func TestAccessServiceTokenRefresh(t *testing.T) { } func TestAccessServiceTokenRotate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accesstag.go b/zero_trust/accesstag.go index 2ebbc75babc..4ad2a618f05 100644 --- a/zero_trust/accesstag.go +++ b/zero_trust/accesstag.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessTagService contains methods and other services that help with interacting diff --git a/zero_trust/accesstag_test.go b/zero_trust/accesstag_test.go index 71a178be65f..272c6d5710e 100644 --- a/zero_trust/accesstag_test.go +++ b/zero_trust/accesstag_test.go @@ -15,7 +15,6 @@ import ( ) func TestAccessTagNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestAccessTagNew(t *testing.T) { } func TestAccessTagUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +74,6 @@ func TestAccessTagUpdate(t *testing.T) { } func TestAccessTagList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -100,7 +97,6 @@ func TestAccessTagList(t *testing.T) { } func TestAccessTagDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -128,7 +124,6 @@ func TestAccessTagDelete(t *testing.T) { } func TestAccessTagGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessuser_test.go b/zero_trust/accessuser_test.go index 7bb2850f1b5..e008030ac78 100644 --- a/zero_trust/accessuser_test.go +++ b/zero_trust/accessuser_test.go @@ -14,7 +14,6 @@ import ( ) func TestAccessUserList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessuseractivesession.go b/zero_trust/accessuseractivesession.go index 8d76cae67ac..9b3b0d11c63 100644 --- a/zero_trust/accessuseractivesession.go +++ b/zero_trust/accessuseractivesession.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessUserActiveSessionService contains methods and other services that help diff --git a/zero_trust/accessuseractivesession_test.go b/zero_trust/accessuseractivesession_test.go index b3f5a777fca..a401c896faa 100644 --- a/zero_trust/accessuseractivesession_test.go +++ b/zero_trust/accessuseractivesession_test.go @@ -14,7 +14,6 @@ import ( ) func TestAccessUserActiveSessionList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestAccessUserActiveSessionList(t *testing.T) { } func TestAccessUserActiveSessionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessuserfailedlogin_test.go b/zero_trust/accessuserfailedlogin_test.go index a179bd4644e..7f59fb2a1f2 100644 --- a/zero_trust/accessuserfailedlogin_test.go +++ b/zero_trust/accessuserfailedlogin_test.go @@ -14,7 +14,6 @@ import ( ) func TestAccessUserFailedLoginList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/accessuserlastseenidentity.go b/zero_trust/accessuserlastseenidentity.go index 33cfce3f715..8671076cd59 100644 --- a/zero_trust/accessuserlastseenidentity.go +++ b/zero_trust/accessuserlastseenidentity.go @@ -9,8 +9,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // AccessUserLastSeenIdentityService contains methods and other services that help diff --git a/zero_trust/accessuserlastseenidentity_test.go b/zero_trust/accessuserlastseenidentity_test.go index b241a3fdb8e..a8c9b8a072d 100644 --- a/zero_trust/accessuserlastseenidentity_test.go +++ b/zero_trust/accessuserlastseenidentity_test.go @@ -14,7 +14,6 @@ import ( ) func TestAccessUserLastSeenIdentityGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/aliases.go b/zero_trust/aliases.go index 0789d130ce4..d61f62238dc 100644 --- a/zero_trust/aliases.go +++ b/zero_trust/aliases.go @@ -4,7 +4,7 @@ package zero_trust import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/zero_trust/connectivitysetting.go b/zero_trust/connectivitysetting.go index a376a94b5a1..34ec4e73e1a 100644 --- a/zero_trust/connectivitysetting.go +++ b/zero_trust/connectivitysetting.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ConnectivitySettingService contains methods and other services that help with diff --git a/zero_trust/connectivitysetting_test.go b/zero_trust/connectivitysetting_test.go index 382a70e6850..2ff1d38c4c0 100644 --- a/zero_trust/connectivitysetting_test.go +++ b/zero_trust/connectivitysetting_test.go @@ -15,7 +15,6 @@ import ( ) func TestConnectivitySettingEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestConnectivitySettingEditWithOptionalParams(t *testing.T) { } func TestConnectivitySettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/device.go b/zero_trust/device.go index 27a823d0460..b50ae8e8b17 100644 --- a/zero_trust/device.go +++ b/zero_trust/device.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -57,7 +57,7 @@ func (r *DeviceService) List(ctx context.Context, query DeviceListParams, opts . opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/devices", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/device_test.go b/zero_trust/device_test.go index 88dac0a3774..876e02d59a6 100644 --- a/zero_trust/device_test.go +++ b/zero_trust/device_test.go @@ -15,7 +15,6 @@ import ( ) func TestDeviceList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -41,7 +40,6 @@ func TestDeviceList(t *testing.T) { } func TestDeviceGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/devicedextest.go b/zero_trust/devicedextest.go index 633b440e34c..5f074129016 100644 --- a/zero_trust/devicedextest.go +++ b/zero_trust/devicedextest.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DeviceDEXTestService contains methods and other services that help with @@ -65,7 +65,7 @@ func (r *DeviceDEXTestService) List(ctx context.Context, query DeviceDEXTestList opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/devices/dex_tests", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/devicedextest_test.go b/zero_trust/devicedextest_test.go index dac8acee177..1b691572526 100644 --- a/zero_trust/devicedextest_test.go +++ b/zero_trust/devicedextest_test.go @@ -15,7 +15,6 @@ import ( ) func TestDeviceDEXTestNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -66,7 +65,6 @@ func TestDeviceDEXTestNewWithOptionalParams(t *testing.T) { } func TestDeviceDEXTestUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -121,7 +119,6 @@ func TestDeviceDEXTestUpdateWithOptionalParams(t *testing.T) { } func TestDeviceDEXTestList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -147,7 +144,6 @@ func TestDeviceDEXTestList(t *testing.T) { } func TestDeviceDEXTestDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -177,7 +173,6 @@ func TestDeviceDEXTestDelete(t *testing.T) { } func TestDeviceDEXTestGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/devicenetwork.go b/zero_trust/devicenetwork.go index 151d3cdbe80..fe9a6a9916a 100644 --- a/zero_trust/devicenetwork.go +++ b/zero_trust/devicenetwork.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DeviceNetworkService contains methods and other services that help with @@ -65,7 +65,7 @@ func (r *DeviceNetworkService) List(ctx context.Context, query DeviceNetworkList opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/devices/networks", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -84,10 +84,10 @@ func (r *DeviceNetworkService) ListAutoPaging(ctx context.Context, query DeviceN // Deletes a device managed network and fetches a list of the remaining device // managed networks for an account. -func (r *DeviceNetworkService) Delete(ctx context.Context, networkID string, params DeviceNetworkDeleteParams, opts ...option.RequestOption) (res *[]DeviceNetwork, err error) { +func (r *DeviceNetworkService) Delete(ctx context.Context, networkID string, body DeviceNetworkDeleteParams, opts ...option.RequestOption) (res *[]DeviceNetwork, err error) { opts = append(r.Options[:], opts...) var env DeviceNetworkDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/devices/networks/%s", params.AccountID, networkID) + path := fmt.Sprintf("accounts/%s/devices/networks/%s", body.AccountID, networkID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -369,11 +369,6 @@ type DeviceNetworkListParams struct { type DeviceNetworkDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r DeviceNetworkDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type DeviceNetworkDeleteResponseEnvelope struct { diff --git a/zero_trust/devicenetwork_test.go b/zero_trust/devicenetwork_test.go index f897bd17f7b..689054aff9a 100644 --- a/zero_trust/devicenetwork_test.go +++ b/zero_trust/devicenetwork_test.go @@ -15,7 +15,6 @@ import ( ) func TestDeviceNetworkNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestDeviceNetworkNewWithOptionalParams(t *testing.T) { } func TestDeviceNetworkUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -83,7 +81,6 @@ func TestDeviceNetworkUpdateWithOptionalParams(t *testing.T) { } func TestDeviceNetworkList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -109,7 +106,6 @@ func TestDeviceNetworkList(t *testing.T) { } func TestDeviceNetworkDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -127,7 +123,6 @@ func TestDeviceNetworkDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DeviceNetworkDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -140,7 +135,6 @@ func TestDeviceNetworkDelete(t *testing.T) { } func TestDeviceNetworkGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/deviceoverridecode.go b/zero_trust/deviceoverridecode.go index ffb1207a666..dc56d7d6011 100644 --- a/zero_trust/deviceoverridecode.go +++ b/zero_trust/deviceoverridecode.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DeviceOverrideCodeService contains methods and other services that help with diff --git a/zero_trust/deviceoverridecode_test.go b/zero_trust/deviceoverridecode_test.go index 0c188750026..6e8651ad974 100644 --- a/zero_trust/deviceoverridecode_test.go +++ b/zero_trust/deviceoverridecode_test.go @@ -15,7 +15,6 @@ import ( ) func TestDeviceOverrideCodeList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/devicepolicy.go b/zero_trust/devicepolicy.go index f76fcf349a2..8142564f7d7 100644 --- a/zero_trust/devicepolicy.go +++ b/zero_trust/devicepolicy.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DevicePolicyService contains methods and other services that help with @@ -61,7 +61,7 @@ func (r *DevicePolicyService) List(ctx context.Context, query DevicePolicyListPa opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/devices/policies", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -80,10 +80,10 @@ func (r *DevicePolicyService) ListAutoPaging(ctx context.Context, query DevicePo // Deletes a device settings profile and fetches a list of the remaining profiles // for an account. -func (r *DevicePolicyService) Delete(ctx context.Context, policyID string, params DevicePolicyDeleteParams, opts ...option.RequestOption) (res *[]SettingsPolicy, err error) { +func (r *DevicePolicyService) Delete(ctx context.Context, policyID string, body DevicePolicyDeleteParams, opts ...option.RequestOption) (res *[]SettingsPolicy, err error) { opts = append(r.Options[:], opts...) var env DevicePolicyDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/devices/policy/%s", params.AccountID, policyID) + path := fmt.Sprintf("accounts/%s/devices/policy/%s", body.AccountID, policyID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -408,11 +408,6 @@ type DevicePolicyListParams struct { type DevicePolicyDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r DevicePolicyDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type DevicePolicyDeleteResponseEnvelope struct { diff --git a/zero_trust/devicepolicy_test.go b/zero_trust/devicepolicy_test.go index bf407178c6d..4ca78b85229 100644 --- a/zero_trust/devicepolicy_test.go +++ b/zero_trust/devicepolicy_test.go @@ -15,7 +15,7 @@ import ( ) func TestDevicePolicyNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -61,7 +61,6 @@ func TestDevicePolicyNewWithOptionalParams(t *testing.T) { } func TestDevicePolicyList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -87,7 +86,6 @@ func TestDevicePolicyList(t *testing.T) { } func TestDevicePolicyDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -105,7 +103,6 @@ func TestDevicePolicyDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DevicePolicyDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -118,7 +115,7 @@ func TestDevicePolicyDelete(t *testing.T) { } func TestDevicePolicyEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -166,7 +163,7 @@ func TestDevicePolicyEditWithOptionalParams(t *testing.T) { } func TestDevicePolicyGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/devicepolicydefaultpolicy.go b/zero_trust/devicepolicydefaultpolicy.go index ff8284d2e44..df0bccd9a54 100644 --- a/zero_trust/devicepolicydefaultpolicy.go +++ b/zero_trust/devicepolicydefaultpolicy.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DevicePolicyDefaultPolicyService contains methods and other services that help diff --git a/zero_trust/devicepolicydefaultpolicy_test.go b/zero_trust/devicepolicydefaultpolicy_test.go index e2164d411a8..f126c61f7c3 100644 --- a/zero_trust/devicepolicydefaultpolicy_test.go +++ b/zero_trust/devicepolicydefaultpolicy_test.go @@ -15,7 +15,6 @@ import ( ) func TestDevicePolicyDefaultPolicyGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/devicepolicyexclude.go b/zero_trust/devicepolicyexclude.go index 4dd7ce3bce8..5e0c2c1d9c6 100644 --- a/zero_trust/devicepolicyexclude.go +++ b/zero_trust/devicepolicyexclude.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DevicePolicyExcludeService contains methods and other services that help with @@ -52,7 +52,7 @@ func (r *DevicePolicyExcludeService) List(ctx context.Context, query DevicePolic opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/devices/policy/exclude", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/devicepolicyexclude_test.go b/zero_trust/devicepolicyexclude_test.go index 3c60baff497..e12eaa07fdf 100644 --- a/zero_trust/devicepolicyexclude_test.go +++ b/zero_trust/devicepolicyexclude_test.go @@ -15,7 +15,6 @@ import ( ) func TestDevicePolicyExcludeUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -54,7 +53,6 @@ func TestDevicePolicyExcludeUpdate(t *testing.T) { } func TestDevicePolicyExcludeList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -80,7 +78,6 @@ func TestDevicePolicyExcludeList(t *testing.T) { } func TestDevicePolicyExcludeGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/devicepolicyfallbackdomain.go b/zero_trust/devicepolicyfallbackdomain.go index 960bf9903df..1da0cbd4d46 100644 --- a/zero_trust/devicepolicyfallbackdomain.go +++ b/zero_trust/devicepolicyfallbackdomain.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DevicePolicyFallbackDomainService contains methods and other services that help @@ -55,7 +55,7 @@ func (r *DevicePolicyFallbackDomainService) List(ctx context.Context, query Devi opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/devices/policy/fallback_domains", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/devicepolicyfallbackdomain_test.go b/zero_trust/devicepolicyfallbackdomain_test.go index caf5294f085..9ce3e568d1e 100644 --- a/zero_trust/devicepolicyfallbackdomain_test.go +++ b/zero_trust/devicepolicyfallbackdomain_test.go @@ -15,7 +15,6 @@ import ( ) func TestDevicePolicyFallbackDomainUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -58,7 +57,6 @@ func TestDevicePolicyFallbackDomainUpdate(t *testing.T) { } func TestDevicePolicyFallbackDomainList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -84,7 +82,6 @@ func TestDevicePolicyFallbackDomainList(t *testing.T) { } func TestDevicePolicyFallbackDomainGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/devicepolicyinclude.go b/zero_trust/devicepolicyinclude.go index 86528171c3a..4bd61e37991 100644 --- a/zero_trust/devicepolicyinclude.go +++ b/zero_trust/devicepolicyinclude.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DevicePolicyIncludeService contains methods and other services that help with @@ -52,7 +52,7 @@ func (r *DevicePolicyIncludeService) List(ctx context.Context, query DevicePolic opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/devices/policy/include", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/devicepolicyinclude_test.go b/zero_trust/devicepolicyinclude_test.go index 73855c68548..8df8f8fb087 100644 --- a/zero_trust/devicepolicyinclude_test.go +++ b/zero_trust/devicepolicyinclude_test.go @@ -15,7 +15,6 @@ import ( ) func TestDevicePolicyIncludeUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -54,7 +53,6 @@ func TestDevicePolicyIncludeUpdate(t *testing.T) { } func TestDevicePolicyIncludeList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -80,7 +78,6 @@ func TestDevicePolicyIncludeList(t *testing.T) { } func TestDevicePolicyIncludeGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/deviceposture.go b/zero_trust/deviceposture.go index 1c0bb0fcc78..2f82260a8b4 100644 --- a/zero_trust/deviceposture.go +++ b/zero_trust/deviceposture.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -69,7 +69,7 @@ func (r *DevicePostureService) List(ctx context.Context, query DevicePostureList opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/devices/posture", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -87,10 +87,10 @@ func (r *DevicePostureService) ListAutoPaging(ctx context.Context, query DeviceP } // Deletes a device posture rule. -func (r *DevicePostureService) Delete(ctx context.Context, ruleID string, params DevicePostureDeleteParams, opts ...option.RequestOption) (res *DevicePostureDeleteResponse, err error) { +func (r *DevicePostureService) Delete(ctx context.Context, ruleID string, body DevicePostureDeleteParams, opts ...option.RequestOption) (res *DevicePostureDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env DevicePostureDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/devices/posture/%s", params.AccountID, ruleID) + path := fmt.Sprintf("accounts/%s/devices/posture/%s", body.AccountID, ruleID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -2090,11 +2090,6 @@ type DevicePostureListParams struct { type DevicePostureDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r DevicePostureDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type DevicePostureDeleteResponseEnvelope struct { diff --git a/zero_trust/deviceposture_test.go b/zero_trust/deviceposture_test.go index 09ef0eda59d..b9d476e451a 100644 --- a/zero_trust/deviceposture_test.go +++ b/zero_trust/deviceposture_test.go @@ -15,7 +15,6 @@ import ( ) func TestDevicePostureNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -60,7 +59,6 @@ func TestDevicePostureNewWithOptionalParams(t *testing.T) { } func TestDevicePostureUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -109,7 +107,6 @@ func TestDevicePostureUpdateWithOptionalParams(t *testing.T) { } func TestDevicePostureList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -135,7 +132,6 @@ func TestDevicePostureList(t *testing.T) { } func TestDevicePostureDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -153,7 +149,6 @@ func TestDevicePostureDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DevicePostureDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -166,7 +161,6 @@ func TestDevicePostureDelete(t *testing.T) { } func TestDevicePostureGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/devicepostureintegration.go b/zero_trust/devicepostureintegration.go index 020bfceae32..67880d333de 100644 --- a/zero_trust/devicepostureintegration.go +++ b/zero_trust/devicepostureintegration.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -54,7 +54,7 @@ func (r *DevicePostureIntegrationService) List(ctx context.Context, query Device opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/devices/posture/integration", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -72,10 +72,10 @@ func (r *DevicePostureIntegrationService) ListAutoPaging(ctx context.Context, qu } // Delete a configured device posture integration. -func (r *DevicePostureIntegrationService) Delete(ctx context.Context, integrationID string, params DevicePostureIntegrationDeleteParams, opts ...option.RequestOption) (res *DevicePostureIntegrationDeleteResponseUnion, err error) { +func (r *DevicePostureIntegrationService) Delete(ctx context.Context, integrationID string, body DevicePostureIntegrationDeleteParams, opts ...option.RequestOption) (res *DevicePostureIntegrationDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env DevicePostureIntegrationDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/devices/posture/integration/%s", params.AccountID, integrationID) + path := fmt.Sprintf("accounts/%s/devices/posture/integration/%s", body.AccountID, integrationID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -460,11 +460,6 @@ type DevicePostureIntegrationListParams struct { type DevicePostureIntegrationDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r DevicePostureIntegrationDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type DevicePostureIntegrationDeleteResponseEnvelope struct { diff --git a/zero_trust/devicepostureintegration_test.go b/zero_trust/devicepostureintegration_test.go index dcb58a0734e..35d7e9d2c73 100644 --- a/zero_trust/devicepostureintegration_test.go +++ b/zero_trust/devicepostureintegration_test.go @@ -15,7 +15,6 @@ import ( ) func TestDevicePostureIntegrationNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestDevicePostureIntegrationNewWithOptionalParams(t *testing.T) { } func TestDevicePostureIntegrationList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +74,6 @@ func TestDevicePostureIntegrationList(t *testing.T) { } func TestDevicePostureIntegrationDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -94,7 +91,6 @@ func TestDevicePostureIntegrationDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.DevicePostureIntegrationDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -107,7 +103,6 @@ func TestDevicePostureIntegrationDelete(t *testing.T) { } func TestDevicePostureIntegrationEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -146,7 +141,6 @@ func TestDevicePostureIntegrationEditWithOptionalParams(t *testing.T) { } func TestDevicePostureIntegrationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/devicerevoke.go b/zero_trust/devicerevoke.go index 6dfeef73042..6a5a81e6269 100644 --- a/zero_trust/devicerevoke.go +++ b/zero_trust/devicerevoke.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/zero_trust/devicerevoke_test.go b/zero_trust/devicerevoke_test.go index 91b21b1a4ca..3b169ae63a8 100644 --- a/zero_trust/devicerevoke_test.go +++ b/zero_trust/devicerevoke_test.go @@ -15,7 +15,6 @@ import ( ) func TestDeviceRevokeNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/devicesetting.go b/zero_trust/devicesetting.go index 8238a8f3d96..b2f14420240 100644 --- a/zero_trust/devicesetting.go +++ b/zero_trust/devicesetting.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DeviceSettingService contains methods and other services that help with diff --git a/zero_trust/devicesetting_test.go b/zero_trust/devicesetting_test.go index 3ccd554d41c..a9dd4830b7b 100644 --- a/zero_trust/devicesetting_test.go +++ b/zero_trust/devicesetting_test.go @@ -15,7 +15,6 @@ import ( ) func TestDeviceSettingUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestDeviceSettingUpdateWithOptionalParams(t *testing.T) { } func TestDeviceSettingList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/deviceunrevoke.go b/zero_trust/deviceunrevoke.go index f2bcd4e770d..ac28cd03237 100644 --- a/zero_trust/deviceunrevoke.go +++ b/zero_trust/deviceunrevoke.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/zero_trust/deviceunrevoke_test.go b/zero_trust/deviceunrevoke_test.go index 5c0c8cf4822..15ec1203448 100644 --- a/zero_trust/deviceunrevoke_test.go +++ b/zero_trust/deviceunrevoke_test.go @@ -15,7 +15,6 @@ import ( ) func TestDeviceUnrevokeNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dexcolo_test.go b/zero_trust/dexcolo_test.go index 7bb8e90a249..8a756b64f8a 100644 --- a/zero_trust/dexcolo_test.go +++ b/zero_trust/dexcolo_test.go @@ -15,7 +15,6 @@ import ( ) func TestDEXColoListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dexfleetstatus.go b/zero_trust/dexfleetstatus.go index d93ccb0521f..e80e4301793 100644 --- a/zero_trust/dexfleetstatus.go +++ b/zero_trust/dexfleetstatus.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DEXFleetStatusService contains methods and other services that help with diff --git a/zero_trust/dexfleetstatus_test.go b/zero_trust/dexfleetstatus_test.go index 971d4893db7..f3d811b340a 100644 --- a/zero_trust/dexfleetstatus_test.go +++ b/zero_trust/dexfleetstatus_test.go @@ -15,7 +15,6 @@ import ( ) func TestDEXFleetStatusLive(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestDEXFleetStatusLive(t *testing.T) { } func TestDEXFleetStatusOverTimeWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dexfleetstatusdevice.go b/zero_trust/dexfleetstatusdevice.go index 062f0a97f30..f24d2b9ee7a 100644 --- a/zero_trust/dexfleetstatusdevice.go +++ b/zero_trust/dexfleetstatusdevice.go @@ -61,13 +61,11 @@ type DEXFleetStatusDeviceListResponse struct { // Cloudflare colo Colo string `json:"colo,required"` // Device identifier (UUID v4) - DeviceID string `json:"deviceId,required"` - Mode interface{} `json:"mode,required"` + DeviceID string `json:"deviceId,required"` // Operating system Platform string `json:"platform,required"` // Network status - Status string `json:"status,required"` - Timestamp interface{} `json:"timestamp,required"` + Status string `json:"status,required"` // WARP client version Version string `json:"version,required"` // Device identifier (human readable) @@ -82,10 +80,8 @@ type DEXFleetStatusDeviceListResponse struct { type dexFleetStatusDeviceListResponseJSON struct { Colo apijson.Field DeviceID apijson.Field - Mode apijson.Field Platform apijson.Field Status apijson.Field - Timestamp apijson.Field Version apijson.Field DeviceName apijson.Field PersonEmail apijson.Field diff --git a/zero_trust/dexfleetstatusdevice_test.go b/zero_trust/dexfleetstatusdevice_test.go index 44af9640b11..2c4193aa687 100644 --- a/zero_trust/dexfleetstatusdevice_test.go +++ b/zero_trust/dexfleetstatusdevice_test.go @@ -15,7 +15,7 @@ import ( ) func TestDEXFleetStatusDeviceListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dexhttptest.go b/zero_trust/dexhttptest.go index 0277a2c09a7..0d9f539d8e0 100644 --- a/zero_trust/dexhttptest.go +++ b/zero_trust/dexhttptest.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DEXHTTPTestService contains methods and other services that help with diff --git a/zero_trust/dexhttptest_test.go b/zero_trust/dexhttptest_test.go index 3af4078a3bd..32aafde50d3 100644 --- a/zero_trust/dexhttptest_test.go +++ b/zero_trust/dexhttptest_test.go @@ -15,7 +15,6 @@ import ( ) func TestDEXHTTPTestGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -34,8 +33,8 @@ func TestDEXHTTPTestGetWithOptionalParams(t *testing.T) { zero_trust.DEXHTTPTestGetParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), Interval: cloudflare.F(zero_trust.DexhttpTestGetParamsIntervalMinute), - TimeEnd: cloudflare.F("string"), - TimeStart: cloudflare.F("string"), + TimeEnd: cloudflare.F("1689606812000"), + TimeStart: cloudflare.F("1689520412000"), Colo: cloudflare.F("string"), DeviceID: cloudflare.F([]string{"string", "string", "string"}), }, diff --git a/zero_trust/dexhttptestpercentile.go b/zero_trust/dexhttptestpercentile.go index 5cbb9016fc7..b89caa2aab9 100644 --- a/zero_trust/dexhttptestpercentile.go +++ b/zero_trust/dexhttptestpercentile.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DEXHTTPTestPercentileService contains methods and other services that help with diff --git a/zero_trust/dexhttptestpercentile_test.go b/zero_trust/dexhttptestpercentile_test.go index 63846d98f2d..9232aa8561f 100644 --- a/zero_trust/dexhttptestpercentile_test.go +++ b/zero_trust/dexhttptestpercentile_test.go @@ -15,7 +15,6 @@ import ( ) func TestDEXHTTPTestPercentileGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dextest.go b/zero_trust/dextest.go index c715d7f738e..616212e3f9d 100644 --- a/zero_trust/dextest.go +++ b/zero_trust/dextest.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DEXTestService contains methods and other services that help with interacting diff --git a/zero_trust/dextest_test.go b/zero_trust/dextest_test.go index 1267b48f9a3..3f7f8f4ca08 100644 --- a/zero_trust/dextest_test.go +++ b/zero_trust/dextest_test.go @@ -15,7 +15,6 @@ import ( ) func TestDEXTestListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dextestuniquedevice.go b/zero_trust/dextestuniquedevice.go index c7a7c8fc6e1..317f8e28ef2 100644 --- a/zero_trust/dextestuniquedevice.go +++ b/zero_trust/dextestuniquedevice.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DEXTestUniqueDeviceService contains methods and other services that help with diff --git a/zero_trust/dextestuniquedevice_test.go b/zero_trust/dextestuniquedevice_test.go index 41aab678341..06169b3eb57 100644 --- a/zero_trust/dextestuniquedevice_test.go +++ b/zero_trust/dextestuniquedevice_test.go @@ -15,7 +15,6 @@ import ( ) func TestDEXTestUniqueDeviceListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dextraceroutetest.go b/zero_trust/dextraceroutetest.go index f17d11fdbf1..e475c65a78e 100644 --- a/zero_trust/dextraceroutetest.go +++ b/zero_trust/dextraceroutetest.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DEXTracerouteTestService contains methods and other services that help with diff --git a/zero_trust/dextraceroutetest_test.go b/zero_trust/dextraceroutetest_test.go index 937aabd6cfb..082e40c6805 100644 --- a/zero_trust/dextraceroutetest_test.go +++ b/zero_trust/dextraceroutetest_test.go @@ -15,7 +15,6 @@ import ( ) func TestDEXTracerouteTestGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -34,8 +33,8 @@ func TestDEXTracerouteTestGetWithOptionalParams(t *testing.T) { zero_trust.DEXTracerouteTestGetParams{ AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), Interval: cloudflare.F(zero_trust.DEXTracerouteTestGetParamsIntervalMinute), - TimeEnd: cloudflare.F("string"), - TimeStart: cloudflare.F("string"), + TimeEnd: cloudflare.F("1689606812000"), + TimeStart: cloudflare.F("1689520412000"), Colo: cloudflare.F("string"), DeviceID: cloudflare.F([]string{"string", "string", "string"}), }, @@ -50,7 +49,6 @@ func TestDEXTracerouteTestGetWithOptionalParams(t *testing.T) { } func TestDEXTracerouteTestNetworkPath(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -70,8 +68,8 @@ func TestDEXTracerouteTestNetworkPath(t *testing.T) { AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"), DeviceID: cloudflare.F("string"), Interval: cloudflare.F(zero_trust.DEXTracerouteTestNetworkPathParamsIntervalMinute), - TimeEnd: cloudflare.F("string"), - TimeStart: cloudflare.F("string"), + TimeEnd: cloudflare.F("1689606812000"), + TimeStart: cloudflare.F("1689520412000"), }, ) if err != nil { @@ -84,7 +82,6 @@ func TestDEXTracerouteTestNetworkPath(t *testing.T) { } func TestDEXTracerouteTestPercentilesWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dextraceroutetestresultnetworkpath.go b/zero_trust/dextraceroutetestresultnetworkpath.go index e84d879172b..fd5743f15a0 100644 --- a/zero_trust/dextraceroutetestresultnetworkpath.go +++ b/zero_trust/dextraceroutetestresultnetworkpath.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DEXTracerouteTestResultNetworkPathService contains methods and other services diff --git a/zero_trust/dextraceroutetestresultnetworkpath_test.go b/zero_trust/dextraceroutetestresultnetworkpath_test.go index 3f3fe83f7cc..99e60ab2b6d 100644 --- a/zero_trust/dextraceroutetestresultnetworkpath_test.go +++ b/zero_trust/dextraceroutetestresultnetworkpath_test.go @@ -15,7 +15,6 @@ import ( ) func TestDEXTracerouteTestResultNetworkPathGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dlpdataset.go b/zero_trust/dlpdataset.go index 92ea4f32345..3f66152766b 100644 --- a/zero_trust/dlpdataset.go +++ b/zero_trust/dlpdataset.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DLPDatasetService contains methods and other services that help with interacting @@ -67,7 +67,7 @@ func (r *DLPDatasetService) List(ctx context.Context, query DLPDatasetListParams opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/dlp/datasets", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/dlpdataset_test.go b/zero_trust/dlpdataset_test.go index 3c11b89e5d7..df9fdde498b 100644 --- a/zero_trust/dlpdataset_test.go +++ b/zero_trust/dlpdataset_test.go @@ -15,7 +15,6 @@ import ( ) func TestDLPDatasetNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestDLPDatasetNewWithOptionalParams(t *testing.T) { } func TestDLPDatasetUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -76,7 +74,6 @@ func TestDLPDatasetUpdateWithOptionalParams(t *testing.T) { } func TestDLPDatasetList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -102,7 +99,6 @@ func TestDLPDatasetList(t *testing.T) { } func TestDLPDatasetDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -132,7 +128,6 @@ func TestDLPDatasetDelete(t *testing.T) { } func TestDLPDatasetGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dlpdatasetupload.go b/zero_trust/dlpdatasetupload.go index 6f17dd6f6a7..18fe28a3417 100644 --- a/zero_trust/dlpdatasetupload.go +++ b/zero_trust/dlpdatasetupload.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DLPDatasetUploadService contains methods and other services that help with diff --git a/zero_trust/dlpdatasetupload_test.go b/zero_trust/dlpdatasetupload_test.go index 194c2632519..d7524d7e6be 100644 --- a/zero_trust/dlpdatasetupload_test.go +++ b/zero_trust/dlpdatasetupload_test.go @@ -15,7 +15,6 @@ import ( ) func TestDLPDatasetUploadNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,7 @@ func TestDLPDatasetUploadNew(t *testing.T) { } func TestDLPDatasetUploadEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dlppattern.go b/zero_trust/dlppattern.go index 55606e98fdb..147daef2207 100644 --- a/zero_trust/dlppattern.go +++ b/zero_trust/dlppattern.go @@ -10,9 +10,9 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/logpush" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DLPPatternService contains methods and other services that help with interacting diff --git a/zero_trust/dlppattern_test.go b/zero_trust/dlppattern_test.go index 7ee523029b2..8ff48a94fd1 100644 --- a/zero_trust/dlppattern_test.go +++ b/zero_trust/dlppattern_test.go @@ -15,7 +15,6 @@ import ( ) func TestDLPPatternValidate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dlppayloadlog.go b/zero_trust/dlppayloadlog.go index d5884b7236c..c3b034ad7b5 100644 --- a/zero_trust/dlppayloadlog.go +++ b/zero_trust/dlppayloadlog.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DLPPayloadLogService contains methods and other services that help with diff --git a/zero_trust/dlppayloadlog_test.go b/zero_trust/dlppayloadlog_test.go index ba059c4d124..3b978a40aa3 100644 --- a/zero_trust/dlppayloadlog_test.go +++ b/zero_trust/dlppayloadlog_test.go @@ -15,7 +15,6 @@ import ( ) func TestDLPPayloadLogUpdate(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestDLPPayloadLogUpdate(t *testing.T) { } func TestDLPPayloadLogGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dlpprofile.go b/zero_trust/dlpprofile.go index e96d9b5c228..b70c46874d7 100644 --- a/zero_trust/dlpprofile.go +++ b/zero_trust/dlpprofile.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -45,7 +45,7 @@ func (r *DLPProfileService) List(ctx context.Context, query DLPProfileListParams opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/dlp/profiles", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/dlpprofile_test.go b/zero_trust/dlpprofile_test.go index d19eea0a3e6..ab6d605bdee 100644 --- a/zero_trust/dlpprofile_test.go +++ b/zero_trust/dlpprofile_test.go @@ -15,7 +15,6 @@ import ( ) func TestDLPProfileList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -41,7 +40,6 @@ func TestDLPProfileList(t *testing.T) { } func TestDLPProfileGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dlpprofilecustom.go b/zero_trust/dlpprofilecustom.go index b07dedce7b5..cce984607de 100644 --- a/zero_trust/dlpprofilecustom.go +++ b/zero_trust/dlpprofilecustom.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -57,10 +57,10 @@ func (r *DLPProfileCustomService) Update(ctx context.Context, profileID string, } // Deletes a DLP custom profile. -func (r *DLPProfileCustomService) Delete(ctx context.Context, profileID string, params DLPProfileCustomDeleteParams, opts ...option.RequestOption) (res *DLPProfileCustomDeleteResponseUnion, err error) { +func (r *DLPProfileCustomService) Delete(ctx context.Context, profileID string, body DLPProfileCustomDeleteParams, opts ...option.RequestOption) (res *DLPProfileCustomDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env DLPProfileCustomDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/dlp/profiles/custom/%s", params.AccountID, profileID) + path := fmt.Sprintf("accounts/%s/dlp/profiles/custom/%s", body.AccountID, profileID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -474,11 +474,6 @@ func (r DLPProfileCustomUpdateParamsSharedEntriesDLPSharedEntryUpdateIntegration type DLPProfileCustomDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r DLPProfileCustomDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type DLPProfileCustomDeleteResponseEnvelope struct { diff --git a/zero_trust/dlpprofilecustom_test.go b/zero_trust/dlpprofilecustom_test.go index 64cea9e783f..55f0e4ecfd5 100644 --- a/zero_trust/dlpprofilecustom_test.go +++ b/zero_trust/dlpprofilecustom_test.go @@ -15,7 +15,6 @@ import ( ) func TestDLPProfileCustomNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -141,7 +140,6 @@ func TestDLPProfileCustomNew(t *testing.T) { } func TestDLPProfileCustomUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -213,7 +211,6 @@ func TestDLPProfileCustomUpdateWithOptionalParams(t *testing.T) { } func TestDLPProfileCustomDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -231,7 +228,6 @@ func TestDLPProfileCustomDelete(t *testing.T) { "384e129d-25bd-403c-8019-bc19eb7a8a5f", zero_trust.DLPProfileCustomDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -244,7 +240,6 @@ func TestDLPProfileCustomDelete(t *testing.T) { } func TestDLPProfileCustomGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/dlpprofilepredefined.go b/zero_trust/dlpprofilepredefined.go index 0a382f5ca9c..66ba754db13 100644 --- a/zero_trust/dlpprofilepredefined.go +++ b/zero_trust/dlpprofilepredefined.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DLPProfilePredefinedService contains methods and other services that help with diff --git a/zero_trust/dlpprofilepredefined_test.go b/zero_trust/dlpprofilepredefined_test.go index e2c30a930b9..0078dc43d8f 100644 --- a/zero_trust/dlpprofilepredefined_test.go +++ b/zero_trust/dlpprofilepredefined_test.go @@ -15,7 +15,6 @@ import ( ) func TestDLPProfilePredefinedUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -60,7 +59,6 @@ func TestDLPProfilePredefinedUpdateWithOptionalParams(t *testing.T) { } func TestDLPProfilePredefinedGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gateway.go b/zero_trust/gateway.go index 25284bb80bf..130da700b97 100644 --- a/zero_trust/gateway.go +++ b/zero_trust/gateway.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // GatewayService contains methods and other services that help with interacting diff --git a/zero_trust/gateway_test.go b/zero_trust/gateway_test.go index ca2f5479242..0df5a93c43c 100644 --- a/zero_trust/gateway_test.go +++ b/zero_trust/gateway_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -41,7 +40,6 @@ func TestGatewayNew(t *testing.T) { } func TestGatewayList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gatewayapptype.go b/zero_trust/gatewayapptype.go index 99ee6217241..c624b08456c 100644 --- a/zero_trust/gatewayapptype.go +++ b/zero_trust/gatewayapptype.go @@ -41,7 +41,7 @@ func (r *GatewayAppTypeService) List(ctx context.Context, query GatewayAppTypeLi opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/gateway/app_types", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/gatewayapptype_test.go b/zero_trust/gatewayapptype_test.go index 739427698e5..7d400cc4ba6 100644 --- a/zero_trust/gatewayapptype_test.go +++ b/zero_trust/gatewayapptype_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayAppTypeList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gatewayauditsshsetting.go b/zero_trust/gatewayauditsshsetting.go index a4415d57ab9..784afebddf6 100644 --- a/zero_trust/gatewayauditsshsetting.go +++ b/zero_trust/gatewayauditsshsetting.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // GatewayAuditSSHSettingService contains methods and other services that help with diff --git a/zero_trust/gatewayauditsshsetting_test.go b/zero_trust/gatewayauditsshsetting_test.go index ba7fc64520d..61dfcc3b884 100644 --- a/zero_trust/gatewayauditsshsetting_test.go +++ b/zero_trust/gatewayauditsshsetting_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayAuditSSHSettingUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestGatewayAuditSSHSettingUpdateWithOptionalParams(t *testing.T) { } func TestGatewayAuditSSHSettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gatewaycategory.go b/zero_trust/gatewaycategory.go index 66975e2256b..8f83dd39ccb 100644 --- a/zero_trust/gatewaycategory.go +++ b/zero_trust/gatewaycategory.go @@ -38,7 +38,7 @@ func (r *GatewayCategoryService) List(ctx context.Context, query GatewayCategory opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/gateway/categories", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/gatewaycategory_test.go b/zero_trust/gatewaycategory_test.go index dffbc158d88..f8e7706d8aa 100644 --- a/zero_trust/gatewaycategory_test.go +++ b/zero_trust/gatewaycategory_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayCategoryList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gatewayconfiguration.go b/zero_trust/gatewayconfiguration.go index 8151e7dd53b..db7c6bd62d4 100644 --- a/zero_trust/gatewayconfiguration.go +++ b/zero_trust/gatewayconfiguration.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // GatewayConfigurationService contains methods and other services that help with diff --git a/zero_trust/gatewayconfiguration_test.go b/zero_trust/gatewayconfiguration_test.go index 0d4e17341fc..619467c27db 100644 --- a/zero_trust/gatewayconfiguration_test.go +++ b/zero_trust/gatewayconfiguration_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayConfigurationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -90,7 +89,6 @@ func TestGatewayConfigurationUpdateWithOptionalParams(t *testing.T) { } func TestGatewayConfigurationEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -165,7 +163,6 @@ func TestGatewayConfigurationEditWithOptionalParams(t *testing.T) { } func TestGatewayConfigurationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gatewaylist.go b/zero_trust/gatewaylist.go index f6ec411ce31..787b004fa1f 100644 --- a/zero_trust/gatewaylist.go +++ b/zero_trust/gatewaylist.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -70,7 +70,7 @@ func (r *GatewayListService) List(ctx context.Context, query GatewayListListPara opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/gateway/lists", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -88,10 +88,10 @@ func (r *GatewayListService) ListAutoPaging(ctx context.Context, query GatewayLi } // Deletes a Zero Trust list. -func (r *GatewayListService) Delete(ctx context.Context, listID string, params GatewayListDeleteParams, opts ...option.RequestOption) (res *GatewayListDeleteResponseUnion, err error) { +func (r *GatewayListService) Delete(ctx context.Context, listID string, body GatewayListDeleteParams, opts ...option.RequestOption) (res *GatewayListDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env GatewayListDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/gateway/lists/%s", params.AccountID, listID) + path := fmt.Sprintf("accounts/%s/gateway/lists/%s", body.AccountID, listID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -427,11 +427,6 @@ type GatewayListListParams struct { type GatewayListDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r GatewayListDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type GatewayListDeleteResponseEnvelope struct { diff --git a/zero_trust/gatewaylist_test.go b/zero_trust/gatewaylist_test.go index 3dc8766ef9d..def73f4ccf5 100644 --- a/zero_trust/gatewaylist_test.go +++ b/zero_trust/gatewaylist_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayListNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -51,7 +50,6 @@ func TestGatewayListNewWithOptionalParams(t *testing.T) { } func TestGatewayListUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -83,7 +81,6 @@ func TestGatewayListUpdateWithOptionalParams(t *testing.T) { } func TestGatewayListList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -109,7 +106,6 @@ func TestGatewayListList(t *testing.T) { } func TestGatewayListDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -127,7 +123,6 @@ func TestGatewayListDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.GatewayListDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -140,7 +135,6 @@ func TestGatewayListDelete(t *testing.T) { } func TestGatewayListEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -178,7 +172,6 @@ func TestGatewayListEditWithOptionalParams(t *testing.T) { } func TestGatewayListGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gatewaylistitem.go b/zero_trust/gatewaylistitem.go index 93aa8795e6e..51c0f687a35 100644 --- a/zero_trust/gatewaylistitem.go +++ b/zero_trust/gatewaylistitem.go @@ -37,7 +37,7 @@ func (r *GatewayListItemService) List(ctx context.Context, listID string, query opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/gateway/lists/%s/items", query.AccountID, listID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/gatewaylistitem_test.go b/zero_trust/gatewaylistitem_test.go index 603526ab09b..d3f3f3084d5 100644 --- a/zero_trust/gatewaylistitem_test.go +++ b/zero_trust/gatewaylistitem_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayListItemList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gatewaylocation.go b/zero_trust/gatewaylocation.go index fcb9ff2e4ed..534409ac1c1 100644 --- a/zero_trust/gatewaylocation.go +++ b/zero_trust/gatewaylocation.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -68,7 +68,7 @@ func (r *GatewayLocationService) List(ctx context.Context, query GatewayLocation opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/gateway/locations", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -86,10 +86,10 @@ func (r *GatewayLocationService) ListAutoPaging(ctx context.Context, query Gatew } // Deletes a configured Zero Trust Gateway location. -func (r *GatewayLocationService) Delete(ctx context.Context, locationID string, params GatewayLocationDeleteParams, opts ...option.RequestOption) (res *GatewayLocationDeleteResponseUnion, err error) { +func (r *GatewayLocationService) Delete(ctx context.Context, locationID string, body GatewayLocationDeleteParams, opts ...option.RequestOption) (res *GatewayLocationDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env GatewayLocationDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/gateway/locations/%s", params.AccountID, locationID) + path := fmt.Sprintf("accounts/%s/gateway/locations/%s", body.AccountID, locationID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -327,11 +327,6 @@ type GatewayLocationListParams struct { type GatewayLocationDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r GatewayLocationDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type GatewayLocationDeleteResponseEnvelope struct { diff --git a/zero_trust/gatewaylocation_test.go b/zero_trust/gatewaylocation_test.go index e0b1ef6b2da..fd05051fa0e 100644 --- a/zero_trust/gatewaylocation_test.go +++ b/zero_trust/gatewaylocation_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayLocationNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -51,7 +50,6 @@ func TestGatewayLocationNewWithOptionalParams(t *testing.T) { } func TestGatewayLocationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -91,7 +89,6 @@ func TestGatewayLocationUpdateWithOptionalParams(t *testing.T) { } func TestGatewayLocationList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -117,7 +114,6 @@ func TestGatewayLocationList(t *testing.T) { } func TestGatewayLocationDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -135,7 +131,6 @@ func TestGatewayLocationDelete(t *testing.T) { "ed35569b41ce4d1facfe683550f54086", zero_trust.GatewayLocationDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -148,7 +143,6 @@ func TestGatewayLocationDelete(t *testing.T) { } func TestGatewayLocationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gatewaylogging.go b/zero_trust/gatewaylogging.go index ce1a5f92829..2e271ead0dd 100644 --- a/zero_trust/gatewaylogging.go +++ b/zero_trust/gatewaylogging.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // GatewayLoggingService contains methods and other services that help with diff --git a/zero_trust/gatewaylogging_test.go b/zero_trust/gatewaylogging_test.go index f22907d333a..8684a34ad39 100644 --- a/zero_trust/gatewaylogging_test.go +++ b/zero_trust/gatewaylogging_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayLoggingUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestGatewayLoggingUpdateWithOptionalParams(t *testing.T) { } func TestGatewayLoggingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gatewayproxyendpoint.go b/zero_trust/gatewayproxyendpoint.go index 13423654bea..9a01e7b1d25 100644 --- a/zero_trust/gatewayproxyendpoint.go +++ b/zero_trust/gatewayproxyendpoint.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -55,7 +55,7 @@ func (r *GatewayProxyEndpointService) List(ctx context.Context, query GatewayPro opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/gateway/proxy_endpoints", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -73,10 +73,10 @@ func (r *GatewayProxyEndpointService) ListAutoPaging(ctx context.Context, query } // Deletes a configured Zero Trust Gateway proxy endpoint. -func (r *GatewayProxyEndpointService) Delete(ctx context.Context, proxyEndpointID string, params GatewayProxyEndpointDeleteParams, opts ...option.RequestOption) (res *GatewayProxyEndpointDeleteResponseUnion, err error) { +func (r *GatewayProxyEndpointService) Delete(ctx context.Context, proxyEndpointID string, body GatewayProxyEndpointDeleteParams, opts ...option.RequestOption) (res *GatewayProxyEndpointDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env GatewayProxyEndpointDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/gateway/proxy_endpoints/%s", params.AccountID, proxyEndpointID) + path := fmt.Sprintf("accounts/%s/gateway/proxy_endpoints/%s", body.AccountID, proxyEndpointID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -226,11 +226,6 @@ type GatewayProxyEndpointListParams struct { type GatewayProxyEndpointDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r GatewayProxyEndpointDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type GatewayProxyEndpointDeleteResponseEnvelope struct { diff --git a/zero_trust/gatewayproxyendpoint_test.go b/zero_trust/gatewayproxyendpoint_test.go index f522e8ef5a5..715b7e36128 100644 --- a/zero_trust/gatewayproxyendpoint_test.go +++ b/zero_trust/gatewayproxyendpoint_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayProxyEndpointNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestGatewayProxyEndpointNew(t *testing.T) { } func TestGatewayProxyEndpointList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestGatewayProxyEndpointList(t *testing.T) { } func TestGatewayProxyEndpointDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -87,7 +84,6 @@ func TestGatewayProxyEndpointDelete(t *testing.T) { "ed35569b41ce4d1facfe683550f54086", zero_trust.GatewayProxyEndpointDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -100,7 +96,6 @@ func TestGatewayProxyEndpointDelete(t *testing.T) { } func TestGatewayProxyEndpointEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -132,7 +127,6 @@ func TestGatewayProxyEndpointEditWithOptionalParams(t *testing.T) { } func TestGatewayProxyEndpointGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/gatewayrule.go b/zero_trust/gatewayrule.go index 7af70bddc06..fd12752d5e7 100644 --- a/zero_trust/gatewayrule.go +++ b/zero_trust/gatewayrule.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -68,7 +68,7 @@ func (r *GatewayRuleService) List(ctx context.Context, query GatewayRuleListPara opts = append(r.Options, opts...) opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...) path := fmt.Sprintf("accounts/%s/gateway/rules", query.AccountID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } @@ -86,10 +86,10 @@ func (r *GatewayRuleService) ListAutoPaging(ctx context.Context, query GatewayRu } // Deletes a Zero Trust Gateway rule. -func (r *GatewayRuleService) Delete(ctx context.Context, ruleID string, params GatewayRuleDeleteParams, opts ...option.RequestOption) (res *GatewayRuleDeleteResponseUnion, err error) { +func (r *GatewayRuleService) Delete(ctx context.Context, ruleID string, body GatewayRuleDeleteParams, opts ...option.RequestOption) (res *GatewayRuleDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env GatewayRuleDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/gateway/rules/%s", params.AccountID, ruleID) + path := fmt.Sprintf("accounts/%s/gateway/rules/%s", body.AccountID, ruleID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -1210,11 +1210,6 @@ type GatewayRuleListParams struct { type GatewayRuleDeleteParams struct { AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r GatewayRuleDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type GatewayRuleDeleteResponseEnvelope struct { diff --git a/zero_trust/gatewayrule_test.go b/zero_trust/gatewayrule_test.go index 1b39f4bbb96..e6eee754854 100644 --- a/zero_trust/gatewayrule_test.go +++ b/zero_trust/gatewayrule_test.go @@ -15,7 +15,6 @@ import ( ) func TestGatewayRuleNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -149,7 +148,6 @@ func TestGatewayRuleNewWithOptionalParams(t *testing.T) { } func TestGatewayRuleUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -287,7 +285,6 @@ func TestGatewayRuleUpdateWithOptionalParams(t *testing.T) { } func TestGatewayRuleList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -313,7 +310,6 @@ func TestGatewayRuleList(t *testing.T) { } func TestGatewayRuleDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -331,7 +327,6 @@ func TestGatewayRuleDelete(t *testing.T) { "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", zero_trust.GatewayRuleDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -344,7 +339,6 @@ func TestGatewayRuleDelete(t *testing.T) { } func TestGatewayRuleGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/identityprovider.go b/zero_trust/identityprovider.go index 1a751fe3c2f..d4f4aaaa9e3 100644 --- a/zero_trust/identityprovider.go +++ b/zero_trust/identityprovider.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -94,7 +94,7 @@ func (r *IdentityProviderService) List(ctx context.Context, query IdentityProvid accountOrZoneID = query.ZoneID } path := fmt.Sprintf("%s/%s/access/identity_providers", accountOrZone, accountOrZoneID) - cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...) + cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, nil, &res, opts...) if err != nil { return nil, err } diff --git a/zero_trust/identityprovider_test.go b/zero_trust/identityprovider_test.go index 9cc3f88cbc1..d2ac7228149 100644 --- a/zero_trust/identityprovider_test.go +++ b/zero_trust/identityprovider_test.go @@ -15,7 +15,7 @@ import ( ) func TestIdentityProviderNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -63,7 +63,7 @@ func TestIdentityProviderNewWithOptionalParams(t *testing.T) { } func TestIdentityProviderUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -115,7 +115,7 @@ func TestIdentityProviderUpdateWithOptionalParams(t *testing.T) { } func TestIdentityProviderListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -142,7 +142,7 @@ func TestIdentityProviderListWithOptionalParams(t *testing.T) { } func TestIdentityProviderDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -173,7 +173,7 @@ func TestIdentityProviderDeleteWithOptionalParams(t *testing.T) { } func TestIdentityProviderGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/networkroute.go b/zero_trust/networkroute.go index 5b05205de66..2578c7d731d 100644 --- a/zero_trust/networkroute.go +++ b/zero_trust/networkroute.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // NetworkRouteService contains methods and other services that help with @@ -143,24 +143,6 @@ func (r routeJSON) RawJSON() string { return r.raw } -type RouteParam struct { - // Optional remark describing the route. - Comment param.Field[string] `json:"comment"` - // Timestamp of when the resource was created. - CreatedAt param.Field[time.Time] `json:"created_at" format:"date-time"` - // Timestamp of when the resource was deleted. If `null`, the resource has not been - // deleted. - DeletedAt param.Field[time.Time] `json:"deleted_at" format:"date-time"` - // The private IPv4 or IPv6 range connected by the route, in CIDR notation. - Network param.Field[string] `json:"network"` - // UUID of the virtual network. - VirtualNetworkID param.Field[string] `json:"virtual_network_id" format:"uuid"` -} - -func (r RouteParam) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r) -} - type Teamnet struct { // UUID of the route. ID string `json:"id"` diff --git a/zero_trust/networkroute_test.go b/zero_trust/networkroute_test.go index 9758c82accc..a9315527d96 100644 --- a/zero_trust/networkroute_test.go +++ b/zero_trust/networkroute_test.go @@ -16,7 +16,6 @@ import ( ) func TestNetworkRouteNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestNetworkRouteNewWithOptionalParams(t *testing.T) { } func TestNetworkRouteListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -82,7 +80,6 @@ func TestNetworkRouteListWithOptionalParams(t *testing.T) { } func TestNetworkRouteDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -112,7 +109,6 @@ func TestNetworkRouteDelete(t *testing.T) { } func TestNetworkRouteEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/networkrouteip.go b/zero_trust/networkrouteip.go index 72867fc846c..b7d794ade4b 100644 --- a/zero_trust/networkrouteip.go +++ b/zero_trust/networkrouteip.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // NetworkRouteIPService contains methods and other services that help with diff --git a/zero_trust/networkrouteip_test.go b/zero_trust/networkrouteip_test.go index 82d48c3e99a..ee48e0d6dea 100644 --- a/zero_trust/networkrouteip_test.go +++ b/zero_trust/networkrouteip_test.go @@ -15,7 +15,6 @@ import ( ) func TestNetworkRouteIPGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/networkroutenetwork.go b/zero_trust/networkroutenetwork.go index bf359c60e43..7c7964c29da 100644 --- a/zero_trust/networkroutenetwork.go +++ b/zero_trust/networkroutenetwork.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // NetworkRouteNetworkService contains methods and other services that help with diff --git a/zero_trust/networkroutenetwork_test.go b/zero_trust/networkroutenetwork_test.go index 1d42308708d..a5f664346a5 100644 --- a/zero_trust/networkroutenetwork_test.go +++ b/zero_trust/networkroutenetwork_test.go @@ -15,7 +15,6 @@ import ( ) func TestNetworkRouteNetworkNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestNetworkRouteNetworkNewWithOptionalParams(t *testing.T) { } func TestNetworkRouteNetworkDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -80,7 +78,6 @@ func TestNetworkRouteNetworkDeleteWithOptionalParams(t *testing.T) { } func TestNetworkRouteNetworkEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/networkvirtualnetwork.go b/zero_trust/networkvirtualnetwork.go index 792ea65fe6e..59a2c2142d0 100644 --- a/zero_trust/networkvirtualnetwork.go +++ b/zero_trust/networkvirtualnetwork.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -75,10 +75,10 @@ func (r *NetworkVirtualNetworkService) ListAutoPaging(ctx context.Context, param } // Deletes an existing virtual network. -func (r *NetworkVirtualNetworkService) Delete(ctx context.Context, virtualNetworkID string, params NetworkVirtualNetworkDeleteParams, opts ...option.RequestOption) (res *NetworkVirtualNetworkDeleteResponseUnion, err error) { +func (r *NetworkVirtualNetworkService) Delete(ctx context.Context, virtualNetworkID string, body NetworkVirtualNetworkDeleteParams, opts ...option.RequestOption) (res *NetworkVirtualNetworkDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env NetworkVirtualNetworkDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/teamnet/virtual_networks/%s", params.AccountID, virtualNetworkID) + path := fmt.Sprintf("accounts/%s/teamnet/virtual_networks/%s", body.AccountID, virtualNetworkID) err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return @@ -300,11 +300,6 @@ func (r NetworkVirtualNetworkListParams) URLQuery() (v url.Values) { type NetworkVirtualNetworkDeleteParams struct { // Cloudflare account ID AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r NetworkVirtualNetworkDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type NetworkVirtualNetworkDeleteResponseEnvelope struct { diff --git a/zero_trust/networkvirtualnetwork_test.go b/zero_trust/networkvirtualnetwork_test.go index 1acfc055793..03608bfa837 100644 --- a/zero_trust/networkvirtualnetwork_test.go +++ b/zero_trust/networkvirtualnetwork_test.go @@ -15,7 +15,6 @@ import ( ) func TestNetworkVirtualNetworkNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestNetworkVirtualNetworkNewWithOptionalParams(t *testing.T) { } func TestNetworkVirtualNetworkListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -74,7 +72,6 @@ func TestNetworkVirtualNetworkListWithOptionalParams(t *testing.T) { } func TestNetworkVirtualNetworkDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -92,7 +89,6 @@ func TestNetworkVirtualNetworkDelete(t *testing.T) { "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.NetworkVirtualNetworkDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -105,7 +101,6 @@ func TestNetworkVirtualNetworkDelete(t *testing.T) { } func TestNetworkVirtualNetworkEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/organization.go b/zero_trust/organization.go index c361263603e..413b842ac43 100644 --- a/zero_trust/organization.go +++ b/zero_trust/organization.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // OrganizationService contains methods and other services that help with diff --git a/zero_trust/organization_test.go b/zero_trust/organization_test.go index e2a06440960..dec682946c4 100644 --- a/zero_trust/organization_test.go +++ b/zero_trust/organization_test.go @@ -15,7 +15,7 @@ import ( ) func TestOrganizationNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -58,7 +58,7 @@ func TestOrganizationNewWithOptionalParams(t *testing.T) { } func TestOrganizationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -105,7 +105,7 @@ func TestOrganizationUpdateWithOptionalParams(t *testing.T) { } func TestOrganizationListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -132,7 +132,7 @@ func TestOrganizationListWithOptionalParams(t *testing.T) { } func TestOrganizationRevokeUsersWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/riskscoring.go b/zero_trust/riskscoring.go index bb004f6fa40..a7c079c43e0 100644 --- a/zero_trust/riskscoring.go +++ b/zero_trust/riskscoring.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/zero_trust/riskscoring_test.go b/zero_trust/riskscoring_test.go index 75642159c99..6cfd078b719 100644 --- a/zero_trust/riskscoring_test.go +++ b/zero_trust/riskscoring_test.go @@ -15,7 +15,6 @@ import ( ) func TestRiskScoringGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestRiskScoringGetWithOptionalParams(t *testing.T) { } func TestRiskScoringReset(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/riskscoringbehaviour.go b/zero_trust/riskscoringbehaviour.go index cfb0ac33a48..d2d976494c5 100644 --- a/zero_trust/riskscoringbehaviour.go +++ b/zero_trust/riskscoringbehaviour.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RiskScoringBehaviourService contains methods and other services that help with diff --git a/zero_trust/riskscoringbehaviour_test.go b/zero_trust/riskscoringbehaviour_test.go index cc3b5e43056..3e6c2e0c742 100644 --- a/zero_trust/riskscoringbehaviour_test.go +++ b/zero_trust/riskscoringbehaviour_test.go @@ -15,7 +15,6 @@ import ( ) func TestRiskScoringBehaviourUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +49,6 @@ func TestRiskScoringBehaviourUpdateWithOptionalParams(t *testing.T) { } func TestRiskScoringBehaviourGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/riskscoringsummary.go b/zero_trust/riskscoringsummary.go index 5e6119315ac..adc66a88854 100644 --- a/zero_trust/riskscoringsummary.go +++ b/zero_trust/riskscoringsummary.go @@ -13,8 +13,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // RiskScoringSummaryService contains methods and other services that help with diff --git a/zero_trust/riskscoringsummary_test.go b/zero_trust/riskscoringsummary_test.go index 45e9f61c126..7e11ba16c6f 100644 --- a/zero_trust/riskscoringsummary_test.go +++ b/zero_trust/riskscoringsummary_test.go @@ -15,7 +15,6 @@ import ( ) func TestRiskScoringSummaryGetWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/seat.go b/zero_trust/seat.go index 92fb1cf91e1..fe3c0198be7 100644 --- a/zero_trust/seat.go +++ b/zero_trust/seat.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SeatService contains methods and other services that help with interacting with diff --git a/zero_trust/seat_test.go b/zero_trust/seat_test.go index b5ff38ff749..64eae5cb4aa 100644 --- a/zero_trust/seat_test.go +++ b/zero_trust/seat_test.go @@ -15,7 +15,7 @@ import ( ) func TestSeatEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") + t.Skip("TODO: investigate broken test") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/tunnel.go b/zero_trust/tunnel.go index 197ec971de3..69b5da83447 100644 --- a/zero_trust/tunnel.go +++ b/zero_trust/tunnel.go @@ -15,8 +15,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -84,11 +84,11 @@ func (r *TunnelService) ListAutoPaging(ctx context.Context, params TunnelListPar } // Deletes an Argo Tunnel from an account. -func (r *TunnelService) Delete(ctx context.Context, tunnelID string, params TunnelDeleteParams, opts ...option.RequestOption) (res *TunnelDeleteResponse, err error) { +func (r *TunnelService) Delete(ctx context.Context, tunnelID string, body TunnelDeleteParams, opts ...option.RequestOption) (res *TunnelDeleteResponse, err error) { opts = append(r.Options[:], opts...) var env TunnelDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/tunnels/%s", params.AccountID, tunnelID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + path := fmt.Sprintf("accounts/%s/tunnels/%s", body.AccountID, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return } @@ -826,11 +826,6 @@ func (r TunnelListParams) URLQuery() (v url.Values) { type TunnelDeleteParams struct { // Cloudflare account ID AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r TunnelDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type TunnelDeleteResponseEnvelope struct { diff --git a/zero_trust/tunnel_test.go b/zero_trust/tunnel_test.go index 3894d09ba10..9d0a963db8a 100644 --- a/zero_trust/tunnel_test.go +++ b/zero_trust/tunnel_test.go @@ -16,7 +16,6 @@ import ( ) func TestTunnelNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -44,7 +43,6 @@ func TestTunnelNew(t *testing.T) { } func TestTunnelListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -81,7 +79,6 @@ func TestTunnelListWithOptionalParams(t *testing.T) { } func TestTunnelDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -99,7 +96,6 @@ func TestTunnelDelete(t *testing.T) { "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.TunnelDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -112,7 +108,6 @@ func TestTunnelDelete(t *testing.T) { } func TestTunnelEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -144,7 +139,6 @@ func TestTunnelEditWithOptionalParams(t *testing.T) { } func TestTunnelGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/tunnelconfiguration.go b/zero_trust/tunnelconfiguration.go index 7612c74a10f..2419ee56fa1 100644 --- a/zero_trust/tunnelconfiguration.go +++ b/zero_trust/tunnelconfiguration.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/zero_trust/tunnelconfiguration_test.go b/zero_trust/tunnelconfiguration_test.go index ffa83258f95..0ce7bf08a0c 100644 --- a/zero_trust/tunnelconfiguration_test.go +++ b/zero_trust/tunnelconfiguration_test.go @@ -15,7 +15,6 @@ import ( ) func TestTunnelConfigurationUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -143,7 +142,6 @@ func TestTunnelConfigurationUpdateWithOptionalParams(t *testing.T) { } func TestTunnelConfigurationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/tunnelconnection.go b/zero_trust/tunnelconnection.go index 7285f174de7..3fbf6bd3394 100644 --- a/zero_trust/tunnelconnection.go +++ b/zero_trust/tunnelconnection.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) @@ -37,11 +37,11 @@ func NewTunnelConnectionService(opts ...option.RequestOption) (r *TunnelConnecti // Removes connections that are in a disconnected or pending reconnect state. We // recommend running this command after shutting down a tunnel. -func (r *TunnelConnectionService) Delete(ctx context.Context, tunnelID string, params TunnelConnectionDeleteParams, opts ...option.RequestOption) (res *TunnelConnectionDeleteResponseUnion, err error) { +func (r *TunnelConnectionService) Delete(ctx context.Context, tunnelID string, body TunnelConnectionDeleteParams, opts ...option.RequestOption) (res *TunnelConnectionDeleteResponseUnion, err error) { opts = append(r.Options[:], opts...) var env TunnelConnectionDeleteResponseEnvelope - path := fmt.Sprintf("accounts/%s/tunnels/%s/connections", params.AccountID, tunnelID) - err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, params, &env, opts...) + path := fmt.Sprintf("accounts/%s/tunnels/%s/connections", body.AccountID, tunnelID) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &env, opts...) if err != nil { return } @@ -178,11 +178,6 @@ func (r TunnelConnectionDeleteResponseArray) ImplementsZeroTrustTunnelConnection type TunnelConnectionDeleteParams struct { // Cloudflare account ID AccountID param.Field[string] `path:"account_id,required"` - Body interface{} `json:"body,required"` -} - -func (r TunnelConnectionDeleteParams) MarshalJSON() (data []byte, err error) { - return apijson.MarshalRoot(r.Body) } type TunnelConnectionDeleteResponseEnvelope struct { diff --git a/zero_trust/tunnelconnection_test.go b/zero_trust/tunnelconnection_test.go index bbb7625efa7..7cab50e2c7c 100644 --- a/zero_trust/tunnelconnection_test.go +++ b/zero_trust/tunnelconnection_test.go @@ -15,7 +15,6 @@ import ( ) func TestTunnelConnectionDelete(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -33,7 +32,6 @@ func TestTunnelConnectionDelete(t *testing.T) { "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.TunnelConnectionDeleteParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), - Body: map[string]interface{}{}, }, ) if err != nil { @@ -46,7 +44,6 @@ func TestTunnelConnectionDelete(t *testing.T) { } func TestTunnelConnectionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/tunnelconnector.go b/zero_trust/tunnelconnector.go index a4cc03469d4..961fa59b9fb 100644 --- a/zero_trust/tunnelconnector.go +++ b/zero_trust/tunnelconnector.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // TunnelConnectorService contains methods and other services that help with diff --git a/zero_trust/tunnelconnector_test.go b/zero_trust/tunnelconnector_test.go index bd83783d553..2f0043daf22 100644 --- a/zero_trust/tunnelconnector_test.go +++ b/zero_trust/tunnelconnector_test.go @@ -15,7 +15,6 @@ import ( ) func TestTunnelConnectorGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/tunnelmanagement.go b/zero_trust/tunnelmanagement.go index 50ae5c622b4..bc048a8deac 100644 --- a/zero_trust/tunnelmanagement.go +++ b/zero_trust/tunnelmanagement.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/zero_trust/tunnelmanagement_test.go b/zero_trust/tunnelmanagement_test.go index 02d7d3e8192..50e7fee993a 100644 --- a/zero_trust/tunnelmanagement_test.go +++ b/zero_trust/tunnelmanagement_test.go @@ -15,7 +15,6 @@ import ( ) func TestTunnelManagementNew(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zero_trust/tunneltoken.go b/zero_trust/tunneltoken.go index 9a04ee58219..5fb11fb1c79 100644 --- a/zero_trust/tunneltoken.go +++ b/zero_trust/tunneltoken.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/tidwall/gjson" ) diff --git a/zero_trust/tunneltoken_test.go b/zero_trust/tunneltoken_test.go index a9d51f44a6c..b59b8f924c8 100644 --- a/zero_trust/tunneltoken_test.go +++ b/zero_trust/tunneltoken_test.go @@ -15,7 +15,6 @@ import ( ) func TestTunnelTokenGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/activationcheck.go b/zones/activationcheck.go index 99a82e212f8..f2c5caeb8eb 100644 --- a/zones/activationcheck.go +++ b/zones/activationcheck.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ActivationCheckService contains methods and other services that help with diff --git a/zones/activationcheck_test.go b/zones/activationcheck_test.go index 36eca7b1ec1..a5f3a38061a 100644 --- a/zones/activationcheck_test.go +++ b/zones/activationcheck_test.go @@ -15,7 +15,6 @@ import ( ) func TestActivationCheckTrigger(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/aliases.go b/zones/aliases.go index 30743453dd3..9b52c9acf7d 100644 --- a/zones/aliases.go +++ b/zones/aliases.go @@ -4,7 +4,7 @@ package zones import ( "github.com/cloudflare/cloudflare-go/v2/internal/apierror" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" + "github.com/cloudflare/cloudflare-go/v2/shared" ) type Error = apierror.Error @@ -44,6 +44,35 @@ type AuditLogOwner = shared.AuditLogOwner // This is an alias to an internal type. type AuditLogResource = shared.AuditLogResource +// The Certificate Authority that will issue the certificate +// +// This is an alias to an internal type. +type CertificateCA = shared.CertificateCA + +// This is an alias to an internal value. +const CertificateCADigicert = shared.CertificateCADigicert + +// This is an alias to an internal value. +const CertificateCAGoogle = shared.CertificateCAGoogle + +// This is an alias to an internal value. +const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt + +// Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), +// or "keyless-certificate" (for Keyless SSL servers). +// +// This is an alias to an internal type. +type CertificateRequestType = shared.CertificateRequestType + +// This is an alias to an internal value. +const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA + +// This is an alias to an internal value. +const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC + +// This is an alias to an internal value. +const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate + // A Cloudflare Tunnel that connects your origin to Cloudflare's edge. // // This is an alias to an internal type. @@ -113,3 +142,14 @@ type ResponseInfo = shared.ResponseInfo // This is an alias to an internal type. type Role = shared.Role + +// Direction to order DNS records in. +// +// This is an alias to an internal type. +type SortDirection = shared.SortDirection + +// This is an alias to an internal value. +const SortDirectionAsc = shared.SortDirectionAsc + +// This is an alias to an internal value. +const SortDirectionDesc = shared.SortDirectionDesc diff --git a/zones/customnameserver.go b/zones/customnameserver.go index 23509dbec0d..cc1744ec156 100644 --- a/zones/customnameserver.go +++ b/zones/customnameserver.go @@ -6,14 +6,12 @@ import ( "context" "fmt" "net/http" - "reflect" "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" - "github.com/tidwall/gjson" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // CustomNameserverService contains methods and other services that help with @@ -39,7 +37,7 @@ func NewCustomNameserverService(opts ...option.RequestOption) (r *CustomNameserv // If you would like new zones in the account to use account custom nameservers by // default, use PUT /accounts/:identifier to set the account setting // use_account_custom_ns_by_default to true. -func (r *CustomNameserverService) Update(ctx context.Context, params CustomNameserverUpdateParams, opts ...option.RequestOption) (res *CustomNameserverUpdateResponseUnion, err error) { +func (r *CustomNameserverService) Update(ctx context.Context, params CustomNameserverUpdateParams, opts ...option.RequestOption) (res *[]CustomNameserverUpdateResponse, err error) { opts = append(r.Options[:], opts...) var env CustomNameserverUpdateResponseEnvelope path := fmt.Sprintf("zones/%s/custom_ns", params.ZoneID) @@ -52,7 +50,7 @@ func (r *CustomNameserverService) Update(ctx context.Context, params CustomNames } // Get metadata for account-level custom nameservers on a zone. -func (r *CustomNameserverService) Get(ctx context.Context, query CustomNameserverGetParams, opts ...option.RequestOption) (res *CustomNameserverGetResponseUnion, err error) { +func (r *CustomNameserverService) Get(ctx context.Context, query CustomNameserverGetParams, opts ...option.RequestOption) (res *[]CustomNameserverGetResponse, err error) { opts = append(r.Options[:], opts...) var env CustomNameserverGetResponseEnvelope path := fmt.Sprintf("zones/%s/custom_ns", query.ZoneID) @@ -64,55 +62,9 @@ func (r *CustomNameserverService) Get(ctx context.Context, query CustomNameserve return } -// Union satisfied by [zones.CustomNameserverUpdateResponseUnknown], -// [zones.CustomNameserverUpdateResponseArray] or [shared.UnionString]. -type CustomNameserverUpdateResponseUnion interface { - ImplementsZonesCustomNameserverUpdateResponseUnion() -} - -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*CustomNameserverUpdateResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(CustomNameserverUpdateResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type CustomNameserverUpdateResponseArray []interface{} - -func (r CustomNameserverUpdateResponseArray) ImplementsZonesCustomNameserverUpdateResponseUnion() {} - -// Union satisfied by [zones.CustomNameserverGetResponseUnknown], -// [zones.CustomNameserverGetResponseArray] or [shared.UnionString]. -type CustomNameserverGetResponseUnion interface { - ImplementsZonesCustomNameserverGetResponseUnion() -} +type CustomNameserverUpdateResponse = interface{} -func init() { - apijson.RegisterUnion( - reflect.TypeOf((*CustomNameserverGetResponseUnion)(nil)).Elem(), - "", - apijson.UnionVariant{ - TypeFilter: gjson.JSON, - Type: reflect.TypeOf(CustomNameserverGetResponseArray{}), - }, - apijson.UnionVariant{ - TypeFilter: gjson.String, - Type: reflect.TypeOf(shared.UnionString("")), - }, - ) -} - -type CustomNameserverGetResponseArray []interface{} - -func (r CustomNameserverGetResponseArray) ImplementsZonesCustomNameserverGetResponseUnion() {} +type CustomNameserverGetResponse = interface{} type CustomNameserverUpdateParams struct { // Identifier @@ -128,11 +80,11 @@ func (r CustomNameserverUpdateParams) MarshalJSON() (data []byte, err error) { } type CustomNameserverUpdateResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomNameserverUpdateResponseUnion `json:"result,required,nullable"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CustomNameserverUpdateResponseEnvelopeSuccess `json:"success,required"` + Result []CustomNameserverUpdateResponse `json:"result,nullable"` ResultInfo CustomNameserverUpdateResponseEnvelopeResultInfo `json:"result_info"` JSON customNameserverUpdateResponseEnvelopeJSON `json:"-"` } @@ -142,8 +94,8 @@ type CustomNameserverUpdateResponseEnvelope struct { type customNameserverUpdateResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field + Result apijson.Field ResultInfo apijson.Field raw string ExtraFields map[string]apijson.Field @@ -209,15 +161,15 @@ type CustomNameserverGetParams struct { } type CustomNameserverGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - Result CustomNameserverGetResponseUnion `json:"result,required,nullable"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success CustomNameserverGetResponseEnvelopeSuccess `json:"success,required"` // Whether zone uses account-level custom nameservers. Enabled bool `json:"enabled"` // The number of the name server set to assign to the zone. NSSet float64 `json:"ns_set"` + Result []CustomNameserverGetResponse `json:"result,nullable"` ResultInfo CustomNameserverGetResponseEnvelopeResultInfo `json:"result_info"` JSON customNameserverGetResponseEnvelopeJSON `json:"-"` } @@ -227,10 +179,10 @@ type CustomNameserverGetResponseEnvelope struct { type customNameserverGetResponseEnvelopeJSON struct { Errors apijson.Field Messages apijson.Field - Result apijson.Field Success apijson.Field Enabled apijson.Field NSSet apijson.Field + Result apijson.Field ResultInfo apijson.Field raw string ExtraFields map[string]apijson.Field diff --git a/zones/customnameserver_test.go b/zones/customnameserver_test.go index 92b61ad5a92..8b91f2a1134 100644 --- a/zones/customnameserver_test.go +++ b/zones/customnameserver_test.go @@ -15,7 +15,6 @@ import ( ) func TestCustomNameserverUpdateWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -43,7 +42,6 @@ func TestCustomNameserverUpdateWithOptionalParams(t *testing.T) { } func TestCustomNameserverGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/dnssetting.go b/zones/dnssetting.go index 1044b666132..843dbfa282f 100644 --- a/zones/dnssetting.go +++ b/zones/dnssetting.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // DNSSettingService contains methods and other services that help with interacting @@ -166,12 +166,8 @@ func (r DNSSettingEditParams) MarshalJSON() (data []byte, err error) { } type DNSSettingEditResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - FoundationDNS interface{} `json:"foundation_dns,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - MultiProvider interface{} `json:"multi_provider,required"` - Nameservers interface{} `json:"nameservers,required"` - SecondaryOverrides interface{} `json:"secondary_overrides,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success DNSSettingEditResponseEnvelopeSuccess `json:"success,required"` Result DNSSetting `json:"result"` @@ -181,16 +177,12 @@ type DNSSettingEditResponseEnvelope struct { // dnsSettingEditResponseEnvelopeJSON contains the JSON metadata for the struct // [DNSSettingEditResponseEnvelope] type dnsSettingEditResponseEnvelopeJSON struct { - Errors apijson.Field - FoundationDNS apijson.Field - Messages apijson.Field - MultiProvider apijson.Field - Nameservers apijson.Field - SecondaryOverrides apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *DNSSettingEditResponseEnvelope) UnmarshalJSON(data []byte) (err error) { @@ -222,12 +214,8 @@ type DNSSettingGetParams struct { } type DNSSettingGetResponseEnvelope struct { - Errors []shared.ResponseInfo `json:"errors,required"` - FoundationDNS interface{} `json:"foundation_dns,required"` - Messages []shared.ResponseInfo `json:"messages,required"` - MultiProvider interface{} `json:"multi_provider,required"` - Nameservers interface{} `json:"nameservers,required"` - SecondaryOverrides interface{} `json:"secondary_overrides,required"` + Errors []shared.ResponseInfo `json:"errors,required"` + Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success DNSSettingGetResponseEnvelopeSuccess `json:"success,required"` Result DNSSetting `json:"result"` @@ -237,16 +225,12 @@ type DNSSettingGetResponseEnvelope struct { // dnsSettingGetResponseEnvelopeJSON contains the JSON metadata for the struct // [DNSSettingGetResponseEnvelope] type dnsSettingGetResponseEnvelopeJSON struct { - Errors apijson.Field - FoundationDNS apijson.Field - Messages apijson.Field - MultiProvider apijson.Field - Nameservers apijson.Field - SecondaryOverrides apijson.Field - Success apijson.Field - Result apijson.Field - raw string - ExtraFields map[string]apijson.Field + Errors apijson.Field + Messages apijson.Field + Success apijson.Field + Result apijson.Field + raw string + ExtraFields map[string]apijson.Field } func (r *DNSSettingGetResponseEnvelope) UnmarshalJSON(data []byte) (err error) { diff --git a/zones/dnssetting_test.go b/zones/dnssetting_test.go index a74202a89cf..6a46603a93c 100644 --- a/zones/dnssetting_test.go +++ b/zones/dnssetting_test.go @@ -15,7 +15,6 @@ import ( ) func TestDNSSettingEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestDNSSettingEditWithOptionalParams(t *testing.T) { } func TestDNSSettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/hold.go b/zones/hold.go index 87d8a219725..631293a4c7c 100644 --- a/zones/hold.go +++ b/zones/hold.go @@ -12,8 +12,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apiquery" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // HoldService contains methods and other services that help with interacting with diff --git a/zones/hold_test.go b/zones/hold_test.go index bebfc691287..12ed5c1378d 100644 --- a/zones/hold_test.go +++ b/zones/hold_test.go @@ -15,7 +15,6 @@ import ( ) func TestHoldNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestHoldNewWithOptionalParams(t *testing.T) { } func TestHoldDeleteWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +67,6 @@ func TestHoldDeleteWithOptionalParams(t *testing.T) { } func TestHoldGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingadvancedddos.go b/zones/settingadvancedddos.go index 5f27e945558..1cabb623e60 100644 --- a/zones/settingadvancedddos.go +++ b/zones/settingadvancedddos.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingAdvancedDDoSService contains methods and other services that help with diff --git a/zones/settingadvancedddos_test.go b/zones/settingadvancedddos_test.go index 7c7345d695a..98bdc6ec032 100644 --- a/zones/settingadvancedddos_test.go +++ b/zones/settingadvancedddos_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingAdvancedDDoSGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingalwaysonline.go b/zones/settingalwaysonline.go index f26dafa2028..ea29879df51 100644 --- a/zones/settingalwaysonline.go +++ b/zones/settingalwaysonline.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingAlwaysOnlineService contains methods and other services that help with diff --git a/zones/settingalwaysonline_test.go b/zones/settingalwaysonline_test.go index 8f96509684c..329a3c8b5b2 100644 --- a/zones/settingalwaysonline_test.go +++ b/zones/settingalwaysonline_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingAlwaysOnlineEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingAlwaysOnlineEdit(t *testing.T) { } func TestSettingAlwaysOnlineGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingalwaysusehttps.go b/zones/settingalwaysusehttps.go index 5424a5fcbc2..fb435bd6c6b 100644 --- a/zones/settingalwaysusehttps.go +++ b/zones/settingalwaysusehttps.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingAlwaysUseHTTPSService contains methods and other services that help with diff --git a/zones/settingalwaysusehttps_test.go b/zones/settingalwaysusehttps_test.go index 5988bcf3864..59a4e649d8b 100644 --- a/zones/settingalwaysusehttps_test.go +++ b/zones/settingalwaysusehttps_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingAlwaysUseHTTPSEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingAlwaysUseHTTPSEdit(t *testing.T) { } func TestSettingAlwaysUseHTTPSGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingautomatichttpsrewrite.go b/zones/settingautomatichttpsrewrite.go index 77a1ec64799..06884392821 100644 --- a/zones/settingautomatichttpsrewrite.go +++ b/zones/settingautomatichttpsrewrite.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingAutomaticHTTPSRewriteService contains methods and other services that diff --git a/zones/settingautomatichttpsrewrite_test.go b/zones/settingautomatichttpsrewrite_test.go index 7f0cf0b4304..3ba2c533c7c 100644 --- a/zones/settingautomatichttpsrewrite_test.go +++ b/zones/settingautomatichttpsrewrite_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingAutomaticHTTPSRewriteEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingAutomaticHTTPSRewriteEdit(t *testing.T) { } func TestSettingAutomaticHTTPSRewriteGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingautomaticplatformoptimization.go b/zones/settingautomaticplatformoptimization.go index 035347ea1b7..8598923d71a 100644 --- a/zones/settingautomaticplatformoptimization.go +++ b/zones/settingautomaticplatformoptimization.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingAutomaticPlatformOptimizationService contains methods and other services diff --git a/zones/settingautomaticplatformoptimization_test.go b/zones/settingautomaticplatformoptimization_test.go index 5613e836463..d8b78efedf2 100644 --- a/zones/settingautomaticplatformoptimization_test.go +++ b/zones/settingautomaticplatformoptimization_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingAutomaticPlatformOptimizationEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestSettingAutomaticPlatformOptimizationEdit(t *testing.T) { } func TestSettingAutomaticPlatformOptimizationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingbrotli.go b/zones/settingbrotli.go index 52d31f5accb..c6e6a1554d0 100644 --- a/zones/settingbrotli.go +++ b/zones/settingbrotli.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingBrotliService contains methods and other services that help with diff --git a/zones/settingbrotli_test.go b/zones/settingbrotli_test.go index 82758f31ddf..fa5a4036979 100644 --- a/zones/settingbrotli_test.go +++ b/zones/settingbrotli_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingBrotliEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingBrotliEdit(t *testing.T) { } func TestSettingBrotliGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingbrowsercachettl.go b/zones/settingbrowsercachettl.go index b87bf1500c1..f336e22909a 100644 --- a/zones/settingbrowsercachettl.go +++ b/zones/settingbrowsercachettl.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingBrowserCacheTTLService contains methods and other services that help with diff --git a/zones/settingbrowsercachettl_test.go b/zones/settingbrowsercachettl_test.go index c55138b3b88..aaf48e569cb 100644 --- a/zones/settingbrowsercachettl_test.go +++ b/zones/settingbrowsercachettl_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingBrowserCacheTTLEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingBrowserCacheTTLEdit(t *testing.T) { } func TestSettingBrowserCacheTTLGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingbrowsercheck.go b/zones/settingbrowsercheck.go index da21bb032ca..a4dd99068dd 100644 --- a/zones/settingbrowsercheck.go +++ b/zones/settingbrowsercheck.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingBrowserCheckService contains methods and other services that help with diff --git a/zones/settingbrowsercheck_test.go b/zones/settingbrowsercheck_test.go index 4c1dfaec1b4..ccfdd0d8489 100644 --- a/zones/settingbrowsercheck_test.go +++ b/zones/settingbrowsercheck_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingBrowserCheckEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingBrowserCheckEdit(t *testing.T) { } func TestSettingBrowserCheckGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingcachelevel.go b/zones/settingcachelevel.go index 67e74300d5d..d595282abfa 100644 --- a/zones/settingcachelevel.go +++ b/zones/settingcachelevel.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingCacheLevelService contains methods and other services that help with diff --git a/zones/settingcachelevel_test.go b/zones/settingcachelevel_test.go index d68ac540476..97c7271fb3c 100644 --- a/zones/settingcachelevel_test.go +++ b/zones/settingcachelevel_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingCacheLevelEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingCacheLevelEdit(t *testing.T) { } func TestSettingCacheLevelGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingchallengettl.go b/zones/settingchallengettl.go index c8c0da23cbb..c74b9b939c9 100644 --- a/zones/settingchallengettl.go +++ b/zones/settingchallengettl.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingChallengeTTLService contains methods and other services that help with diff --git a/zones/settingchallengettl_test.go b/zones/settingchallengettl_test.go index 6cac4f215ec..d73491fd6df 100644 --- a/zones/settingchallengettl_test.go +++ b/zones/settingchallengettl_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingChallengeTTLEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingChallengeTTLEdit(t *testing.T) { } func TestSettingChallengeTTLGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingcipher.go b/zones/settingcipher.go index bf82b30ea00..a77fca14fce 100644 --- a/zones/settingcipher.go +++ b/zones/settingcipher.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingCipherService contains methods and other services that help with diff --git a/zones/settingcipher_test.go b/zones/settingcipher_test.go index 13610188c13..c04cd5bdab0 100644 --- a/zones/settingcipher_test.go +++ b/zones/settingcipher_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingCipherEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingCipherEdit(t *testing.T) { } func TestSettingCipherGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingdevelopmentmode.go b/zones/settingdevelopmentmode.go index 06cabcd39dd..21f6d7a6843 100644 --- a/zones/settingdevelopmentmode.go +++ b/zones/settingdevelopmentmode.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingDevelopmentModeService contains methods and other services that help with diff --git a/zones/settingdevelopmentmode_test.go b/zones/settingdevelopmentmode_test.go index 181bb064811..c20f24f3867 100644 --- a/zones/settingdevelopmentmode_test.go +++ b/zones/settingdevelopmentmode_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingDevelopmentModeEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingDevelopmentModeEdit(t *testing.T) { } func TestSettingDevelopmentModeGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingearlyhint.go b/zones/settingearlyhint.go index 07b563de89e..89c913fe148 100644 --- a/zones/settingearlyhint.go +++ b/zones/settingearlyhint.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingEarlyHintService contains methods and other services that help with diff --git a/zones/settingearlyhint_test.go b/zones/settingearlyhint_test.go index 7c557048192..fe9f33b15c9 100644 --- a/zones/settingearlyhint_test.go +++ b/zones/settingearlyhint_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingEarlyHintEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingEarlyHintEdit(t *testing.T) { } func TestSettingEarlyHintGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingemailobfuscation.go b/zones/settingemailobfuscation.go index 9f1ef855598..7905ffe09a8 100644 --- a/zones/settingemailobfuscation.go +++ b/zones/settingemailobfuscation.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingEmailObfuscationService contains methods and other services that help diff --git a/zones/settingemailobfuscation_test.go b/zones/settingemailobfuscation_test.go index df2b4fd6797..9d322301c8e 100644 --- a/zones/settingemailobfuscation_test.go +++ b/zones/settingemailobfuscation_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingEmailObfuscationEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingEmailObfuscationEdit(t *testing.T) { } func TestSettingEmailObfuscationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingfontsetting.go b/zones/settingfontsetting.go index 4a1d659b853..62d8739945a 100644 --- a/zones/settingfontsetting.go +++ b/zones/settingfontsetting.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingFontSettingService contains methods and other services that help with diff --git a/zones/settingfontsetting_test.go b/zones/settingfontsetting_test.go index 9d2b7d986e2..50415fcc9e5 100644 --- a/zones/settingfontsetting_test.go +++ b/zones/settingfontsetting_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingFontSettingEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingFontSettingEdit(t *testing.T) { } func TestSettingFontSettingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingh2prioritization.go b/zones/settingh2prioritization.go index 016fe71a58c..76ccde50572 100644 --- a/zones/settingh2prioritization.go +++ b/zones/settingh2prioritization.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingH2PrioritizationService contains methods and other services that help diff --git a/zones/settingh2prioritization_test.go b/zones/settingh2prioritization_test.go index 4f31fcf190c..78f58ed01a9 100644 --- a/zones/settingh2prioritization_test.go +++ b/zones/settingh2prioritization_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingH2PrioritizationEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestSettingH2PrioritizationEditWithOptionalParams(t *testing.T) { } func TestSettingH2PrioritizationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settinghotlinkprotection.go b/zones/settinghotlinkprotection.go index 895c763212c..a51fe2cf8cf 100644 --- a/zones/settinghotlinkprotection.go +++ b/zones/settinghotlinkprotection.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingHotlinkProtectionService contains methods and other services that help diff --git a/zones/settinghotlinkprotection_test.go b/zones/settinghotlinkprotection_test.go index 3462d4a6610..6c0b23e1ac5 100644 --- a/zones/settinghotlinkprotection_test.go +++ b/zones/settinghotlinkprotection_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingHotlinkProtectionEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingHotlinkProtectionEdit(t *testing.T) { } func TestSettingHotlinkProtectionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settinghttp2.go b/zones/settinghttp2.go index d237f94828b..5992dd14d08 100644 --- a/zones/settinghttp2.go +++ b/zones/settinghttp2.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingHTTP2Service contains methods and other services that help with diff --git a/zones/settinghttp2_test.go b/zones/settinghttp2_test.go index 175b717cd5b..c2a7b286600 100644 --- a/zones/settinghttp2_test.go +++ b/zones/settinghttp2_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingHTTP2Edit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingHTTP2Edit(t *testing.T) { } func TestSettingHTTP2Get(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settinghttp3.go b/zones/settinghttp3.go index 386c22759f5..e98dce10afe 100644 --- a/zones/settinghttp3.go +++ b/zones/settinghttp3.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingHTTP3Service contains methods and other services that help with diff --git a/zones/settinghttp3_test.go b/zones/settinghttp3_test.go index baa4ce3bcdb..c22904b30ed 100644 --- a/zones/settinghttp3_test.go +++ b/zones/settinghttp3_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingHTTP3Edit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingHTTP3Edit(t *testing.T) { } func TestSettingHTTP3Get(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingimageresizing.go b/zones/settingimageresizing.go index e400db1185c..84824bf9ae0 100644 --- a/zones/settingimageresizing.go +++ b/zones/settingimageresizing.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingImageResizingService contains methods and other services that help with diff --git a/zones/settingimageresizing_test.go b/zones/settingimageresizing_test.go index d3a8470bb9d..26b8f11ad7d 100644 --- a/zones/settingimageresizing_test.go +++ b/zones/settingimageresizing_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingImageResizingEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestSettingImageResizingEditWithOptionalParams(t *testing.T) { } func TestSettingImageResizingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingipgeolocation.go b/zones/settingipgeolocation.go index 848d34bcc80..733f15180d5 100644 --- a/zones/settingipgeolocation.go +++ b/zones/settingipgeolocation.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingIPGeolocationService contains methods and other services that help with diff --git a/zones/settingipgeolocation_test.go b/zones/settingipgeolocation_test.go index 9590c95c797..de34426c82e 100644 --- a/zones/settingipgeolocation_test.go +++ b/zones/settingipgeolocation_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingIPGeolocationEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingIPGeolocationEdit(t *testing.T) { } func TestSettingIPGeolocationGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingipv6.go b/zones/settingipv6.go index 6e8457b5194..b66112ef774 100644 --- a/zones/settingipv6.go +++ b/zones/settingipv6.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingIPV6Service contains methods and other services that help with diff --git a/zones/settingipv6_test.go b/zones/settingipv6_test.go index a415a57355a..0c4676f47db 100644 --- a/zones/settingipv6_test.go +++ b/zones/settingipv6_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingIPV6Edit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingIPV6Edit(t *testing.T) { } func TestSettingIPV6Get(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingminify.go b/zones/settingminify.go index 444f491c30a..91c9d7fb2c9 100644 --- a/zones/settingminify.go +++ b/zones/settingminify.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingMinifyService contains methods and other services that help with diff --git a/zones/settingminify_test.go b/zones/settingminify_test.go index 5443ea161d7..31d38a35d6d 100644 --- a/zones/settingminify_test.go +++ b/zones/settingminify_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingMinifyEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestSettingMinifyEditWithOptionalParams(t *testing.T) { } func TestSettingMinifyGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingmintlsversion.go b/zones/settingmintlsversion.go index 09076d3eee4..dae89bc1dbe 100644 --- a/zones/settingmintlsversion.go +++ b/zones/settingmintlsversion.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingMinTLSVersionService contains methods and other services that help with diff --git a/zones/settingmintlsversion_test.go b/zones/settingmintlsversion_test.go index a54dbfadb9f..49628aea26a 100644 --- a/zones/settingmintlsversion_test.go +++ b/zones/settingmintlsversion_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingMinTLSVersionEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingMinTLSVersionEdit(t *testing.T) { } func TestSettingMinTLSVersionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingmirage.go b/zones/settingmirage.go index 8e9997ae326..cc0963fbda5 100644 --- a/zones/settingmirage.go +++ b/zones/settingmirage.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingMirageService contains methods and other services that help with diff --git a/zones/settingmirage_test.go b/zones/settingmirage_test.go index 472a748bc1e..52b29b901e5 100644 --- a/zones/settingmirage_test.go +++ b/zones/settingmirage_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingMirageEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingMirageEdit(t *testing.T) { } func TestSettingMirageGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingmobileredirect.go b/zones/settingmobileredirect.go index e6d1fbde6ef..1973d3f8b53 100644 --- a/zones/settingmobileredirect.go +++ b/zones/settingmobileredirect.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingMobileRedirectService contains methods and other services that help with diff --git a/zones/settingmobileredirect_test.go b/zones/settingmobileredirect_test.go index 74473fc0648..5b76c1be3e6 100644 --- a/zones/settingmobileredirect_test.go +++ b/zones/settingmobileredirect_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingMobileRedirectEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -46,7 +45,6 @@ func TestSettingMobileRedirectEditWithOptionalParams(t *testing.T) { } func TestSettingMobileRedirectGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingnel.go b/zones/settingnel.go index 0d26f0d7d60..54076ed6338 100644 --- a/zones/settingnel.go +++ b/zones/settingnel.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingNELService contains methods and other services that help with interacting diff --git a/zones/settingnel_test.go b/zones/settingnel_test.go index e3187fd522a..9608e401d66 100644 --- a/zones/settingnel_test.go +++ b/zones/settingnel_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingNELEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -47,7 +46,6 @@ func TestSettingNELEditWithOptionalParams(t *testing.T) { } func TestSettingNELGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingopportunisticencryption.go b/zones/settingopportunisticencryption.go index aee10ccd03f..54a78c7f733 100644 --- a/zones/settingopportunisticencryption.go +++ b/zones/settingopportunisticencryption.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingOpportunisticEncryptionService contains methods and other services that diff --git a/zones/settingopportunisticencryption_test.go b/zones/settingopportunisticencryption_test.go index ed76578f739..9b07abd94ed 100644 --- a/zones/settingopportunisticencryption_test.go +++ b/zones/settingopportunisticencryption_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingOpportunisticEncryptionEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingOpportunisticEncryptionEdit(t *testing.T) { } func TestSettingOpportunisticEncryptionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingopportunisticonion.go b/zones/settingopportunisticonion.go index 62594310409..e26981541de 100644 --- a/zones/settingopportunisticonion.go +++ b/zones/settingopportunisticonion.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingOpportunisticOnionService contains methods and other services that help diff --git a/zones/settingopportunisticonion_test.go b/zones/settingopportunisticonion_test.go index 7cedd455c2a..1227c220b15 100644 --- a/zones/settingopportunisticonion_test.go +++ b/zones/settingopportunisticonion_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingOpportunisticOnionEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingOpportunisticOnionEdit(t *testing.T) { } func TestSettingOpportunisticOnionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingorangetoorange.go b/zones/settingorangetoorange.go index 56e1c6d18a8..fb2f2dd6b4a 100644 --- a/zones/settingorangetoorange.go +++ b/zones/settingorangetoorange.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingOrangeToOrangeService contains methods and other services that help with diff --git a/zones/settingorangetoorange_test.go b/zones/settingorangetoorange_test.go index dfed5834f13..9f9685aacc0 100644 --- a/zones/settingorangetoorange_test.go +++ b/zones/settingorangetoorange_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingOrangeToOrangeEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestSettingOrangeToOrangeEditWithOptionalParams(t *testing.T) { } func TestSettingOrangeToOrangeGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingoriginerrorpagepassthru.go b/zones/settingoriginerrorpagepassthru.go index cfad8d96a53..dbf55d78291 100644 --- a/zones/settingoriginerrorpagepassthru.go +++ b/zones/settingoriginerrorpagepassthru.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingOriginErrorPagePassThruService contains methods and other services that diff --git a/zones/settingoriginerrorpagepassthru_test.go b/zones/settingoriginerrorpagepassthru_test.go index e99a2fa494d..e3291bbbf10 100644 --- a/zones/settingoriginerrorpagepassthru_test.go +++ b/zones/settingoriginerrorpagepassthru_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingOriginErrorPagePassThruEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingOriginErrorPagePassThruEdit(t *testing.T) { } func TestSettingOriginErrorPagePassThruGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingoriginmaxhttpversion.go b/zones/settingoriginmaxhttpversion.go index 66242bf3ab2..c9b8e211d22 100644 --- a/zones/settingoriginmaxhttpversion.go +++ b/zones/settingoriginmaxhttpversion.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingOriginMaxHTTPVersionService contains methods and other services that help diff --git a/zones/settingoriginmaxhttpversion_test.go b/zones/settingoriginmaxhttpversion_test.go index 97775b7e58d..13e585135fd 100644 --- a/zones/settingoriginmaxhttpversion_test.go +++ b/zones/settingoriginmaxhttpversion_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingOriginMaxHTTPVersionEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingOriginMaxHTTPVersionEdit(t *testing.T) { } func TestSettingOriginMaxHTTPVersionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingpolish.go b/zones/settingpolish.go index 8952f4c2ff3..4fcdf015414 100644 --- a/zones/settingpolish.go +++ b/zones/settingpolish.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingPolishService contains methods and other services that help with diff --git a/zones/settingpolish_test.go b/zones/settingpolish_test.go index a43ad239246..f63ac3ac705 100644 --- a/zones/settingpolish_test.go +++ b/zones/settingpolish_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingPolishEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestSettingPolishEditWithOptionalParams(t *testing.T) { } func TestSettingPolishGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingprefetchpreload.go b/zones/settingprefetchpreload.go index a04e4601bde..6efce57a541 100644 --- a/zones/settingprefetchpreload.go +++ b/zones/settingprefetchpreload.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingPrefetchPreloadService contains methods and other services that help with diff --git a/zones/settingprefetchpreload_test.go b/zones/settingprefetchpreload_test.go index 2b4c1ed412a..2cbb4555c02 100644 --- a/zones/settingprefetchpreload_test.go +++ b/zones/settingprefetchpreload_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingPrefetchPreloadEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingPrefetchPreloadEdit(t *testing.T) { } func TestSettingPrefetchPreloadGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingproxyreadtimeout.go b/zones/settingproxyreadtimeout.go index f224c58f92c..a7bc5491423 100644 --- a/zones/settingproxyreadtimeout.go +++ b/zones/settingproxyreadtimeout.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingProxyReadTimeoutService contains methods and other services that help diff --git a/zones/settingproxyreadtimeout_test.go b/zones/settingproxyreadtimeout_test.go index aaf8688af73..f6d8c3cdd96 100644 --- a/zones/settingproxyreadtimeout_test.go +++ b/zones/settingproxyreadtimeout_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingProxyReadTimeoutEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestSettingProxyReadTimeoutEditWithOptionalParams(t *testing.T) { } func TestSettingProxyReadTimeoutGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingpseudoipv4.go b/zones/settingpseudoipv4.go index 3096f2f582c..41afe258988 100644 --- a/zones/settingpseudoipv4.go +++ b/zones/settingpseudoipv4.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingPseudoIPV4Service contains methods and other services that help with diff --git a/zones/settingpseudoipv4_test.go b/zones/settingpseudoipv4_test.go index abff46bbbdb..a7364e5993f 100644 --- a/zones/settingpseudoipv4_test.go +++ b/zones/settingpseudoipv4_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingPseudoIPV4Edit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingPseudoIPV4Edit(t *testing.T) { } func TestSettingPseudoIPV4Get(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingresponsebuffering.go b/zones/settingresponsebuffering.go index 4199ed956d2..b00528882ff 100644 --- a/zones/settingresponsebuffering.go +++ b/zones/settingresponsebuffering.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingResponseBufferingService contains methods and other services that help diff --git a/zones/settingresponsebuffering_test.go b/zones/settingresponsebuffering_test.go index c655f89535c..0c86fd37336 100644 --- a/zones/settingresponsebuffering_test.go +++ b/zones/settingresponsebuffering_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingResponseBufferingEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingResponseBufferingEdit(t *testing.T) { } func TestSettingResponseBufferingGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingrocketloader.go b/zones/settingrocketloader.go index 9aee7a9baac..b51a63ee634 100644 --- a/zones/settingrocketloader.go +++ b/zones/settingrocketloader.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingRocketLoaderService contains methods and other services that help with diff --git a/zones/settingrocketloader_test.go b/zones/settingrocketloader_test.go index 80aa014fa02..9d98f0033c7 100644 --- a/zones/settingrocketloader_test.go +++ b/zones/settingrocketloader_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingRocketLoaderEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestSettingRocketLoaderEditWithOptionalParams(t *testing.T) { } func TestSettingRocketLoaderGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingsecurityheader.go b/zones/settingsecurityheader.go index 52447c988b7..b480645f608 100644 --- a/zones/settingsecurityheader.go +++ b/zones/settingsecurityheader.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingSecurityHeaderService contains methods and other services that help with diff --git a/zones/settingsecurityheader_test.go b/zones/settingsecurityheader_test.go index 2d5ff83cdc6..ffb43b33e04 100644 --- a/zones/settingsecurityheader_test.go +++ b/zones/settingsecurityheader_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingSecurityHeaderEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +48,6 @@ func TestSettingSecurityHeaderEditWithOptionalParams(t *testing.T) { } func TestSettingSecurityHeaderGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingsecuritylevel.go b/zones/settingsecuritylevel.go index 6242a6d3434..9955e94771a 100644 --- a/zones/settingsecuritylevel.go +++ b/zones/settingsecuritylevel.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingSecurityLevelService contains methods and other services that help with diff --git a/zones/settingsecuritylevel_test.go b/zones/settingsecuritylevel_test.go index a1d85924e5c..f23fd5fb356 100644 --- a/zones/settingsecuritylevel_test.go +++ b/zones/settingsecuritylevel_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingSecurityLevelEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingSecurityLevelEdit(t *testing.T) { } func TestSettingSecurityLevelGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingserversideexclude.go b/zones/settingserversideexclude.go index 88a335e1225..705f4b6fd67 100644 --- a/zones/settingserversideexclude.go +++ b/zones/settingserversideexclude.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingServerSideExcludeService contains methods and other services that help diff --git a/zones/settingserversideexclude_test.go b/zones/settingserversideexclude_test.go index 44ff638ded4..fee585a6e77 100644 --- a/zones/settingserversideexclude_test.go +++ b/zones/settingserversideexclude_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingServerSideExcludeEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingServerSideExcludeEdit(t *testing.T) { } func TestSettingServerSideExcludeGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingsortquerystringforcache.go b/zones/settingsortquerystringforcache.go index 05466ecd1f1..882427d1a6a 100644 --- a/zones/settingsortquerystringforcache.go +++ b/zones/settingsortquerystringforcache.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingSortQueryStringForCacheService contains methods and other services that diff --git a/zones/settingsortquerystringforcache_test.go b/zones/settingsortquerystringforcache_test.go index f2d31f7ac84..b3dd9d8a958 100644 --- a/zones/settingsortquerystringforcache_test.go +++ b/zones/settingsortquerystringforcache_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingSortQueryStringForCacheEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingSortQueryStringForCacheEdit(t *testing.T) { } func TestSettingSortQueryStringForCacheGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingssl.go b/zones/settingssl.go index 911c6074e66..af5e6111f3d 100644 --- a/zones/settingssl.go +++ b/zones/settingssl.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingSSLService contains methods and other services that help with interacting diff --git a/zones/settingssl_test.go b/zones/settingssl_test.go index 69309ab14d4..ba1f25ff77c 100644 --- a/zones/settingssl_test.go +++ b/zones/settingssl_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingSSLEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingSSLEdit(t *testing.T) { } func TestSettingSSLGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingsslrecommender.go b/zones/settingsslrecommender.go index b560cdcff0e..32bd1b6103c 100644 --- a/zones/settingsslrecommender.go +++ b/zones/settingsslrecommender.go @@ -10,8 +10,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingSSLRecommenderService contains methods and other services that help with diff --git a/zones/settingsslrecommender_test.go b/zones/settingsslrecommender_test.go index e4ecc3a40ae..888e7f831d6 100644 --- a/zones/settingsslrecommender_test.go +++ b/zones/settingsslrecommender_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingSSLRecommenderEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -45,7 +44,6 @@ func TestSettingSSLRecommenderEditWithOptionalParams(t *testing.T) { } func TestSettingSSLRecommenderGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingtls13.go b/zones/settingtls13.go index ae4588277b7..af48d573f13 100644 --- a/zones/settingtls13.go +++ b/zones/settingtls13.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingTLS1_3Service contains methods and other services that help with diff --git a/zones/settingtls13_test.go b/zones/settingtls13_test.go index 1ccad879a2c..f523aadafee 100644 --- a/zones/settingtls13_test.go +++ b/zones/settingtls13_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingTLS1_3Edit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingTLS1_3Edit(t *testing.T) { } func TestSettingTLS1_3Get(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingtlsclientauth.go b/zones/settingtlsclientauth.go index dd664490187..ff1640cbc09 100644 --- a/zones/settingtlsclientauth.go +++ b/zones/settingtlsclientauth.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingTLSClientAuthService contains methods and other services that help with diff --git a/zones/settingtlsclientauth_test.go b/zones/settingtlsclientauth_test.go index 0aa368b613c..fa6580e10db 100644 --- a/zones/settingtlsclientauth_test.go +++ b/zones/settingtlsclientauth_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingTLSClientAuthEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingTLSClientAuthEdit(t *testing.T) { } func TestSettingTLSClientAuthGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingtrueclientipheader.go b/zones/settingtrueclientipheader.go index 10fae504b73..f6151e714a5 100644 --- a/zones/settingtrueclientipheader.go +++ b/zones/settingtrueclientipheader.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingTrueClientIPHeaderService contains methods and other services that help diff --git a/zones/settingtrueclientipheader_test.go b/zones/settingtrueclientipheader_test.go index 02135c9ca88..6a41c3d631e 100644 --- a/zones/settingtrueclientipheader_test.go +++ b/zones/settingtrueclientipheader_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingTrueClientIPHeaderEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingTrueClientIPHeaderEdit(t *testing.T) { } func TestSettingTrueClientIPHeaderGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingwaf.go b/zones/settingwaf.go index 04e7866b474..505c2420a66 100644 --- a/zones/settingwaf.go +++ b/zones/settingwaf.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingWAFService contains methods and other services that help with interacting diff --git a/zones/settingwaf_test.go b/zones/settingwaf_test.go index a0d703798f9..22bbdaf70c9 100644 --- a/zones/settingwaf_test.go +++ b/zones/settingwaf_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingWAFEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingWAFEdit(t *testing.T) { } func TestSettingWAFGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingwebp.go b/zones/settingwebp.go index 4d7bb7ac507..a3acddb9b04 100644 --- a/zones/settingwebp.go +++ b/zones/settingwebp.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingWebPService contains methods and other services that help with diff --git a/zones/settingwebp_test.go b/zones/settingwebp_test.go index e7991c284be..76f6773bb9c 100644 --- a/zones/settingwebp_test.go +++ b/zones/settingwebp_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingWebPEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingWebPEdit(t *testing.T) { } func TestSettingWebPGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingwebsocket.go b/zones/settingwebsocket.go index 24b1f33c510..5233be31ae3 100644 --- a/zones/settingwebsocket.go +++ b/zones/settingwebsocket.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingWebsocketService contains methods and other services that help with diff --git a/zones/settingwebsocket_test.go b/zones/settingwebsocket_test.go index b7366f67e3f..fc1810779cb 100644 --- a/zones/settingwebsocket_test.go +++ b/zones/settingwebsocket_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingWebsocketEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingWebsocketEdit(t *testing.T) { } func TestSettingWebsocketGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/settingzerortt.go b/zones/settingzerortt.go index 50780504a4d..4a45e332265 100644 --- a/zones/settingzerortt.go +++ b/zones/settingzerortt.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // SettingZeroRTTService contains methods and other services that help with diff --git a/zones/settingzerortt_test.go b/zones/settingzerortt_test.go index 16cd8ce94cb..1355544f33b 100644 --- a/zones/settingzerortt_test.go +++ b/zones/settingzerortt_test.go @@ -15,7 +15,6 @@ import ( ) func TestSettingZeroRTTEdit(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -42,7 +41,6 @@ func TestSettingZeroRTTEdit(t *testing.T) { } func TestSettingZeroRTTGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/subscription.go b/zones/subscription.go index d0a6ca15958..e38b4deb29d 100644 --- a/zones/subscription.go +++ b/zones/subscription.go @@ -11,8 +11,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/apijson" "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" "github.com/cloudflare/cloudflare-go/v2/user" "github.com/tidwall/gjson" ) diff --git a/zones/subscription_test.go b/zones/subscription_test.go index 36e8c6cc36c..95fb8e05282 100644 --- a/zones/subscription_test.go +++ b/zones/subscription_test.go @@ -16,7 +16,6 @@ import ( ) func TestSubscriptionNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -77,7 +76,6 @@ func TestSubscriptionNewWithOptionalParams(t *testing.T) { } func TestSubscriptionList(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -101,7 +99,6 @@ func TestSubscriptionList(t *testing.T) { } func TestSubscriptionGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/zones/zone.go b/zones/zone.go index e87b85ac196..8a094c3e72c 100644 --- a/zones/zone.go +++ b/zones/zone.go @@ -14,8 +14,8 @@ import ( "github.com/cloudflare/cloudflare-go/v2/internal/pagination" "github.com/cloudflare/cloudflare-go/v2/internal/param" "github.com/cloudflare/cloudflare-go/v2/internal/requestconfig" - "github.com/cloudflare/cloudflare-go/v2/internal/shared" "github.com/cloudflare/cloudflare-go/v2/option" + "github.com/cloudflare/cloudflare-go/v2/shared" ) // ZoneService contains methods and other services that help with interacting with @@ -122,6 +122,24 @@ func (r *ZoneService) Get(ctx context.Context, query ZoneGetParams, opts ...opti return } +// A full zone implies that DNS is hosted with Cloudflare. A partial zone is +// typically a partner-hosted zone or a CNAME setup. +type Type string + +const ( + TypeFull Type = "full" + TypePartial Type = "partial" + TypeSecondary Type = "secondary" +) + +func (r Type) IsKnown() bool { + switch r { + case TypeFull, TypePartial, TypeSecondary: + return true + } + return false +} + type Zone struct { // Identifier ID string `json:"id,required"` @@ -141,10 +159,11 @@ type Zone struct { ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` // The domain name Name string `json:"name,required"` + // The name servers Cloudflare assigns to a zone + NameServers []string `json:"name_servers,required" format:"hostname"` // DNS host at the time of switching to Cloudflare OriginalDnshost string `json:"original_dnshost,required,nullable"` - // Original name servers before moving to Cloudflare Notes: Is this only available - // for full zones? + // Original name servers before moving to Cloudflare OriginalNameServers []string `json:"original_name_servers,required,nullable" format:"hostname"` // Registrar for the domain at the time of switching to Cloudflare OriginalRegistrar string `json:"original_registrar,required,nullable"` @@ -166,6 +185,7 @@ type zoneJSON struct { Meta apijson.Field ModifiedOn apijson.Field Name apijson.Field + NameServers apijson.Field OriginalDnshost apijson.Field OriginalNameServers apijson.Field OriginalRegistrar apijson.Field @@ -303,7 +323,7 @@ type ZoneNewParams struct { Name param.Field[string] `json:"name,required"` // A full zone implies that DNS is hosted with Cloudflare. A partial zone is // typically a partner-hosted zone or a CNAME setup. - Type param.Field[ZoneNewParamsType] `json:"type"` + Type param.Field[Type] `json:"type"` } func (r ZoneNewParams) MarshalJSON() (data []byte, err error) { @@ -319,24 +339,6 @@ func (r ZoneNewParamsAccount) MarshalJSON() (data []byte, err error) { return apijson.MarshalRoot(r) } -// A full zone implies that DNS is hosted with Cloudflare. A partial zone is -// typically a partner-hosted zone or a CNAME setup. -type ZoneNewParamsType string - -const ( - ZoneNewParamsTypeFull ZoneNewParamsType = "full" - ZoneNewParamsTypePartial ZoneNewParamsType = "partial" - ZoneNewParamsTypeSecondary ZoneNewParamsType = "secondary" -) - -func (r ZoneNewParamsType) IsKnown() bool { - switch r { - case ZoneNewParamsTypeFull, ZoneNewParamsTypePartial, ZoneNewParamsTypeSecondary: - return true - } - return false -} - type ZoneNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` diff --git a/zones/zone_test.go b/zones/zone_test.go index b88e6d11777..5235fb68f81 100644 --- a/zones/zone_test.go +++ b/zones/zone_test.go @@ -15,7 +15,6 @@ import ( ) func TestZoneNewWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -33,7 +32,7 @@ func TestZoneNewWithOptionalParams(t *testing.T) { ID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }), Name: cloudflare.F("example.com"), - Type: cloudflare.F(zones.ZoneNewParamsTypeFull), + Type: cloudflare.F(zones.TypeFull), }) if err != nil { var apierr *cloudflare.Error @@ -45,7 +44,6 @@ func TestZoneNewWithOptionalParams(t *testing.T) { } func TestZoneListWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -107,7 +105,6 @@ func TestZoneDelete(t *testing.T) { } func TestZoneEditWithOptionalParams(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -138,7 +135,6 @@ func TestZoneEditWithOptionalParams(t *testing.T) { } func TestZoneGet(t *testing.T) { - t.Skip("skipped: tests are disabled for the time being") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL