| Requires the role: | TenantReader |
| GET | /api/configitems/{Id}/hierarchy | Returns a list with ids of all parent items | |
|---|---|---|---|
| GET | /configitems/{Id}/hierarchy | Returns a list with ids of all parent items |
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'
# @Api(Description="Return the object hierarchy of a configitem")
# @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(0, Culture=neutral, PublicKeyToken=null]]), StatusCode=200)
# @ApiResponse(Description="Check log for more info", StatusCode=500)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetConfigItemHierarchy(IBaseRequest, IHasTenantName, IGet):
"""
Return the object hierarchy of a configitem
"""
# @ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")
id: Optional[str] = None
# @ApiMember(Description="objecttype of searched configitem", IsRequired=true, ParameterType="query")
# @Validate(Validator="NotNull")
config_item_type: Optional[ObjectTypes] = None
"""
objecttype of searched configitem
"""
# @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
# @Validate(Validator="NotEmpty")
tenant_name: Optional[str] = None
# @ApiMember(DataType="string", Format="guid", ParameterType="query")
tx_id: Optional[str] = None
class ValueDataType(str, Enum):
STRING = 'String'
NUMBER = 'Number'
BOOLEAN = 'Boolean'
LIST = 'List'
class Environments(str, Enum):
LAB = 'Lab'
POC = 'Poc'
DEV = 'Dev'
TEST = 'Test'
INT_ = 'Int'
UAT = 'Uat'
PROD = 'Prod'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VariableDto:
name: Optional[str] = None
value: Optional[str] = None
"""
Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false, List = [1,2,3,4]). Note: string values need extra quotes
"""
type: Optional[ValueDataType] = None
"""
The data type of the value property
"""
description: Optional[str] = None
is_inherited: bool = False
environment: Optional[Environments] = None
T = TypeVar('T')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ItemsResponse(Generic[T]):
items: Optional[IList[VariableDto]] = None
offset: int = 0
total: int = 0
is_grouped: bool = False
response_status: Optional[ResponseStatus] = None
meta: Optional[Dict[str, str]] = None
Python GetConfigItemHierarchy 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/configitems/{Id}/hierarchy HTTP/1.1
Host: core.starburst.svc
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"items":null,"offset":0,"total":0,"isGrouped":false,"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"meta":{"String":"String"}}