CoreService

<back to all web services

GetPatchingWindowAssignment

Patching - CRUD

Returns a single patching window assignment by its id

Requires Authentication
Requires the role:TenantReader
The following routes are available for this service:
GET/api/patching/windows/assignments/{Id}Returns a single patching window assignment by its id
GET/patching/windows/assignments/{Id}Returns a single patching window assignment by its id
import Foundation
import ServiceStack

/**
* Returns a single patching window assignment by its id
*/
// @Api(Description="Returns a single patching window assignment by its id")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(PatchingWindowAssignmentDto), StatusCode=200)
public class GetPatchingWindowAssignment : IBaseRequest, IHasId, IHasTenantName, IGet, Codable
{
    /**
    * The primary key of every config item
    */
    // @ApiMember(DataType="string", Description="The primary key of every config item", 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 PatchingWindowAssignmentDto : Codable
{
    public var id:String
    public var resourceId:String
    public var resource:ResourceDto
    public var patchingWindowId:String
    public var patchingWindow:PatchingWindowDto

    required public init(){}
}

public class ResourceDto : ConfigItemDto, IResourceDto
{
    /**
    * Free text field to store an external resource id
    */
    public var extId:String
    /**
    * Free text field to store an external resource type
    */
    public var extType:String
    /**
    * Free text field to store an external resource name
    */
    public var extName:String
    /**
    * The id of the tenant
    */
    public var tenantId:String
    /**
    * The id of the parent (ResourceGroup)
    */
    public var parentId:String
    /**
    * The parent (ResourceGroup
    */
    public var parent:ConfigItemDto
    /**
    * The id of the parent (Deployment
    */
    public var deploymentId:String
    /**
    * The parent (Deployement
    */
    public var deployment:DeploymentDto
    /**
    * The id of the collection the resource belongs to
    */
    public var collectionId:String
    /**
    * The collection the resource belongs to
    */
    public var collection:DeploymentCollectionDto
    /**
    * The environment the resourcegroup is deployed in
    */
    public var environment:Environments
    /**
    * The id of the provider of the resource (e.g. Azure, AWS, other DC provider
    */
    public var resourceProviderId:String
    /**
    * The provider of the resource (e.g. Azure, AWS, other DC provider
    */
    public var resourceProvider:ResourceProviderDto
    /**
    * State of the resource
    */
    public var state:OperationalStates
    public var variables:IList<VariableDto>
    /**
    * Can be used for dc location
    */
    public var location:String
    /**
    * Last time the resource was seen/updated by a scan/cfgmgmt run etc.
    */
    public var lastSeen:Date?
    /**
    * Last time the resource has been patched successfully
    */
    public var lastPatchDate:Date?
    /**
    * Scheduled time for the next patching window
    */
    public var nextPatchDate:Date?
    /**
    * Time of the last successfull backup
    */
    public var lastBackupDate:Date?
    /**
    * True = scanned (not deployed from dune template), False = deployed from dune with template
    */
    public var isForeign:Bool
    /**
    * Is alerting in external monitoring activated
    */
    public var isAlerting:Bool
    /**
    * Used to identify external monitoring maintenance/downtime id
    */
    public var alertingDisabledId:String
    /**
    * Reason why alerting is disabled
    */
    public var alertingDisabledReason:String
    /**
    * Identifies the resource as vulnerable (security)
    */
    public var isVulnerable:Bool
    /**
    * Reason why the resource is vulnerable
    */
    public var vulnerabilityReason:String
    /**
    * True if resource is in cmdb but missing on provider/infra
    */
    public var isMissingOnProvider:Bool
    /**
    * Shows if a resource can be started/stopped
    */
    public var supportsStartStop:Bool
    /**
    * The cost for the current month
    */
    public var costCurrentMonth:Double
    /**
    * The cost for the last month
    */
    public var costLastMonth:Double
    /**
    * The cost currency
    */
    public var costCurrency:String
    /**
    * Additional generic configs
    */
    public var config:[String:String] = [:]

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

