CoreService

<back to all web services

QueryResourceGroups

ResourceGroup - CRUD

GetResourceGroups

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
GET/api/resourcegroups/Returns all resourcegroups
GET/resourcegroups/Returns all resourcegroups
import Foundation
import ServiceStack

/**
* GetResourceGroups
*/
// @Api(Description="GetResourceGroups")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(0, Culture=neutral, PublicKeyToken=null]]), StatusCode=200)
public class QueryResourceGroups : QueryDb<ResourceGroup>, IGetMultipleRequest, IHasTenantName, IGet, IGroupable
{
    // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    // @Validate(Validator="NotEmpty")
    public var tenantName:String

    /**
    * If true, also soft deleted items will be returned
    */
    // @ApiMember(Description="If true, also soft deleted items will be returned", ParameterType="query")
    public var includeDeleted:Bool?

    /**
    * The property, the data will be grouped on
    */
    // @ApiMember(Description="The property, the data will be grouped on", ParameterType="query")
    public var groupBy:String

    /**
    * The property, used for aggregation
    */
    // @ApiMember(Description="The property, used for aggregation", ParameterType="query")
    public var aggregateOn:String

    /**
    * The aggregation function to use
    */
    // @ApiMember(Description="The aggregation function to use", ParameterType="query")
    public var aggregation:Aggregations?

    /**
    * Returns all referenced object
    */
    // @ApiMember(Description="Returns all referenced object", ParameterType="query")
    public var includeReferencedObjects:Bool?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case tenantName
        case includeDeleted
        case groupBy
        case aggregateOn
        case aggregation
        case includeReferencedObjects
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        tenantName = try container.decodeIfPresent(String.self, forKey: .tenantName)
        includeDeleted = try container.decodeIfPresent(Bool.self, forKey: .includeDeleted)
        groupBy = try container.decodeIfPresent(String.self, forKey: .groupBy)
        aggregateOn = try container.decodeIfPresent(String.self, forKey: .aggregateOn)
        aggregation = try container.decodeIfPresent(Aggregations.self, forKey: .aggregation)
        includeReferencedObjects = try container.decodeIfPresent(Bool.self, forKey: .includeReferencedObjects)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if tenantName != nil { try container.encode(tenantName, forKey: .tenantName) }
        if includeDeleted != nil { try container.encode(includeDeleted, forKey: .includeDeleted) }
        if groupBy != nil { try container.encode(groupBy, forKey: .groupBy) }
        if aggregateOn != nil { try container.encode(aggregateOn, forKey: .aggregateOn) }
        if aggregation != nil { try container.encode(aggregation, forKey: .aggregation) }
        if includeReferencedObjects != nil { try container.encode(includeReferencedObjects, forKey: .includeReferencedObjects) }
    }
}

public class ResourceGroup : ConfigItem, IHasTenantId, IHasVariables, IEnvironmentSpecific, IHasSequence
{
    // @Required()
    public var shortId:String?

    // @Required()
    public var tenantId:String?

    // @Required()
    public var environment:Environments?

    // @Required()
    public var state:LifecycleStates?

    // @Required()
    // @References(typeof(Deployment))
    public var parentId:String?

    public var parent:Deployment
    public var templateId:String?
    // @Required()
    public var parameters:IList<Parameter>?

    // @Required()
    public var variables:IList<Variable>?

