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

namespace CoreService.ServiceModel.Dtos.Base.Responses
{
    public partial class ConfigItemDto
        : IConfigItem
    {
        public virtual Guid Id { get; set; }
        public virtual string Name { get; set; }
        public virtual string DisplayName { get; set; }
        public virtual string? Description { get; set; }
        public virtual ObjectTypes ObjectType { get; set; }
        public virtual string SelfLink { get; set; }
        public virtual IList<TagDto> Tags { get; set; }
        public virtual IList<PathItemDto> Path { get; set; }
        public virtual DateTime Created { get; set; }
        public virtual string CreateUser { get; set; }
        public virtual string CreateUserId { get; set; }
        public virtual DateTime Modified { get; set; }
        public virtual string ModifyUser { get; set; }
        public virtual string ModifyUserId { get; set; }
        public virtual bool IsDeleted { get; set; }
        public virtual DateTime? Deleted { get; set; }
        public virtual string? DeleteUser { get; set; }
        public virtual string? DeleteUserId { get; set; }
        public virtual IList<LinkDto> Links { get; set; }
    }

    public partial class LinkDto
    {
        public virtual string Caption { get; set; }
        public virtual string Rel { get; set; }
        public virtual string HRef { get; set; }
        public virtual string Method { get; set; }
    }

    public partial class PathItemDto
    {
        public virtual string Label { get; set; }
        public virtual string Link { get; set; }
        public virtual ObjectTypes ObjectType { get; set; }
        public virtual Guid ObjectId { get; set; }
    }

    public partial class TagDto
    {
        public virtual string Name { get; set; }
        public virtual string? Value { get; set; }
        public virtual bool IsProtected { get; set; }
    }

}

namespace CoreService.ServiceModel.Dtos.ResourceProviders.Crud
{
    ///<summary>
    ///Creates a new resourceprovider
    ///</summary>
    [Api(Description="Creates a new resourceprovider")]
    [ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(CoreService.ServiceModel.Dtos.ResourceProviders.Responses.ResourceProviderDto), StatusCode=201)]
    public partial class CreateResourceProvider
        : ICreateRequest, IHasTenantName, IPost
    {
        [ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
        [Validate("NotEmpty")]
        public virtual string TenantName { get; set; }

        ///<summary>
        ///The resource providers name
        ///</summary>
        [ApiMember(DataType="string", Description="The resource providers name", IsRequired=true, ParameterType="body")]
        [Validate("NotEmpty")]
        [Validate("MaximumLength(50)")]
        [Validate("RegularExpression(′^[0-9a-z]+[0-9a-z-]*[0-9a-z]+$′)")]
        public virtual string Name { get; set; }

        ///<summary>
        ///The resource providers display name
        ///</summary>
        [ApiMember(DataType="string", Description="The resource providers display name", ParameterType="body")]
        [Validate("MaximumLength(250)")]
        public virtual string? DisplayName { get; set; }

        ///<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("MaximumLength(8000)")]
        public virtual string? Description { get; set; }

        ///<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("NotNull")]
        public virtual Environments DefaultEnvironment { get; set; }

        ///<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("NotEmpty")]
        public virtual IList<Environments> AllowedEnvironments { get; set; }

        ///<summary>
        ///The provider type (e.g. Azure)
        ///</summary>
        [ApiMember(Description="The provider type (e.g. Azure)", IsRequired=true, ParameterType="body")]
        [Validate("NotNull")]
        public virtual ResourceProviderTypes Type { get; set; }

        ///<summary>
        ///The resource provider config
        ///</summary>
        [ApiMember(DataType="array", Description="The resource provider config", IsRequired=true, ParameterType="body")]
        [Validate("NotNull")]
        public virtual IList<ProviderConfigEntryDto> Config { get; set; }

        [ApiMember(DataType="array", ParameterType="body")]
        public virtual IList<TagDto>? Tags { get; set; }

        ///<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("NotNull")]
        public virtual bool IsDisabled { get; set; }

        ///<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("NotNull")]
        public virtual bool InitializeForDeployments { get; set; }
    }

}

namespace CoreService.ServiceModel.Dtos.ResourceProviders.Responses
{
    public partial class ProviderConfigEntryDto
    {
        public virtual string Name { get; set; }
        public virtual string Value { get; set; }
        public virtual bool isSecure { get; set; }
    }

    public partial class ResourceProviderDto
        : ConfigItemDto, IHasTenantId
    {
        public virtual Guid TenantId { get; set; }
        ///<summary>
        ///If environment cannot be detected while scanning, default environment will be used
        ///</summary>
        public virtual Environments DefaultEnvironment { get; set; }
        ///<summary>
        ///List off all allowed environments for this resource provider
        ///</summary>
        public virtual IList<Environments> AllowedEnvironments { get; set; }
        ///<summary>
        ///Defines the provider type (e.g. Azure, Aws)
        ///</summary>
        public virtual ResourceProviderTypes Type { get; set; }
        ///<summary>
        ///Additional generic data which varies depending on ProviderType
        ///</summary>
        public virtual IList<ProviderConfigEntryDto> Config { get; set; }
        ///<summary>
        ///Disabled ResourceProviders cannot be selected for new deployments
        ///</summary>
        public virtual bool IsDisabled { get; set; }
        ///<summary>
        ///Shows if a ResourceProvider has been initialized and can accept deployments (resources)
        ///</summary>
        public virtual bool IsReadyForDeployments { get; set; }
        ///<summary>
        ///The cost for the current month
        ///</summary>
        public virtual decimal CostCurrentMonth { get; set; }
        ///<summary>
        ///The cost for the last month
        ///</summary>
        public virtual decimal CostLastMonth { get; set; }
        ///<summary>
        ///The cost currency
        ///</summary>
        public virtual string CostCurrency { get; set; }
    }

}

namespace CoreService.ServiceModel.Enums
{
    public enum Environments
    {
        Lab,
        Poc,
        Dev,
        Test,
        Int,
        Uat,
        Prod,
    }

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

}

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,
    }

}

C# 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}