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: SmarterAuthenticatedNeverCachedWebView

The ledger’s most recent resources, newest first, and a summary of all of them.

The request’s JSON body may have limit, the number of resources, up to DEFAULT_LIMIT.

Response:

{
    "summary": {"total": 12, "active": 9, "activeBillable": 3, "destroyed": 3},
    "objects": [{"id": 12, "provider": "aws", "resourceType": "dns.zone", ...}]
}
property formatted_class_name: str

Returns the class name in a formatted string along with the name of this view.

post(request, *args, **kwargs)[source]
Return type:

JsonResponse

class smarter.apps.infrastructure.views.listview.InfrastructureResourceListView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

Render the Infrastructure Resource list of the Smarter web console.

property formatted_class_name: str

Returns a formatted string of the class name for logging purposes.

get(request, *args, **kwargs)[source]

Handle GET requests and return a cleaned HttpResponse.

Parameters:

request (ASGIRequest) – The HTTP request object.

Returns:

An HttpResponse with the cleaned HTML content.

Return type:

HttpResponse

template_path: str = 'react/infrastructure-resource-list.html'
smarter.apps.infrastructure.views.listview.summary()[source]

Counts of the ledger’s resources: in total, active, active and billable, and destroyed.

Return type:

dict[str, int]

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: object

Named URL patterns of the infrastructure app.

listview = 'infrastructure_resource_list_view'
listview_api = 'infrastructure_resource_list_api_view'
namespace = 'infrastructure'