    private enum CodingKeys : String, CodingKey {
        case extId
        case extType
        case extName
        case tenantId
        case parentId
        case parent
        case deploymentId
        case deployment
        case collectionId
        case collection
        case environment
        case resourceProviderId
        case resourceProvider
        case state
        case variables
        case location
        case lastSeen
        case lastPatchDate
        case nextPatchDate
        case lastBackupDate
        case isForeign
        case isAlerting
        case alertingDisabledId
        case alertingDisabledReason
        case isVulnerable
        case vulnerabilityReason
        case isMissingOnProvider
        case supportsStartStop
        case costCurrentMonth
        case costLastMonth
        case costCurrency
        case config
        case links
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        extId = try container.decodeIfPresent(String.self, forKey: .extId)
        extType = try container.decodeIfPresent(String.self, forKey: .extType)
        extName = try container.decodeIfPresent(String.self, forKey: .extName)
        tenantId = try container.decodeIfPresent(String.self, forKey: .tenantId)
        parentId = try container.decodeIfPresent(String.self, forKey: .parentId)
        parent = try container.decodeIfPresent(ConfigItemDto.self, forKey: .parent)
        deploymentId = try container.decodeIfPresent(String.self, forKey: .deploymentId)
        deployment = try container.decodeIfPresent(DeploymentDto.self, forKey: .deployment)
        collectionId = try container.decodeIfPresent(String.self, forKey: .collectionId)
        collection = try container.decodeIfPresent(DeploymentCollectionDto.self, forKey: .collection)
        environment = try container.decodeIfPresent(Environments.self, forKey: .environment)
        resourceProviderId = try container.decodeIfPresent(String.self, forKey: .resourceProviderId)
        resourceProvider = try container.decodeIfPresent(ResourceProviderDto.self, forKey: .resourceProvider)
        state = try container.decodeIfPresent(OperationalStates.self, forKey: .state)
        variables = try container.decodeIfPresent(IList<VariableDto>.self, forKey: .variables)
        location = try container.decodeIfPresent(String.self, forKey: .location)
        lastSeen = try container.decodeIfPresent(Date.self, forKey: .lastSeen)
        lastPatchDate = try container.decodeIfPresent(Date.self, forKey: .lastPatchDate)
        nextPatchDate = try container.decodeIfPresent(Date.self, forKey: .nextPatchDate)
        lastBackupDate = try container.decodeIfPresent(Date.self, forKey: .lastBackupDate)
        isForeign = try container.decodeIfPresent(Bool.self, forKey: .isForeign)
        isAlerting = try container.decodeIfPresent(Bool.self, forKey: .isAlerting)
        alertingDisabledId = try container.decodeIfPresent(String.self, forKey: .alertingDisabledId)
        alertingDisabledReason = try container.decodeIfPresent(String.self, forKey: .alertingDisabledReason)
        isVulnerable = try container.decodeIfPresent(Bool.self, forKey: .isVulnerable)
        vulnerabilityReason = try container.decodeIfPresent(String.self, forKey: .vulnerabilityReason)
        isMissingOnProvider = try container.decodeIfPresent(Bool.self, forKey: .isMissingOnProvider)
        supportsStartStop = try container.decodeIfPresent(Bool.self, forKey: .supportsStartStop)
        costCurrentMonth = try container.decodeIfPresent(Double.self, forKey: .costCurrentMonth)
        costLastMonth = try container.decodeIfPresent(Double.self, forKey: .costLastMonth)
        costCurrency = try container.decodeIfPresent(String.self, forKey: .costCurrency)
        config = try container.decodeIfPresent([String:String].self, forKey: .config) ?? [:]
        links = try container.decodeIfPresent(IList<LinkDto>.self, forKey: .links)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if extId != nil { try container.encode(extId, forKey: .extId) }
        if extType != nil { try container.encode(extType, forKey: .extType) }
        if extName != nil { try container.encode(extName, forKey: .extName) }
        if tenantId != nil { try container.encode(tenantId, forKey: .tenantId) }
        if parentId != nil { try container.encode(parentId, forKey: .parentId) }
        if parent != nil { try container.encode(parent, forKey: .parent) }
        if deploymentId != nil { try container.encode(deploymentId, forKey: .deploymentId) }
        if deployment != nil { try container.encode(deployment, forKey: .deployment) }
        if collectionId != nil { try container.encode(collectionId, forKey: .collectionId) }
        if collection != nil { try container.encode(collection, forKey: .collection) }
        if environment != nil { try container.encode(environment, forKey: .environment) }
        if resourceProviderId != nil { try container.encode(resourceProviderId, forKey: .resourceProviderId) }
        if resourceProvider != nil { try container.encode(resourceProvider, forKey: .resourceProvider) }
        if state != nil { try container.encode(state, forKey: .state) }
        if variables != nil { try container.encode(variables, forKey: .variables) }
        if location != nil { try container.encode(location, forKey: .location) }
        if lastSeen != nil { try container.encode(lastSeen, forKey: .lastSeen) }
        if lastPatchDate != nil { try container.encode(lastPatchDate, forKey: .lastPatchDate) }
        if nextPatchDate != nil { try container.encode(nextPatchDate, forKey: .nextPatchDate) }
        if lastBackupDate != nil { try container.encode(lastBackupDate, forKey: .lastBackupDate) }
        if isForeign != nil { try container.encode(isForeign, forKey: .isForeign) }
        if isAlerting != nil { try container.encode(isAlerting, forKey: .isAlerting) }
        if alertingDisabledId != nil { try container.encode(alertingDisabledId, forKey: .alertingDisabledId) }
        if alertingDisabledReason != nil { try container.encode(alertingDisabledReason, forKey: .alertingDisabledReason) }
        if isVulnerable != nil { try container.encode(isVulnerable, forKey: .isVulnerable) }
        if vulnerabilityReason != nil { try container.encode(vulnerabilityReason, forKey: .vulnerabilityReason) }
        if isMissingOnProvider != nil { try container.encode(isMissingOnProvider, forKey: .isMissingOnProvider) }
        if supportsStartStop != nil { try container.encode(supportsStartStop, forKey: .supportsStartStop) }
        if costCurrentMonth != nil { try container.encode(costCurrentMonth, forKey: .costCurrentMonth) }
        if costLastMonth != nil { try container.encode(costLastMonth, forKey: .costLastMonth) }
        if costCurrency != nil { try container.encode(costCurrency, forKey: .costCurrency) }
        if config.count > 0 { try container.encode(config, forKey: .config) }
        if links != nil { try container.encode(links, forKey: .links) }
    }
}

public class ConfigItemDto : IConfigItem, Codable
{
    public var id:String
    public var name:String
    public var displayName:String
    public var Description:String
    public var objectType:ObjectTypes
    public var selfLink:String
    public var tags:IList<TagDto>
    public var path:IList<PathItemDto>
    public var created:Date
    public var createUser:String
    public var createUserId:String
    public var modified:Date
    public var modifyUser:String
    public var modifyUserId:String
    public var isDeleted:Bool
    public var deleted:Date?
    public var deleteUser:String
    public var deleteUserId:String
    public var links:IList<LinkDto>

    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 TagDto : Codable
{
    public var name:String
    public var value:String
    public var isProtected:Bool

    required public init(){}
}

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