    public var nextPatchDate:Date?
    public var composition:ResourceCompositions

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case shortId
        case tenantId
        case name
        case objectType
        case selfLink
        case environment
        case state
        case parentId
        case parent
        case templateId
        case parameters
        case variables
        case nextPatchDate
        case composition
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        shortId = try container.decodeIfPresent(String.self, forKey: .shortId)
        tenantId = try container.decodeIfPresent(String.self, forKey: .tenantId)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        objectType = try container.decodeIfPresent(ObjectTypes.self, forKey: .objectType)
        selfLink = try container.decodeIfPresent(String.self, forKey: .selfLink)
        environment = try container.decodeIfPresent(Environments.self, forKey: .environment)
        state = try container.decodeIfPresent(LifecycleStates.self, forKey: .state)
        parentId = try container.decodeIfPresent(String.self, forKey: .parentId)
        parent = try container.decodeIfPresent(Deployment.self, forKey: .parent)
        templateId = try container.decodeIfPresent(String.self, forKey: .templateId)
        parameters = try container.decodeIfPresent(IList<Parameter>.self, forKey: .parameters)
        variables = try container.decodeIfPresent(IList<Variable>.self, forKey: .variables)
        nextPatchDate = try container.decodeIfPresent(Date.self, forKey: .nextPatchDate)
        composition = try container.decodeIfPresent(ResourceCompositions.self, forKey: .composition)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if shortId != nil { try container.encode(shortId, forKey: .shortId) }
        if tenantId != nil { try container.encode(tenantId, forKey: .tenantId) }
        if name != nil { try container.encode(name, forKey: .name) }
        if objectType != nil { try container.encode(objectType, forKey: .objectType) }
        if selfLink != nil { try container.encode(selfLink, forKey: .selfLink) }
        if environment != nil { try container.encode(environment, forKey: .environment) }
        if state != nil { try container.encode(state, forKey: .state) }
        if parentId != nil { try container.encode(parentId, forKey: .parentId) }
        if parent != nil { try container.encode(parent, forKey: .parent) }
        if templateId != nil { try container.encode(templateId, forKey: .templateId) }
        if parameters != nil { try container.encode(parameters, forKey: .parameters) }
        if variables != nil { try container.encode(variables, forKey: .variables) }
        if nextPatchDate != nil { try container.encode(nextPatchDate, forKey: .nextPatchDate) }
        if composition != nil { try container.encode(composition, forKey: .composition) }
    }
}

public class ConfigItem : Auditable, IConfigItem
{
    public var id:String
    // @Required()
    public var name:String?

    // @Required()
    // @StringLength(250)
    public var displayName:String?

    // @StringLength(8000)
    public var Description:String

    public var objectType:ObjectTypes
    // @Ignore()
    public var selfLink:String

    // @Required()
    public var tags:IList<Tag>?

    // @Required()
    public var path:IList<PathItem>?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case id
        case name
        case displayName
        case Description
        case objectType
        case selfLink
        case tags
        case path
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        id = try container.decodeIfPresent(String.self, forKey: .id)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        displayName = try container.decodeIfPresent(String.self, forKey: .displayName)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        objectType = try container.decodeIfPresent(ObjectTypes.self, forKey: .objectType)
        selfLink = try container.decodeIfPresent(String.self, forKey: .selfLink)
        tags = try container.decodeIfPresent(IList<Tag>.self, forKey: .tags)
        path = try container.decodeIfPresent(IList<PathItem>.self, forKey: .path)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if id != nil { try container.encode(id, forKey: .id) }
        if name != nil { try container.encode(name, forKey: .name) }
        if displayName != nil { try container.encode(displayName, forKey: .displayName) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if objectType != nil { try container.encode(objectType, forKey: .objectType) }
        if selfLink != nil { try container.encode(selfLink, forKey: .selfLink) }
        if tags != nil { try container.encode(tags, forKey: .tags) }
        if path != nil { try container.encode(path, forKey: .path) }
    }
}

public class Auditable : IAuditable, Codable
{
    // @Required()
    public var created:Date?

    // @Required()
    public var createUser:String?

    // @Required()
    public var createUserId:String?

    // @Required()
    public var modified:Date?

    // @Required()
    public var modifyUser:String?

    // @Required()
    public var modifyUserId:String?

    // @Required()
    public var isDeleted:Bool?

    public var deleted:Date?
    public var deleteUser:String
    public var deleteUserId: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
}

public class Tag : Codable
{
    public var name:String
    public var value:String
    public var isProtected:Bool

    required public init(){}
}

public class PathItem : Codable
{
    public var label:String
    public var link:String
    public var objectType:ObjectTypes
    public var objectId:String

    required public init(){}
}

public enum Environments : String, Codable
{
    case Lab
    case Poc
    case Dev
    case Test
    case Int
    case Uat
    case Prod
}

public enum LifecycleStates : String, Codable
{
    case New
    case Deploying
    case Deployed
    case Removing
    case Removed
    case Failure
    case Imported
}

public class Deployment : ConfigItem, IHasTenantId, IHasVariables, IEnvironmentSpecific, IHasSequence
{
    // @Required()
    public var shortId:String?

    // @Required()
    public var tenantId:String?

    // @Required()
    public var nameUserDefinedPart:String?

    // @Required()
    public var state:LifecycleStates?

