| Required role: | TenantReader |
| POST | /api/resourcegroups/ | Creates a new resourcegroup | |
|---|---|---|---|
| POST | /resourcegroups/ | Creates a new resourcegroup |
import 'package:servicestack/servicestack.dart';
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,
}
class TagDto implements IConvertible
{
String name = "";
String? value;
bool isProtected;
TagDto({this.name,this.value,this.isProtected});
TagDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
name = json['name'];
value = json['value'];
isProtected = json['isProtected'];
return this;
}
Map<String, dynamic> toJson() => {
'name': name,
'value': value,
'isProtected': isProtected
};
getTypeName() => "TagDto";
TypeContext? context = _ctx;
}
class PathItemDto implements IConvertible
{
String label = "";
String link = "";
ObjectTypes objectType;
String objectId = "";
PathItemDto({this.label,this.link,this.objectType,this.objectId});
PathItemDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
label = json['label'];
link = json['link'];
objectType = JsonConverters.fromJson(json['objectType'],'ObjectTypes',context!);
objectId = json['objectId'];
return this;
}
Map<String, dynamic> toJson() => {
'label': label,
'link': link,
'objectType': JsonConverters.toJson(objectType,'ObjectTypes',context!),
'objectId': objectId
};
getTypeName() => "PathItemDto";
TypeContext? context = _ctx;
}
class LinkDto implements IConvertible
{
String caption = "";
String rel = "";
String hRef = "";
String method = "";
LinkDto({this.caption,this.rel,this.hRef,this.method});
LinkDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
caption = json['caption'];
rel = json['rel'];
hRef = json['hRef'];
method = json['method'];
return this;
}
Map<String, dynamic> toJson() => {
'caption': caption,
'rel': rel,
'hRef': hRef,
'method': method
};
getTypeName() => "LinkDto";
TypeContext? context = _ctx;
}
class ConfigItemDto implements IConfigItem, IConvertible
{
String id = "";
String name = "";
String displayName = "";
String? description;
ObjectTypes objectType;
String selfLink = "";
List<TagDto>? tags;
List<PathItemDto>? path;
DateTime created = DateTime(0);
String createUser = "";
String createUserId = "";
DateTime modified = DateTime(0);
String modifyUser = "";
String modifyUserId = "";
bool isDeleted;
DateTime? deleted;
String? deleteUser;
String? deleteUserId;
List<LinkDto>? links;
ConfigItemDto({this.id,this.name,this.displayName,this.description,this.objectType,this.selfLink,this.tags,this.path,this.created,this.createUser,this.createUserId,this.modified,this.modifyUser,this.modifyUserId,this.isDeleted,this.deleted,this.deleteUser,this.deleteUserId,this.links});
ConfigItemDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
displayName = json['displayName'];
description = json['description'];
objectType = JsonConverters.fromJson(json['objectType'],'ObjectTypes',context!);
selfLink = json['selfLink'];
tags = JsonConverters.fromJson(json['tags'],'List<TagDto>',context!);
path = JsonConverters.fromJson(json['path'],'List<PathItemDto>',context!);
created = JsonConverters.fromJson(json['created'],'DateTime',context!);
createUser = json['createUser'];
createUserId = json['createUserId'];
modified = JsonConverters.fromJson(json['modified'],'DateTime',context!);
modifyUser = json['modifyUser'];
modifyUserId = json['modifyUserId'];
isDeleted = json['isDeleted'];
deleted = JsonConverters.fromJson(json['deleted'],'DateTime',context!);
deleteUser = json['deleteUser'];
deleteUserId = json['deleteUserId'];
links = JsonConverters.fromJson(json['links'],'List<LinkDto>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'displayName': displayName,
'description': description,
'objectType': JsonConverters.toJson(objectType,'ObjectTypes',context!),
'selfLink': selfLink,
'tags': JsonConverters.toJson(tags,'List<TagDto>',context!),
'path': JsonConverters.toJson(path,'List<PathItemDto>',context!),
'created': JsonConverters.toJson(created,'DateTime',context!),
'createUser': createUser,
'createUserId': createUserId,
'modified': JsonConverters.toJson(modified,'DateTime',context!),
'modifyUser': modifyUser,
'modifyUserId': modifyUserId,
'isDeleted': isDeleted,
'deleted': JsonConverters.toJson(deleted,'DateTime',context!),
'deleteUser': deleteUser,
'deleteUserId': deleteUserId,
'links': JsonConverters.toJson(links,'List<LinkDto>',context!)
};
getTypeName() => "ConfigItemDto";
TypeContext? context = _ctx;
}
enum Environments
{
Lab,
Poc,
Dev,
Test,
Int,
Uat,
Prod,
}
enum LifecycleStates
{
New,
Deploying,
Deployed,
Removing,
Removed,
Failure,
Imported,
}
enum ParameterValueType
{
String,
Number,
Boolean,
SecureString,
}
class ParameterDto implements IConvertible
{
String name = "";
String? description;
/**
* Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false). Note: string values need extra quotes
*/
String? value;
/**
* Optional default value for the frontend. Needs to be in the same format as the value
*/
String? Default;
/**
* Optional parameters do not need to have a value. Default -> Optional=false
*/
bool optional;
/**
* The data type of the value and default property
*/
ParameterValueType type;
String? validation;
ParameterDto({this.name,this.description,this.value,this.Default,this.optional,this.type,this.validation});
ParameterDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
name = json['name'];
description = json['description'];
value = json['value'];
Default = json['default'];
optional = json['optional'];
type = JsonConverters.fromJson(json['type'],'ParameterValueType',context!);
validation = json['validation'];
return this;
}
Map<String, dynamic> toJson() => {
'name': name,
'description': description,
'value': value,
'default': Default,
'optional': optional,
'type': JsonConverters.toJson(type,'ParameterValueType',context!),
'validation': validation
};
getTypeName() => "ParameterDto";
TypeContext? context = _ctx;
}
enum ValueDataType
{
String,
Number,
Boolean,
List,
}
class VariableDto implements IConvertible
{
String name = "";
/**
* 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
*/
String value = "";
/**
* The data type of the value property
*/
ValueDataType type;
String? description;
bool isInherited;
Environments? environment;
VariableDto({this.name,this.value,this.type,this.description,this.isInherited,this.environment});
VariableDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
name = json['name'];
value = json['value'];
type = JsonConverters.fromJson(json['type'],'ValueDataType',context!);
description = json['description'];
isInherited = json['isInherited'];
environment = JsonConverters.fromJson(json['environment'],'Environments',context!);
return this;
}
Map<String, dynamic> toJson() => {
'name': name,
'value': value,
'type': JsonConverters.toJson(type,'ValueDataType',context!),
'description': description,
'isInherited': isInherited,
'environment': JsonConverters.toJson(environment,'Environments',context!)
};
getTypeName() => "VariableDto";
TypeContext? context = _ctx;
}
enum ResourceCompositions
{
Native,
Foreign,
Mixed,
}
class ResourceGroupDto extends ConfigItemDto implements IHasParent, IHasTenantId, IEnvironmentSpecific, IConvertible
{
/**
* Shorter id than the guid which can be used for automation (tenant wide unique) prefixed with a 'g'. E.g. gk36x3
*/
String shortId = "";
/**
* The id of the tenant
*/
String tenantId = "";
/**
* The environment the resourcegroup is deployed in
*/
Environments environment;
/**
* The state of the deployment
*/
LifecycleStates state;
/**
* The id of the parent (deployment) of the resourcegroup
*/
String parentId = "";
/**
* The id of the template which was used to create the resourcegroup
*/
String? templateId;
/**
* Shows if a resourcegroup was rolled out through a dune template or not
*/
bool isTemplateBased;
/**
* The parent (deployment) of the resourcegroup
*/
ConfigItemDto? parent;
/**
* The parameters which were used to create this resourcegroup
*/
List<ParameterDto>? parameters;
/**
* A resourcegroup scoped list of variables used for resourcegroup of resources
*/
List<VariableDto>? variables;
/**
* The date, when the resourcegroups resources will receive updates
*/
DateTime? nextPatchDate;
/**
* Composition show if all resources in the resourcegroup are dune native, dune foreign or a mix of both
*/
ResourceCompositions composition;
List<LinkDto>? links;
ResourceGroupDto({this.shortId,this.tenantId,this.environment,this.state,this.parentId,this.templateId,this.isTemplateBased,this.parent,this.parameters,this.variables,this.nextPatchDate,this.composition,this.links});
ResourceGroupDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
shortId = json['shortId'];
tenantId = json['tenantId'];
environment = JsonConverters.fromJson(json['environment'],'Environments',context!);
state = JsonConverters.fromJson(json['state'],'LifecycleStates',context!);
parentId = json['parentId'];
templateId = json['templateId'];
isTemplateBased = json['isTemplateBased'];
parent = JsonConverters.fromJson(json['parent'],'ConfigItemDto',context!);
parameters = JsonConverters.fromJson(json['parameters'],'List<ParameterDto>',context!);
variables = JsonConverters.fromJson(json['variables'],'List<VariableDto>',context!);
nextPatchDate = JsonConverters.fromJson(json['nextPatchDate'],'DateTime',context!);
composition = JsonConverters.fromJson(json['composition'],'ResourceCompositions',context!);
links = JsonConverters.fromJson(json['links'],'List<LinkDto>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'shortId': shortId,
'tenantId': tenantId,
'environment': JsonConverters.toJson(environment,'Environments',context!),
'state': JsonConverters.toJson(state,'LifecycleStates',context!),
'parentId': parentId,
'templateId': templateId,
'isTemplateBased': isTemplateBased,
'parent': JsonConverters.toJson(parent,'ConfigItemDto',context!),
'parameters': JsonConverters.toJson(parameters,'List<ParameterDto>',context!),
'variables': JsonConverters.toJson(variables,'List<VariableDto>',context!),
'nextPatchDate': JsonConverters.toJson(nextPatchDate,'DateTime',context!),
'composition': JsonConverters.toJson(composition,'ResourceCompositions',context!),
'links': JsonConverters.toJson(links,'List<LinkDto>',context!)
});
getTypeName() => "ResourceGroupDto";
TypeContext? context = _ctx;
}
/**
* Create a new resourcegroup
*/
// @Api(Description="Create a new resourcegroup")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(ResourceGroupDto), StatusCode=201)
class CreateResourceGroup implements ICreateRequest, IHasTenantName, IHasParent, IPost, IConvertible
{
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
String tenantName = "";
/**
* The resourcegroups name
*/
// @ApiMember(DataType="string", Description="The resourcegroups name", IsRequired=true, ParameterType="body")
// @Validate(Validator="NotEmpty")
// @Validate(Validator="MaximumLength(50)")
// @Validate(Validator="RegularExpression(′^[0-9a-z]+[0-9a-z-]*[0-9a-z]+$′)")
String name = "";
/**
* The resourcegroups display name
*/
// @ApiMember(DataType="string", Description="The resourcegroups display name", ParameterType="body")
// @Validate(Validator="MaximumLength(250)")
String? displayName;
/**
* A more detailed description for the resourcegroup
*/
// @ApiMember(DataType="string", Description="A more detailed description for the resourcegroup", ParameterType="body")
// @Validate(Validator="MaximumLength(8000)")
String? description;
/**
* The id of the deployment, this resourcegroup belongs to
*/
// @ApiMember(DataType="string", Description="The id of the deployment, this resourcegroup belongs to", Format="guid", IsRequired=true, ParameterType="body")
String parentId = "";
/**
* The id of the template, this resourcegroup is based on
*/
// @ApiMember(DataType="string", Description="The id of the template, this resourcegroup is based on", Format="guid", ParameterType="body")
String? templateId;
// @ApiMember(DataType="array", ParameterType="body")
List<ParameterDto>? parameters;
// @ApiMember(DataType="array", ParameterType="body")
List<VariableDto>? variables;
// @ApiMember(DataType="array", ParameterType="body")
List<TagDto>? tags;
CreateResourceGroup({this.tenantName,this.name,this.displayName,this.description,this.parentId,this.templateId,this.parameters,this.variables,this.tags});
CreateResourceGroup.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
tenantName = json['tenantName'];
name = json['name'];
displayName = json['displayName'];
description = json['description'];
parentId = json['parentId'];
templateId = json['templateId'];
parameters = JsonConverters.fromJson(json['parameters'],'List<ParameterDto>',context!);
variables = JsonConverters.fromJson(json['variables'],'List<VariableDto>',context!);
tags = JsonConverters.fromJson(json['tags'],'List<TagDto>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'tenantName': tenantName,
'name': name,
'displayName': displayName,
'description': description,
'parentId': parentId,
'templateId': templateId,
'parameters': JsonConverters.toJson(parameters,'List<ParameterDto>',context!),
'variables': JsonConverters.toJson(variables,'List<VariableDto>',context!),
'tags': JsonConverters.toJson(tags,'List<TagDto>',context!)
};
getTypeName() => "CreateResourceGroup";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'duneframework.com', types: <String, TypeInfo> {
'ObjectTypes': TypeInfo(TypeOf.Enum, enumValues:ObjectTypes.values),
'TagDto': TypeInfo(TypeOf.Class, create:() => TagDto()),
'PathItemDto': TypeInfo(TypeOf.Class, create:() => PathItemDto()),
'LinkDto': TypeInfo(TypeOf.Class, create:() => LinkDto()),
'ConfigItemDto': TypeInfo(TypeOf.Class, create:() => ConfigItemDto()),
'List<TagDto>': TypeInfo(TypeOf.Class, create:() => <TagDto>[]),
'List<PathItemDto>': TypeInfo(TypeOf.Class, create:() => <PathItemDto>[]),
'List<LinkDto>': TypeInfo(TypeOf.Class, create:() => <LinkDto>[]),
'Environments': TypeInfo(TypeOf.Enum, enumValues:Environments.values),
'LifecycleStates': TypeInfo(TypeOf.Enum, enumValues:LifecycleStates.values),
'ParameterValueType': TypeInfo(TypeOf.Enum, enumValues:ParameterValueType.values),
'ParameterDto': TypeInfo(TypeOf.Class, create:() => ParameterDto()),
'ValueDataType': TypeInfo(TypeOf.Enum, enumValues:ValueDataType.values),
'VariableDto': TypeInfo(TypeOf.Class, create:() => VariableDto()),
'ResourceCompositions': TypeInfo(TypeOf.Enum, enumValues:ResourceCompositions.values),
'ResourceGroupDto': TypeInfo(TypeOf.Class, create:() => ResourceGroupDto()),
'List<ParameterDto>': TypeInfo(TypeOf.Class, create:() => <ParameterDto>[]),
'List<VariableDto>': TypeInfo(TypeOf.Class, create:() => <VariableDto>[]),
'CreateResourceGroup': TypeInfo(TypeOf.Class, create:() => CreateResourceGroup()),
});
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"}