Views
Views of the React Infrastructure Resource list in the Smarter web console.
The ledger, InfrastructureResource, describes the
platform’s cloud infrastructure and what it costs, so it is for superusers only. It is written
by the infrastructure signals’ receivers, so the list is read-only.
- class smarter.apps.infrastructure.views.listview.InfrastructureResourceListApiView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewA page of the ledger’s resources that match the list’s filters, newest first, and a summary of all of them.
The request’s JSON body may have the filters of
filter_resources(), andpage, from 1, andpageSize, up toMAX_PAGE_SIZE. A page past the last is the last.Response:
{ "summary": {"total": 12, "active": 9, "activeBillable": 3, "destroyed": 3}, "objects": [{"id": 12, "provider": "aws", "resourceType": "dns.zone", ...}], "pagination": {"page": 1, "pageSize": 50, "numPages": 1, "count": 9}, "choices": {"providers": ["aws"], "resourceTypes": ["dns.record", "dns.zone"]} }
- property formatted_class_name: str
Returns a formatted string of the class name for logging purposes.
- post(request, *args, **kwargs)[source]
Return a page of the ledger’s resources that match the filters in the JSON body, and a summary.
- Parameters:
request (
ASGIRequest) – The request, whose JSON body has the filters,pageandpageSize.- Return type:
- Returns:
The JSON response described above, or 403 Forbidden for a user who is not a superuser.
- class smarter.apps.infrastructure.views.listview.InfrastructureResourceListView(**kwargs)[source]
Bases:
ConsoleAppViewThe Infrastructure Resource list page,
/infrastructure/, which the single-page console serves (ADR-035).The console renders
@smarter/infrastructure-resource-list’s list at the page’s path for a superuser, and shows anyone else that the page is not found; the list callsInfrastructureResourceListApiView, which answers 403 Forbidden to a user who is not a superuser.
- smarter.apps.infrastructure.views.listview.choices()[source]
The providers and resource types of the whole ledger, for the list’s filters.
- smarter.apps.infrastructure.views.listview.filter_resources(body)[source]
The ledger’s resources that match the list’s filters, newest first.
- smarter.apps.infrastructure.views.listview.summary()[source]
Counts of the ledger’s resources: in total, active, active and billable, and destroyed.
Django URL patterns of the infrastructure app: the ledger of cloud resources.
- how we got here:
/infrastructure/
- class smarter.apps.infrastructure.urls.InfrastructureReverseNames[source]
Bases:
objectNamed URL patterns of the infrastructure app’s console pages.
The endpoint that the list page’s React app calls is in the web console’s api: see
smarter.apps.infrastructure.api.web.urls.InfrastructureApiWebReverseNames.- listview = 'infrastructure_resource_list_view'
- namespace = 'infrastructure'