    // @Required()
    public var environment:Environments?

    public var templateId:String?
    // @Required()
    public var parameters:IList<Parameter>?

    // @Required()
    public var variables:IList<Variable>?

    // @Required()
    public var variablesSnapshot:IList<Variable>?

    // @Required()
    // @References(typeof(DeploymentCollection))
    public var parentId:String?

    public var parent:DeploymentCollection
    // @Required()
    public var validFrom:Date?

    public var validUntil:Date?
    // @Required()
    public var isNeverExpiring:Bool?

    public var nextPatchDate:Date?
    // @Required()
    public var defaultResourceProviderId:String?

    // @Required()
    public var needsAttention:Bool?

    public var composition:ResourceCompositions
    public var monthlyBudget:Double
    public var sendBudgetNotificationMails:Bool
    public var budgetWarningThresholdPercent:Int
    public var operationalState:OperationalStates
    public var resourcesRunning:Int
    public var resourcesTotal:Int

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case shortId
        case tenantId
        case name
        case nameUserDefinedPart
        case objectType
        case selfLink
        case state
        case environment
        case templateId
        case parameters
        case variables
        case variablesSnapshot
        case parentId
        case parent
        case validFrom
        case validUntil
        case isNeverExpiring
        case nextPatchDate
        case defaultResourceProviderId
        case needsAttention
        case composition
        case monthlyBudget
        case sendBudgetNotificationMails
        case budgetWarningThresholdPercent
        case operationalState
        case resourcesRunning
        case resourcesTotal
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        shortId = try container.decodeIfPresent(String.self, forKey: .shortId)
        tenantId = try container.decodeIfPresent(String.self, forKey: .tenantId)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        nameUserDefinedPart = try container.decodeIfPresent(String.self, forKey: .nameUserDefinedPart)
        objectType = try container.decodeIfPresent(ObjectTypes.self, forKey: .objectType)
        selfLink = try container.decodeIfPresent(String.self, forKey: .selfLink)
        state = try container.decodeIfPresent(LifecycleStates.self, forKey: .state)
        environment = try container.decodeIfPresent(Environments.self, forKey: .environment)
        templateId = try container.decodeIfPresent(String.self, forKey: .templateId)
        parameters = try container.decodeIfPresent(IList<Parameter>.self, forKey: .parameters)
        variables = try container.decodeIfPresent(IList<Variable>.self, forKey: .variables)
        variablesSnapshot = try container.decodeIfPresent(IList<Variable>.self, forKey: .variablesSnapshot)
        parentId = try container.decodeIfPresent(String.self, forKey: .parentId)
        parent = try container.decodeIfPresent(DeploymentCollection.self, forKey: .parent)
        validFrom = try container.decodeIfPresent(Date.self, forKey: .validFrom)
        validUntil = try container.decodeIfPresent(Date.self, forKey: .validUntil)
        isNeverExpiring = try container.decodeIfPresent(Bool.self, forKey: .isNeverExpiring)
        nextPatchDate = try container.decodeIfPresent(Date.self, forKey: .nextPatchDate)
        defaultResourceProviderId = try container.decodeIfPresent(String.self, forKey: .defaultResourceProviderId)
        needsAttention = try container.decodeIfPresent(Bool.self, forKey: .needsAttention)
        composition = try container.decodeIfPresent(ResourceCompositions.self, forKey: .composition)
        monthlyBudget = try container.decodeIfPresent(Double.self, forKey: .monthlyBudget)
        sendBudgetNotificationMails = try container.decodeIfPresent(Bool.self, forKey: .sendBudgetNotificationMails)
        budgetWarningThresholdPercent = try container.decodeIfPresent(Int.self, forKey: .budgetWarningThresholdPercent)
        operationalState = try container.decodeIfPresent(OperationalStates.self, forKey: .operationalState)
        resourcesRunning = try container.decodeIfPresent(Int.self, forKey: .resourcesRunning)
        resourcesTotal = try container.decodeIfPresent(Int.self, forKey: .resourcesTotal)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if shortId != nil { try container.encode(shortId, forKey: .shortId) }
        if tenantId != nil { try container.encode(tenantId, forKey: .tenantId) }
        if name != nil { try container.encode(name, forKey: .name) }
        if nameUserDefinedPart != nil { try container.encode(nameUserDefinedPart, forKey: .nameUserDefinedPart) }
        if objectType != nil { try container.encode(objectType, forKey: .objectType) }
        if selfLink != nil { try container.encode(selfLink, forKey: .selfLink) }
        if state != nil { try container.encode(state, forKey: .state) }
        if environment != nil { try container.encode(environment, forKey: .environment) }
        if templateId != nil { try container.encode(templateId, forKey: .templateId) }
        if parameters != nil { try container.encode(parameters, forKey: .parameters) }
        if variables != nil { try container.encode(variables, forKey: .variables) }
        if variablesSnapshot != nil { try container.encode(variablesSnapshot, forKey: .variablesSnapshot) }
        if parentId != nil { try container.encode(parentId, forKey: .parentId) }
        if parent != nil { try container.encode(parent, forKey: .parent) }
        if validFrom != nil { try container.encode(validFrom, forKey: .validFrom) }
        if validUntil != nil { try container.encode(validUntil, forKey: .validUntil) }
        if isNeverExpiring != nil { try container.encode(isNeverExpiring, forKey: .isNeverExpiring) }
        if nextPatchDate != nil { try container.encode(nextPatchDate, forKey: .nextPatchDate) }
        if defaultResourceProviderId != nil { try container.encode(defaultResourceProviderId, forKey: .defaultResourceProviderId) }
        if needsAttention != nil { try container.encode(needsAttention, forKey: .needsAttention) }
        if composition != nil { try container.encode(composition, forKey: .composition) }
        if monthlyBudget != nil { try container.encode(monthlyBudget, forKey: .monthlyBudget) }
        if sendBudgetNotificationMails != nil { try container.encode(sendBudgetNotificationMails, forKey: .sendBudgetNotificationMails) }
        if budgetWarningThresholdPercent != nil { try container.encode(budgetWarningThresholdPercent, forKey: .budgetWarningThresholdPercent) }
        if operationalState != nil { try container.encode(operationalState, forKey: .operationalState) }
        if resourcesRunning != nil { try container.encode(resourcesRunning, forKey: .resourcesRunning) }
        if resourcesTotal != nil { try container.encode(resourcesTotal, forKey: .resourcesTotal) }
    }
}

