CoreService

<back to all web services

CreateDeployment

Deployment - CRUD

Creates a new deployment

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
POST/api/deployments/Creates a new deployment
POST/deployments/Creates a new deployment
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.Deployments.Crud;
using CoreService.ServiceModel.Enums;
using CoreService.ServiceModel.Dtos.Base.Responses;
using CoreService.ServiceModel.Dtos.Deployments.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.Deployments.Crud
{
    ///<summary>
    ///Creates a new deployment
    ///</summary>
    [Api(Description="Creates a new deployment")]
    [ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(CoreService.ServiceModel.Dtos.Deployments.Responses.DeploymentDto), StatusCode=201)]
    public partial class CreateDeployment
        : ICreateRequest, IHasTenantName, IHasParent, IPost
    {
        [ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
        [Validate("NotEmpty")]
        public virtual string TenantName { get; set; }

        ///<summary>
        ///The name of the deployment
        ///</summary>
        [ApiMember(DataType="string", Description="The name of the deployment", IsRequired=true, ParameterType="body")]
        [Validate("NotEmpty")]
        [Validate("MaximumLength(100)")]
        [Validate("RegularExpression(′^([0-9a-z]+[0-9a-z-]*[0-9a-z]+)_([a-z]+)$′)")]
        public virtual string Name { get; set; }

        ///<summary>
        ///The deployments display name
        ///</summary>
        [ApiMember(DataType="string", Description="The deployments display name", ParameterType="body")]
        [Validate("MaximumLength(250)")]
        public virtual string? DisplayName { get; set; }

        ///<summary>
        ///A more detailed description for the deployment
        ///</summary>
        [ApiMember(DataType="string", Description="A more detailed description for the deployment", ParameterType="body")]
        [Validate("MaximumLength(8000)")]
        public virtual string? Description { get; set; }

        ///<summary>
        ///The id of the collection, this deployment belongs to
        ///</summary>
        [ApiMember(DataType="string", Description="The id of the collection, this deployment belongs to", Format="guid", IsRequired=true, ParameterType="body")]
        public virtual Guid ParentId { get; set; }

        ///<summary>
        ///The id of the template, this deployment is based on
        ///</summary>
        [ApiMember(DataType="string", Description="The id of the template, this deployment is based on", Format="guid", ParameterType="body")]
        public virtual Guid? TemplateId { get; set; }

        ///<summary>
        ///The default resource provider for this deployment
        ///</summary>
        [ApiMember(DataType="string", Description="The default resource provider for this deployment", Format="guid", IsRequired=true, ParameterType="body")]
        public virtual Guid DefaultResourceProviderId { get; set; }

        ///<summary>
        ///What kind of environment is this deployment
        ///</summary>
        [ApiMember(Description="What kind of environment is this deployment", IsRequired=true, ParameterType="body")]
        public virtual Environments Environment { 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; }

        ///<summary>
        ///The expiry date of the environment
        ///</summary>
        [ApiMember(DataType="string", Description="The expiry date of the environment", ParameterType="body")]
        public virtual DateTime? ValidUntil { get; set; }

        ///<summary>
        ///Set if the environment should never expire
        ///</summary>
        [ApiMember(DataType="bool", Description="Set if the environment should never expire", ParameterType="body")]
        public virtual bool? IsNeverExpiring { get; set; }

        [ApiMember(DataType="array", IsRequired=true, ParameterType="body")]
        [Validate("NotEmpty")]
        public virtual IList<int> OwnerUserIds { get; set; }
    }

}