    required public init(){}
}

public class LinkDto : Codable
{
    public var caption:String
    public var rel:String
    public var hRef:String
    public var method:String

    required public init(){}
}

public class DeploymentDto : ConfigItemDto, IHasParentDto, IHasTenantId, IEnvironmentSpecific
{
    /**
    * The operational state of the deployment (Running, Stopped, None, Unknown)
    */
    public var operationalState:OperationalStates
    /**
    * How many start/stop-capable resources are currently running
    */
    public var resourcesRunning:Int
    /**
    * Total number of start/stop-capable resources in this deployment
    */
    public var resourcesTotal:Int
    /**
    * Shorter id than the guid which can be used for automation (tenant wide unique) prefixed with a 'd'. E.g. dr36x3
    */
    public var shortId:String
    /**
    * The user defined part of the name property {userDefined}_{environment}
    */
    public var nameUserDefinedPart:String
    /**
    * The id of the tenant
    */
    public var tenantId:String
    /**
    * The state of the deployment
    */
    public var state:LifecycleStates
    /**
    * The environment the deployment is deployed in
    */
    public var environment:Environments
    /**
    * The id of the template which was used to create the deployment
    */
    public var templateId:String?
    /**
    * Shows if a deployment was rolled out through a dune template or not
    */
    public var isTemplateBased:Bool
    /**
    * The parameters which were used to create this deployment
    */
    public var parameters:IList<ParameterDto>
    /**
    * A deployment scoped list of variables used for deployment of resources
    */
    public var variables:IList<VariableDto>
    /**
    * A snapshot of the varialbs used to create the deployment
    */
    public var variablesSnapshot:IList<VariableDto>
    /**
    * The id of the parent (collection) of the deployment
    */
    public var parentId:String
    /**
    * The parent (collection) of the deployment
    */
    public var parent:ConfigItemDto
    /**
    * The Date when the resources got deployed
    */
    public var validFrom:Date
    /**
    * The Date when the deployment expires and has to be reevaluated
    */
    public var validUntil:Date?
    /**
    * The deployment will never expire
    */
    public var isNeverExpiring:Bool
    /**
    * The date, when the deployments resources will receive updates
    */
    public var nextPatchDate:Date?
    /**
    * The default resource provider where the resources are deployed
    */
    public var defaultResourceProviderId:String
    /**
    * Deployments which have issues in Jobs are marked with NeedsAttention
    */
    public var needsAttention:Bool
    /**
    * Composition show if all resources in the deployment are dune native, dune foreign or a mix of both
    */
    public var composition:ResourceCompositions
    /**
    * The monthly cost budget for the whole collection
    */
    public var monthlyBudget:Double?
    /**
    * Whether to send budget information mails to the collection owners
    */
    public var sendBudgetNotificationMails:Bool?
    /**
    * A threshold, when to send the first budget warning mail
    */
    public var budgetWarningThresholdPercent:Int?

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

