| Required role: | TenantReader |
| GET | /api/statistics/billableresources | Returns billable resource counts | |
|---|---|---|---|
| GET | /statistics/billableresources | Returns billable resource counts |
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
Object = TypeVar('Object')
class ObjectTypes(str, Enum):
NONE = 'None'
CONFIG_ITEM = 'ConfigItem'
TENANT = 'Tenant'
COLLECTION = 'Collection'
RESOURCE = 'Resource'
COMPUTE_NODE = 'ComputeNode'
VIRTUAL_MACHINE = 'VirtualMachine'
PHYSICAL_MACHINE = 'PhysicalMachine'
DISK = 'Disk'
SUBNET = 'Subnet'
IP_ADDRESS = 'IPAddress'
JOB = 'Job'
JOB_EVENT = 'JobEvent'
FREEZE_PERIOD = 'FreezePeriod'
RESOURCE_GROUP = 'ResourceGroup'
DEPLOYMENT = 'Deployment'
RESOURCE_GROUP_TEMPLATE = 'ResourceGroupTemplate'
DEPLOYMENT_TEMPLATE = 'DeploymentTemplate'
RESOURCE_PROVIDER = 'ResourceProvider'
GENERIC_RESOURCE = 'GenericResource'
ROLE = 'Role'
PERMISSION = 'Permission'
USER = 'User'
PATCHING_WINDOW = 'PatchingWindow'
UPDATE = 'Update'
REPORT_DEFINITION = 'ReportDefinition'
TIME_SERIES = 'TimeSeries'
DATA_POINT = 'DataPoint'
ACTION = 'Action'
ACTION_ASSIGNMENT = 'ActionAssignment'
USER_NOTE = 'UserNote'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HeaderDto(IHasIdName, IHasObjectType):
id: Optional[str] = None
name: Optional[str] = None
display_name: Optional[str] = None
object_type: Optional[ObjectTypes] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BillableResourceDto:
type: Optional[ObjectTypes] = None
total_count: int = 0
billable_count: int = 0
billable_resources: List[HeaderDto] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BillableResourceSummaryDto:
generated_on: datetime.datetime = datetime.datetime(1, 1, 1)
billable_resources: Dict[str, BillableResourceDto] = field(default_factory=dict)
# @Api(Description="Returns billable resource counts")
# @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(BillableResourceSummaryDto), StatusCode=200)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetBillableResources(IBaseRequest, IHasTenantName, IGet):
"""
Returns billable resource counts
"""
# @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
# @Validate(Validator="NotEmpty")
tenant_name: Optional[str] = None
Python GetBillableResources DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/statistics/billableresources HTTP/1.1 Host: core.starburst.svc Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"generatedOn":"0001-01-01T00:00:00.0000000Z","billableResources":{"String":{"type":"None","totalCount":0,"billableCount":0,"billableResources":[{"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","objectType":"None"}]}}}