diff --git a/apps/assets/api/automations/gather_accounts.py b/apps/assets/api/automations/gather_accounts.py index e69de29bb..e7a265f96 100644 --- a/apps/assets/api/automations/gather_accounts.py +++ b/apps/assets/api/automations/gather_accounts.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# +from orgs.mixins.api import OrgBulkModelViewSet + +from assets.models import GatherAccountsAutomation +from assets import serializers + +__all__ = [ + 'GatherAccountsAutomationViewSet', +] + + +class GatherAccountsAutomationViewSet(OrgBulkModelViewSet): + model = GatherAccountsAutomation + filter_fields = ('name',) + search_fields = filter_fields + ordering_fields = ('name',) + serializer_class = serializers.GatherAccountAutomationSerializer diff --git a/apps/assets/serializers/automations/gather_accounts.py b/apps/assets/serializers/automations/gather_accounts.py index e69de29bb..0f6308d49 100644 --- a/apps/assets/serializers/automations/gather_accounts.py +++ b/apps/assets/serializers/automations/gather_accounts.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# +from assets.models import GatherAccountsAutomation +from common.utils import get_logger + +from .base import BaseAutomationSerializer + +logger = get_logger(__file__) + +__all__ = [ + 'GatherAccountAutomationSerializer', +] + + +class GatherAccountAutomationSerializer(BaseAutomationSerializer): + class Meta: + model = GatherAccountsAutomation + read_only_fields = BaseAutomationSerializer.Meta.read_only_fields + fields = BaseAutomationSerializer.Meta.fields + read_only_fields + extra_kwargs = BaseAutomationSerializer.Meta.extra_kwargs diff --git a/apps/assets/urls/api_urls.py b/apps/assets/urls/api_urls.py index d2bf6f258..a7077aa39 100644 --- a/apps/assets/urls/api_urls.py +++ b/apps/assets/urls/api_urls.py @@ -27,9 +27,10 @@ router.register(r'favorite-assets', api.FavoriteAssetViewSet, 'favorite-asset') router.register(r'account-backup-plans', api.AccountBackupPlanViewSet, 'account-backup') router.register(r'account-backup-plan-executions', api.AccountBackupPlanExecutionViewSet, 'account-backup-execution') -router.register(r'change-secret-automations', api.ChangeSecretAutomationViewSet, 'change-secret-automations') +router.register(r'change-secret-automations', api.ChangeSecretAutomationViewSet, 'change-secret-automation') router.register(r'automation-executions', api.AutomationExecutionViewSet, 'automation-execution') -router.register(r'change-secret-records', api.ChangeSecretRecordViewSet, 'change-secret-records') +router.register(r'change-secret-records', api.ChangeSecretRecordViewSet, 'change-secret-record') +router.register(r'gather-account-automations', api.GatherAccountsAutomationViewSet, 'gather-account-automation') urlpatterns = [ # path('assets//gateways/', api.AssetGatewayListApi.as_view(), name='asset-gateway-list'),