    private enum CodingKeys : String, CodingKey {
        case operationalState
        case resourcesRunning
        case resourcesTotal
        case shortId
        case nameUserDefinedPart
        case tenantId
        case state
        case environment
        case templateId
        case isTemplateBased
        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 links
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        operationalState = try container.decodeIfPresent(OperationalStates.self, forKey: .operationalState)
        resourcesRunning = try container.decodeIfPresent(Int.self, forKey: .resourcesRunning)
        resourcesTotal = try container.decodeIfPresent(Int.self, forKey: .resourcesTotal)
        shortId = try container.decodeIfPresent(String.self, forKey: .shortId)
        nameUserDefinedPart = try container.decodeIfPresent(String.self, forKey: .nameUserDefinedPart)
        tenantId = try container.decodeIfPresent(String.self, forKey: .tenantId)
        state = try container.decodeIfPresent(LifecycleStates.self, forKey: .state)
        environment = try container.decodeIfPresent(Environments.self, forKey: .environment)
        templateId = try container.decodeIfPresent(String.self, forKey: .templateId)
        isTemplateBased = try container.decodeIfPresent(Bool.self, forKey: .isTemplateBased)
        parameters = try container.decodeIfPresent(IList<ParameterDto>.self, forKey: .parameters)
        variables = try container.decodeIfPresent(IList<VariableDto>.self, forKey: .variables)
        variablesSnapshot = try container.decodeIfPresent(IList<VariableDto>.self, forKey: .variablesSnapshot)
        parentId = try container.decodeIfPresent(String.self, forKey: .parentId)
        parent = try container.decodeIfPresent(ConfigItemDto.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)
        links = try container.decodeIfPresent(IList<LinkDto>.self, forKey: .links)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        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) }
        if shortId != nil { try container.encode(shortId, forKey: .shortId) }
        if nameUserDefinedPart != nil { try container.encode(nameUserDefinedPart, forKey: .nameUserDefinedPart) }
        if tenantId != nil { try container.encode(tenantId, forKey: .tenantId) }
        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 isTemplateBased != nil { try container.encode(isTemplateBased, forKey: .isTemplateBased) }
        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 links != nil { try container.encode(links, forKey: .links) }
    }
}

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

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

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

