Skip to content

Commit

Permalink
Merge pull request #126 from tkishel/rename_to_normalize
Browse files Browse the repository at this point in the history
Rename api directories to normalize
  • Loading branch information
tkishel authored Feb 10, 2023
2 parents 667ae7a + 857508c commit fc7c69b
Show file tree
Hide file tree
Showing 36 changed files with 49 additions and 44 deletions.
4 changes: 2 additions & 2 deletions prismacloud/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import sys

from .pc_lib_api import PrismaCloudAPI
from .pc_lib_api import PrismaCloudAPI
from .pc_lib_utility import PrismaCloudUtility
from .version import version as api_version
from .version import version as api_version

__author__ = 'Palo Alto Networks CSE/SE/SA Teams'
__version__ = api_version
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import sys

from .posture import *
from .cspm import *
from ._endpoints import *
from ._extended import *

mixin_classes_as_strings = list(filter(lambda x: x.endswith('PrismaCloudAPIMixin'), dir()))
mixin_classes = [getattr(sys.modules[__name__], x) for x in mixin_classes_as_strings]

# pylint: disable=too-few-public-methods
class PrismaCloudAPIPosture(*mixin_classes):
class PrismaCloudAPICSPM(*mixin_classes):
""" Prisma Cloud CSPM API Class """
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys

from .compute import *
from .cwpp import *
from ._audits import *
from ._cloud import *
from ._collections import *
Expand All @@ -20,9 +20,9 @@
from ._status import *
from ._tags import *

mixin_classes_as_strings = list(filter(lambda x: x.endswith('PrismaCloudAPIComputeMixin'), dir()))
mixin_classes_as_strings = list(filter(lambda x: x.endswith('PrismaCloudAPICWPPMixin'), dir()))
mixin_classes = [getattr(sys.modules[__name__], x) for x in mixin_classes_as_strings]

# pylint: disable=too-few-public-methods
class PrismaCloudAPICompute(*mixin_classes):
class PrismaCloudAPICWPP(*mixin_classes):
""" Prisma Cloud CWP API Class """
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" Prisma Cloud Compute API Audits Endpoints Class """

class AuditsPrismaCloudAPIComputeMixin:
class AuditsPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Audit Endpoints Class """

# The audits/incidents endpoint is the only documented audits endpoint.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Cloud

class CloudPrismaCloudAPIComputeMixin:
class CloudPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Cloud Endpoints Class """

