| Required role: | TenantReader |
| GET | /api/deployments/{Id}/structure | Returns the structure of a deployment | |
|---|---|---|---|
| GET | /deployments/{Id}/structure | Returns the structure of a deployment |
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
enum ObjectTypes : string
{
case None = 'None';
case ConfigItem = 'ConfigItem';
case Tenant = 'Tenant';
case Collection = 'Collection';
case Resource = 'Resource';
case ComputeNode = 'ComputeNode';
case VirtualMachine = 'VirtualMachine';
case PhysicalMachine = 'PhysicalMachine';
case Disk = 'Disk';
case Subnet = 'Subnet';
case IPAddress = 'IPAddress';
case Job = 'Job';
case JobEvent = 'JobEvent';
case FreezePeriod = 'FreezePeriod';
case ResourceGroup = 'ResourceGroup';
case Deployment = 'Deployment';
case ResourceGroupTemplate = 'ResourceGroupTemplate';
case DeploymentTemplate = 'DeploymentTemplate';
case ResourceProvider = 'ResourceProvider';
case GenericResource = 'GenericResource';
case Role = 'Role';
case Permission = 'Permission';
case User = 'User';
case PatchingWindow = 'PatchingWindow';
case Update = 'Update';
case ReportDefinition = 'ReportDefinition';
case TimeSeries = 'TimeSeries';
case DataPoint = 'DataPoint';
case Action = 'Action';
case ActionAssignment = 'ActionAssignment';
case UserNote = 'UserNote';
}
class HierarchyItemDto implements JsonSerializable
{
public function __construct(
/** @var string */
public string $id='',
/** @var ObjectTypes|null */
public ?ObjectTypes $configItemType=null,
/** @var string|null */
public ?string $name=null,
/** @var string|null */
public ?string $displayName=null,
/** @var string|null */
public ?string $description=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['configItemType'])) $this->configItemType = JsonConverters::from('ObjectTypes', $o['configItemType']);
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['displayName'])) $this->displayName = $o['displayName'];
if (isset($o['description'])) $this->description = $o['description'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->configItemType)) $o['configItemType'] = JsonConverters::to('ObjectTypes', $this->configItemType);
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->displayName)) $o['displayName'] = $this->displayName;
if (isset($this->description)) $o['description'] = $this->description;
return empty($o) ? new class(){} : $o;
}
}
class NestedHierarchyItemDto extends HierarchyItemDto implements JsonSerializable
{
/**
* @param string $id
* @param ObjectTypes|null $configItemType
* @param string|null $name
* @param string|null $displayName
* @param string|null $description
*/
public function __construct(
string $id='',
?ObjectTypes $configItemType=null,
?string $name=null,
?string $displayName=null,
?string $description=null,
/** @var array<NestedHierarchyItemDto>|null */
public ?array $children=null
) {
parent::__construct($id,$configItemType,$name,$displayName,$description);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['children'])) $this->children = JsonConverters::fromArray('NestedHierarchyItemDto', $o['children']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->children)) $o['children'] = JsonConverters::toArray('NestedHierarchyItemDto', $this->children);
return empty($o) ? new class(){} : $o;
}
}
/** @description Returns the structure of a deployment (deployment → resource groups → resources) */
// @Api(Description="Returns the structure of a deployment (deployment → resource groups → resources)")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType="typeof(YCO.Dune.Models.Dtos.Core.NestedHierarchyItemDto)", StatusCode=200)
class GetDeploymentStructure implements IBaseRequest, IHasTenantName, IGet, JsonSerializable
{
public function __construct(
// @ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")
/** @var string */
public string $id='',
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
/** @var string */
public string $tenantName=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['tenantName'])) $this->tenantName = $o['tenantName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->tenantName)) $o['tenantName'] = $this->tenantName;
return empty($o) ? new class(){} : $o;
}
}
PHP 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
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"}