public class ParameterDto : Codable
{
    public var name:String
    public var Description:String
    /**
    * Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false). Note: string values need extra quotes
    */
    public var value:String
    /**
    * Optional default value for the frontend. Needs to be in the same format as the value
    */
    public var `default`:String
    /**
    * Optional parameters do not need to have a value. Default -> Optional=false
    */
    public var optional:Bool
    /**
    * The data type of the value and default property
    */
    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 VariableDto : Codable
{
    public var name:String
    /**
    * 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
    */
    public var value:String
    /**
    * The data type of the value property
    */
    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 enum ResourceCompositions : String, Codable
{
    case Native
    case Foreign
    case Mixed
}

public class DeploymentCollectionDto : ConfigItemDto, IHasTenantId
{
    public var tenantId:String
    public var tenant:TenantDto
    /**
    * A collection scoped list of variables
    */
    public var variables:IList<VariableDto>
    /**
    * Defines the collection where scanned but not deployed resources will be stored
    */
    public var isLostAndFound:Bool
    /**
    * The monthly cost budget for the whole collection
    */
    public var monthlyBudget:Double?
    /**
    * Whether to send budget information mails to the collection owners
    */
    public var sendBudgetNotificationMails:Bool?
    /**
    * A threshold, when to send the first budget warning mail
    */
    public var budgetWarningThresholdPercent:Int?

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

    private enum CodingKeys : String, CodingKey {
        case tenantId
        case tenant
        case variables
        case isLostAndFound
        case monthlyBudget
        case sendBudgetNotificationMails
        case budgetWarningThresholdPercent
        case links
    }

    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)
        tenant = try container.decodeIfPresent(TenantDto.self, forKey: .tenant)
        variables = try container.decodeIfPresent(IList<VariableDto>.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)
        links = try container.decodeIfPresent(IList<LinkDto>.self, forKey: .links)
    }

    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 tenant != nil { try container.encode(tenant, forKey: .tenant) }
        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) }
        if links != nil { try container.encode(links, forKey: .links) }
    }
}

public class TenantDto : ConfigItemDto
{
    /**
    * Variables defined on tenant level
    */
    public var variables:IList<VariableDto>
    /**
    * Allowed email domains used for authentication
    */
    public var allowedMailDomains:IList<String>
    /**
    * List of licensed modules for this tenant
    */
    public var licensedModules:IList<String>
    /**
    * Amount of days until a Deployment expires
    */
    public var defaultDeploymentLifetimeDays:Int16
    /**
    * Max amount of days until a Deployment expires
    */
    public var maxDeploymentLifetimeDays:Int16
    /**
    * Amount of days without patching until a unpatched warning is shown
    */
    public var systemUnpatchedWarningDays:Int16
    /**
    * Amount of hours without backup until a backup missing warning is shown
    */
    public var systemBackupMissingWarningHours:Int16
    /**
    * Amount of days until a vulnerable resource is getting stopped
    */
    public var stopVulnerableResourceAfterDays:Int16
    /**
    * Amount of days before deployment expiration, which triggers the expiration warning
    */
    public var deploymentExpirationWarningDays:Int16
    /**
    * Amount of days the patch notification is sent out prior to the patch date
    */
    public var patchNotificationDays:Int16
    /**
    * Use a pool with your own hostnames (true) or let the hostname be auto generated (false)
    */
    public var useCustomHostnames:Bool
    /**
    * After how many days inactive vulnerabilities will be purged from database
    */
    public var removeInactiveVulnerabilitiesAfterDays:Int16

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

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

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        variables = try container.decodeIfPresent(IList<VariableDto>.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)
        links = try container.decodeIfPresent(IList<LinkDto>.self, forKey: .links)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        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) }
        if links != nil { try container.encode(links, forKey: .links) }
    }
}