public class Parameter : Codable
{
    public var name:String
    public var Description:String
    public var value:String
    public var `default`:String
    public var optional:Bool
    public var type:ParameterValueType
    public var validation:String

    required public init(){}
}

public enum ParameterValueType : String, Codable
{
    case String
    case Number
    case Boolean
    case SecureString
}

public class Variable : Codable
{
    public var name:String
    public var value:String
    public var type:ValueDataType
    public var Description:String
    public var isInherited:Bool
    public var environment:Environments?

    required public init(){}
}

public enum ValueDataType : String, Codable
{
    case String
    case Number
    case Boolean
    case List
}

public class DeploymentCollection : ConfigItem, IHasTenantId, IHasVariables
{
    // @Required()
    public var tenantId:String?

    // @Required()
    public var variables:IList<Variable>?

    // @Required()
    public var isLostAndFound:Bool?

    public var monthlyBudget:Double
    public var sendBudgetNotificationMails:Bool
    public var budgetWarningThresholdPercent:Int

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case tenantId
        case name
        case objectType
        case selfLink
        case variables
        case isLostAndFound
        case monthlyBudget
        case sendBudgetNotificationMails
        case budgetWarningThresholdPercent
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        tenantId = try container.decodeIfPresent(String.self, forKey: .tenantId)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        objectType = try container.decodeIfPresent(ObjectTypes.self, forKey: .objectType)
        selfLink = try container.decodeIfPresent(String.self, forKey: .selfLink)
        variables = try container.decodeIfPresent(IList<Variable>.self, forKey: .variables)
        isLostAndFound = try container.decodeIfPresent(Bool.self, forKey: .isLostAndFound)
        monthlyBudget = try container.decodeIfPresent(Double.self, forKey: .monthlyBudget)
        sendBudgetNotificationMails = try container.decodeIfPresent(Bool.self, forKey: .sendBudgetNotificationMails)
        budgetWarningThresholdPercent = try container.decodeIfPresent(Int.self, forKey: .budgetWarningThresholdPercent)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if tenantId != nil { try container.encode(tenantId, forKey: .tenantId) }
        if name != nil { try container.encode(name, forKey: .name) }
        if objectType != nil { try container.encode(objectType, forKey: .objectType) }
        if selfLink != nil { try container.encode(selfLink, forKey: .selfLink) }
        if variables != nil { try container.encode(variables, forKey: .variables) }
        if isLostAndFound != nil { try container.encode(isLostAndFound, forKey: .isLostAndFound) }
        if monthlyBudget != nil { try container.encode(monthlyBudget, forKey: .monthlyBudget) }
        if sendBudgetNotificationMails != nil { try container.encode(sendBudgetNotificationMails, forKey: .sendBudgetNotificationMails) }
        if budgetWarningThresholdPercent != nil { try container.encode(budgetWarningThresholdPercent, forKey: .budgetWarningThresholdPercent) }
    }
}