namespace CoreService.ServiceModel.Dtos.Deployments.Responses
{
    public partial class DeploymentDto
        : ConfigItemDto, IHasParentDto, IHasTenantId, IEnvironmentSpecific
    {
        ///<summary>
        ///The operational state of the deployment (Running, Stopped, None, Unknown)
        ///</summary>
        public virtual OperationalStates OperationalState { get; set; }
        ///<summary>
        ///How many start/stop-capable resources are currently running
        ///</summary>
        public virtual int ResourcesRunning { get; set; }
        ///<summary>
        ///Total number of start/stop-capable resources in this deployment
        ///</summary>
        public virtual int ResourcesTotal { get; set; }
        ///<summary>
        ///Shorter id than the guid which can be used for automation (tenant wide unique) prefixed with a 'd'. E.g. dr36x3
        ///</summary>
        public virtual string ShortId { get; set; }
        ///<summary>
        ///The user defined part of the name property {userDefined}_{environment}
        ///</summary>
        public virtual string NameUserDefinedPart { get; set; }
        ///<summary>
        ///The id of the tenant
        ///</summary>
        public virtual Guid TenantId { get; set; }
        ///<summary>
        ///The state of the deployment
        ///</summary>
        public virtual LifecycleStates State { get; set; }
        ///<summary>
        ///The environment the deployment is deployed in
        ///</summary>
        public virtual Environments Environment { get; set; }
        ///<summary>
        ///The id of the template which was used to create the deployment
        ///</summary>
        public virtual Guid? TemplateId { get; set; }
        ///<summary>
        ///Shows if a deployment was rolled out through a dune template or not
        ///</summary>
        public virtual bool IsTemplateBased { get; set; }
        ///<summary>
        ///The parameters which were used to create this deployment
        ///</summary>
        public virtual IList<ParameterDto> Parameters { get; set; }
        ///<summary>
        ///A deployment scoped list of variables used for deployment of resources
        ///</summary>
        public virtual IList<VariableDto> Variables { get; set; }
        ///<summary>
        ///A snapshot of the varialbs used to create the deployment
        ///</summary>
        public virtual IList<VariableDto> VariablesSnapshot { get; set; }
        ///<summary>
        ///The id of the parent (collection) of the deployment
        ///</summary>
        public virtual Guid ParentId { get; set; }
        ///<summary>
        ///The parent (collection) of the deployment
        ///</summary>
        public virtual ConfigItemDto? Parent { get; set; }
        ///<summary>
        ///The Date when the resources got deployed
        ///</summary>
        public virtual DateTime ValidFrom { get; set; }
        ///<summary>
        ///The Date when the deployment expires and has to be reevaluated
        ///</summary>
        public virtual DateTime? ValidUntil { get; set; }
        ///<summary>
        ///The deployment will never expire
        ///</summary>
        public virtual bool IsNeverExpiring { get; set; }
        ///<summary>
        ///The date, when the deployments resources will receive updates
        ///</summary>
        public virtual DateTime? NextPatchDate { get; set; }
        ///<summary>
        ///The default resource provider where the resources are deployed
        ///</summary>
        public virtual Guid DefaultResourceProviderId { get; set; }
        ///<summary>
        ///Deployments which have issues in Jobs are marked with NeedsAttention
        ///</summary>
        public virtual bool NeedsAttention { get; set; }
        ///<summary>
        ///Composition show if all resources in the deployment are dune native, dune foreign or a mix of both
        ///</summary>
        public virtual ResourceCompositions Composition { 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.Enums
{
    public enum Environments
    {
        Lab,
        Poc,
        Dev,
        Test,
        Int,
        Uat,
        Prod,
    }

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

    public enum OperationalStates
    {
        None,
        Starting,
        Running,
        Stopping,
        Stopped,
        Restarting,
        Deleting,
        Unknown,
    }

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

}

C# CreateDeployment 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/deployments/ 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","defaultResourceProviderId":"00000000-0000-0000-0000-000000000000","environment":"Lab","parameters":null,"variables":null,"tags":null,"validUntil":"0001-01-01T00:00:00.0000000Z","isNeverExpiring":false,"ownerUserIds":null,"txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"operationalState":"None","resourcesRunning":0,"resourcesTotal":0,"shortId":"String","nameUserDefinedPart":"String","tenantId":"00000000-0000-0000-0000-000000000000","state":"New","environment":"Lab","templateId":"00000000-0000-0000-0000-000000000000","isTemplateBased":true,"parameters":null,"variables":null,"variablesSnapshot":null,"parentId":"00000000-0000-0000-0000-000000000000","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},"validFrom":"0001-01-01T00:00:00.0000000Z","validUntil":"0001-01-01T00:00:00.0000000Z","isNeverExpiring":false,"nextPatchDate":"0001-01-01T00:00:00.0000000Z","defaultResourceProviderId":"00000000-0000-0000-0000-000000000000","needsAttention":false,"composition":"Native","monthlyBudget":0,"sendBudgetNotificationMails":false,"budgetWarningThresholdPercent":0,"links":[{"caption":"Index","rel":"index","hRef":"/deployments/","method":"GET"},{"caption":"Collection","rel":"up","hRef":"/collections/00000000-0000-0000-0000-000000000000","method":"GET"},{"caption":"Resourcegroups","rel":"down","hRef":"/resourcegroups?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"}