class CIChangeCMDBHistoryResource(MResource): ci = TastyForeignKey(CIResource, 'ci') class Meta: queryset = CIChangeCMDBHistory.objects.all() authentication = ApiKeyAuthentication() authorization = RalphAuthorization(required_perms=[ Perm.read_configuration_item_info_generic, ]) filtering = { 'ci': ALL, 'comment': ALL, 'created': ALL, 'field_name': ALL, 'id': ALL, 'modified': ALL, 'new_value': ALL, 'old_value': ALL, 'resource_uri': ALL, 'time': ALL, } excludes = ('cache_version', ) list_allowed_methods = ['get'] resource_name = 'cichangecmdbhistory' throttle = CacheThrottle( throttle_at=THROTTLE_AT, timeframe=TIMEFRAME, expiration=EXPIRATION, )
class CIChangeCMDBHistoryResource(MResource): ci = TastyForeignKey(CIResource, 'ci') class Meta: queryset = CIChangeCMDBHistory.objects.all() authentication = ApiKeyAuthentication() authorization = DjangoAuthorization() list_allowed_methods = ['get'] resource_name = 'cichangecmdbhistory' throttle = CacheThrottle(throttle_at=THROTTLE_AT, timeframe=TIMEFREME, expiration=EXPIRATION)
class CIResource(MResource): ci_link = LinkField(view='ci_view_main', as_qs=False) impact_link = LinkField(view='ci_graphs', as_qs=True) attributes = CustomAttributesField() business_owners = OwnershipField(CIOwnershipType.business, full=True) technical_owners = OwnershipField(CIOwnershipType.technical, full=True) effective_business_owners = OwnershipField(CIOwnershipType.business, full=True, effective=True) effective_technical_owners = OwnershipField(CIOwnershipType.technical, full=True, effective=True) layers = fields.ManyToManyField('ralph.cmdb.api.CILayersResource', 'layers', full=True) type = TastyForeignKey('ralph.cmdb.api.CITypesResource', 'type', full=True) class Meta: queryset = CI.objects.all() authentication = ApiKeyAuthentication() authorization = RalphAuthorization(required_perms=[ Perm.read_configuration_item_info_generic, ]) list_allowed_methods = [ 'get', 'post', 'put', 'patch', 'delete', 'head', ] resource_name = 'ci' filtering = { 'attributes': ALL, 'added_manually': ALL, 'barcode': ( 'startswith', 'exact', ), 'business_service': ALL, 'bussiness_owners': ALL, 'cache_version': ALL, 'created': ALL, 'id': ALL, 'layers': ALL_WITH_RELATIONS, 'modified': ALL, 'name': ( 'startswith', 'exact', ), 'object_id': ('exact', ), 'pci_scope': ('exact', ), 'resource_uri': ALL, 'state': ALL, 'status': ALL, 'technical_owners': ALL, 'technical_service': ALL, 'type': ALL_WITH_RELATIONS, 'uid': ALL, 'zabbix_id': ALL, } throttle = CacheThrottle( throttle_at=THROTTLE_AT, timeframe=TIMEFRAME, expiration=EXPIRATION, )