public enum ResourceCompositions : String, Codable
{
    case Native
    case Foreign
    case Mixed
}

public enum OperationalStates : String, Codable
{
    case None
    case Starting
    case Running
    case Stopping
    case Stopped
    case Restarting
    case Deleting
    case Unknown
}

public enum Aggregations : String, Codable
{
    case None
    case Count
    case DistinctCount
    case Sum
    case Min
    case Max
    case Avg
    case First
}

public class TimeSeriesDefinition : Auditable, IHasIdName, IHasTenantId, IHasObjectType
{
    public var id:String
    // @References(typeof(Tenant))
    public var tenantId:String

    public var tenant:Tenant
    public var name:String
    public var displayName:String
    // @Ignore()
    public var selfLink:String

    // @Required()
    public var objectType:ObjectTypes?

    public var Description:String
    public var sourceType:ObjectTypes
    public var autoCollection:Bool
    public var autoCollectionQuery:String
    public var autoCollectionInterval:Int?
    public var autoCollectionIntervalUnit:IntervalUnits?
    @TimeSpan public var autoCollectionTime:TimeInterval?
    public var lastAutoCollected:Date?
    public var retentionTimeMonths:Int

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case id
        case tenantId
        case tenant
        case name
        case displayName
        case selfLink
        case objectType
        case Description
        case sourceType
        case autoCollection
        case autoCollectionQuery
        case autoCollectionInterval
        case autoCollectionIntervalUnit
        case autoCollectionTime
        case lastAutoCollected
        case retentionTimeMonths
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        id = try container.decodeIfPresent(String.self, forKey: .id)
        tenantId = try container.decodeIfPresent(String.self, forKey: .tenantId)
        tenant = try container.decodeIfPresent(Tenant.self, forKey: .tenant)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        displayName = try container.decodeIfPresent(String.self, forKey: .displayName)
        selfLink = try container.decodeIfPresent(String.self, forKey: .selfLink)
        objectType = try container.decodeIfPresent(ObjectTypes.self, forKey: .objectType)
        Description = try container.decodeIfPresent(String.self, forKey: .Description)
        sourceType = try container.decodeIfPresent(ObjectTypes.self, forKey: .sourceType)
        autoCollection = try container.decodeIfPresent(Bool.self, forKey: .autoCollection)
        autoCollectionQuery = try container.decodeIfPresent(String.self, forKey: .autoCollectionQuery)
        autoCollectionInterval = try container.decodeIfPresent(Int.self, forKey: .autoCollectionInterval)
        autoCollectionIntervalUnit = try container.decodeIfPresent(IntervalUnits.self, forKey: .autoCollectionIntervalUnit)
        autoCollectionTime = try container.convertIfPresent(TimeInterval.self, forKey: .autoCollectionTime)
        lastAutoCollected = try container.decodeIfPresent(Date.self, forKey: .lastAutoCollected)
        retentionTimeMonths = try container.decodeIfPresent(Int.self, forKey: .retentionTimeMonths)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if id != nil { try container.encode(id, forKey: .id) }
        if tenantId != nil { try container.encode(tenantId, forKey: .tenantId) }
        if tenant != nil { try container.encode(tenant, forKey: .tenant) }
        if name != nil { try container.encode(name, forKey: .name) }
        if displayName != nil { try container.encode(displayName, forKey: .displayName) }
        if selfLink != nil { try container.encode(selfLink, forKey: .selfLink) }
        if objectType != nil { try container.encode(objectType, forKey: .objectType) }
        if Description != nil { try container.encode(Description, forKey: .Description) }
        if sourceType != nil { try container.encode(sourceType, forKey: .sourceType) }
        if autoCollection != nil { try container.encode(autoCollection, forKey: .autoCollection) }
        if autoCollectionQuery != nil { try container.encode(autoCollectionQuery, forKey: .autoCollectionQuery) }
        if autoCollectionInterval != nil { try container.encode(autoCollectionInterval, forKey: .autoCollectionInterval) }
        if autoCollectionIntervalUnit != nil { try container.encode(autoCollectionIntervalUnit, forKey: .autoCollectionIntervalUnit) }
        if autoCollectionTime != nil { try container.encode(autoCollectionTime, forKey: .autoCollectionTime) }
        if lastAutoCollected != nil { try container.encode(lastAutoCollected, forKey: .lastAutoCollected) }
        if retentionTimeMonths != nil { try container.encode(retentionTimeMonths, forKey: .retentionTimeMonths) }
    }
}