public class ResourceProviderDto : ConfigItemDto, IHasTenantId
{
    public var tenantId:String
    /**
    * If environment cannot be detected while scanning, default environment will be used
    */
    public var defaultEnvironment:Environments
    /**
    * List off all allowed environments for this resource provider
    */
    public var allowedEnvironments:IList<Environments>
    /**
    * Defines the provider type (e.g. Azure, Aws)
    */
    public var type:ResourceProviderTypes
    /**
    * Additional generic data which varies depending on ProviderType
    */
    public var config:IList<ProviderConfigEntryDto>
    /**
    * Disabled ResourceProviders cannot be selected for new deployments
    */
    public var isDisabled:Bool
    /**
    * Shows if a ResourceProvider has been initialized and can accept deployments (resources)
    */
    public var isReadyForDeployments:Bool
    /**
    * The cost for the current month
    */
    public var costCurrentMonth:Double
    /**
    * The cost for the last month
    */
    public var costLastMonth:Double
    /**
    * The cost currency
    */
    public var costCurrency:String

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

    private enum CodingKeys : String, CodingKey {
        case tenantId
        case defaultEnvironment
        case allowedEnvironments
        case type
        case config
        case isDisabled
        case isReadyForDeployments
        case costCurrentMonth
        case costLastMonth
        case costCurrency
    }

    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)
        defaultEnvironment = try container.decodeIfPresent(Environments.self, forKey: .defaultEnvironment)
        allowedEnvironments = try container.decodeIfPresent(IList<Environments>.self, forKey: .allowedEnvironments)
        type = try container.decodeIfPresent(ResourceProviderTypes.self, forKey: .type)
        config = try container.decodeIfPresent(IList<ProviderConfigEntryDto>.self, forKey: .config)
        isDisabled = try container.decodeIfPresent(Bool.self, forKey: .isDisabled)
        isReadyForDeployments = try container.decodeIfPresent(Bool.self, forKey: .isReadyForDeployments)
        costCurrentMonth = try container.decodeIfPresent(Double.self, forKey: .costCurrentMonth)
        costLastMonth = try container.decodeIfPresent(Double.self, forKey: .costLastMonth)
        costCurrency = try container.decodeIfPresent(String.self, forKey: .costCurrency)
    }

    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 defaultEnvironment != nil { try container.encode(defaultEnvironment, forKey: .defaultEnvironment) }
        if allowedEnvironments != nil { try container.encode(allowedEnvironments, forKey: .allowedEnvironments) }
        if type != nil { try container.encode(type, forKey: .type) }
        if config != nil { try container.encode(config, forKey: .config) }
        if isDisabled != nil { try container.encode(isDisabled, forKey: .isDisabled) }
        if isReadyForDeployments != nil { try container.encode(isReadyForDeployments, forKey: .isReadyForDeployments) }
        if costCurrentMonth != nil { try container.encode(costCurrentMonth, forKey: .costCurrentMonth) }
        if costLastMonth != nil { try container.encode(costLastMonth, forKey: .costLastMonth) }
        if costCurrency != nil { try container.encode(costCurrency, forKey: .costCurrency) }
    }
}

public enum ResourceProviderTypes : String, Codable
{
    case Azure
    case AmazonWebServices
    case GoogleCloudPlatform
    case ActiveDirectoryServices
    case DomainNameSystem
    case SwisscomESC
    case AzureKeyVault
}

public class ProviderConfigEntryDto : Codable
{
    public var name:String
    public var value:String
    public var isSecure:Bool

    required public init(){}
}

public class PatchingWindowDto : Codable
{
    public var id:String
    public var name:String
    public var dayOfWeek:DayOfWeek
    public var monthlyOccurence:MonthlyDayOccurence
    @TimeSpan public var timeOfDay:TimeInterval
    @TimeSpan public var duration:TimeInterval
    public var isDefault:Bool

    required public init(){}
}

public enum MonthlyDayOccurence : Int, Codable
{
    case First = 1
    case Second = 2
    case Third = 3
    case Fourth = 4
}


