| Required role: | TenantReader |
| POST | /api/collections/ | Creates a new collection | |
|---|---|---|---|
| POST | /collections/ | Creates a new collection |
Imports System
Imports System.IO
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports CoreService.ServiceModel.Dtos.Collections.Crud
Imports CoreService.ServiceModel.Dtos.Base.Responses
Imports CoreService.ServiceModel.Enums
Imports CoreService.ServiceModel.Dtos.Collections.Responses
Imports YCO.Dune.Models.Enums
Imports CoreService.ServiceModel.Dtos.Tenant.Responses
Namespace Global
Namespace CoreService.ServiceModel.Dtos.Base.Responses
Public Partial Class ConfigItemDto
Implements IConfigItem
Public Overridable Property Id As Guid
Public Overridable Property Name As String
Public Overridable Property DisplayName As String Implements IConfigItem.DisplayName
Public Overridable Property Description As String Implements IConfigItem.Description
Public Overridable Property ObjectType As ObjectTypes
Public Overridable Property SelfLink As String Implements IConfigItem.SelfLink
Public Overridable Property Tags As IList(Of TagDto) Implements IConfigItem.Tags
Public Overridable Property Path As IList(Of PathItemDto)
Public Overridable Property Created As Date
Public Overridable Property CreateUser As String
Public Overridable Property CreateUserId As String
Public Overridable Property Modified As Date
Public Overridable Property ModifyUser As String
Public Overridable Property ModifyUserId As String
Public Overridable Property IsDeleted As Boolean
Public Overridable Property Deleted As Date?
Public Overridable Property DeleteUser As String
Public Overridable Property DeleteUserId As String
Public Overridable Property Links As IList(Of LinkDto)
End Class
Public Partial Class LinkDto
Public Overridable Property Caption As String
Public Overridable Property Rel As String
Public Overridable Property HRef As String
Public Overridable Property Method As String
End Class
Public Partial Class PathItemDto
Public Overridable Property Label As String
Public Overridable Property Link As String
Public Overridable Property ObjectType As ObjectTypes
Public Overridable Property ObjectId As Guid
End Class
Public Partial Class TagDto
Public Overridable Property Name As String
Public Overridable Property Value As String
Public Overridable Property IsProtected As Boolean
End Class
Public Partial Class VariableDto
Public Overridable Property Name As String
'''<Summary>
'''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
'''</Summary>
Public Overridable Property Value As String
'''<Summary>
'''The data type of the value property
'''</Summary>
Public Overridable Property Type As ValueDataType
Public Overridable Property Description As String
Public Overridable Property IsInherited As Boolean
Public Overridable Property Environment As Environments?
End Class
End Namespace
Namespace CoreService.ServiceModel.Dtos.Collections.Crud
'''<Summary>
'''Creates a new collection
'''</Summary>
<Api(Description:="Creates a new collection")>
<ApiResponse(Description:="Success", IsDefaultResponse:=true, ResponseType:=GetType(DeploymentCollectionDto), StatusCode:=201)>
Public Partial Class CreateCollection
Implements ICreateRequest
Implements IHasTenantName
Implements IPost
<ApiMember(DataType:="string", IsRequired:=true, ParameterType:="header")>
<Validate(Validator:="NotEmpty")>
Public Overridable Property TenantName As String Implements IHasTenantName.TenantName
'''<Summary>
'''The collections name
'''</Summary>
<ApiMember(DataType:="string", Description:="The collections name", IsRequired:=true, ParameterType:="body")>
<Validate(Validator:="NotEmpty")>
<Validate(Validator:="MaximumLength(50)")>
<Validate(Validator:="RegularExpression(′^[0-9a-z]+[0-9a-z-]*[0-9a-z]+$′)")>
Public Overridable Property Name As String Implements ICreateRequest.Name
'''<Summary>
'''The collections display name
'''</Summary>
<ApiMember(DataType:="string", Description:="The collections display name", ParameterType:="body")>
<Validate(Validator:="MaximumLength(250)")>
Public Overridable Property DisplayName As String Implements ICreateRequest.DisplayName
'''<Summary>
'''A more detailed description for the collection
'''</Summary>
<ApiMember(DataType:="string", Description:="A more detailed description for the collection", ParameterType:="body")>
<Validate(Validator:="MaximumLength(8000)")>
Public Overridable Property Description As String Implements ICreateRequest.Description
'''<Summary>
'''Defines the collections where scanned but not deployed resources will be stored
'''</Summary>
<ApiMember(DataType:="bool", Description:="Defines the collections where scanned but not deployed resources will be stored")>
Public Overridable Property IsLostAndFound As Boolean?
<ApiMember(DataType:="array", ParameterType:="body")>
Public Overridable Property Variables As IList(Of VariableDto)
<ApiMember(DataType:="array", ParameterType:="body")>
Public Overridable Property Tags As IList(Of TagDto)
End Class
End Namespace
Namespace CoreService.ServiceModel.Dtos.Collections.Responses
Public Partial Class DeploymentCollectionDto
Inherits ConfigItemDto
Implements IHasTenantId
Public Overridable Property TenantId As Guid Implements IHasTenantId.TenantId
Public Overridable Property Tenant As TenantDto
'''<Summary>
'''A collection scoped list of variables
'''</Summary>
Public Overridable Property Variables As IList(Of VariableDto)
'''<Summary>
'''Defines the collection where scanned but not deployed resources will be stored
'''</Summary>
Public Overridable Property IsLostAndFound As Boolean
'''<Summary>
'''The monthly cost budget for the whole collection
'''</Summary>
Public Overridable Property MonthlyBudget As Decimal?
'''<Summary>
'''Whether to send budget information mails to the collection owners
'''</Summary>
Public Overridable Property SendBudgetNotificationMails As Boolean?
'''<Summary>
'''A threshold, when to send the first budget warning mail
'''</Summary>
Public Overridable Property BudgetWarningThresholdPercent As Integer?
Public Overridable Property Links As IList(Of LinkDto)
End Class
End Namespace
Namespace CoreService.ServiceModel.Dtos.Tenant.Responses
Public Partial Class TenantDto
Inherits ConfigItemDto
'''<Summary>
'''Variables defined on tenant level
'''</Summary>
Public Overridable Property Variables As IList(Of VariableDto)
'''<Summary>
'''Allowed email domains used for authentication
'''</Summary>
Public Overridable Property AllowedMailDomains As IList(Of String)
'''<Summary>
'''List of licensed modules for this tenant
'''</Summary>
Public Overridable Property LicensedModules As IList(Of String)
'''<Summary>
'''Amount of days until a Deployment expires
'''</Summary>
Public Overridable Property DefaultDeploymentLifetimeDays As Short
'''<Summary>
'''Max amount of days until a Deployment expires
'''</Summary>
Public Overridable Property MaxDeploymentLifetimeDays As Short
'''<Summary>
'''Amount of days without patching until a unpatched warning is shown
'''</Summary>
Public Overridable Property SystemUnpatchedWarningDays As Short
'''<Summary>
'''Amount of hours without backup until a backup missing warning is shown
'''</Summary>
Public Overridable Property SystemBackupMissingWarningHours As Short
'''<Summary>
'''Amount of days until a vulnerable resource is getting stopped
'''</Summary>
Public Overridable Property StopVulnerableResourceAfterDays As Short
'''<Summary>
'''Amount of days before deployment expiration, which triggers the expiration warning
'''</Summary>
Public Overridable Property DeploymentExpirationWarningDays As Short
'''<Summary>
'''Amount of days the patch notification is sent out prior to the patch date
'''</Summary>
Public Overridable Property PatchNotificationDays As Short
'''<Summary>
'''Use a pool with your own hostnames (true) or let the hostname be auto generated (false)
'''</Summary>
Public Overridable Property UseCustomHostnames As Boolean
'''<Summary>
'''After how many days inactive vulnerabilities will be purged from database
'''</Summary>
Public Overridable Property RemoveInactiveVulnerabilitiesAfterDays As Short
Public Overridable Property Links As IList(Of LinkDto)
End Class
End Namespace
Namespace CoreService.ServiceModel.Enums
Public Enum Environments
Lab
Poc
Dev
Test
Int
Uat
Prod
End Enum
Public Enum ValueDataType
[String]
Number
[Boolean]
List
End Enum
End Namespace
Namespace YCO.Dune.Models.Enums
Public Enum ObjectTypes
None
ConfigItem
Tenant
Collection
Resource
ComputeNode
VirtualMachine
PhysicalMachine
Disk
Subnet
IPAddress
Job
JobEvent
FreezePeriod
ResourceGroup
Deployment
ResourceGroupTemplate
DeploymentTemplate
ResourceProvider
GenericResource
Role
Permission
User
PatchingWindow
Update
ReportDefinition
TimeSeries
DataPoint
Action
ActionAssignment
UserNote
End Enum
End Namespace
End Namespace
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.
POST /api/collections/ HTTP/1.1
Host: core.starburst.svc
Accept: application/json
Content-Type: application/json
Content-Length: length
{"tenantName":"String","name":"String","displayName":"String","description":"String","isLostAndFound":false,"variables":null,"tags":null,"txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"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"}