public class Tenant : ConfigItem, IHasVariables
{
    // @Required()
    public var variables:IList<Variable>?

    // @Required()
    public var allowedMailDomains:IList<String>?

    // @Required()
    public var licensedModules:IList<String>?

    // @Required()
    public var defaultDeploymentLifetimeDays:Int16?

    // @Required()
    public var maxDeploymentLifetimeDays:Int16?

    // @Required()
    public var systemUnpatchedWarningDays:Int16?

    // @Required()
    public var systemBackupMissingWarningHours:Int16?

    // @Required()
    public var stopVulnerableResourceAfterDays:Int16?

    // @Required()
    public var deploymentExpirationWarningDays:Int16?

    // @Required()
    public var patchNotificationDays:Int16?

    // @Required()
    public var useCustomHostnames:Bool?

    // @Required()
    public var removeInactiveVulnerabilitiesAfterDays:Int16?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case name
        case objectType
        case selfLink
        case variables
        case allowedMailDomains
        case licensedModules
        case defaultDeploymentLifetimeDays
        case maxDeploymentLifetimeDays
        case systemUnpatchedWarningDays
        case systemBackupMissingWarningHours
        case stopVulnerableResourceAfterDays
        case deploymentExpirationWarningDays
        case patchNotificationDays
        case useCustomHostnames
        case removeInactiveVulnerabilitiesAfterDays
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        objectType = try container.decodeIfPresent(ObjectTypes.self, forKey: .objectType)
        selfLink = try container.decodeIfPresent(String.self, forKey: .selfLink)
        variables = try container.decodeIfPresent(IList<Variable>.self, forKey: .variables)
        allowedMailDomains = try container.decodeIfPresent(IList<String>.self, forKey: .allowedMailDomains)
        licensedModules = try container.decodeIfPresent(IList<String>.self, forKey: .licensedModules)
        defaultDeploymentLifetimeDays = try container.decodeIfPresent(Int16.self, forKey: .defaultDeploymentLifetimeDays)
        maxDeploymentLifetimeDays = try container.decodeIfPresent(Int16.self, forKey: .maxDeploymentLifetimeDays)
        systemUnpatchedWarningDays = try container.decodeIfPresent(Int16.self, forKey: .systemUnpatchedWarningDays)
        systemBackupMissingWarningHours = try container.decodeIfPresent(Int16.self, forKey: .systemBackupMissingWarningHours)
        stopVulnerableResourceAfterDays = try container.decodeIfPresent(Int16.self, forKey: .stopVulnerableResourceAfterDays)
        deploymentExpirationWarningDays = try container.decodeIfPresent(Int16.self, forKey: .deploymentExpirationWarningDays)
        patchNotificationDays = try container.decodeIfPresent(Int16.self, forKey: .patchNotificationDays)
        useCustomHostnames = try container.decodeIfPresent(Bool.self, forKey: .useCustomHostnames)
        removeInactiveVulnerabilitiesAfterDays = try container.decodeIfPresent(Int16.self, forKey: .removeInactiveVulnerabilitiesAfterDays)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if name != nil { try container.encode(name, forKey: .name) }
        if objectType != nil { try container.encode(objectType, forKey: .objectType) }
        if selfLink != nil { try container.encode(selfLink, forKey: .selfLink) }
        if variables != nil { try container.encode(variables, forKey: .variables) }
        if allowedMailDomains != nil { try container.encode(allowedMailDomains, forKey: .allowedMailDomains) }
        if licensedModules != nil { try container.encode(licensedModules, forKey: .licensedModules) }
        if defaultDeploymentLifetimeDays != nil { try container.encode(defaultDeploymentLifetimeDays, forKey: .defaultDeploymentLifetimeDays) }
        if maxDeploymentLifetimeDays != nil { try container.encode(maxDeploymentLifetimeDays, forKey: .maxDeploymentLifetimeDays) }
        if systemUnpatchedWarningDays != nil { try container.encode(systemUnpatchedWarningDays, forKey: .systemUnpatchedWarningDays) }
        if systemBackupMissingWarningHours != nil { try container.encode(systemBackupMissingWarningHours, forKey: .systemBackupMissingWarningHours) }
        if stopVulnerableResourceAfterDays != nil { try container.encode(stopVulnerableResourceAfterDays, forKey: .stopVulnerableResourceAfterDays) }
        if deploymentExpirationWarningDays != nil { try container.encode(deploymentExpirationWarningDays, forKey: .deploymentExpirationWarningDays) }
        if patchNotificationDays != nil { try container.encode(patchNotificationDays, forKey: .patchNotificationDays) }
        if useCustomHostnames != nil { try container.encode(useCustomHostnames, forKey: .useCustomHostnames) }
        if removeInactiveVulnerabilitiesAfterDays != nil { try container.encode(removeInactiveVulnerabilitiesAfterDays, forKey: .removeInactiveVulnerabilitiesAfterDays) }
    }
}

