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
Imports System
Imports System.IO
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports CoreService.ServiceModel.Dtos.Deployments.Crud
Imports CoreService.ServiceModel.Enums
Imports CoreService.ServiceModel.Dtos.Base.Responses
Imports CoreService.ServiceModel.Dtos.Deployments.Responses
Imports YCO.Dune.Models.Enums

Namespace Global

    Namespace CoreService.ServiceModel.Dtos.Base.Responses

        Public Partial Class ConfigItemDto
            Implements IConfigItem
            Public Overridable Property Id As Guid
            Public Overridable Property Name As String
            Public Overridable Property DisplayName As String Implements IConfigItem.DisplayName
            Public Overridable Property Description As String Implements IConfigItem.Description
            Public Overridable Property ObjectType As ObjectTypes
            Public Overridable Property SelfLink As String Implements IConfigItem.SelfLink
            Public Overridable Property Tags As IList(Of TagDto) Implements IConfigItem.Tags
            Public Overridable Property Path As IList(Of PathItemDto)
            Public Overridable Property Created As Date
            Public Overridable Property CreateUser As String
            Public Overridable Property CreateUserId As String
            Public Overridable Property Modified As Date
            Public Overridable Property ModifyUser As String
            Public Overridable Property ModifyUserId As String
            Public Overridable Property IsDeleted As Boolean
            Public Overridable Property Deleted As Date?
            Public Overridable Property DeleteUser As String
            Public Overridable Property DeleteUserId As String
            Public Overridable Property Links As IList(Of LinkDto)
        End Class

        Public Partial Class LinkDto
            Public Overridable Property Caption As String
            Public Overridable Property Rel As String
            Public Overridable Property HRef As String
            Public Overridable Property Method As String
        End Class

        Public Partial Class ParameterDto
            Public Overridable Property Name As String
            Public Overridable Property Description As String
            '''<Summary>
            '''Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false). Note: string values need extra quotes
            '''</Summary>
            Public Overridable Property Value As String
            '''<Summary>
            '''Optional default value for the frontend. Needs to be in the same format as the value
            '''</Summary>
            Public Overridable Property [Default] As String
            '''<Summary>
            '''Optional parameters do not need to have a value. Default -> Optional=false
            '''</Summary>
            Public Overridable Property [Optional] As Boolean
            '''<Summary>
            '''The data type of the value and default property
            '''</Summary>
            Public Overridable Property Type As ParameterValueType
            Public Overridable Property Validation As String
        End Class

        Public Partial Class PathItemDto
            Public Overridable Property Label As String
            Public Overridable Property Link As String
            Public Overridable Property ObjectType As ObjectTypes
            Public Overridable Property ObjectId As Guid
        End Class

        Public Partial Class TagDto
            Public Overridable Property Name As String
            Public Overridable Property Value As String
            Public Overridable Property IsProtected As Boolean
        End Class

        Public Partial Class VariableDto
            Public Overridable Property Name As String
            '''<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 Overridable Property Value As String
            '''<Summary>
            '''The data type of the value property
            '''</Summary>
            Public Overridable Property Type As ValueDataType
            Public Overridable Property Description As String
            Public Overridable Property IsInherited As Boolean
            Public Overridable Property Environment As Environments?
        End Class
    End Namespace

    Namespace CoreService.ServiceModel.Dtos.Deployments.Crud

        '''<Summary>
        '''Creates a new deployment
        '''</Summary>
        <Api(Description:="Creates a new deployment")>
        <ApiResponse(Description:="Success", IsDefaultResponse:=true, ResponseType:=GetType(DeploymentDto), StatusCode:=201)>
        Public Partial Class CreateDeployment
            Implements ICreateRequest
            Implements IHasTenantName
            Implements IHasParent
            Implements IPost
            <ApiMember(DataType:="string", IsRequired:=true, ParameterType:="header")>
            <Validate(Validator:="NotEmpty")>
            Public Overridable Property TenantName As String Implements IHasTenantName.TenantName

            '''<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]+)$′)")>
            Public Overridable Property Name As String Implements ICreateRequest.Name

            '''<Summary>
            '''The deployments display name
            '''</Summary>
            <ApiMember(DataType:="string", Description:="The deployments display name", ParameterType:="body")>
            <Validate(Validator:="MaximumLength(250)")>
            Public Overridable Property DisplayName As String Implements ICreateRequest.DisplayName

            '''<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)")>
            Public Overridable Property Description As String Implements ICreateRequest.Description

            '''<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 Overridable Property ParentId As Guid Implements IHasParent.ParentId

            '''<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 Overridable Property TemplateId As Guid?

            '''<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 Overridable Property DefaultResourceProviderId As Guid

            '''<Summary>
            '''What kind of environment is this deployment
            '''</Summary>
            <ApiMember(Description:="What kind of environment is this deployment", IsRequired:=true, ParameterType:="body")>
            Public Overridable Property Environment As Environments

            <ApiMember(DataType:="array", ParameterType:="body")>
            Public Overridable Property Parameters As IList(Of ParameterDto)

            <ApiMember(DataType:="array", ParameterType:="body")>
            Public Overridable Property Variables As IList(Of VariableDto)

            <ApiMember(DataType:="array", ParameterType:="body")>
            Public Overridable Property Tags As IList(Of TagDto)

            '''<Summary>
            '''The expiry date of the environment
            '''</Summary>
            <ApiMember(DataType:="string", Description:="The expiry date of the environment", ParameterType:="body")>
            Public Overridable Property ValidUntil As Date?

            '''<Summary>
            '''Set if the environment should never expire
            '''</Summary>
            <ApiMember(DataType:="bool", Description:="Set if the environment should never expire", ParameterType:="body")>
            Public Overridable Property IsNeverExpiring As Boolean?

            <ApiMember(DataType:="array", IsRequired:=true, ParameterType:="body")>
            <Validate(Validator:="NotEmpty")>
            Public Overridable Property OwnerUserIds As IList(Of Integer)
        End Class
    End Namespace

    Namespace CoreService.ServiceModel.Dtos.Deployments.Responses

        Public Partial Class DeploymentDto
            Inherits ConfigItemDto
            Implements IHasParentDto
            Implements IHasTenantId
            Implements IEnvironmentSpecific
            '''<Summary>
            '''The operational state of the deployment (Running, Stopped, None, Unknown)
            '''</Summary>
            Public Overridable Property OperationalState As OperationalStates
            '''<Summary>
            '''How many start/stop-capable resources are currently running
            '''</Summary>
            Public Overridable Property ResourcesRunning As Integer
            '''<Summary>
            '''Total number of start/stop-capable resources in this deployment
            '''</Summary>
            Public Overridable Property ResourcesTotal As Integer
            '''<Summary>
            '''Shorter id than the guid which can be used for automation (tenant wide unique) prefixed with a 'd'. E.g. dr36x3
            '''</Summary>
            Public Overridable Property ShortId As String
            '''<Summary>
            '''The user defined part of the name property {userDefined}_{environment}
            '''</Summary>
            Public Overridable Property NameUserDefinedPart As String
            '''<Summary>
            '''The id of the tenant
            '''</Summary>
            Public Overridable Property TenantId As Guid Implements IHasTenantId.TenantId
            '''<Summary>
            '''The state of the deployment
            '''</Summary>
            Public Overridable Property State As LifecycleStates
            '''<Summary>
            '''The environment the deployment is deployed in
            '''</Summary>
            Public Overridable Property Environment As Environments Implements IEnvironmentSpecific.Environment
            '''<Summary>
            '''The id of the template which was used to create the deployment
            '''</Summary>
            Public Overridable Property TemplateId As Guid?
            '''<Summary>
            '''Shows if a deployment was rolled out through a dune template or not
            '''</Summary>
            Public Overridable Property IsTemplateBased As Boolean
            '''<Summary>
            '''The parameters which were used to create this deployment
            '''</Summary>
            Public Overridable Property Parameters As IList(Of ParameterDto)
            '''<Summary>
            '''A deployment scoped list of variables used for deployment of resources
            '''</Summary>
            Public Overridable Property Variables As IList(Of VariableDto)
            '''<Summary>
            '''A snapshot of the varialbs used to create the deployment
            '''</Summary>
            Public Overridable Property VariablesSnapshot As IList(Of VariableDto)
            '''<Summary>
            '''The id of the parent (collection) of the deployment
            '''</Summary>
            Public Overridable Property ParentId As Guid
            '''<Summary>
            '''The parent (collection) of the deployment
            '''</Summary>
            Public Overridable Property Parent As ConfigItemDto Implements IHasParentDto.Parent
            '''<Summary>
            '''The Date when the resources got deployed
            '''</Summary>
            Public Overridable Property ValidFrom As Date
            '''<Summary>
            '''The Date when the deployment expires and has to be reevaluated
            '''</Summary>
            Public Overridable Property ValidUntil As Date?
            '''<Summary>
            '''The deployment will never expire
            '''</Summary>
            Public Overridable Property IsNeverExpiring As Boolean
            '''<Summary>
            '''The date, when the deployments resources will receive updates
            '''</Summary>
            Public Overridable Property NextPatchDate As Date?
            '''<Summary>
            '''The default resource provider where the resources are deployed
            '''</Summary>
            Public Overridable Property DefaultResourceProviderId As Guid
            '''<Summary>
            '''Deployments which have issues in Jobs are marked with NeedsAttention
            '''</Summary>
            Public Overridable Property NeedsAttention As Boolean
            '''<Summary>
            '''Composition show if all resources in the deployment are dune native, dune foreign or a mix of both
            '''</Summary>
            Public Overridable Property Composition As ResourceCompositions
            '''<Summary>
            '''The monthly cost budget for the whole collection
            '''</Summary>
            Public Overridable Property MonthlyBudget As Decimal?
            '''<Summary>
            '''Whether to send budget information mails to the collection owners
            '''</Summary>
            Public Overridable Property SendBudgetNotificationMails As Boolean?
            '''<Summary>
            '''A threshold, when to send the first budget warning mail
            '''</Summary>
            Public Overridable Property BudgetWarningThresholdPercent As Integer?
            Public Overridable Property Links As IList(Of LinkDto)
        End Class
    End Namespace

    Namespace CoreService.ServiceModel.Enums

        Public Enum Environments
            Lab
            Poc
            Dev
            Test
            Int
            Uat
            Prod
        End Enum

        Public Enum LifecycleStates
            [New]
            Deploying
            Deployed
            Removing
            Removed
            Failure
            Imported
        End Enum

        Public Enum OperationalStates
            None
            Starting
            Running
            Stopping
            Stopped
            Restarting
            Deleting
            Unknown
        End Enum

        Public Enum ParameterValueType
            [String]
            Number
            [Boolean]
            SecureString
        End Enum

        Public Enum ResourceCompositions
            Native
            Foreign
            Mixed
        End Enum

        Public Enum ValueDataType
            [String]
            Number
            [Boolean]
            List
        End Enum
    End Namespace

    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
        End Enum
    End Namespace
End Namespace

VB.NET 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"}