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
namespace CoreService.ServiceModel.Dtos.Base.Responses

open System
open System.IO
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations

    type ObjectTypes =
        | None = 0
        | ConfigItem = 1
        | Tenant = 2
        | Collection = 3
        | Resource = 4
        | ComputeNode = 5
        | VirtualMachine = 6
        | PhysicalMachine = 7
        | Disk = 8
        | Subnet = 9
        | IPAddress = 10
        | Job = 11
        | JobEvent = 12
        | FreezePeriod = 13
        | ResourceGroup = 14
        | Deployment = 15
        | ResourceGroupTemplate = 16
        | DeploymentTemplate = 17
        | ResourceProvider = 18
        | GenericResource = 19
        | Role = 20
        | Permission = 21
        | User = 22
        | PatchingWindow = 23
        | Update = 24
        | ReportDefinition = 25
        | TimeSeries = 26
        | DataPoint = 27
        | Action = 28
        | ActionAssignment = 29
        | UserNote = 30

    [<AllowNullLiteral>]
    type TagDto() = 
        member val Name:String = null with get,set
        member val Value:String = null with get,set
        member val IsProtected:Boolean = new Boolean() with get,set

    [<AllowNullLiteral>]
    type PathItemDto() = 
        member val Label:String = null with get,set
        member val Link:String = null with get,set
        member val ObjectType:ObjectTypes = new ObjectTypes() with get,set
        member val ObjectId:Guid = new Guid() with get,set

    [<AllowNullLiteral>]
    type LinkDto() = 
        member val Caption:String = null with get,set
        member val Rel:String = null with get,set
        member val HRef:String = null with get,set
        member val Method:String = null with get,set

    [<AllowNullLiteral>]
    type ConfigItemDto() = 
        member val Id:Guid = new Guid() with get,set
        member val Name:String = null with get,set
        member val DisplayName:String = null with get,set
        member val Description:String = null with get,set
        member val ObjectType:ObjectTypes = new ObjectTypes() with get,set
        member val SelfLink:String = null with get,set
        member val Tags:IList<TagDto> = null with get,set
        member val Path:IList<PathItemDto> = null with get,set
        member val Created:DateTime = new DateTime() with get,set
        member val CreateUser:String = null with get,set
        member val CreateUserId:String = null with get,set
        member val Modified:DateTime = new DateTime() with get,set
        member val ModifyUser:String = null with get,set
        member val ModifyUserId:String = null with get,set
        member val IsDeleted:Boolean = new Boolean() with get,set
        member val Deleted:Nullable<DateTime> = new Nullable<DateTime>() with get,set
        member val DeleteUser:String = null with get,set
        member val DeleteUserId:String = null with get,set
        member val Links:IList<LinkDto> = null with get,set

    type OperationalStates =
        | None = 0
        | Starting = 1
        | Running = 2
        | Stopping = 3
        | Stopped = 4
        | Restarting = 5
        | Deleting = 6
        | Unknown = 7

    type LifecycleStates =
        | New = 0
        | Deploying = 1
        | Deployed = 2
        | Removing = 3
        | Removed = 4
        | Failure = 5
        | Imported = 6

    type Environments =
        | Lab = 0
        | Poc = 1
        | Dev = 2
        | Test = 3
        | Int = 4
        | Uat = 5
        | Prod = 6

    type ParameterValueType =
        | String = 0
        | Number = 1
        | Boolean = 2
        | SecureString = 3

    [<AllowNullLiteral>]
    type ParameterDto() = 
        member val Name:String = null with get,set
        member val Description:String = null with 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>
        member val Value:String = null with get,set

        ///<summary>
        ///Optional default value for the frontend. Needs to be in the same format as the value
        ///</summary>
        member val Default:String = null with get,set

        ///<summary>
        ///Optional parameters do not need to have a value. Default -> Optional=false
        ///</summary>
        member val Optional:Boolean = new Boolean() with get,set

        ///<summary>
        ///The data type of the value and default property
        ///</summary>
        member val Type:ParameterValueType = new ParameterValueType() with get,set

        member val Validation:String = null with get,set

    type ValueDataType =
        | String = 0
        | Number = 1
        | Boolean = 2
        | List = 3

    [<AllowNullLiteral>]
    type VariableDto() = 
        member val Name:String = null with 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>
        member val Value:String = null with get,set

        ///<summary>
        ///The data type of the value property
        ///</summary>
        member val Type:ValueDataType = new ValueDataType() with get,set

        member val Description:String = null with get,set
        member val IsInherited:Boolean = new Boolean() with get,set
        member val Environment:Nullable<Environments> = new Nullable<Environments>() with get,set

    type ResourceCompositions =
        | Native = 0
        | Foreign = 1
        | Mixed = 2

    [<AllowNullLiteral>]
    type DeploymentDto() = 
        inherit ConfigItemDto()
        ///<summary>
        ///The operational state of the deployment (Running, Stopped, None, Unknown)
        ///</summary>
        member val OperationalState:OperationalStates = new OperationalStates() with get,set

        ///<summary>
        ///How many start/stop-capable resources are currently running
        ///</summary>
        member val ResourcesRunning:Int32 = new Int32() with get,set

        ///<summary>
        ///Total number of start/stop-capable resources in this deployment
        ///</summary>
        member val ResourcesTotal:Int32 = new Int32() with 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>
        member val ShortId:String = null with get,set

        ///<summary>
        ///The user defined part of the name property {userDefined}_{environment}
        ///</summary>
        member val NameUserDefinedPart:String = null with get,set

        ///<summary>
        ///The id of the tenant
        ///</summary>
        member val TenantId:Guid = new Guid() with get,set

        ///<summary>
        ///The state of the deployment
        ///</summary>
        member val State:LifecycleStates = new LifecycleStates() with get,set

        ///<summary>
        ///The environment the deployment is deployed in
        ///</summary>
        member val Environment:Environments = new Environments() with get,set

        ///<summary>
        ///The id of the template which was used to create the deployment
        ///</summary>
        member val TemplateId:Nullable<Guid> = new Nullable<Guid>() with get,set

        ///<summary>
        ///Shows if a deployment was rolled out through a dune template or not
        ///</summary>
        member val IsTemplateBased:Boolean = new Boolean() with get,set

        ///<summary>
        ///The parameters which were used to create this deployment
        ///</summary>
        member val Parameters:IList<ParameterDto> = null with get,set

        ///<summary>
        ///A deployment scoped list of variables used for deployment of resources
        ///</summary>
        member val Variables:IList<VariableDto> = null with get,set

        ///<summary>
        ///A snapshot of the varialbs used to create the deployment
        ///</summary>
        member val VariablesSnapshot:IList<VariableDto> = null with get,set

        ///<summary>
        ///The id of the parent (collection) of the deployment
        ///</summary>
        member val ParentId:Guid = new Guid() with get,set

        ///<summary>
        ///The parent (collection) of the deployment
        ///</summary>
        member val Parent:ConfigItemDto = null with get,set

        ///<summary>
        ///The Date when the resources got deployed
        ///</summary>
        member val ValidFrom:DateTime = new DateTime() with get,set

        ///<summary>
        ///The Date when the deployment expires and has to be reevaluated
        ///</summary>
        member val ValidUntil:Nullable<DateTime> = new Nullable<DateTime>() with get,set

        ///<summary>
        ///The deployment will never expire
        ///</summary>
        member val IsNeverExpiring:Boolean = new Boolean() with get,set

        ///<summary>
        ///The date, when the deployments resources will receive updates
        ///</summary>
        member val NextPatchDate:Nullable<DateTime> = new Nullable<DateTime>() with get,set

        ///<summary>
        ///The default resource provider where the resources are deployed
        ///</summary>
        member val DefaultResourceProviderId:Guid = new Guid() with get,set

        ///<summary>
        ///Deployments which have issues in Jobs are marked with NeedsAttention
        ///</summary>
        member val NeedsAttention:Boolean = new Boolean() with get,set

        ///<summary>
        ///Composition show if all resources in the deployment are dune native, dune foreign or a mix of both
        ///</summary>
        member val Composition:ResourceCompositions = new ResourceCompositions() with get,set

        ///<summary>
        ///The monthly cost budget for the whole collection
        ///</summary>
        member val MonthlyBudget:Nullable<Decimal> = new Nullable<Decimal>() with get,set

        ///<summary>
        ///Whether to send budget information mails to the collection owners
        ///</summary>
        member val SendBudgetNotificationMails:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        ///<summary>
        ///A threshold, when to send the first budget warning mail
        ///</summary>
        member val BudgetWarningThresholdPercent:Nullable<Int32> = new Nullable<Int32>() with get,set

        member val Links:IList<LinkDto> = null with get,set

    ///<summary>
    ///Creates a new deployment
    ///</summary>
    [<Api(Description="Creates a new deployment")>]
    [<ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof<DeploymentDto>, StatusCode=201)>]
    [<AllowNullLiteral>]
    type CreateDeployment() = 
        interface IPost
        [<ApiMember(DataType="string", IsRequired=true, ParameterType="header")>]
        [<Validate(Validator="NotEmpty")>]
        member val TenantName:String = null with get,set

        ///<summary>
        ///The name of the deployment
        ///</summary>
        [<ApiMember(DataType="string", Description="The name of the deployment", IsRequired=true, ParameterType="body")>]
        [<Validate(Validator="NotEmpty")>]
        [<Validate(Validator="MaximumLength(100)")>]
        [<Validate(Validator="RegularExpression(′^([0-9a-z]+[0-9a-z-]*[0-9a-z]+)_([a-z]+)$′)")>]
        member val Name:String = null with get,set

        ///<summary>
        ///The deployments display name
        ///</summary>
        [<ApiMember(DataType="string", Description="The deployments display name", ParameterType="body")>]
        [<Validate(Validator="MaximumLength(250)")>]
        member val DisplayName:String = null with 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(Validator="MaximumLength(8000)")>]
        member val Description:String = null with 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")>]
        member val ParentId:Guid = new Guid() with 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")>]
        member val TemplateId:Nullable<Guid> = new Nullable<Guid>() with 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")>]
        member val DefaultResourceProviderId:Guid = new Guid() with get,set

        ///<summary>
        ///What kind of environment is this deployment
        ///</summary>
        [<ApiMember(Description="What kind of environment is this deployment", IsRequired=true, ParameterType="body")>]
        member val Environment:Environments = new Environments() with get,set

        [<ApiMember(DataType="array", ParameterType="body")>]
        member val Parameters:IList<ParameterDto> = null with get,set

        [<ApiMember(DataType="array", ParameterType="body")>]
        member val Variables:IList<VariableDto> = null with get,set

        [<ApiMember(DataType="array", ParameterType="body")>]
        member val Tags:IList<TagDto> = null with get,set

        ///<summary>
        ///The expiry date of the environment
        ///</summary>
        [<ApiMember(DataType="string", Description="The expiry date of the environment", ParameterType="body")>]
        member val ValidUntil:Nullable<DateTime> = new Nullable<DateTime>() with get,set

        ///<summary>
        ///Set if the environment should never expire
        ///</summary>
        [<ApiMember(DataType="bool", Description="Set if the environment should never expire", ParameterType="body")>]
        member val IsNeverExpiring:Nullable<Boolean> = new Nullable<Boolean>() with get,set

        [<ApiMember(DataType="array", IsRequired=true, ParameterType="body")>]
        [<Validate(Validator="NotEmpty")>]
        member val OwnerUserIds:IList<Int32> = null with get,set

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