public enum IntervalUnits : String, Codable
{
    case Second
    case Minute
    case Hour
    case Day
    case Week
    case Month
    case Year
}


Swift QueryResourceGroups 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/resourcegroups/ HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"offset":0,"total":0,"results":[{"shortId":"String","tenantId":"00000000-0000-0000-0000-000000000000","name":"String","objectType":"ResourceGroup","selfLink":"/resourcegroups/00000000-0000-0000-0000-000000000000","environment":"Lab","state":"New","parentId":"00000000-0000-0000-0000-000000000000","parent":{"shortId":"String","tenantId":"00000000-0000-0000-0000-000000000000","name":"String","nameUserDefinedPart":"String","objectType":"Deployment","selfLink":"/deployments/00000000-0000-0000-0000-000000000000","state":"New","environment":"Lab","templateId":"00000000-0000-0000-0000-000000000000","parameters":null,"variables":null,"variablesSnapshot":null,"parentId":"00000000-0000-0000-0000-000000000000","parent":{"tenantId":"00000000-0000-0000-0000-000000000000","name":"String","objectType":"Collection","selfLink":"/collections/00000000-0000-0000-0000-000000000000","variables":null,"isLostAndFound":false,"monthlyBudget":0,"sendBudgetNotificationMails":false,"budgetWarningThresholdPercent":0,"id":"00000000-0000-0000-0000-000000000000","displayName":"String","description":"String","tags":null,"path":null,"created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","isDeleted":false,"deleted":"0001-01-01T00:00:00.0000000Z","deleteUser":"String","deleteUserId":"String"},"validFrom":"0001-01-01T00:00:00.0000000Z","validUntil":"0001-01-01T00:00:00.0000000Z","isNeverExpiring":false,"nextPatchDate":"0001-01-01T00:00:00.0000000Z","defaultResourceProviderId":"00000000-0000-0000-0000-000000000000","needsAttention":false,"composition":"Native","monthlyBudget":0,"sendBudgetNotificationMails":false,"budgetWarningThresholdPercent":0,"operationalState":"None","resourcesRunning":0,"resourcesTotal":0,"id":"00000000-0000-0000-0000-000000000000","displayName":"String","description":"String","tags":null,"path":null,"created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","isDeleted":false,"deleted":"0001-01-01T00:00:00.0000000Z","deleteUser":"String","deleteUserId":"String"},"templateId":"00000000-0000-0000-0000-000000000000","parameters":null,"variables":null,"nextPatchDate":"0001-01-01T00:00:00.0000000Z","composition":"Native","id":"00000000-0000-0000-0000-000000000000","displayName":"String","description":"String","tags":null,"path":null,"created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","isDeleted":false,"deleted":"0001-01-01T00:00:00.0000000Z","deleteUser":"String","deleteUserId":"String"}],"meta":{"String":"String"},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}