CoreService

<back to all web services

CreateResourceProvider

ResourceProvider - CRUD

Creates a new resourceprovider

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


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

    /**
    * The resource providers name
    */
    @ApiMember(DataType="string", Description="The resource providers 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 resource providers display name
    */
    @ApiMember(DataType="string", Description="The resource providers display name", ParameterType="body")
    @Validate(Validator="MaximumLength(250)")
    override var displayName:String? = null

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

    /**
    * If environment cannot be detected while scanning, default environment will be used
    */
    @ApiMember(Description="If environment cannot be detected while scanning, default environment will be used", IsRequired=true, ParameterType="body")
    @Validate(Validator="NotNull")
    open var defaultEnvironment:Environments? = null

    /**
    * List off all allowed environments for this resource provider
    */
    @ApiMember(Description="List off all allowed environments for this resource provider", IsRequired=true, ParameterType="body")
    @Validate(Validator="NotEmpty")
    open var allowedEnvironments:IList<Environments>? = null

    /**
    * The provider type (e.g. Azure)
    */
    @ApiMember(Description="The provider type (e.g. Azure)", IsRequired=true, ParameterType="body")
    @Validate(Validator="NotNull")
    @SerializedName("type") open var Type:ResourceProviderTypes? = null

    /**
    * The resource provider config
    */
    @ApiMember(DataType="array", Description="The resource provider config", IsRequired=true, ParameterType="body")
    @Validate(Validator="NotNull")
    open var config:IList<ProviderConfigEntryDto>? = null

    @ApiMember(DataType="array", ParameterType="body")
    open var tags:IList<TagDto>? = null

    /**
    * Disabled resource providers will be ignored when scanning, etc.
    */
    @ApiMember(Description="Disabled resource providers will be ignored when scanning, etc.", IsRequired=true, ParameterType="body")
    @Validate(Validator="NotNull")
    open var isDisabled:Boolean? = null

    /**
    * Start the initialization process, which enables the resource provider for deployments if successfull
    */
    @ApiMember(Description="Start the initialization process, which enables the resource provider for deployments if successfull", IsRequired=true, ParameterType="body")
    @Validate(Validator="NotNull")
    open var initializeForDeployments:Boolean? = null
}

enum class Environments
{
    Lab,
    Poc,
    Dev,
    Test,
    Int,
    Uat,
    Prod,
}

enum class ResourceProviderTypes
{
    Azure,
    AmazonWebServices,
    GoogleCloudPlatform,
    ActiveDirectoryServices,
    DomainNameSystem,
    SwisscomESC,
    AzureKeyVault,
}

open class ProviderConfigEntryDto
{
    open var name:String? = null
    open var value:String? = null
    open var isSecure:Boolean? = null
}

open class TagDto
{
    open var name:String? = null
    open var value:String? = null
    open var isProtected:Boolean? = null
}

open class ResourceProviderDto : ConfigItemDto(), IHasTenantId
{
    override var tenantId:UUID? = null
    /**
    * If environment cannot be detected while scanning, default environment will be used
    */
    open var defaultEnvironment:Environments? = null
    /**
    * List off all allowed environments for this resource provider
    */
    open var allowedEnvironments:IList<Environments>? = null
    /**
    * Defines the provider type (e.g. Azure, Aws)
    */
    @SerializedName("type") open var Type:ResourceProviderTypes? = null
    /**
    * Additional generic data which varies depending on ProviderType
    */
    open var config:IList<ProviderConfigEntryDto>? = null
    /**
    * Disabled ResourceProviders cannot be selected for new deployments
    */
    open var isDisabled:Boolean? = null
    /**
    * Shows if a ResourceProvider has been initialized and can accept deployments (resources)
    */
    open var isReadyForDeployments:Boolean? = null
    /**
    * The cost for the current month
    */
    open var costCurrentMonth:BigDecimal? = null
    /**
    * The cost for the last month
    */
    open var costLastMonth:BigDecimal? = null
    /**
    * The cost currency
    */
    open var costCurrency:String? = 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
}

Kotlin CreateResourceProvider 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/resourceproviders/ 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","defaultEnvironment":"Lab","allowedEnvironments":null,"type":"Azure","config":null,"tags":null,"isDisabled":false,"initializeForDeployments":false,"txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"tenantId":"00000000-0000-0000-0000-000000000000","defaultEnvironment":"Lab","allowedEnvironments":null,"type":"Azure","config":null,"isDisabled":false,"isReadyForDeployments":false,"costCurrentMonth":0,"costLastMonth":0,"costCurrency":"String","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}