| Required role: | TenantReader |
| POST | /api/collections/ | Creates a new collection | |
|---|---|---|---|
| POST | /collections/ | Creates a new collection |
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using CoreService.ServiceModel.Dtos.Collections.Crud;
using CoreService.ServiceModel.Dtos.Base.Responses;
using CoreService.ServiceModel.Enums;
using CoreService.ServiceModel.Dtos.Collections.Responses;
using YCO.Dune.Models.Enums;
using CoreService.ServiceModel.Dtos.Tenant.Responses;
namespace CoreService.ServiceModel.Dtos.Base.Responses
{
public partial class ConfigItemDto
: IConfigItem
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual string DisplayName { get; set; }
public virtual string? Description { get; set; }
public virtual ObjectTypes ObjectType { get; set; }
public virtual string SelfLink { get; set; }
public virtual IList<TagDto> Tags { get; set; }
public virtual IList<PathItemDto> Path { get; set; }
public virtual DateTime Created { get; set; }
public virtual string CreateUser { get; set; }
public virtual string CreateUserId { get; set; }
public virtual DateTime Modified { get; set; }
public virtual string ModifyUser { get; set; }
public virtual string ModifyUserId { get; set; }
public virtual bool IsDeleted { get; set; }
public virtual DateTime? Deleted { get; set; }
public virtual string? DeleteUser { get; set; }
public virtual string? DeleteUserId { get; set; }
public virtual IList<LinkDto> Links { get; set; }
}
public partial class LinkDto
{
public virtual string Caption { get; set; }
public virtual string Rel { get; set; }
public virtual string HRef { get; set; }
public virtual string Method { get; set; }
}
public partial class PathItemDto
{
public virtual string Label { get; set; }
public virtual string Link { get; set; }
public virtual ObjectTypes ObjectType { get; set; }
public virtual Guid ObjectId { get; set; }
}
public partial class TagDto
{
public virtual string Name { get; set; }
public virtual string? Value { get; set; }
public virtual bool IsProtected { get; set; }
}
public partial class VariableDto
{
public virtual string Name { get; set; }
///<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 virtual string Value { get; set; }
///<summary>
///The data type of the value property
///</summary>
public virtual ValueDataType Type { get; set; }
public virtual string? Description { get; set; }
public virtual bool IsInherited { get; set; }
public virtual Environments? Environment { get; set; }
}
}
namespace CoreService.ServiceModel.Dtos.Collections.Crud
{
///<summary>
///Creates a new collection
///</summary>
[Api(Description="Creates a new collection")]
[ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(CoreService.ServiceModel.Dtos.Collections.Responses.DeploymentCollectionDto), StatusCode=201)]
public partial class CreateCollection
: ICreateRequest, IHasTenantName, IPost
{
[ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
[Validate("NotEmpty")]
public virtual string TenantName { get; set; }
///<summary>
///The collections name
///</summary>
[ApiMember(DataType="string", Description="The collections name", IsRequired=true, ParameterType="body")]
[Validate("NotEmpty")]
[Validate("MaximumLength(50)")]
[Validate("RegularExpression(′^[0-9a-z]+[0-9a-z-]*[0-9a-z]+$′)")]
public virtual string Name { get; set; }
///<summary>
///The collections display name
///</summary>
[ApiMember(DataType="string", Description="The collections display name", ParameterType="body")]
[Validate("MaximumLength(250)")]
public virtual string? DisplayName { get; set; }
///<summary>
///A more detailed description for the collection
///</summary>
[ApiMember(DataType="string", Description="A more detailed description for the collection", ParameterType="body")]
[Validate("MaximumLength(8000)")]
public virtual string? Description { get; set; }
///<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 virtual bool? IsLostAndFound { get; set; }
[ApiMember(DataType="array", ParameterType="body")]
public virtual IList<VariableDto>? Variables { get; set; }
[ApiMember(DataType="array", ParameterType="body")]
public virtual IList<TagDto>? Tags { get; set; }
}
}
namespace CoreService.ServiceModel.Dtos.Collections.Responses
{
public partial class DeploymentCollectionDto
: ConfigItemDto, IHasTenantId
{
public virtual Guid TenantId { get; set; }
public virtual TenantDto? Tenant { get; set; }
///<summary>
///A collection scoped list of variables
///</summary>
public virtual IList<VariableDto> Variables { get; set; }
///<summary>
///Defines the collection where scanned but not deployed resources will be stored
///</summary>
public virtual bool IsLostAndFound { get; set; }
///<summary>
///The monthly cost budget for the whole collection
///</summary>
public virtual decimal? MonthlyBudget { get; set; }
///<summary>
///Whether to send budget information mails to the collection owners
///</summary>
public virtual bool? SendBudgetNotificationMails { get; set; }
///<summary>
///A threshold, when to send the first budget warning mail
///</summary>
public virtual int? BudgetWarningThresholdPercent { get; set; }
public virtual IList<LinkDto> Links { get; set; }
}
}
namespace CoreService.ServiceModel.Dtos.Tenant.Responses
{
public partial class TenantDto
: ConfigItemDto
{
///<summary>
///Variables defined on tenant level
///</summary>
public virtual IList<VariableDto> Variables { get; set; }
///<summary>
///Allowed email domains used for authentication
///</summary>
public virtual IList<string> AllowedMailDomains { get; set; }
///<summary>
///List of licensed modules for this tenant
///</summary>
public virtual IList<string> LicensedModules { get; set; }
///<summary>
///Amount of days until a Deployment expires
///</summary>
public virtual short DefaultDeploymentLifetimeDays { get; set; }
///<summary>
///Max amount of days until a Deployment expires
///</summary>
public virtual short MaxDeploymentLifetimeDays { get; set; }
///<summary>
///Amount of days without patching until a unpatched warning is shown
///</summary>
public virtual short SystemUnpatchedWarningDays { get; set; }
///<summary>
///Amount of hours without backup until a backup missing warning is shown
///</summary>
public virtual short SystemBackupMissingWarningHours { get; set; }
///<summary>
///Amount of days until a vulnerable resource is getting stopped
///</summary>
public virtual short StopVulnerableResourceAfterDays { get; set; }
///<summary>
///Amount of days before deployment expiration, which triggers the expiration warning
///</summary>
public virtual short DeploymentExpirationWarningDays { get; set; }
///<summary>
///Amount of days the patch notification is sent out prior to the patch date
///</summary>
public virtual short PatchNotificationDays { get; set; }
///<summary>
///Use a pool with your own hostnames (true) or let the hostname be auto generated (false)
///</summary>
public virtual bool UseCustomHostnames { get; set; }
///<summary>
///After how many days inactive vulnerabilities will be purged from database
///</summary>
public virtual short RemoveInactiveVulnerabilitiesAfterDays { get; set; }
public virtual IList<LinkDto> Links { get; set; }
}
}
namespace CoreService.ServiceModel.Enums
{
public enum Environments
{
Lab,
Poc,
Dev,
Test,
Int,
Uat,
Prod,
}
public enum ValueDataType
{
String,
Number,
Boolean,
List,
}
}
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,
}
}
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"}