From cacd64fa8e330924d8f645a25cae2d69ec817cb4 Mon Sep 17 00:00:00 2001 From: Simon Melotte Date: Wed, 3 Jul 2024 15:42:04 +0200 Subject: [PATCH] add enfocement rules endpoint --- .github/workflows/pylint.yml | 7 ++++++- prismacloud/api/pccs/__init__.py | 1 + prismacloud/api/pccs/_rules.py | 18 ++++++++++++++++++ prismacloud/api/version.py | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 prismacloud/api/pccs/_rules.py diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 08987b1..a5436fb 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -17,22 +17,27 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} + - name: Install Dependencies run: | python -m pip install --upgrade pip pip install pylint pip install -r requirements.txt pip install build + - name: Test API run: | pylint prismacloud/api + - name: Test Scripts run: | python -m build - pip install dist/prismacloud_api-* + # pip install dist/prismacloud_api-* + pip install dist/prismacloud_api-*.whl # Only install the wheel file pip install -r scripts/requirements.txt pylint scripts/*.py diff --git a/prismacloud/api/pccs/__init__.py b/prismacloud/api/pccs/__init__.py index 7d01a57..2dbe3b6 100644 --- a/prismacloud/api/pccs/__init__.py +++ b/prismacloud/api/pccs/__init__.py @@ -7,6 +7,7 @@ from ._errors import * from ._fixes import * from ._repositories import * +from ._rules import * from ._scans import * from ._suppressions import * from ._packages import * diff --git a/prismacloud/api/pccs/_rules.py b/prismacloud/api/pccs/_rules.py new file mode 100644 index 0000000..e164358 --- /dev/null +++ b/prismacloud/api/pccs/_rules.py @@ -0,0 +1,18 @@ +""" Prisma Cloud Code Security enforcement-rules Endpoints Class """ + +# enforcement-rules + +class SuppressionsPrismaCloudAPIPCCSMixin: + """ Prisma Cloud Code Security API Suppressions Endpoints Class """ + + def enforcement_rules_read(self): + return self.execute_code_security('GET', 'code/api/v1/enforcement-rules') + + def enforcement_rules_update(self, rules): + return self.execute_code_security('PUT', 'code/api/v1/enforcement-rules', body_params=rules) + + def enforcement_rules_exception_create(self, policy_id, rule): + return self.execute_code_security('POST', 'code/api/v1/enforcement-rules', body_params=rule) + + def enforcement_rules_exception_delete(self, rule_id): + return self.execute_code_security('DELETE', 'code/api/v1/enforcement-rules/%s' % (rule_id)) diff --git a/prismacloud/api/version.py b/prismacloud/api/version.py index 698394c..f7e1619 100644 --- a/prismacloud/api/version.py +++ b/prismacloud/api/version.py @@ -1 +1 @@ -version = "5.2.22" +version = "5.2.23"