| Required role: | TenantReader |
| POST | /api/resourcegroups/ | Creates a new resourcegroup | |
|---|---|---|---|
| POST | /resourcegroups/ | Creates a new resourcegroup |
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.ResourceGroups.Crud;
using CoreService.ServiceModel.Dtos.Base.Responses;
using CoreService.ServiceModel.Enums;
using CoreService.ServiceModel.Dtos.ResourceGroups.Responses;
using YCO.Dune.Models.Enums;
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 ParameterDto
{
public virtual string Name { get; set; }
public virtual string? Description { get; set; }
///<summary>
///Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false). Note: string values need extra quotes
///</summary>
public virtual string? Value { get; set; }
///<summary>
///Optional default value for the frontend. Needs to be in the same format as the value
///</summary>
public virtual string? Default { get; set; }
///<summary>
///Optional parameters do not need to have a value. Default -> Optional=false
///</summary>
public virtual bool Optional { get; set; }
///<summary>
///The data type of the value and default property
///</summary>
public virtual ParameterValueType Type { get; set; }
public virtual string? Validation { 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.ResourceGroups.Crud
{
///<summary>
///Create a new resourcegroup
///</summary>
[Api(Description="Create a new resourcegroup")]
[ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(CoreService.ServiceModel.Dtos.ResourceGroups.Responses.ResourceGroupDto), StatusCode=201)]
public partial class CreateResourceGroup
: ICreateRequest, IHasTenantName, IHasParent, IPost
{
[ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
[Validate("NotEmpty")]
public virtual string TenantName { get; set; }
///<summary>
///The resourcegroups name
///</summary>
[ApiMember(DataType="string", Description="The resourcegroups 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 resourcegroups display name
///</summary>
[ApiMember(DataType="string", Description="The resourcegroups display name", ParameterType="body")]
[Validate("MaximumLength(250)")]
public virtual string? DisplayName { get; set; }
///<summary>
///A more detailed description for the resourcegroup
///</summary>
[ApiMember(DataType="string", Description="A more detailed description for the resourcegroup", ParameterType="body")]
[Validate("MaximumLength(8000)")]
public virtual string? Description { get; set; }
///<summary>
///The id of the deployment, this resourcegroup belongs to
///</summary>
[ApiMember(DataType="string", Description="The id of the deployment, this resourcegroup belongs to", Format="guid", IsRequired=true, ParameterType="body")]
public virtual Guid ParentId { get; set; }
///<summary>
///The id of the template, this resourcegroup is based on
///</summary>
[ApiMember(DataType="string", Description="The id of the template, this resourcegroup is based on", Format="guid", ParameterType="body")]
public virtual Guid? TemplateId { get; set; }
[ApiMember(DataType="array", ParameterType="body")]
public virtual IList<ParameterDto> Parameters { 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.ResourceGroups.Responses
{
public partial class ResourceGroupDto
: ConfigItemDto, IHasParent, IHasTenantId, IEnvironmentSpecific
{
///<summary>
///Shorter id than the guid which can be used for automation (tenant wide unique) prefixed with a 'g'. E.g. gk36x3
///</summary>
public virtual string ShortId { get; set; }
///<summary>
///The id of the tenant
///</summary>
public virtual Guid TenantId { get; set; }
///<summary>
///The environment the resourcegroup is deployed in
///</summary>
public virtual Environments Environment { get; set; }
///<summary>
///The state of the deployment
///</summary>
public virtual LifecycleStates State { get; set; }
///<summary>
///The id of the parent (deployment) of the resourcegroup
///</summary>
public virtual Guid ParentId { get; set; }
///<summary>
///The id of the template which was used to create the resourcegroup
///</summary>
public virtual Guid? TemplateId { get; set; }
///<summary>
///Shows if a resourcegroup was rolled out through a dune template or not
///</summary>
public virtual bool IsTemplateBased { get; set; }
///<summary>
///The parent (deployment) of the resourcegroup
///</summary>
public virtual ConfigItemDto? Parent { get; set; }
///<summary>
///The parameters which were used to create this resourcegroup
///</summary>
public virtual IList<ParameterDto> Parameters { get; set; }
///<summary>
///A resourcegroup scoped list of variables used for resourcegroup of resources
///</summary>
public virtual IList<VariableDto> Variables { get; set; }
///<summary>
///The date, when the resourcegroups resources will receive updates
///</summary>
public virtual DateTime? NextPatchDate { get; set; }
///<summary>
///Composition show if all resources in the resourcegroup are dune native, dune foreign or a mix of both
///</summary>
public virtual ResourceCompositions Composition { 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 LifecycleStates
{
New,
Deploying,
Deployed,
Removing,
Removed,
Failure,
Imported,
}
public enum ParameterValueType
{
String,
Number,
Boolean,
SecureString,
}
public enum ResourceCompositions
{
Native,
Foreign,
Mixed,
}
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/resourcegroups/ 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","parentId":"00000000-0000-0000-0000-000000000000","templateId":"00000000-0000-0000-0000-000000000000","parameters":null,"variables":null,"tags":null,"txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"shortId":"String","tenantId":"00000000-0000-0000-0000-000000000000","environment":"Lab","state":"New","parentId":"00000000-0000-0000-0000-000000000000","templateId":"00000000-0000-0000-0000-000000000000","isTemplateBased":true,"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},"parameters":null,"variables":null,"nextPatchDate":"0001-01-01T00:00:00.0000000Z","composition":"Native","links":[{"caption":"Index","rel":"index","hRef":"/resourcegroups/","method":"GET"},{"caption":"Deployment","rel":"up","hRef":"/deployments/00000000-0000-0000-0000-000000000000","method":"GET"},{"caption":"Resources","rel":"down","hRef":"/resources?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"}