CoreService

<back to all web services

CreateDeploymentTemplate

DeploymentTemplate - CRUD

Create a new deployment template

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

public class dtos
{

    /**
    * Create a new deployment template
    */
    @Api(Description="Create a new deployment template")
    @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=DeploymentTemplateDto.class, StatusCode=201)
    public static class CreateDeploymentTemplate implements IBaseRequest, IHasTenantName, IPost
    {
        @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
        @Validate(Validator="NotEmpty")
        public String tenantName = null;

        /**
        * The version of the template structure
        */
        @ApiMember(DataType="integer", Description="The version of the template structure", IsRequired=true, ParameterType="body")
        @Validate(Validator="GreaterThan(0)")
        public Integer schemaVersion = null;

        /**
        * The definition of the template (YAML)
        */
        @ApiMember(DataType="string", Description="The definition of the template (YAML)", Format="yaml", IsRequired=true, ParameterType="body")
        @Validate(Validator="NotEmpty")
        public String definition = null;

        /**
        * Specify the environments the deployment template is allowed for
        */
        @ApiMember(DataType="array", Description="Specify the environments the deployment template is allowed for", ParameterType="body")
        public IList<Environments> allowedEnvironments = null;

        /**
        * Specify the resource providers the deployment template is allowed for
        */
        @ApiMember(DataType="array", Description="Specify the resource providers the deployment template is allowed for", ParameterType="body")
        public IList<UUID> allowedResourceProviderIds = null;
        
        public String getTenantName() { return tenantName; }
        public CreateDeploymentTemplate setTenantName(String value) { this.tenantName = value; return this; }
        public Integer getSchemaVersion() { return schemaVersion; }
        public CreateDeploymentTemplate setSchemaVersion(Integer value) { this.schemaVersion = value; return this; }
        public String getDefinition() { return definition; }
        public CreateDeploymentTemplate setDefinition(String value) { this.definition = value; return this; }
        public IList<Environments> getAllowedEnvironments() { return allowedEnvironments; }
        public CreateDeploymentTemplate setAllowedEnvironments(IList<Environments> value) { this.allowedEnvironments = value; return this; }
        public IList<UUID> getAllowedResourceProviderIds() { return allowedResourceProviderIds; }
        public CreateDeploymentTemplate setAllowedResourceProviderIds(IList<UUID> value) { this.allowedResourceProviderIds = value; return this; }
    }

    public static enum Environments
    {
        Lab,
        Poc,
        Dev,
        Test,
        Int,
        Uat,
        Prod;
    }

    public static class DeploymentTemplateDto extends ConfigItemDto implements IHasTenantId
    {
        public UUID tenantId = null;
        /**
        * The schema version of the attached definition (json/yaml structure)
        */
        public Integer schemaVersion = null;
        /**
        * The version of the template (changes with each change to the template)
        */
        public String version = null;
        /**
        * The version in a numeric (padded) form which can be used for sorting
        */
        public Integer versionNumeric = null;
        /**
        * The template definition as json/yaml
        */
        public String definition = null;
        /**
        * Template variables
        */
        public IList<VariableDto> variables = null;
        /**
        * Template parameters
        */
        public IList<ParameterDto> parameters = null;
        /**
        * Disabled templates should not be selected for deployments
        */
        public Boolean isDisabled = null;
        /**
        * The template with the highest version number has IsLatest set to true
        */
        public Boolean isLatest = null;
        /**
        * This template can be deployed only to the environments listed below
        */
        public IList<Environments> allowedEnvironments = null;
        /**
        * This template can be deployed only to the resource providers listed below
        */
        public IList<ResourceProviderDto> allowedResourceProviders = null;
        /**
        * An optional list of the child resource group templates
        */
        public IList<ResourceGroupTemplateDto> resourceGroupTemplates = null;
        
        public UUID getTenantId() { return tenantId; }
        public DeploymentTemplateDto setTenantId(UUID value) { this.tenantId = value; return this; }
        public Integer getSchemaVersion() { return schemaVersion; }
        public DeploymentTemplateDto setSchemaVersion(Integer value) { this.schemaVersion = value; return this; }
        public String getVersion() { return version; }
        public DeploymentTemplateDto setVersion(String value) { this.version = value; return this; }
        public Integer getVersionNumeric() { return versionNumeric; }
        public DeploymentTemplateDto setVersionNumeric(Integer value) { this.versionNumeric = value; return this; }
        public String getDefinition() { return definition; }
        public DeploymentTemplateDto setDefinition(String value) { this.definition = value; return this; }
        public IList<VariableDto> getVariables() { return variables; }
        public DeploymentTemplateDto setVariables(IList<VariableDto> value) { this.variables = value; return this; }
        public IList<ParameterDto> getParameters() { return parameters; }
        public DeploymentTemplateDto setParameters(IList<ParameterDto> value) { this.parameters = value; return this; }
        public Boolean getIsDisabled() { return isDisabled; }
        public DeploymentTemplateDto setIsDisabled(Boolean value) { this.isDisabled = value; return this; }
        public Boolean getIsLatest() { return isLatest; }
        public DeploymentTemplateDto setIsLatest(Boolean value) { this.isLatest = value; return this; }
        public IList<Environments> getAllowedEnvironments() { return allowedEnvironments; }
        public DeploymentTemplateDto setAllowedEnvironments(IList<Environments> value) { this.allowedEnvironments = value; return this; }
        public IList<ResourceProviderDto> getAllowedResourceProviders() { return allowedResourceProviders; }
        public DeploymentTemplateDto setAllowedResourceProviders(IList<ResourceProviderDto> value) { this.allowedResourceProviders = value; return this; }
        public IList<ResourceGroupTemplateDto> getResourceGroupTemplates() { return resourceGroupTemplates; }
        public DeploymentTemplateDto setResourceGroupTemplates(IList<ResourceGroupTemplateDto> value) { this.resourceGroupTemplates = value; return this; }
    }

    public static class ConfigItemDto implements IConfigItem
    {
        public UUID id = null;
        public String name = null;
        public String displayName = null;
        public String description = null;
        public ObjectTypes objectType = null;
        public String selfLink = null;
        public IList<TagDto> tags = null;
        public IList<PathItemDto> path = null;
        public Date created = null;
        public String createUser = null;
        public String createUserId = null;
        public Date modified = null;
        public String modifyUser = null;
        public String modifyUserId = null;
        public Boolean isDeleted = null;
        public Date deleted = null;
        public String deleteUser = null;
        public String deleteUserId = null;
        public IList<LinkDto> links = null;
        
        public UUID getId() { return id; }
        public ConfigItemDto setId(UUID value) { this.id = value; return this; }
        public String getName() { return name; }
        public ConfigItemDto setName(String value) { this.name = value; return this; }
        public String getDisplayName() { return displayName; }
        public ConfigItemDto setDisplayName(String value) { this.displayName = value; return this; }
        public String getDescription() { return description; }
        public ConfigItemDto setDescription(String value) { this.description = value; return this; }
        public ObjectTypes getObjectType() { return objectType; }
        public ConfigItemDto setObjectType(ObjectTypes value) { this.objectType = value; return this; }
        public String getSelfLink() { return selfLink; }
        public ConfigItemDto setSelfLink(String value) { this.selfLink = value; return this; }
        public IList<TagDto> getTags() { return tags; }
        public ConfigItemDto setTags(IList<TagDto> value) { this.tags = value; return this; }
        public IList<PathItemDto> getPath() { return path; }
        public ConfigItemDto setPath(IList<PathItemDto> value) { this.path = value; return this; }
        public Date getCreated() { return created; }
        public ConfigItemDto setCreated(Date value) { this.created = value; return this; }
        public String getCreateUser() { return createUser; }
        public ConfigItemDto setCreateUser(String value) { this.createUser = value; return this; }
        public String getCreateUserId() { return createUserId; }
        public ConfigItemDto setCreateUserId(String value) { this.createUserId = value; return this; }
        public Date getModified() { return modified; }
        public ConfigItemDto setModified(Date value) { this.modified = value; return this; }
        public String getModifyUser() { return modifyUser; }
        public ConfigItemDto setModifyUser(String value) { this.modifyUser = value; return this; }
        public String getModifyUserId() { return modifyUserId; }
        public ConfigItemDto setModifyUserId(String value) { this.modifyUserId = value; return this; }
        public Boolean getIsDeleted() { return isDeleted; }
        public ConfigItemDto setIsDeleted(Boolean value) { this.isDeleted = value; return this; }
        public Date getDeleted() { return deleted; }
        public ConfigItemDto setDeleted(Date value) { this.deleted = value; return this; }
        public String getDeleteUser() { return deleteUser; }
        public ConfigItemDto setDeleteUser(String value) { this.deleteUser = value; return this; }
        public String getDeleteUserId() { return deleteUserId; }
        public ConfigItemDto setDeleteUserId(String value) { this.deleteUserId = value; return this; }
        public IList<LinkDto> getLinks() { return links; }
        public ConfigItemDto setLinks(IList<LinkDto> value) { this.links = value; return this; }
    }

    public static 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;
    }

    public static class TagDto
    {
        public String name = null;
        public String value = null;
        public Boolean isProtected = null;
        
        public String getName() { return name; }
        public TagDto setName(String value) { this.name = value; return this; }
        public String getValue() { return value; }
        public TagDto setValue(String value) { this.value = value; return this; }
        public Boolean getIsProtected() { return isProtected; }
        public TagDto setIsProtected(Boolean value) { this.isProtected = value; return this; }
    }

    public static class PathItemDto
    {
        public String label = null;
        public String link = null;
        public ObjectTypes objectType = null;
        public UUID objectId = null;
        
        public String getLabel() { return label; }
        public PathItemDto setLabel(String value) { this.label = value; return this; }
        public String getLink() { return link; }
        public PathItemDto setLink(String value) { this.link = value; return this; }
        public ObjectTypes getObjectType() { return objectType; }
        public PathItemDto setObjectType(ObjectTypes value) { this.objectType = value; return this; }
        public UUID getObjectId() { return objectId; }
        public PathItemDto setObjectId(UUID value) { this.objectId = value; return this; }
    }

    public static class LinkDto
    {
        public String caption = null;
        public String rel = null;
        public String hRef = null;
        public String method = null;
        
        public String getCaption() { return caption; }
        public LinkDto setCaption(String value) { this.caption = value; return this; }
        public String getRel() { return rel; }
        public LinkDto setRel(String value) { this.rel = value; return this; }
        public String getHRef() { return hRef; }
        public LinkDto setHRef(String value) { this.hRef = value; return this; }
        public String getMethod() { return method; }
        public LinkDto setMethod(String value) { this.method = value; return this; }
    }

    public static class VariableDto
    {
        public String name = 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
        */
        public String value = null;
        /**
        * The data type of the value property
        */
        public ValueDataType type = null;
        public String description = null;
        public Boolean isInherited = null;
        public Environments environment = null;
        
        public String getName() { return name; }
        public VariableDto setName(String value) { this.name = value; return this; }
        public String getValue() { return value; }
        public VariableDto setValue(String value) { this.value = value; return this; }
        public ValueDataType getType() { return type; }
        public VariableDto setType(ValueDataType value) { this.type = value; return this; }
        public String getDescription() { return description; }
        public VariableDto setDescription(String value) { this.description = value; return this; }
        public Boolean getIsInherited() { return isInherited; }
        public VariableDto setIsInherited(Boolean value) { this.isInherited = value; return this; }
        public Environments getEnvironment() { return environment; }
        public VariableDto setEnvironment(Environments value) { this.environment = value; return this; }
    }

    public static enum ValueDataType
    {
        String,
        Number,
        Boolean,
        List;
    }

    public static class ParameterDto
    {
        public String name = null;
        public String description = null;
        /**
        * Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false). Note: string values need extra quotes
        */
        public String value = null;
        /**
        * Optional default value for the frontend. Needs to be in the same format as the value
        */
        @SerializedName("default") public String Default = null;
        /**
        * Optional parameters do not need to have a value. Default -> Optional=false
        */
        public Boolean optional = null;
        /**
        * The data type of the value and default property
        */
        public ParameterValueType type = null;
        public String validation = null;
        
        public String getName() { return name; }
        public ParameterDto setName(String value) { this.name = value; return this; }
        public String getDescription() { return description; }
        public ParameterDto setDescription(String value) { this.description = value; return this; }
        public String getValue() { return value; }
        public ParameterDto setValue(String value) { this.value = value; return this; }
        public String getDefault() { return Default; }
        public ParameterDto setDefault(String value) { this.Default = value; return this; }
        public Boolean isOptional() { return optional; }
        public ParameterDto setOptional(Boolean value) { this.optional = value; return this; }
        public ParameterValueType getType() { return type; }
        public ParameterDto setType(ParameterValueType value) { this.type = value; return this; }
        public String getValidation() { return validation; }
        public ParameterDto setValidation(String value) { this.validation = value; return this; }
    }

    public static enum ParameterValueType
    {
        String,
        Number,
        Boolean,
        SecureString;
    }

    public static class ResourceProviderDto extends ConfigItemDto implements IHasTenantId
    {
        public UUID tenantId = null;
        /**
        * If environment cannot be detected while scanning, default environment will be used
        */
        public Environments defaultEnvironment = null;
        /**
        * List off all allowed environments for this resource provider
        */
        public IList<Environments> allowedEnvironments = null;
        /**
        * Defines the provider type (e.g. Azure, Aws)
        */
        public ResourceProviderTypes type = null;
        /**
        * Additional generic data which varies depending on ProviderType
        */
        public IList<ProviderConfigEntryDto> config = null;
        /**
        * Disabled ResourceProviders cannot be selected for new deployments
        */
        public Boolean isDisabled = null;
        /**
        * Shows if a ResourceProvider has been initialized and can accept deployments (resources)
        */
        public Boolean isReadyForDeployments = null;
        /**
        * The cost for the current month
        */
        public BigDecimal costCurrentMonth = null;
        /**
        * The cost for the last month
        */
        public BigDecimal costLastMonth = null;
        /**
        * The cost currency
        */
        public String costCurrency = null;
        
        public UUID getTenantId() { return tenantId; }
        public ResourceProviderDto setTenantId(UUID value) { this.tenantId = value; return this; }
        public Environments getDefaultEnvironment() { return defaultEnvironment; }
        public ResourceProviderDto setDefaultEnvironment(Environments value) { this.defaultEnvironment = value; return this; }
        public IList<Environments> getAllowedEnvironments() { return allowedEnvironments; }
        public ResourceProviderDto setAllowedEnvironments(IList<Environments> value) { this.allowedEnvironments = value; return this; }
        public ResourceProviderTypes getType() { return type; }
        public ResourceProviderDto setType(ResourceProviderTypes value) { this.type = value; return this; }
        public IList<ProviderConfigEntryDto> getConfig() { return config; }
        public ResourceProviderDto setConfig(IList<ProviderConfigEntryDto> value) { this.config = value; return this; }
        public Boolean getIsDisabled() { return isDisabled; }
        public ResourceProviderDto setIsDisabled(Boolean value) { this.isDisabled = value; return this; }
        public Boolean getIsReadyForDeployments() { return isReadyForDeployments; }
        public ResourceProviderDto setIsReadyForDeployments(Boolean value) { this.isReadyForDeployments = value; return this; }
        public BigDecimal getCostCurrentMonth() { return costCurrentMonth; }
        public ResourceProviderDto setCostCurrentMonth(BigDecimal value) { this.costCurrentMonth = value; return this; }
        public BigDecimal getCostLastMonth() { return costLastMonth; }
        public ResourceProviderDto setCostLastMonth(BigDecimal value) { this.costLastMonth = value; return this; }
        public String getCostCurrency() { return costCurrency; }
        public ResourceProviderDto setCostCurrency(String value) { this.costCurrency = value; return this; }
    }

    public static enum ResourceProviderTypes
    {
        Azure,
        AmazonWebServices,
        GoogleCloudPlatform,
        ActiveDirectoryServices,
        DomainNameSystem,
        SwisscomESC,
        AzureKeyVault;
    }

    public static class ProviderConfigEntryDto
    {
        public String name = null;
        public String value = null;
        public Boolean isSecure = null;
        
        public String getName() { return name; }
        public ProviderConfigEntryDto setName(String value) { this.name = value; return this; }
        public String getValue() { return value; }
        public ProviderConfigEntryDto setValue(String value) { this.value = value; return this; }
        public Boolean getIsSecure() { return isSecure; }
        public ProviderConfigEntryDto setIsSecure(Boolean value) { this.isSecure = value; return this; }
    }

    public static class ResourceGroupTemplateDto extends ConfigItemDto implements IHasTenantId
    {
        public UUID tenantId = null;
        /**
        * The schema version of the attached definition (json/yaml structure)
        */
        public Integer schemaVersion = null;
        /**
        * The version of the template (changes with each change to the template)
        */
        public String version = null;
        /**
        * The version in a numeric (padded) form which can be used for sorting
        */
        public Integer versionNumeric = null;
        /**
        * The template definition/body either as json or yaml
        */
        public String definition = null;
        /**
        * Template variables
        */
        public IList<VariableDto> variables = null;
        /**
        * Template parameters
        */
        public IList<ParameterDto> parameters = null;
        /**
        * The template with the highest version number has IsLatest set to true
        */
        public Boolean isLatest = null;
        /**
        * List of contained resources
        */
        public IList<ResourceTemplateDto> resourceTemplates = null;
        
        public UUID getTenantId() { return tenantId; }
        public ResourceGroupTemplateDto setTenantId(UUID value) { this.tenantId = value; return this; }
        public Integer getSchemaVersion() { return schemaVersion; }
        public ResourceGroupTemplateDto setSchemaVersion(Integer value) { this.schemaVersion = value; return this; }
        public String getVersion() { return version; }
        public ResourceGroupTemplateDto setVersion(String value) { this.version = value; return this; }
        public Integer getVersionNumeric() { return versionNumeric; }
        public ResourceGroupTemplateDto setVersionNumeric(Integer value) { this.versionNumeric = value; return this; }
        public String getDefinition() { return definition; }
        public ResourceGroupTemplateDto setDefinition(String value) { this.definition = value; return this; }
        public IList<VariableDto> getVariables() { return variables; }
        public ResourceGroupTemplateDto setVariables(IList<VariableDto> value) { this.variables = value; return this; }
        public IList<ParameterDto> getParameters() { return parameters; }
        public ResourceGroupTemplateDto setParameters(IList<ParameterDto> value) { this.parameters = value; return this; }
        public Boolean getIsLatest() { return isLatest; }
        public ResourceGroupTemplateDto setIsLatest(Boolean value) { this.isLatest = value; return this; }
        public IList<ResourceTemplateDto> getResourceTemplates() { return resourceTemplates; }
        public ResourceGroupTemplateDto setResourceTemplates(IList<ResourceTemplateDto> value) { this.resourceTemplates = value; return this; }
    }

    public static class ResourceTemplateDto
    {
        public String name = null;
        public String displayName = null;
        public String description = null;
        public ObjectTypes type = null;
        
        public String getName() { return name; }
        public ResourceTemplateDto setName(String value) { this.name = value; return this; }
        public String getDisplayName() { return displayName; }
        public ResourceTemplateDto setDisplayName(String value) { this.displayName = value; return this; }
        public String getDescription() { return description; }
        public ResourceTemplateDto setDescription(String value) { this.description = value; return this; }
        public ObjectTypes getType() { return type; }
        public ResourceTemplateDto setType(ObjectTypes value) { this.type = value; return this; }
    }

}

Java CreateDeploymentTemplate 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/deploymenttemplates/ HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"tenantName":"String","schemaVersion":0,"definition":"String","allowedEnvironments":null,"allowedResourceProviderIds":null,"txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"tenantId":"00000000-0000-0000-0000-000000000000","schemaVersion":0,"version":"String","versionNumeric":0,"definition":"String","variables":null,"parameters":null,"isDisabled":false,"isLatest":false,"allowedEnvironments":null,"allowedResourceProviders":null,"resourceGroupTemplates":null,"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}