# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# class BaseRequest(object):
# 
#     def as_payload(self, filter_=None):
#         return payload_filter(self.__dict__, filter_)
# 
# Path: tenable_io/api/models.py
# class Exclusion(BaseModel):
#     def __init__(
#             self,
#             id=None,
#             name=None,
#             description=None,
#             schedule=None,
#             creation_date=None,
#             last_modification_date=None,
#             members=None,
#     ):
#         self._schedule = None
# 
#         self.id = id
#         self.name = name
#         self.description = description
#         self.schedule = schedule
#         self.creation_date = creation_date
#         self.last_modification_date = last_modification_date
#         self.members = members
# 
#     @property
#     def schedule(self):
#         return self._schedule
# 
#     @schedule.setter
#     @BaseModel._model(ExclusionSchedule)
#     def schedule(self, schedule):
#         self._schedule = schedule
# 
# class ExclusionList(BaseModel):
#     def __init__(
#             self,
#             exclusions=None
#     ):
#         self._exclusions = None
#         self.exclusions = exclusions
# 
#     @property
#     def exclusions(self):
#         return self._exclusions
# 
#     @exclusions.setter
#     @BaseModel._model_list(Exclusion)
#     def exclusions(self, exclusions):
#         self._exclusions = exclusions
# 
# class ExclusionSchedule(BaseModel):
# 
#     def __init__(
#             self,
#             enabled=None,
#             starttime=None,
#             endtime=None,
#             timezone=None,
#             rrules=None
#     ):
#         self._rrules = None
# 
#         self.enabled = enabled
#         self.starttime = starttime
#         self.endtime = endtime
#         self.timezone = timezone
#         self.rrules = rrules
# 
#     @property
#     def rrules(self):
#         return self._rrules
# 
#     @rrules.setter
#     @BaseModel._model(ExclusionRrules)
#     def rrules(self, rrules):
#         self._rrules = rrules
# 
#     def as_payload(self, filter_=None):
#         payload = super(ExclusionSchedule, self).as_payload(True)
#         if isinstance(self.rrules, ExclusionRrules):
#             payload.__setitem__('rrules', self.rrules.as_payload(True))
#         else:
#             payload.pop('rrules', None)
#         payload.pop('_rrules', None)
#         return payload


from tenable_io.api.base import BaseApi, BaseRequest
from tenable_io.api.models import Exclusion, ExclusionList, ExclusionSchedule

    def import_exclusion(self, file):
        """Imports an exclusion from csv using the file upload API.
        To use this API you must first import the file using the File upload API.
        Your file file should be a csv file formatted as:
            id,name,description,members,creation_date,last_modification_date
            <int>,<string>,<string>,<comma separated IPv4s or hostnames>,<date in unix format>,<date in unix format>

        :param file: Name of the import file.
        :raise TenableIOApiException:  When API error is encountered.
        """
        self._client.post('exclusions/import', {'file': file})


class ExclusionSaveBaseRequest(BaseRequest):

    def __init__(
            self,
            name,
            members=None,
            description=None,
            schedule=None
    ):
        self.name = name
        self.members = members
        self.description = description
        self.schedule = schedule

    def as_payload(self, filter_=None):
        payload = super(ExclusionSaveBaseRequest, self).as_payload(True)

# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# class BaseRequest(object):
# 
#     def as_payload(self, filter_=None):
#         return payload_filter(self.__dict__, filter_)
# 
# Path: tenable_io/api/models.py
# class Exclusion(BaseModel):
#     def __init__(
#             self,
#             id=None,
#             name=None,
#             description=None,
#             schedule=None,
#             creation_date=None,
#             last_modification_date=None,
#             members=None,
#     ):
#         self._schedule = None
# 
#         self.id = id
#         self.name = name
#         self.description = description
#         self.schedule = schedule
#         self.creation_date = creation_date
#         self.last_modification_date = last_modification_date
#         self.members = members
# 
#     @property
#     def schedule(self):
#         return self._schedule
# 
#     @schedule.setter
#     @BaseModel._model(ExclusionSchedule)
#     def schedule(self, schedule):
#         self._schedule = schedule
# 
# class ExclusionList(BaseModel):
#     def __init__(
#             self,
#             exclusions=None
#     ):
#         self._exclusions = None
#         self.exclusions = exclusions
# 
#     @property
#     def exclusions(self):
#         return self._exclusions
# 
#     @exclusions.setter
#     @BaseModel._model_list(Exclusion)
#     def exclusions(self, exclusions):
#         self._exclusions = exclusions
# 
# class ExclusionSchedule(BaseModel):
# 
#     def __init__(
#             self,
#             enabled=None,
#             starttime=None,
#             endtime=None,
#             timezone=None,
#             rrules=None
#     ):
#         self._rrules = None
# 
#         self.enabled = enabled
#         self.starttime = starttime
#         self.endtime = endtime
#         self.timezone = timezone
#         self.rrules = rrules
# 
#     @property
#     def rrules(self):
#         return self._rrules
# 
#     @rrules.setter
#     @BaseModel._model(ExclusionRrules)
#     def rrules(self, rrules):
#         self._rrules = rrules
# 
#     def as_payload(self, filter_=None):
#         payload = super(ExclusionSchedule, self).as_payload(True)
#         if isinstance(self.rrules, ExclusionRrules):
#             payload.__setitem__('rrules', self.rrules.as_payload(True))
#         else:
#             payload.pop('rrules', None)
#         payload.pop('_rrules', None)
#         return payload


# Path: tenable_io/api/exclusions.py
from tenable_io.api.base import BaseApi, BaseRequest
from tenable_io.api.models import Exclusion, ExclusionList, ExclusionSchedule


    def import_exclusion(self, file):
        """Imports an exclusion from csv using the file upload API.
        To use this API you must first import the file using the File upload API.
        Your file file should be a csv file formatted as:
            id,name,description,members,creation_date,last_modification_date
            <int>,<string>,<string>,<comma separated IPv4s or hostnames>,<date in unix format>,<date in unix format>

        :param file: Name of the import file.
        :raise TenableIOApiException:  When API error is encountered.
        """
        self._client.post('exclusions/import', {'file': file})


class ExclusionSaveBaseRequest(BaseRequest):

    def __init__(
            self,
            name,
            members=None,
            description=None,
            schedule=None
    ):
        self.name = name
        self.members = members
        self.description = description
        self.schedule = schedule

    def as_payload(self, filter_=None):
        payload = super(ExclusionSaveBaseRequest, self).as_payload(True)

        if isinstance(self.schedule, ExclusionSchedule):