diff --git a/.github/workflows/update_api.yml b/.github/workflows/update_api.yml new file mode 100644 index 00000000..dd0c6728 --- /dev/null +++ b/.github/workflows/update_api.yml @@ -0,0 +1,57 @@ +name: Update API +on: + workflow_dispatch: + schedule: + - cron: "30 3 * * *" +jobs: + update-api: + if: ${{ github.repository == 'saimedhi/opensearch-py' }} + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + - name: Config git to rebase + run: git config --global pull.rebase true + - name: Set up Python 3.7 + uses: actions/setup-python@v4 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python3.7 -m pip install nox + - name: Generate API + run: nox -s generate + - name: Update CHANGELOG + run: | + start_line=$(grep -n '## \[Unreleased\]' CHANGELOG.md | cut -d: -f1) + end_line=$(awk '/^## \[/ {print NR; exit}' CHANGELOG.md || wc -l < CHANGELOG.md) + sed -i "${start_line},${end_line}s/### Updated APIs/### Updated APIs\n- Updated opensearch-py to reflect the latest OpenSearch API spec./" CHANGELOG.md + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: GitHub App token + id: github_app_token + uses: tibdex/github-app-token@v2.1.0 + with: + app_id: ${{ secrets.CI_APP_ID }} + private_key: ${{ secrets.CI_APP_PRIVATE_KEY }} + - name: Create pull request + id: cpr + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ steps.github_app_token.outputs.token }} + commit-message: Updated opensearch-py to reflect the latest OpenSearch API spec (${{ steps.date.outputs.date }}) + title: Updated opensearch-py to reflect the latest OpenSearch API spec + body: | + Updated [opensearch-py](https://github.com/saimedhi/opensearch-py) to reflect the latest [OpenSearch API spec](https://github.com/saimedhi/opensearch-api-specification/blob/main/OpenSearch.openapi.json) + Date: ${{ steps.date.outputs.date }} + branch: automated-api-update + base: main + signoff: true + labels: | + autocut \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f4ce00af..3e3cb3a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Fixed - Fix KeyError when scroll return no hits ([#616](https://github.com/opensearch-project/opensearch-py/pull/616)) - Fix reuse of `OpenSearch` using `Urllib3HttpConnection` and `AsyncOpenSearch` after calling `close` ([#639](https://github.com/opensearch-project/opensearch-py/pull/639)) +### Updated APIs ### Security ### Dependencies - Bumps `pytest-asyncio` from <=0.21.1 to <=0.23.4 @@ -35,6 +36,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fix `TypeError` on `parallel_bulk` ([#601](https://github.com/opensearch-project/opensearch-py/pull/601)) - Fix Amazon OpenSearch Serverless integration with LangChain ([#603](https://github.com/opensearch-project/opensearch-py/pull/603)) - Fix type of `Field.__setattr__` ([604](https://github.com/opensearch-project/opensearch-py/pull/604)) +### Updated APIs ### Security ## [2.4.1] @@ -218,4 +220,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) [2.2.0]: https://github.com/opensearch-project/opensearch-py/compare/v2.1.1...v2.2.0 [2.1.1]: https://github.com/opensearch-project/opensearch-py/compare/v2.1.0...v2.1.1 [2.1.0]: https://github.com/opensearch-project/opensearch-py/compare/v2.0.1...v2.1.0 -[2.0.1]: https://github.com/opensearch-project/opensearch-py/compare/v2.0.0...v2.0.1 \ No newline at end of file +[2.0.1]: https://github.com/opensearch-project/opensearch-py/compare/v2.0.0...v2.0.1 diff --git a/opensearchpy/_async/client/cluster.py b/opensearchpy/_async/client/cluster.py index 70d93cf8..c47aef07 100644 --- a/opensearchpy/_async/client/cluster.py +++ b/opensearchpy/_async/client/cluster.py @@ -530,10 +530,7 @@ async def delete_decommission_awareness( """ return await self.transport.perform_request( - "DELETE", - "/_cluster/decommission/awareness/", - params=params, - headers=headers, + "DELETE", "/_cluster/decommission/awareness", params=params, headers=headers ) @query_params() diff --git a/opensearchpy/_async/client/security.py b/opensearchpy/_async/client/security.py index c5b9f2ca..6b8c2026 100644 --- a/opensearchpy/_async/client/security.py +++ b/opensearchpy/_async/client/security.py @@ -98,7 +98,7 @@ async def get_action_groups( """ return await self.transport.perform_request( "GET", - "/_plugins/_security/api/actiongroups/", + "/_plugins/_security/api/actiongroups", params=params, headers=headers, ) diff --git a/opensearchpy/client/cluster.py b/opensearchpy/client/cluster.py index fc49f266..6af86a91 100644 --- a/opensearchpy/client/cluster.py +++ b/opensearchpy/client/cluster.py @@ -530,10 +530,7 @@ def delete_decommission_awareness( """ return self.transport.perform_request( - "DELETE", - "/_cluster/decommission/awareness/", - params=params, - headers=headers, + "DELETE", "/_cluster/decommission/awareness", params=params, headers=headers ) @query_params() diff --git a/opensearchpy/client/security.py b/opensearchpy/client/security.py index d7b76a90..66a365fd 100644 --- a/opensearchpy/client/security.py +++ b/opensearchpy/client/security.py @@ -98,7 +98,7 @@ def get_action_groups( """ return self.transport.perform_request( "GET", - "/_plugins/_security/api/actiongroups/", + "/_plugins/_security/api/actiongroups", params=params, headers=headers, )