CoreService

<back to all web services

CreateResourceGroup

ResourceGroup - CRUD

Create a new resourcegroup

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
POST/api/resourcegroups/Creates a new resourcegroup
POST/resourcegroups/Creates a new resourcegroup
import java.math.*
import java.util.*
import java.io.InputStream
import net.servicestack.client.*
import com.google.gson.annotations.*
import com.google.gson.reflect.*


/**
* Create a new resourcegroup
*/
@Api(Description="Create a new resourcegroup")
@ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=ResourceGroupDto::class, StatusCode=201)
open class CreateResourceGroup : ICreateRequest, IHasTenantName, IHasParent, IPost
{
    @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    @Validate(Validator="NotEmpty")
    override var tenantName:String? = null

    /**
    * 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]+$′)")
    override var name:String? = null

    /**
    * The resourcegroups display name
    */
    @ApiMember(DataType="string", Description="The resourcegroups display name", ParameterType="body")
    @Validate(Validator="MaximumLength(250)")
    override var displayName:String? = null

    /**
    * A more detailed description for the resourcegroup
    */
    @ApiMember(DataType="string", Description="A more detailed description for the resourcegroup", ParameterType="body")
    @Validate(Validator="MaximumLength(8000)")
    override var description:String? = null

    /**
    * 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")
    override var parentId:UUID? = null

    /**
    * 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")
    open var templateId:UUID? = null

    @ApiMember(DataType="array", ParameterType="body")
    open var parameters:IList<ParameterDto>? = 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 ParameterDto
{
    open var name:String? = null
    open var description:String? = null
    /**
    * Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false). Note: string values need extra quotes
    */
    open var value:String? = null
    /**
    * Optional default value for the frontend. Needs to be in the same format as the value
    */
    @SerializedName("default") open var Default:String? = null
    /**
    * Optional parameters do not need to have a value. Default -> Optional=false
    */
    open var optional:Boolean? = null
    /**
    * The data type of the value and default property
    */
    @SerializedName("type") open var Type:ParameterValueType? = null
    open var validation:String? = null
}

enum class ParameterValueType
{
    String,
    Number,
    Boolean,
    SecureString,
}

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 ResourceGroupDto : ConfigItemDto(), IHasParent, IHasTenantId, IEnvironmentSpecific
{
    /**
    * Shorter id than the guid which can be used for automation (tenant wide unique) prefixed with a 'g'. E.g. gk36x3
    */
    open var shortId:String? = null
    /**
    * The id of the tenant
    */
    override var tenantId:UUID? = null
    /**
    * The environment the resourcegroup is deployed in
    */
    override var environment:Environments? = null
    /**
    * The state of the deployment
    */
    open var state:LifecycleStates? = null
    /**
    * The id of the parent (deployment) of the resourcegroup
    */
    override var parentId:UUID? = null
    /**
    * The id of the template which was used to create the resourcegroup
    */
    open var templateId:UUID? = null
    /**
    * Shows if a resourcegroup was rolled out through a dune template or not
    */
    open var isTemplateBased:Boolean? = null
    /**
    * The parent (deployment) of the resourcegroup
    */
    open var parent:ConfigItemDto? = null
    /**
    * The parameters which were used to create this resourcegroup
    */
    open var parameters:IList<ParameterDto>? = null
    /**
    * A resourcegroup scoped list of variables used for resourcegroup of resources
    */
    open var variables:IList<VariableDto>? = null
    /**
    * The date, when the resourcegroups resources will receive updates
    */
    open var nextPatchDate:Date? = null
    /**
    * Composition show if all resources in the resourcegroup are dune native, dune foreign or a mix of both
    */
    open var composition:ResourceCompositions? = 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
}

enum class LifecycleStates
{
    New,
    Deploying,
    Deployed,
    Removing,
    Removed,
    Failure,
    Imported,
}

enum class ResourceCompositions
{
    Native,
    Foreign,
    Mixed,
}

Kotlin CreateResourceGroup DTOs

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

HTTP + JSON

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"}