Swift GetPatchingWindowAssignment 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/patching/windows/assignments/{Id} HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"id":"00000000-0000-0000-0000-000000000000","resourceId":"00000000-0000-0000-0000-000000000000","resource":{"extId":"String","extType":"String","extName":"String","tenantId":"00000000-0000-0000-0000-000000000000","parentId":"00000000-0000-0000-0000-000000000000","parent":{"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"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","links":null},"deploymentId":"00000000-0000-0000-0000-000000000000","deployment":{"operationalState":"None","resourcesRunning":0,"resourcesTotal":0,"shortId":"String","nameUserDefinedPart":"String","tenantId":"00000000-0000-0000-0000-000000000000","state":"New","environment":"Lab","templateId":"00000000-0000-0000-0000-000000000000","isTemplateBased":true,"parameters":null,"variables":null,"variablesSnapshot":null,"parentId":"00000000-0000-0000-0000-000000000000","parent":{"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"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","links":null},"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,"links":[{"caption":"Index","rel":"index","hRef":"/deployments/","method":"GET"},{"caption":"Collection","rel":"up","hRef":"/collections/00000000-0000-0000-0000-000000000000","method":"GET"},{"caption":"Resourcegroups","rel":"down","hRef":"/resourcegroups?parentId=00000000-0000-0000-0000-000000000000","method":"GET"}],"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"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"},"collectionId":"00000000-0000-0000-0000-000000000000","collection":{"tenantId":"00000000-0000-0000-0000-000000000000","tenant":{"variables":null,"allowedMailDomains":null,"licensedModules":null,"defaultDeploymentLifetimeDays":0,"maxDeploymentLifetimeDays":0,"systemUnpatchedWarningDays":0,"systemBackupMissingWarningHours":0,"stopVulnerableResourceAfterDays":0,"deploymentExpirationWarningDays":0,"patchNotificationDays":0,"useCustomHostnames":false,"removeInactiveVulnerabilitiesAfterDays":0,"links":[{"caption":"Collections","rel":"down","hRef":"/collections/","method":"GET"}],"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"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"},"variables":null,"isLostAndFound":false,"monthlyBudget":0,"sendBudgetNotificationMails":false,"budgetWarningThresholdPercent":0,"links":[{"caption":"Index","rel":"up","hRef":"/collections/","method":"GET"},{"caption":"Deployments","rel":"down","hRef":"/deployments?parentId=00000000-0000-0000-0000-000000000000","method":"GET"}],"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"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"},"environment":"Lab","resourceProviderId":"00000000-0000-0000-0000-000000000000","resourceProvider":{"tenantId":"00000000-0000-0000-0000-000000000000","defaultEnvironment":"Lab","allowedEnvironments":null,"type":"Azure","config":null,"isDisabled":false,"isReadyForDeployments":false,"costCurrentMonth":0,"costLastMonth":0,"costCurrency":"String","id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"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","links":null},"state":"None","variables":null,"location":"String","lastSeen":"0001-01-01T00:00:00.0000000Z","lastPatchDate":"0001-01-01T00:00:00.0000000Z","nextPatchDate":"0001-01-01T00:00:00.0000000Z","lastBackupDate":"0001-01-01T00:00:00.0000000Z","isForeign":false,"isAlerting":false,"alertingDisabledId":"String","alertingDisabledReason":"String","isVulnerable":false,"vulnerabilityReason":"String","isMissingOnProvider":false,"supportsStartStop":false,"costCurrentMonth":0,"costLastMonth":0,"costCurrency":"String","config":{"String":{}},"links":[{"caption":"Index","rel":"index","hRef":"/resources/","method":"GET"},{"caption":"ResourceGroup","rel":"up","hRef":"/resourcegroups/00000000-0000-0000-0000-000000000000","method":"GET"},{"caption":"Deployment","rel":"up","hRef":"/deployments/00000000-0000-0000-0000-000000000000","method":"GET"}],"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"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"},"patchingWindowId":"00000000-0000-0000-0000-000000000000","patchingWindow":{"id":"00000000-0000-0000-0000-000000000000","name":"String","dayOfWeek":"Sunday","monthlyOccurence":"First","timeOfDay":"00:00:00","duration":"00:00:00","isDefault":false}}