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
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.ResourceProviders.Crud
Imports CoreService.ServiceModel.Enums
Imports CoreService.ServiceModel.Dtos.ResourceProviders.Responses
Imports CoreService.ServiceModel.Dtos.Base.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 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
    End Namespace

    Namespace CoreService.ServiceModel.Dtos.ResourceProviders.Crud

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

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

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

            '''<Summary>
            '''A more detailed description for the resource provider
            '''</Summary>
            <ApiMember(DataType:="string", Description:="A more detailed description for the resource provider", ParameterType:="body")>
            <Validate(Validator:="MaximumLength(8000)")>
            Public Overridable Property Description As String Implements ICreateRequest.Description

            '''<Summary>
            '''If environment cannot be detected while scanning, default environment will be used
            '''</Summary>
            <ApiMember(Description:="If environment cannot be detected while scanning, default environment will be used", IsRequired:=true, ParameterType:="body")>
            <Validate(Validator:="NotNull")>
            Public Overridable Property DefaultEnvironment As Environments

            '''<Summary>
            '''List off all allowed environments for this resource provider
            '''</Summary>
            <ApiMember(Description:="List off all allowed environments for this resource provider", IsRequired:=true, ParameterType:="body")>
            <Validate(Validator:="NotEmpty")>
            Public Overridable Property AllowedEnvironments As IList(Of Environments)

            '''<Summary>
            '''The provider type (e.g. Azure)
            '''</Summary>
            <ApiMember(Description:="The provider type (e.g. Azure)", IsRequired:=true, ParameterType:="body")>
            <Validate(Validator:="NotNull")>
            Public Overridable Property Type As ResourceProviderTypes?

            '''<Summary>
            '''The resource provider config
            '''</Summary>
            <ApiMember(DataType:="array", Description:="The resource provider config", IsRequired:=true, ParameterType:="body")>
            <Validate(Validator:="NotNull")>
            Public Overridable Property Config As IList(Of ProviderConfigEntryDto)

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

            '''<Summary>
            '''Disabled resource providers will be ignored when scanning, etc.
            '''</Summary>
            <ApiMember(Description:="Disabled resource providers will be ignored when scanning, etc.", IsRequired:=true, ParameterType:="body")>
            <Validate(Validator:="NotNull")>
            Public Overridable Property IsDisabled As Boolean

            '''<Summary>
            '''Start the initialization process, which enables the resource provider for deployments if successfull
            '''</Summary>
            <ApiMember(Description:="Start the initialization process, which enables the resource provider for deployments if successfull", IsRequired:=true, ParameterType:="body")>
            <Validate(Validator:="NotNull")>
            Public Overridable Property InitializeForDeployments As Boolean
        End Class
    End Namespace

    Namespace CoreService.ServiceModel.Dtos.ResourceProviders.Responses

        Public Partial Class ProviderConfigEntryDto
            Public Overridable Property Name As String
            Public Overridable Property Value As String
            Public Overridable Property isSecure As Boolean
        End Class

        Public Partial Class ResourceProviderDto
            Inherits ConfigItemDto
            Implements IHasTenantId
            Public Overridable Property TenantId As Guid Implements IHasTenantId.TenantId
            '''<Summary>
            '''If environment cannot be detected while scanning, default environment will be used
            '''</Summary>
            Public Overridable Property DefaultEnvironment As Environments
            '''<Summary>
            '''List off all allowed environments for this resource provider
            '''</Summary>
            Public Overridable Property AllowedEnvironments As IList(Of Environments)
            '''<Summary>
            '''Defines the provider type (e.g. Azure, Aws)
            '''</Summary>
            Public Overridable Property Type As ResourceProviderTypes
            '''<Summary>
            '''Additional generic data which varies depending on ProviderType
            '''</Summary>
            Public Overridable Property Config As IList(Of ProviderConfigEntryDto)
            '''<Summary>
            '''Disabled ResourceProviders cannot be selected for new deployments
            '''</Summary>
            Public Overridable Property IsDisabled As Boolean
            '''<Summary>
            '''Shows if a ResourceProvider has been initialized and can accept deployments (resources)
            '''</Summary>
            Public Overridable Property IsReadyForDeployments As Boolean
            '''<Summary>
            '''The cost for the current month
            '''</Summary>
            Public Overridable Property CostCurrentMonth As Decimal
            '''<Summary>
            '''The cost for the last month
            '''</Summary>
            Public Overridable Property CostLastMonth As Decimal
            '''<Summary>
            '''The cost currency
            '''</Summary>
            Public Overridable Property CostCurrency As String
        End Class
    End Namespace

    Namespace CoreService.ServiceModel.Enums

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

        Public Enum ResourceProviderTypes
            Azure
            AmazonWebServices
            GoogleCloudPlatform
            ActiveDirectoryServices
            DomainNameSystem
            SwisscomESC
            AzureKeyVault
        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 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}