| Required role: | TenantReader |
| POST | /api/collections/ | Creates a new collection | |
|---|---|---|---|
| POST | /collections/ | Creates a new collection |
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*
import com.google.gson.annotations.*
import com.google.gson.reflect.*
/**
* Creates a new collection
*/
@Api(Description="Creates a new collection")
@ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=DeploymentCollectionDto::class, StatusCode=201)
open class CreateCollection : ICreateRequest, IHasTenantName, IPost
{
@ApiMember(DataType="string", IsRequired=true, ParameterType="header")
@Validate(Validator="NotEmpty")
override var tenantName:String? = null
/**
* The collections name
*/
@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]+$′)")
override var name:String? = null
/**
* The collections display name
*/
@ApiMember(DataType="string", Description="The collections display name", ParameterType="body")
@Validate(Validator="MaximumLength(250)")
override var displayName:String? = null
/**
* A more detailed description for the collection
*/
@ApiMember(DataType="string", Description="A more detailed description for the collection", ParameterType="body")
@Validate(Validator="MaximumLength(8000)")
override var description:String? = null
/**
* Defines the collections where scanned but not deployed resources will be stored
*/
@ApiMember(DataType="bool", Description="Defines the collections where scanned but not deployed resources will be stored")
open var isLostAndFound:Boolean? = null
@ApiMember(DataType="array", ParameterType="body")
open var variables:IList<VariableDto>? = null
@ApiMember(DataType="array", ParameterType="body")
open var tags:IList<TagDto>? = null
}
open class VariableDto
{
open var name:String? = null
/**
* 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
*/
open var value:String? = null
/**
* The data type of the value property
*/
@SerializedName("type") open var Type:ValueDataType? = null
open var description:String? = null
open var isInherited:Boolean? = null
open var environment:Environments? = null
}
enum class ValueDataType
{
String,
Number,
Boolean,
List,
}
enum class Environments
{
Lab,
Poc,
Dev,
Test,
Int,
Uat,
Prod,
}
open class TagDto
{
open var name:String? = null
open var value:String? = null
open var isProtected:Boolean? = null
}
open class DeploymentCollectionDto : ConfigItemDto(), IHasTenantId
{
override var tenantId:UUID? = null
open var tenant:TenantDto? = null
/**
* A collection scoped list of variables
*/
open var variables:IList<VariableDto>? = null
/**
* Defines the collection where scanned but not deployed resources will be stored
*/
open var isLostAndFound:Boolean? = null
/**
* The monthly cost budget for the whole collection
*/
open var monthlyBudget:BigDecimal? = null
/**
* Whether to send budget information mails to the collection owners
*/
open var sendBudgetNotificationMails:Boolean? = null
/**
* A threshold, when to send the first budget warning mail
*/
open var budgetWarningThresholdPercent:Int? = null
override var links:IList<LinkDto>? = null
}
open class ConfigItemDto : IConfigItem
{
open var id:UUID? = null
open var name:String? = null
override var displayName:String? = null
override var description:String? = null
open var objectType:ObjectTypes? = null
override var selfLink:String? = null
override var tags:IList<TagDto>? = null
open var path:IList<PathItemDto>? = null
open var created:Date? = null
open var createUser:String? = null
open var createUserId:String? = null
open var modified:Date? = null
open var modifyUser:String? = null
open var modifyUserId:String? = null
open var isDeleted:Boolean? = null
open var deleted:Date? = null
open var deleteUser:String? = null
open var deleteUserId:String? = null
open var links:IList<LinkDto>? = null
}
enum class 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,
}
open class PathItemDto
{
open var label:String? = null
open var link:String? = null
open var objectType:ObjectTypes? = null
open var objectId:UUID? = null
}
open class LinkDto
{
open var caption:String? = null
open var rel:String? = null
open var hRef:String? = null
open var method:String? = null
}
open class TenantDto : ConfigItemDto()
{
/**
* Variables defined on tenant level
*/
open var variables:IList<VariableDto>? = null
/**
* Allowed email domains used for authentication
*/
open var allowedMailDomains:IList<String>? = null
/**
* List of licensed modules for this tenant
*/
open var licensedModules:IList<String>? = null
/**
* Amount of days until a Deployment expires
*/
open var defaultDeploymentLifetimeDays:Short? = null
/**
* Max amount of days until a Deployment expires
*/
open var maxDeploymentLifetimeDays:Short? = null
/**
* Amount of days without patching until a unpatched warning is shown
*/
open var systemUnpatchedWarningDays:Short? = null
/**
* Amount of hours without backup until a backup missing warning is shown
*/
open var systemBackupMissingWarningHours:Short? = null
/**
* Amount of days until a vulnerable resource is getting stopped
*/
open var stopVulnerableResourceAfterDays:Short? = null
/**
* Amount of days before deployment expiration, which triggers the expiration warning
*/
open var deploymentExpirationWarningDays:Short? = null
/**
* Amount of days the patch notification is sent out prior to the patch date
*/
open var patchNotificationDays:Short? = null
/**
* Use a pool with your own hostnames (true) or let the hostname be auto generated (false)
*/
open var useCustomHostnames:Boolean? = null
/**
* After how many days inactive vulnerabilities will be purged from database
*/
open var removeInactiveVulnerabilitiesAfterDays:Short? = null
override var links:IList<LinkDto>? = null
}
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"}