| Required roles: | TenantReader, TenantReader |
| GET | /api/usernotes | Returns a list of user notes, filterable by ConfigItemId | |
|---|---|---|---|
| GET | /usernotes | Returns a list of user notes, filterable by ConfigItemId |
import Foundation
import ServiceStack
/**
* Returns a list of user notes
*/
// @Api(Description="Returns a list of user notes")
// @ApiResponse(Description="Ok", ResponseType=typeof(0, Culture=neutral, PublicKeyToken=null]]), StatusCode=200)
public class QueryUserNotes : QueryDb<UserNote>, IGetMultipleRequest, IHasTenantName, IGet
{
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
public var tenantName:String
/**
* Filter notes by the config item they are attached to
*/
// @ApiMember(DataType="string", Description="Filter notes by the config item they are attached to", Format="guid", ParameterType="query")
public var configItemId: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?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case tenantName
case configItemId
case includeDeleted
}
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)
configItemId = try container.decodeIfPresent(String.self, forKey: .configItemId)
includeDeleted = try container.decodeIfPresent(Bool.self, forKey: .includeDeleted)
}
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 configItemId != nil { try container.encode(configItemId, forKey: .configItemId) }
if includeDeleted != nil { try container.encode(includeDeleted, forKey: .includeDeleted) }
}
}
public class UserNote : Auditable, IHasId, IHasObjectType, IHasTenantId
{
public var id:String
// @Required()
// @StringLength(1000)
public var message:String?
// @Required()
public var configItemId:String?
// @Required()
public var configItemType:ObjectTypes?
// @Required()
public var configItemName:String?
// @Required()
public var tenantId:String?
// @Ignore()
public var objectType:ObjectTypes
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case id
case message
case configItemId
case configItemType
case configItemName
case tenantId
case objectType
}
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)
message = try container.decodeIfPresent(String.self, forKey: .message)
configItemId = try container.decodeIfPresent(String.self, forKey: .configItemId)
configItemType = try container.decodeIfPresent(ObjectTypes.self, forKey: .configItemType)
configItemName = try container.decodeIfPresent(String.self, forKey: .configItemName)
tenantId = try container.decodeIfPresent(String.self, forKey: .tenantId)
objectType = try container.decodeIfPresent(ObjectTypes.self, forKey: .objectType)
}
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 message != nil { try container.encode(message, forKey: .message) }
if configItemId != nil { try container.encode(configItemId, forKey: .configItemId) }
if configItemType != nil { try container.encode(configItemType, forKey: .configItemType) }
if configItemName != nil { try container.encode(configItemName, forKey: .configItemName) }
if tenantId != nil { try container.encode(tenantId, forKey: .tenantId) }
if objectType != nil { try container.encode(objectType, forKey: .objectType) }
}
}
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 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 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 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 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 enum Environments : String, Codable
{
case Lab
case Poc
case Dev
case Test
case Int
case Uat
case Prod
}
public enum IntervalUnits : String, Codable
{
case Second
case Minute
case Hour
case Day
case Week
case Month
case Year
}
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/usernotes 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":[{"id":"00000000-0000-0000-0000-000000000000","message":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","configItemName":"String","tenantId":"00000000-0000-0000-0000-000000000000","objectType":"UserNote","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"}}}