# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/base.py
# class BaseRequest(object):
# 
#     def as_payload(self, filter_=None):
#         return payload_filter(self.__dict__, filter_)
# 
# Path: tenable_io/api/models.py
# class AccessGroup(BaseModel):
# 
#     def __init__(
#             self,
#             container_uuid=None,
#             created_at=None,
#             updated_at=None,
#             id=None,
#             name=None,
#             all_assets=None,
#             all_users=None,
#             status=None,
#             rules=None,
#             principals=None,
#             version=None,
#             created_by_uuid=None,
#             updated_by_uuid=None,
#             updated_by_name=None,
#             created_by_name=None,
#             processing_percent_complete=None
#     ):
#         self._rules = None
#         self._principals = None
#         self.container_uuid = container_uuid
#         self.created_at = created_at
#         self.updated_at = updated_at
#         self.id = id
#         self.name = name
#         self.all_assets = all_assets
#         self.all_users = all_users
#         self.status = status
#         self.rules = rules
#         self.principals = principals
#         self.version = version
#         self.created_by_uuid = created_by_uuid
#         self.updated_by_uuid = updated_by_uuid
#         self.updated_by_name = updated_by_name
#         self.created_by_name = created_by_name
#         self.processing_percent_complete = processing_percent_complete
# 
#     @property
#     def rules(self):
#         return self._rules
# 
#     @rules.setter
#     @BaseModel._model_list(AssetRule)
#     def rules(self, rules):
#         self._rules = rules
# 
#     @property
#     def principals(self):
#         return self._principals
# 
#     @principals.setter
#     @BaseModel._model_list(AssetRulePrincipal)
#     def principals(self, principals):
#         self._principals = principals
# 
# class AccessGroupList(BaseModel):
# 
#     def __init__(
#             self,
#             access_groups=None,
#             pagination=None
#     ):
#         self._access_groups = None
#         self._pagination = None
#         self.access_groups = access_groups
#         self.pagination = pagination
# 
#     @property
#     def access_groups(self):
#         return self._access_groups
# 
#     @access_groups.setter
#     @BaseModel._model_list(AccessGroup)
#     def access_groups(self, access_groups):
#         self._access_groups = access_groups
# 
#     @property
#     def pagination(self):
#         return self._pagination
# 
#     @pagination.setter
#     @BaseModel._model(FilterPagination)
#     def pagination(self, pagination):
#         self._pagination = pagination
# 
# class AssetRule(BaseModel):
# 
#     def __init__(
#             self,
#             type=None,
#             operator=None,
#             terms=None
#     ):
#         self.type = type
#         self.operator = operator
#         self.terms = terms
# 
# class AssetRuleFilter(Filter):
# 
#     def __init__(
#             self,
#             placeholder=None,
#     ):
#         self.placeholder = placeholder
# 
# class AssetRulePrincipal(BaseModel):
# 
#     def __init__(
#             self,
#             type=None,
#             principal_id=None,
#             principal_name=None
#     ):
#         self.type = type
#         self.principal_id = principal_id
#         self.principal_name = principal_name
# 
# class Filters(BaseModel):
# 
#     def __init__(
#             self,
#             filters=None,
#             sort=None,
#             wildcard_fields=None
#     ):
#         self._filters = None
#         self.filters = filters
#         self.sort = sort
#         self.wildcard_fields = wildcard_fields
# 
#     @property
#     def filters(self):
#         return self._filters
# 
#     @filters.setter
#     @BaseModel._model_list(Filter)
#     def filters(self, filters):
#         self._filters = filters


from json import loads
from tenable_io.api.base import BaseApi
from tenable_io.api.base import BaseRequest
from tenable_io.api.models import AccessGroup, AccessGroupList, AssetRule, AssetRuleFilter, AssetRulePrincipal, Filters
    ):
        """Request for AccessGroupsApi.create and AccessGroupsApi.edit.

        :param name: The name of the access group. Must be unique within the container, a maximum of 255 characters, and
            alphanumeric, but can include limited special characters (underscore, dash, parenthesis, brackets, colon).
            You can add a maximum of 5,000 access groups to an individual container.
        :type name: string
        :param all_assets: Specifies whether the access group is the All Assets group or a user-defined group. A create
            request with this parameter set to 'true' will fail.
            Set to 'true' to edit membership in the All Assets access group. In which case, any rules
            are ignored, but existing principals are overwritten based on the all_users and principals parameters.
            Set to 'false' to edit a user-defined access group. The existing rules are overwritten with the new rules,
            and existing principals are overwritten based on the all_users and principals parameters.
        :type all_assets: boolean
        :param all_users: Specifies whether assets in the access group can be viewed by all or only some users.
            Default is 'False'. If 'true', all users in your organization have Can View access to the
            assets defined in the rules parameter and any principal parameters is ignored.
            If 'false', only specified users have Can View access to the assets defined in the rules parameter.
            You define which users or user groups have access in the principals parameter of the request.
        :type all_users: boolean
        :param rules: An array of asset rules. Tenable.io uses these rules to assign assets to the access group.
            You can only add rules to access groups if the all_assets parameter is set to 'false'.
        :type rules: list
        :param principals: A list of principals. Each representing a user or user group assigned to the access group.
            Data in this array is handled based on the all_users parameter. If all_users is 'true',
            any principal data is ignored and you can omit this parameter.
            If all_users is 'false', the principal data is added to the access group.
        :type principals: list
        """
        for r in rules:

# Path: tenable_io/api/base.py
# class BaseApi(object):
# 
#     def __init__(self, client):
#         self._client = client
# 
# Path: tenable_io/api/base.py
# class BaseRequest(object):
# 
#     def as_payload(self, filter_=None):
#         return payload_filter(self.__dict__, filter_)
# 
# Path: tenable_io/api/models.py
# class AccessGroup(BaseModel):
# 
#     def __init__(
#             self,
#             container_uuid=None,
#             created_at=None,
#             updated_at=None,
#             id=None,
#             name=None,
#             all_assets=None,
#             all_users=None,
#             status=None,
#             rules=None,
#             principals=None,
#             version=None,
#             created_by_uuid=None,
#             updated_by_uuid=None,
#             updated_by_name=None,
#             created_by_name=None,
#             processing_percent_complete=None
#     ):
#         self._rules = None
#         self._principals = None
#         self.container_uuid = container_uuid
#         self.created_at = created_at
#         self.updated_at = updated_at
#         self.id = id
#         self.name = name
#         self.all_assets = all_assets
#         self.all_users = all_users
#         self.status = status
#         self.rules = rules
#         self.principals = principals
#         self.version = version
#         self.created_by_uuid = created_by_uuid
#         self.updated_by_uuid = updated_by_uuid
#         self.updated_by_name = updated_by_name
#         self.created_by_name = created_by_name
#         self.processing_percent_complete = processing_percent_complete
# 
#     @property
#     def rules(self):
#         return self._rules
# 
#     @rules.setter
#     @BaseModel._model_list(AssetRule)
#     def rules(self, rules):
#         self._rules = rules
# 
#     @property
#     def principals(self):
#         return self._principals
# 
#     @principals.setter
#     @BaseModel._model_list(AssetRulePrincipal)
#     def principals(self, principals):
#         self._principals = principals
# 
# class AccessGroupList(BaseModel):
# 
#     def __init__(
#             self,
#             access_groups=None,
#             pagination=None
#     ):
#         self._access_groups = None
#         self._pagination = None
#         self.access_groups = access_groups
#         self.pagination = pagination
# 
#     @property
#     def access_groups(self):
#         return self._access_groups
# 
#     @access_groups.setter
#     @BaseModel._model_list(AccessGroup)
#     def access_groups(self, access_groups):
#         self._access_groups = access_groups
# 
#     @property
#     def pagination(self):
#         return self._pagination
# 
#     @pagination.setter
#     @BaseModel._model(FilterPagination)
#     def pagination(self, pagination):
#         self._pagination = pagination
# 
# class AssetRule(BaseModel):
# 
#     def __init__(
#             self,
#             type=None,
#             operator=None,
#             terms=None
#     ):
#         self.type = type
#         self.operator = operator
#         self.terms = terms
# 
# class AssetRuleFilter(Filter):
# 
#     def __init__(
#             self,
#             placeholder=None,
#     ):
#         self.placeholder = placeholder
# 
# class AssetRulePrincipal(BaseModel):
# 
#     def __init__(
#             self,
#             type=None,
#             principal_id=None,
#             principal_name=None
#     ):
#         self.type = type
#         self.principal_id = principal_id
#         self.principal_name = principal_name
# 
# class Filters(BaseModel):
# 
#     def __init__(
#             self,
#             filters=None,
#             sort=None,
#             wildcard_fields=None
#     ):
#         self._filters = None
#         self.filters = filters
#         self.sort = sort
#         self.wildcard_fields = wildcard_fields
# 
#     @property
#     def filters(self):
#         return self._filters
# 
#     @filters.setter
#     @BaseModel._model_list(Filter)
#     def filters(self, filters):
#         self._filters = filters


# Path: tenable_io/api/access_groups.py
from json import loads
from tenable_io.api.base import BaseApi
from tenable_io.api.base import BaseRequest
from tenable_io.api.models import AccessGroup, AccessGroupList, AssetRule, AssetRuleFilter, AssetRulePrincipal, Filters

    ):
        """Request for AccessGroupsApi.create and AccessGroupsApi.edit.

        :param name: The name of the access group. Must be unique within the container, a maximum of 255 characters, and
            alphanumeric, but can include limited special characters (underscore, dash, parenthesis, brackets, colon).
            You can add a maximum of 5,000 access groups to an individual container.
        :type name: string
        :param all_assets: Specifies whether the access group is the All Assets group or a user-defined group. A create
            request with this parameter set to 'true' will fail.
            Set to 'true' to edit membership in the All Assets access group. In which case, any rules
            are ignored, but existing principals are overwritten based on the all_users and principals parameters.
            Set to 'false' to edit a user-defined access group. The existing rules are overwritten with the new rules,
            and existing principals are overwritten based on the all_users and principals parameters.
        :type all_assets: boolean
        :param all_users: Specifies whether assets in the access group can be viewed by all or only some users.
            Default is 'False'. If 'true', all users in your organization have Can View access to the
            assets defined in the rules parameter and any principal parameters is ignored.
            If 'false', only specified users have Can View access to the assets defined in the rules parameter.
            You define which users or user groups have access in the principals parameter of the request.
        :type all_users: boolean
        :param rules: An array of asset rules. Tenable.io uses these rules to assign assets to the access group.
            You can only add rules to access groups if the all_assets parameter is set to 'false'.
        :type rules: list
        :param principals: A list of principals. Each representing a user or user group assigned to the access group.
            Data in this array is handled based on the all_users parameter. If all_users is 'true',
            any principal data is ignored and you can omit this parameter.
            If all_users is 'false', the principal data is added to the access group.
        :type principals: list
        """
        for r in rules:

            assert isinstance(r, AssetRule)