diff --git a/.github/workflows/update_api.yml b/.github/workflows/update_api.yml new file mode 100644 index 00000000..d5319cfa --- /dev/null +++ b/.github/workflows/update_api.yml @@ -0,0 +1,59 @@ +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 + uses: jacobtomlinson/gha-find-replace@v3 + with: + find: "- Your contribution here." + replace: "- Updated opensearch-py to reflect the latest OpenSearch API spec." + include: "**CHANGELOG.md" + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: GitHub App token + if: ${{ github.repository == 'saimedhi/opensearch-py' }} + 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/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json) + Date: ${{ steps.date.outputs.date }} + branch: automated-api-update + base: main + signoff: true + labels: | + autocut diff --git a/CHANGELOG.md b/CHANGELOG.md index 40563c66..0f16f5b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Incorporated API generation into CI workflow and fixed 'generate' nox session ([#660](https://github.com/opensearch-project/opensearch-py/pull/660)) ### Changed - Updated the `get_policy` API in the index_management plugin to allow the policy_id argument as optional ([#633](https://github.com/opensearch-project/opensearch-py/pull/633)) +### Automated API Update +- Updated opensearch-py to reflect the latest OpenSearch API spec. ### Deprecated ### Removed - Removed unnecessary `# -*- coding: utf-8 -*-` headers from .py files ([#615](https://github.com/opensearch-project/opensearch-py/pull/615), [#617](https://github.com/opensearch-project/opensearch-py/pull/617)) diff --git a/noxfile.py b/noxfile.py index 1b261fe0..3dd8fea0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -74,7 +74,7 @@ def format(session: Any) -> None: session.run("black", *SOURCE_FILES) session.run("python", "utils/license_headers.py", "fix", *SOURCE_FILES) - session.notify("lint") + # session.notify("lint") @nox.session(python=["3.7"]) # type: ignore 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, )