CoreService

<back to all web services

CreateTimeSeriesDefinition

TimeSeries - CRUD

Creates a new time series definition

Requires Authentication
Required roles:TenantReader, TenantAdmin
The following routes are available for this service:
POST/api/timeseries/Creates a new time series definition
POST/timeseries/Creates a new time series definition
namespace CoreService.ServiceModel.Dtos.TimeSeries.Crud

open System
open System.IO
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations

    type ObjectTypes =
        | None = 0
        | ConfigItem = 1
        | Tenant = 2
        | Collection = 3
        | Resource = 4
        | ComputeNode = 5
        | VirtualMachine = 6
        | PhysicalMachine = 7
        | Disk = 8
        | Subnet = 9
        | IPAddress = 10
        | Job = 11
        | JobEvent = 12
        | FreezePeriod = 13
        | ResourceGroup = 14
        | Deployment = 15
        | ResourceGroupTemplate = 16
        | DeploymentTemplate = 17
        | ResourceProvider = 18
        | GenericResource = 19
        | Role = 20
        | Permission = 21
        | User = 22
        | PatchingWindow = 23
        | Update = 24
        | ReportDefinition = 25
        | TimeSeries = 26
        | DataPoint = 27
        | Action = 28
        | ActionAssignment = 29
        | UserNote = 30

    type IntervalUnits =
        | Second = 0
        | Minute = 1
        | Hour = 2
        | Day = 3
        | Week = 4
        | Month = 5
        | Year = 6

    [<AllowNullLiteral>]
    type TimeSeriesDefinitionDto() = 
        member val Id:Guid = new Guid() with get,set
        member val Name:String = null with get,set
        member val Description:String = null with get,set
        member val SourceType:ObjectTypes = new ObjectTypes() with get,set
        member val AutoCollectionQuery:String = null with get,set
        member val AutoCollectionInterval:Nullable<Double> = new Nullable<Double>() with get,set
        member val AutoCollectionIntervalUnit:Nullable<IntervalUnits> = new Nullable<IntervalUnits>() with get,set
        member val AutoCollectionTime:Nullable<TimeOnly> = new Nullable<TimeOnly>() with get,set
        member val LastAutoCollected:Nullable<DateTime> = new Nullable<DateTime>() with get,set
        member val AutoCollection:Boolean = new Boolean() with get,set
        member val RetentionTimeMonths:Nullable<Int32> = new Nullable<Int32>() with get,set

    ///<summary>
    ///Creates a new time series definition
    ///</summary>
    [<Api(Description="Creates a new time series definition")>]
    [<ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof<TimeSeriesDefinitionDto>, StatusCode=201)>]
    [<AllowNullLiteral>]
    type CreateTimeSeriesDefinition() = 
        interface IPost
        [<ApiMember(DataType="string", IsRequired=true, ParameterType="header")>]
        [<Validate(Validator="NotEmpty")>]
        member val TenantName:String = null with get,set

        ///<summary>
        ///The unique name of the time series
        ///</summary>
        [<ApiMember(DataType="string", Description="The unique name of the time series", IsRequired=true, ParameterType="body")>]
        [<Validate(Validator="NotEmpty")>]
        [<Validate(Validator="MaximumLength(100)")>]
        [<Validate(Validator="RegularExpression(′^[0-9a-z]′)")>]
        member val Name:String = null with get,set

        ///<summary>
        ///The time series display name
        ///</summary>
        [<ApiMember(DataType="string", Description="The time series display name", ParameterType="body")>]
        [<Validate(Validator="MaximumLength(250)")>]
        member val DisplayName:String = null with get,set

        ///<summary>
        ///A more detailed description for the series
        ///</summary>
        [<ApiMember(DataType="string", Description="A more detailed description for the series", ParameterType="body")>]
        [<Validate(Validator="MaximumLength(8000)")>]
        member val Description:String = null with get,set

        ///<summary>
        ///The source type of the time series. Only used when AutoCollection is true
        ///</summary>
        [<ApiMember(DataType="string", Description="The source type of the time series. Only used when AutoCollection is true", ParameterType="body")>]
        [<Validate(Validator="MaximumLength(50)")>]
        member val SourceType:Nullable<ObjectTypes> = new Nullable<ObjectTypes>() with get,set

        ///<summary>
        ///The query used to extract datapoints from source table. Only used when AutoCollection is true
        ///</summary>
        [<ApiMember(DataType="string", Description="The query used to extract datapoints from source table. Only used when AutoCollection is true", ParameterType="body")>]
        [<Validate(Validator="MaximumLength(2147483647)")>]
        member val AutoCollectionQuery:String = null with get,set

        ///<summary>
        ///How often a datapoint will be collected, Only used when AutoCollection is true
        ///</summary>
        [<ApiMember(DataType="int", Description="How often a datapoint will be collected, Only used when AutoCollection is true", ParameterType="body")>]
        member val AutoCollectionInterval:Nullable<Int32> = new Nullable<Int32>() with get,set

        ///<summary>
        ///The interval unit for auto collection, Only used when AutoCollection is true
        ///</summary>
        [<ApiMember(DataType="int", Description="The interval unit for auto collection, Only used when AutoCollection is true", ParameterType="body")>]
        member val AutoCollectionIntervalUnit:Nullable<IntervalUnits> = new Nullable<IntervalUnits>() with get,set

        ///<summary>
        ///The time (UTC), when the query will be executed to collect the datapoints, Only used when AutoCollection is true
        ///</summary>
        [<ApiMember(DataType="string", Description="The time (UTC), when the query will be executed to collect the datapoints, Only used when AutoCollection is true", Format="TimeOnly", ParameterType="body")>]
        member val AutoCollectionTime:Nullable<TimeOnly> = new Nullable<TimeOnly>() with get,set

        ///<summary>
        ///How often a datapoint will be collected, Only used when AutoCollection is true
        ///</summary>
        [<ApiMember(DataType="bool", Description="How often a datapoint will be collected, Only used when AutoCollection is true", ParameterType="body")>]
        member val AutoCollection:Boolean = new Boolean() with get,set

        ///<summary>
        ///How many months to keep data in the time series before deleting them
        ///</summary>
        [<ApiMember(DataType="double", Description="How many months to keep data in the time series before deleting them", ParameterType="body")>]
        member val RetentionTimeMonths:Nullable<Double> = new Nullable<Double>() with get,set

F# CreateTimeSeriesDefinition 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/timeseries/ 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","sourceType":"None","autoCollectionQuery":"String","autoCollectionInterval":0,"autoCollectionIntervalUnit":"Second","autoCollectionTime":"00:00","autoCollection":false,"retentionTimeMonths":0,"txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"id":"00000000-0000-0000-0000-000000000000","name":"String","description":"String","sourceType":"None","autoCollectionQuery":"String","autoCollectionInterval":0,"autoCollectionIntervalUnit":"Second","autoCollectionTime":"00:00","lastAutoCollected":"0001-01-01T00:00:00.0000000Z","autoCollection":false,"retentionTimeMonths":0}