def cloud_discovery_read(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Containers

class CollectionsPrismaCloudAPIComputeMixin:
class CollectionsPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Collections Endpoints Class """

def collections_list_read(self, query_params=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Containers

class ContainersPrismaCloudAPIComputeMixin:
class ContainersPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Containers Endpoints Class """

def containers_list_read(self, image_id=None, query_params=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Credentials (Manage > Authentication > Credentials store)


class CredentialsPrismaCloudAPIComputeMixin:
class CredentialsPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Credentials Endpoints Class """

def credential_list_read(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Containers

class DefendersPrismaCloudAPIComputeMixin:
class DefendersPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Defenders Endpoints Class """

def defenders_list_read(self, query_params=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Containers

class HostsPrismaCloudAPIComputeMixin:
class HostsPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Hosts Endpoints Class """

# Running hosts table in Monitor > Vulnerabilities > Hosts > Running Hosts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Images (Monitor > Vulnerabilities/Compliance > Images > Deployed)

class ImagesPrismaCloudAPIComputeMixin:
class ImagesPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Images Endpoints Class """

def images_list_read(self, image_id=None, query_params=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Containers

class LogsPrismaCloudAPIComputeMixin:
class LogsPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Logs Endpoints Class """

# Undocumented endpoints.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Credentials (Defend > Compliance)

class PoliciesPrismaCloudAPIComputeMixin:
class PoliciesPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Credentials Endpoints Class """

def policies_cloud_platforms_read(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Images (Monitor > Vulnerabilities/Compliance > Images > Deployed)

class RegistryPrismaCloudAPIComputeMixin:
class RegistryPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Images Endpoints Class """

def registry_list_read(self, image_id=None):
Expand All @@ -12,6 +12,10 @@ def registry_list_read(self, image_id=None):
images = self.execute_compute('GET', 'api/v1/registry?filterBaseImage=true', paginated=True)
return images

def registry_list_image_names(self, query_params=None):
result = self.execute_compute('GET', 'api/v1/registry/names?', query_params=query_params)
return result

def registry_scan(self, body_params=None):
result = self.execute_compute('POST', 'api/v1/registry/scan', body_params=body_params)
return result
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Scans (Monitor > Vulnerabilities/Compliance > Images > CI)

class ScansPrismaCloudAPIComputeMixin:
class ScansPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Scans Endpoints Class """

def scans_list_read(self, image_id=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Credentials (Defend > Compliance)

class SettingsPrismaCloudAPIComputeMixin:
class SettingsPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Settings Endpoints Class """

def settings_serverless_scan_read(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" Prisma Cloud Compute API Stats Endpoints Class """

class StatsPrismaCloudAPIComputeMixin:
class StatsPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Stats Endpoints Class """

def stats_app_firewall_count_read(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" Prisma Cloud Compute API Statuses Endpoints Class """

class StatusPrismaCloudAPIComputeMixin:
class StatusPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Statuses Endpoints Class """

def statuses_intelligence(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Tags are predefined labels that help you manage your vulnerabilities via the Console UI and Prisma Cloud Compute API.

class TagsPrismaCloudAPIComputeMixin:
class TagsPrismaCloudAPICWPPMixin:
""" Prisma Cloud Compute API Tags Endpoints Class """

def tags_list_read(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import requests

class PrismaCloudAPIComputeMixin():
class PrismaCloudAPICWPPMixin():
""" Requests and Output """

def login_compute(self):
Expand Down
9 changes: 5 additions & 4 deletions prismacloud/api/pc_lib_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import logging

from .posture import PrismaCloudAPIPosture
from .code_security import PrismaCloudAPICodeSecurity
from .compute import PrismaCloudAPICompute
from .cspm import PrismaCloudAPICSPM
from .cwpp import PrismaCloudAPICWPP
from .pccs import PrismaCloudAPIPCCS

from .pc_lib_utility import PrismaCloudUtility

# --Description-- #
Expand All @@ -23,7 +24,7 @@ def __call__(self, *args, **kwargs):
return self.method(*args, **kwargs)

# pylint: disable=too-many-instance-attributes
class PrismaCloudAPI(PrismaCloudAPIPosture, PrismaCloudAPICompute, PrismaCloudAPICodeSecurity):
class PrismaCloudAPI(PrismaCloudAPICSPM, PrismaCloudAPICWPP, PrismaCloudAPIPCCS):
""" Prisma Cloud API Class """
# pylint: disable=super-init-not-called
def __init__(self):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import sys

from .code_security import *
from .pccs import *
from ._checkov_version import *
from ._errors import *
from ._fixes import *
from ._repositories import *
from ._scans import *
from ._suppressions import *
from ._errors import *
from ._fixes import *
from ._repositories import *
from ._scans import *
from ._suppressions import *

mixin_classes_as_strings = list(filter(lambda x: x.endswith('PrismaCloudAPICodeSecurityMixin'), dir()))
mixin_classes_as_strings = list(filter(lambda x: x.endswith('PrismaCloudAPIPCCSMixin'), dir()))
mixin_classes = [getattr(sys.modules[__name__], x) for x in mixin_classes_as_strings]

# pylint: disable=too-few-public-methods
class PrismaCloudAPICodeSecurity(*mixin_classes):
class PrismaCloudAPIPCCS(*mixin_classes):
""" Prisma Cloud Code Security API Class """
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Checkov Version

class CheckovVersionPrismaCloudAPICodeSecurityMixin:
class CheckovVersionPrismaCloudAPIPCCSMixin:
""" Prisma Cloud Code Security API Checkov Version Endpoint Class """

def checkov_version(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Errors

class ErrorsPrismaCloudAPICodeSecurityMixin:
class ErrorsPrismaCloudAPIPCCSMixin:
""" Prisma Cloud Code Security API Errors Endpoints Class """

def errors_files_list(self, criteria):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Fixes

class FixesPrismaCloudAPICodeSecurityMixin:
class FixesPrismaCloudAPIPCCSMixin:
""" Prisma Cloud Code Security API Fixes Endpoints Class """

def fixes_list(self, body_params):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Repositories

class RepositoriesPrismaCloudAPICodeSecurityMixin:
class RepositoriesPrismaCloudAPIPCCSMixin:
""" Prisma Cloud Code Security API Repositories Endpoints Class """

def repositories_list_read(self, query_params=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Scans

class ScansPrismaCloudAPICodeSecurityMixin:
class ScansPrismaCloudAPIPCCSMixin:
""" Prisma Cloud Code Security API Scans Endpoints Class """

def scan(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Suppressions

class SuppressionsPrismaCloudAPICodeSecurityMixin:
class SuppressionsPrismaCloudAPIPCCSMixin:
""" Prisma Cloud Code Security API Suppressions Endpoints Class """

def suppressions_list_read(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import requests

class PrismaCloudAPICodeSecurityMixin():
class PrismaCloudAPIPCCSMixin():
""" Requests and Output """

# pylint: disable=too-many-arguments,too-many-branches,too-many-locals,too-many-statements
Expand Down
2 changes: 1 addition & 1 deletion prismacloud/api/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
""" version file """

version = '5.1.6'
version = '5.2.0'

0 comments on commit fc7c69b

Please sign in to comment.