CoreService

<back to all web services

GetDeploymentStructure

Deployment - CRUD

Returns the structure of a deployment (deployment → resource groups → resources)

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
GET/api/deployments/{Id}/structureReturns the structure of a deployment
GET/deployments/{Id}/structureReturns the structure of a deployment
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 HierarchyItemDto:
    id: Optional[str] = None
    config_item_type: Optional[ObjectTypes] = None
    name: Optional[str] = None
    display_name: Optional[str] = None
    description: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class NestedHierarchyItemDto(HierarchyItemDto):
    children: List[NestedHierarchyItemDto] = field(default_factory=list)


# @Api(Description="Returns the structure of a deployment (deployment → resource groups → resources)")
# @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(NestedHierarchyItemDto), StatusCode=200)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetDeploymentStructure(IBaseRequest, IHasTenantName, IGet):
    """
    Returns the structure of a deployment (deployment → resource groups → resources)
    """

    # @ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")
    id: Optional[str] = None

    # @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    # @Validate(Validator="NotEmpty")
    tenant_name: Optional[str] = None

Python GetDeploymentStructure 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

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /api/deployments/{Id}/structure HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"children":[{"children":[{"children":[{"children":null,"id":"00000000-0000-0000-0000-000000000000","configItemType":"None","name":"String","displayName":"String","description":"String"}],"id":"00000000-0000-0000-0000-000000000000","configItemType":"None","name":"String","displayName":"String","description":"String"}],"id":"00000000-0000-0000-0000-000000000000","configItemType":"None","name":"String","displayName":"String","description":"String"}],"id":"00000000-0000-0000-0000-000000000000","configItemType":"None","name":"String","displayName":"String","description":"String"}