From 52851fb707a7851c145a675ac261433dbcf1183d Mon Sep 17 00:00:00 2001 From: tkishel Date: Wed, 20 Jul 2022 09:53:44 -0700 Subject: [PATCH 1/2] add stats endpoints --- prismacloud/api/compute/_stats.py | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 prismacloud/api/compute/_stats.py diff --git a/prismacloud/api/compute/_stats.py b/prismacloud/api/compute/_stats.py new file mode 100644 index 0000000..6792828 --- /dev/null +++ b/prismacloud/api/compute/_stats.py @@ -0,0 +1,56 @@ +""" Prisma Cloud Compute API Stats Endpoints Class """ + +class StatsPrismaCloudAPIComputeMixin: + """ Prisma Cloud Compute API Stats Endpoints Class """ + + def stats_app_firewall_count_read(self): + # Returns the number of app firewalls in use. + return self.execute_compute('GET', 'api/v1/stats/app-firewall/count') + + def stats_compliance_read(self, query_params=None): + # Maps to the table in Monitor > Compliance > Compliance Explorer + return self.execute_compute('GET', 'api/v1/stats/compliance?', query_params=query_params) + + def stats_compliance_download(self, query_params=None): + return self.execute_compute('GET', 'api/v1/stats/compliance/download?', query_params=query_params) + + def stats_compliance_refresh(self, query_params=None): + # Refreshes the current day's list and counts of compliance issues, as well as the list of affected running resources. + # This endpoint returns the same response as /api/v1/stats/compliance, but with updated data for the current day. + return self.execute_compute('GET', 'api/v1/stats/compliance/refresh?', query_params=query_params) + + def stats_daily_read(self): + # Returns a historical list of per-day statistics for the resources protected by Prisma Cloud Compute, + # including the total number of runtime audits, image vulnerabilities, and compliance violations. + return self.execute_compute('GET', 'api/v1/stats/daily', paginated=True) + + def stats_trends_read(self): + # Returns statistics about the resources protected by Prisma Cloud Compute, + # including the total number of runtime audits, image vulnerabilities, and compliance violations. + return self.execute_compute('GET', 'api/v1/stats/dashboard') + + def stats_events_read(self, query_params=None): + # Returns events statistics for your environment. + return self.execute_compute('GET', 'api/v1/stats/events?', query_params=query_params) + + def stats_license_read(self): + return self.execute_compute('GET', 'api/v1/stats/license') + + def stats_vulnerabilities_read(self, query_params=None): + # Returns a list of vulnerabilities (CVEs) in the deployed images, registry images, hosts, and serverless functions affecting your environment. + return self.execute_compute('GET', 'api/v1/stats/vulnerabilities?', query_params=query_params, paginated=True) + + def stats_vulnerabilities_download(self, query_params=None): + return self.execute_compute('GET', 'api/v1/stats/vulnerabilities/download?', query_params=query_params) + + def stats_vulnerabilities_impacted_resoures_read(self, query_params=None): + # Generates a list of impacted resources for a specific vulnerability. This endpoint returns a list of all deployed images, registry images, hosts, and serverless functions affected by a given CVE. + return self.execute_compute('GET', 'api/v1/stats/vulnerabilities/impacted-resources?', query_params=query_params) + + def stats_vulnerabilities_impacted_resoures_download(self, query_params=None): + return self.execute_compute('GET', 'api/v1/stats/vulnerabilities/impacted-resources/download?', query_params=query_params) + + def stats_vulnerabilities_refresh(self, query_params=None): + # Refreshes the current day's CVE counts and CVE list, as well as their descriptions. + # This endpoint returns the same response as /api/v1/stats/vulnerabilities, but with updated data for the current day. + return self.execute_compute('GET', 'api/v1/stats/vulnerabilities/refresh?', query_params=query_params, paginated=True) From 2140294c495c7e837aee6349105e3657ede11ff6 Mon Sep 17 00:00:00 2001 From: tkishel Date: Wed, 20 Jul 2022 09:53:56 -0700 Subject: [PATCH 2/2] update version --- prismacloud/api/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prismacloud/api/version.py b/prismacloud/api/version.py index 2715992..217c1b5 100644 --- a/prismacloud/api/version.py +++ b/prismacloud/api/version.py @@ -1,3 +1,3 @@ """ version file """ -version = '4.0.8' +version = '4.0.9'