| Required role: | TenantReader |
| GET | /api/deployments/{Id}/structure | Returns the structure of a deployment | |
|---|---|---|---|
| GET | /deployments/{Id}/structure | Returns the structure of a deployment |
import Foundation
import ServiceStack
/**
* 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(NestedHierarchyItemDto), StatusCode=200)
public class GetDeploymentStructure : IBaseRequest, IHasTenantName, IGet, Codable
{
// @ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")
public var id:String
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
public var tenantName:String
required public init(){}
}
public class NestedHierarchyItemDto : HierarchyItemDto
{
public var children:[NestedHierarchyItemDto] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case children
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
children = try container.decodeIfPresent([NestedHierarchyItemDto].self, forKey: .children) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if children.count > 0 { try container.encode(children, forKey: .children) }
}
}
public class HierarchyItemDto : Codable
{
public var id:String
public var configItemType:ObjectTypes
public var name:String
public var displayName:String
public var Description:String
required public init(){}
}
public enum ObjectTypes : String, Codable
{
case None
case ConfigItem
case Tenant
case Collection
case Resource
case ComputeNode
case VirtualMachine
case PhysicalMachine
case Disk
case Subnet
case IPAddress
case Job
case JobEvent
case FreezePeriod
case ResourceGroup
case Deployment
case ResourceGroupTemplate
case DeploymentTemplate
case ResourceProvider
case GenericResource
case Role
case Permission
case User
case PatchingWindow
case Update
case ReportDefinition
case TimeSeries
case DataPoint
case Action
case ActionAssignment
case UserNote
}
Swift 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"}