diff --git a/fmcapi/api_objects/device_services/devicerecords.py b/fmcapi/api_objects/device_services/devicerecords.py index eddc818..2ccf58d 100644 --- a/fmcapi/api_objects/device_services/devicerecords.py +++ b/fmcapi/api_objects/device_services/devicerecords.py @@ -24,33 +24,37 @@ class DeviceRecords(APIClassTemplate): VALID_GET_FILTERS = [ # TODO: name as a get filter will conflict with existing logic to look something up by name - use hostname instead for now # "name", # String - "hostName", # String - "serialNumber", # String - "containerType", # DeviceCluster|DeviceHAPair|DeviceStack - "clusterBootstrapSupported", # Bool - "analyticsOnly", # Bool - "includeOtherAssociatedPolicies", # Bool - "modeType" # NGFW|Chassis - ] - VALID_FOR_KWARGS = VALID_JSON_DATA + VALID_GET_FILTERS + [ - "acp_name", - "acp_id", - "model", - "modelId", - "modelNumber", - "modelType", - "healthStatus", - "healthPolicy", - "type", - "version", - "sw_version", - "deviceGroup", - "prohibitPacketTransfer", - "keepLocalEvents", - "ftdMode", - "keepLocalEvents", - "expanded" + "hostName", # String + "serialNumber", # String + "containerType", # DeviceCluster|DeviceHAPair|DeviceStack + "clusterBootstrapSupported", # Bool + "analyticsOnly", # Bool + "includeOtherAssociatedPolicies", # Bool + "modeType", # NGFW|Chassis ] + VALID_FOR_KWARGS = ( + VALID_JSON_DATA + + VALID_GET_FILTERS + + [ + "acp_name", + "acp_id", + "model", + "modelId", + "modelNumber", + "modelType", + "healthStatus", + "healthPolicy", + "type", + "version", + "sw_version", + "deviceGroup", + "prohibitPacketTransfer", + "keepLocalEvents", + "ftdMode", + "keepLocalEvents", + "expanded", + ] + ) URL_SUFFIX = "/devices/devicerecords" REQUIRED_FOR_POST = ["accessPolicy", "hostName", "regKey", "type"] REQUIRED_FOR_PUT = ["id"] diff --git a/fmcapi/api_objects/object_services/grouppolicies.py b/fmcapi/api_objects/object_services/grouppolicies.py index eb6f061..0c2610c 100644 --- a/fmcapi/api_objects/object_services/grouppolicies.py +++ b/fmcapi/api_objects/object_services/grouppolicies.py @@ -11,26 +11,26 @@ class GroupPolicies(APIClassTemplate): "id", "name", "type", - "generalSettings", # Dict - "anyConnectSettings", # Dict - "advancedSettings", # Dict - "enableSSLProtocol", # Bool - "enableIPsecIKEv2Protocol", # Bool + "generalSettings", # Dict + "anyConnectSettings", # Dict + "advancedSettings", # Dict + "enableSSLProtocol", # Bool + "enableIPsecIKEv2Protocol", # Bool ] VALID_GET_FILTERS = [ - "unusedOnly", # Bool - "nameOrValue", # String + "unusedOnly", # Bool + "nameOrValue", # String ] VALID_FOR_KWARGS = VALID_JSON_DATA + VALID_GET_FILTERS + [] URL_SUFFIX = "/object/grouppolicies" REQUIRED_FOR_PUT = [ "id", "name", - "generalSettings", # Dict - "anyConnectSettings", # Dict - "advancedSettings", # Dict - "enableSSLProtocol", # Bool - "enableIPsecIKEv2Protocol", # Bool + "generalSettings", # Dict + "anyConnectSettings", # Dict + "advancedSettings", # Dict + "enableSSLProtocol", # Bool + "enableIPsecIKEv2Protocol", # Bool ] def __init__(self, fmc, **kwargs): @@ -44,4 +44,4 @@ def __init__(self, fmc, **kwargs): super().__init__(fmc, **kwargs) logging.debug("In __init__() for GroupPolicies class.") self.type = "GroupPolicy" - self.parse_kwargs(**kwargs) \ No newline at end of file + self.parse_kwargs(**kwargs) diff --git a/fmcapi/api_objects/policy_services/connectionprofiles.py b/fmcapi/api_objects/policy_services/connectionprofiles.py index adec224..1ef990d 100644 --- a/fmcapi/api_objects/policy_services/connectionprofiles.py +++ b/fmcapi/api_objects/policy_services/connectionprofiles.py @@ -8,7 +8,7 @@ class ConnectionProfiles(APIClassTemplate): """The ConnectionProfiles Object in the FMC.""" REQUIRED_FOR_GET = ["container_uuid"] - REQUIRED_FOR_POST = ["container_uuid","name"] + REQUIRED_FOR_POST = ["container_uuid", "name"] REQUIRED_FOR_PUT = ["container_uuid", "id"] REQUIRED_FOR_DELETE = ["container_uuid", "id"] VALID_JSON_DATA = [ @@ -27,9 +27,9 @@ class ConnectionProfiles(APIClassTemplate): "allowConnectionOnlyIfAuthorized", "enablePasswordManagement", "stripGroupFromUsername", - "stripRealmFromUsername" + "stripRealmFromUsername", ] - VALID_FOR_KWARGS = VALID_JSON_DATA + ["container_uuid"] + VALID_FOR_KWARGS = VALID_JSON_DATA + ["container_uuid"] URL_SUFFIX = "/policy/ravpns" FIRST_SUPPORTED_FMC_VERSION = "7.2" diff --git a/fmcapi/api_objects/policy_services/dynamicaccesspolicies.py b/fmcapi/api_objects/policy_services/dynamicaccesspolicies.py index 2c16dbb..6527ac8 100644 --- a/fmcapi/api_objects/policy_services/dynamicaccesspolicies.py +++ b/fmcapi/api_objects/policy_services/dynamicaccesspolicies.py @@ -8,6 +8,7 @@ class DynamicAccessPolicies(APIClassTemplate): """The DynamicAccessPolicies Object in the FMC.""" + REQUIRED_FOR_PUT = [ "id", "authorizationAttributes", @@ -40,7 +41,6 @@ def __init__(self, fmc, **kwargs): self.parse_kwargs(**kwargs) def unpack_xml_config(self, encoded_xml): - """ Unpack and reformat base64 encoded xml from DAP api responses @@ -57,7 +57,6 @@ def unpack_xml_config(self, encoded_xml): return xml_dict def repack_xml_config(self, xml_dict): - """Repack dict into xml and encoded for use with DAP api calls Args: @@ -74,7 +73,6 @@ def repack_xml_config(self, xml_dict): return encoded_xml_string def get(self, **kwargs): - """ Modified get() for DynamicAccessPolicies class to make working with dapXmlConfig and hostscanXmlConfig a bit easier. This will create self.dapXmlConfig_dict @@ -83,41 +81,39 @@ def get(self, **kwargs): super().get(**kwargs) logging.debug("In get() for DynamicAccessPolicies class.") - if hasattr(self, 'dapXmlConfig'): + if hasattr(self, "dapXmlConfig"): self.dapXmlConfig_dict = self.unpack_xml_config(self.dapXmlConfig) - if hasattr(self, 'hostscanXmlConfig'): + if hasattr(self, "hostscanXmlConfig"): self.hostscanXmlConfig_dict = self.unpack_xml_config(self.hostscanXmlConfig) def post(self, **kwargs): - """ Modified post() for DynamicAccessPolicies class to make working with dapXmlConfig and hostscanXmlConfig a bit easier. This will take self.dapXmlConfig_dict and self.hostscanXmlConfig_dict and convert to xml before base64 encoding for use with api endpoint. """ - if hasattr(self, 'dapXmlConfig_dict'): + if hasattr(self, "dapXmlConfig_dict"): self.dapXmlConfig = self.repack_xml_config(self.dapXmlConfig_dict) - if hasattr(self, 'hostscanXmlConfig_dict'): + if hasattr(self, "hostscanXmlConfig_dict"): self.hostscanXmlConfig = self.repack_xml_config(self.hostscanXmlConfig_dict) super().post(**kwargs) logging.debug("In post() for DynamicAccessPolicies class.") def put(self, **kwargs): - """ Modified put() for DynamicAccessPolicies class to make working with dapXmlConfig and hostscanXmlConfig a bit easier. This will take self.dapXmlConfig_dict and self.hostscanXmlConfig_dict and convert to xml before base64 encoding for use with api endpoint. """ - if hasattr(self, 'dapXmlConfig_dict'): + if hasattr(self, "dapXmlConfig_dict"): self.dapXmlConfig = self.repack_xml_config(self.dapXmlConfig_dict) - if hasattr(self, 'hostscanXmlConfig_dict'): + if hasattr(self, "hostscanXmlConfig_dict"): self.hostscanXmlConfig = self.repack_xml_config(self.hostscanXmlConfig_dict) super().put(**kwargs) diff --git a/fmcapi/api_objects/policy_services/ravpns.py b/fmcapi/api_objects/policy_services/ravpns.py index cd5db70..8b9a1d3 100644 --- a/fmcapi/api_objects/policy_services/ravpns.py +++ b/fmcapi/api_objects/policy_services/ravpns.py @@ -6,6 +6,7 @@ class RAVpn(APIClassTemplate): """The RAVpn Object in the FMC.""" + VALID_JSON_DATA = [ "id", "name", @@ -25,7 +26,7 @@ class RAVpn(APIClassTemplate): "ldapAttributeMaps", "loadBalanceSettings", "configureSSL", - "configureIpsec" + "configureIpsec", ] VALID_FOR_KWARGS = VALID_JSON_DATA + [] URL_SUFFIX = "/policy/ravpns"