Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
logging.debug("In parse_kwargs() for URLCategory class.")
def post(self):
logging.info('POST method for API for URLCategory not supported.')
pass
def put(self):
logging.info('PUT method for API for URLCategory not supported.')
pass
def delete(self):
logging.info('DELETE method for API for URLCategory not supported.')
pass
class VlanTag(APIClassTemplate):
"""
The URL Object in the FMC.
"""
URL_SUFFIX = '/object/vlantags'
REQUIRED_FOR_POST = ['name', 'data']
def __init__(self, fmc, **kwargs):
super().__init__(fmc, **kwargs)
logging.debug("In __init__() for VlanTag class.")
self.type = 'VlanTag'
self.parse_kwargs(**kwargs)
def format_data(self):
logging.debug("In format_data() for VlanTag class.")
json_data = {}
if 'literals' in self.__dict__:
literals_list = []
for obj in self.literals:
if obj['value'] != value:
literals_list.append(obj)
self.literals = literals_list
logging.info('Removed "{}" from NetworkGroup.'.format(value))
else:
logging.info("This NetworkGroup has no unnamed_networks. Nothing to remove.")
elif action == 'clear':
if 'literals' in self.__dict__:
del self.literals
logging.info('All unnamed_networks removed from this NetworkGroup.')
class ApplicationCategory(APIClassTemplate):
"""
The ApplicationCategory Object in the FMC.
"""
URL_SUFFIX = '/object/applicationcategories'
VALID_CHARACTERS_FOR_NAME = """[.\w\d_\- ]"""
def __init__(self, fmc, **kwargs):
super().__init__(fmc, **kwargs)
logging.debug("In __init__() for ApplicationCategory class.")
self.parse_kwargs(**kwargs)
def format_data(self):
logging.debug("In format_data() for ApplicationCategory class.")
json_data = {}
if 'id' in self.__dict__:
if 'name' in self.__dict__:
json_data['name'] = self.name
if 'value' in self.__dict__:
json_data['value'] = self.value
if 'description' in self.__dict__:
json_data['description'] = self.description
return json_data
def parse_kwargs(self, **kwargs):
super().parse_kwargs(**kwargs)
logging.debug("In parse_kwargs() for IPNetwork class.")
if 'value' in kwargs:
self.value = kwargs['value']
class IPRange(APIClassTemplate):
"""
The Range Object in the FMC.
"""
URL_SUFFIX = '/object/ranges'
REQUIRED_FOR_POST = ['name', 'value']
def __init__(self, fmc, **kwargs):
super().__init__(fmc, **kwargs)
logging.debug("In __init__() for IPRange class.")
self.parse_kwargs(**kwargs)
if 'value' in kwargs:
value_type = get_networkaddress_type(kwargs['value'])
if value_type == 'host':
logging.warning("value, {}, is of type {}. Limited functionality for this object due to it being "
"created via the IPRange function.".format(kwargs['value'], value_type))
self.applicationTypes = kwargs['applicationTypes']
def post(self):
logging.info('POST method for API for Application not supported.')
pass
def put(self):
logging.info('PUT method for API for Application not supported.')
pass
def delete(self):
logging.info('DELETE method for API for Application not supported.')
pass
class ApplicationTag(APIClassTemplate):
"""
The ApplicationTag Object in the FMC.
"""
URL_SUFFIX = '/object/applicationtags'
VALID_CHARACTERS_FOR_NAME = """[.\w\d_\-\/\. ]"""
def __init__(self, fmc, **kwargs):
super().__init__(fmc, **kwargs)
logging.debug("In __init__() for ApplicationTag class.")
self.parse_kwargs(**kwargs)
def format_data(self):
logging.debug("In format_data() for ApplicationTag class.")
json_data = {}
if 'id' in self.__dict__:
logging.debug("In parse_kwargs() for IntrusionPolicy class.")
def post(self):
logging.info('POST method for API for IntrusionPolicy not supported.')
pass
def put(self):
logging.info('PUT method for API for IntrusionPolicy not supported.')
pass
def delete(self):
logging.info('DELETE method for API for IntrusionPolicy not supported.')
pass
class AccessControlPolicy(APIClassTemplate):
"""
The Access Control Policy Object in the FMC.
"""
URL_SUFFIX = '/policy/accesspolicies'
REQUIRED_FOR_POST = ['name']
DEFAULT_ACTION_OPTIONS = ['BLOCK', 'NETWORK_DISCOVERY', 'IPS'] # Not implemented yet.
FILTER_BY_NAME = True
def __init__(self, fmc, **kwargs):
super().__init__(fmc, **kwargs)
logging.debug("In __init__() for AccessControlPolicy class.")
self.parse_kwargs(**kwargs)
def format_data(self):
logging.debug("In format_data() for AccessControlPolicy class.")
if 'name' in self.__dict__:
json_data['name'] = self.name
if 'url' in self.__dict__:
json_data['url'] = self.url
if 'description' in self.__dict__:
json_data['description'] = self.description
return json_data
def parse_kwargs(self, **kwargs):
super().parse_kwargs(**kwargs)
logging.debug("In parse_kwargs() for URL class.")
if 'url' in kwargs:
self.url = kwargs['url']
class URLGroup(APIClassTemplate):
"""
The URLGroup Object in the FMC.
"""
URL_SUFFIX = '/object/urlgroups'
# Technically you can have objects OR literals but I'm not set up for "OR" logic, yet.
REQUIRED_FOR_POST = ['name', 'objects']
def __init__(self, fmc, **kwargs):
super().__init__(fmc, **kwargs)
logging.debug("In __init__() for URLGroup class.")
self.parse_kwargs(**kwargs)
self.type = 'URLGroup'
def format_data(self):
if 'interfaces' in self.__dict__:
json_data['interfaces'] = self.interfaces
return json_data
def parse_kwargs(self, **kwargs):
super().parse_kwargs(**kwargs)
logging.debug("In parse_kwargs() for SecurityZone class.")
if 'interfaceMode' in kwargs:
self.interfaceMode = kwargs['interfaceMode']
else:
self.interfaceMode = 'ROUTED'
if 'interfaces' in kwargs:
self.interfaces = kwargs['interfaces']
class Continent(APIClassTemplate):
"""
The Continent Object in the FMC.
"""
URL_SUFFIX = '/object/continents'
VALID_CHARACTERS_FOR_NAME = """[.\w\d_\- ]"""
def __init__(self, fmc, **kwargs):
super().__init__(fmc, **kwargs)
logging.debug("In __init__() for Continent class.")
self.parse_kwargs(**kwargs)
self.type = 'Continent'
def format_data(self):
logging.debug("In format_data() for Continent class.")
json_data = {}
self.parse_kwargs(**kwargs)
def post(self):
logging.info('POST method for API for Ports not supported.')
pass
def put(self):
logging.info('PUT method for API for Ports not supported.')
pass
def delete(self):
logging.info('DELETE method for API for Ports not supported.')
pass
class ProtocolPort(APIClassTemplate):
"""
The Port Object in the FMC.
"""
URL_SUFFIX = '/object/protocolportobjects'
REQUIRED_FOR_POST = ['name', 'port', 'protocol']
def __init__(self, fmc, **kwargs):
super().__init__(fmc, **kwargs)
logging.debug("In __init__() for ProtocolPort class.")
self.parse_kwargs(**kwargs)
def format_data(self):
logging.debug("In format_data() for ProtocolPort class.")
json_data = {}
if 'id' in self.__dict__:
logging.debug("In parse_kwargs() for ApplicationProductivity class.")
def post(self):
logging.info('POST method for API for ApplicationProductivity not supported.')
pass
def put(self):
logging.info('PUT method for API for ApplicationProductivity not supported.')
pass
def delete(self):
logging.info('DELETE method for API for ApplicationProductivity not supported.')
pass
class ApplicationRisk(APIClassTemplate):
"""
The ApplicationRisk Object in the FMC.
"""
URL_SUFFIX = '/object/applicationrisks'
VALID_CHARACTERS_FOR_NAME = """[.\w\d_\- ]"""
def __init__(self, fmc, **kwargs):
super().__init__(fmc, **kwargs)
logging.debug("In __init__() for ApplicationRisk class.")
self.parse_kwargs(**kwargs)
def format_data(self):
logging.debug("In format_data() for ApplicationRisk class.")
json_data = {}
if 'id' in self.__dict__:
logging.debug("In parse_kwargs() for ApplicationType class.")
def post(self):
logging.info('POST method for API for ApplicationType not supported.')
pass
def put(self):
logging.info('PUT method for API for ApplicationType not supported.')
pass
def delete(self):
logging.info('DELETE method for API for ApplicationType not supported.')
pass
class URL(APIClassTemplate):
"""
The URL Object in the FMC.
"""
URL_SUFFIX = '/object/urls'
REQUIRED_FOR_POST = ['name', 'url']
def __init__(self, fmc, **kwargs):
super().__init__(fmc, **kwargs)
logging.debug("In __init__() for URL class.")
self.parse_kwargs(**kwargs)
def format_data(self):
logging.debug("In format_data() for URL class.")
json_data = {}
if 'id' in self.__dict__: