| Required roles: | TenantReader, TenantAdmin |
| POST | /api/timeseries/ | Creates a new time series definition | |
|---|---|---|---|
| POST | /timeseries/ | Creates a new time series definition |
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.TimeSeries.Crud
Imports YCO.Dune.Models.Enums
Imports CoreService.ServiceModel.Dtos.TimeSeries.Reponses
Namespace Global
Namespace CoreService.ServiceModel.Dtos.TimeSeries.Crud
'''<Summary>
'''Creates a new time series definition
'''</Summary>
<Api(Description:="Creates a new time series definition")>
<ApiResponse(Description:="Success", IsDefaultResponse:=true, ResponseType:=GetType(TimeSeriesDefinitionDto), StatusCode:=201)>
Public Partial Class CreateTimeSeriesDefinition
Implements ICreateRequest
Implements IHasTenantName
Implements IPost
Implements ITimeSeriesDefinitionRequest
<ApiMember(DataType:="string", IsRequired:=true, ParameterType:="header")>
<Validate(Validator:="NotEmpty")>
Public Overridable Property TenantName As String Implements ITimeSeriesDefinitionRequest.TenantName
'''<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]′)")>
Public Overridable Property Name As String Implements ITimeSeriesDefinitionRequest.Name
'''<Summary>
'''The time series display name
'''</Summary>
<ApiMember(DataType:="string", Description:="The time series display name", ParameterType:="body")>
<Validate(Validator:="MaximumLength(250)")>
Public Overridable Property DisplayName As String Implements ITimeSeriesDefinitionRequest.DisplayName
'''<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)")>
Public Overridable Property Description As String Implements ITimeSeriesDefinitionRequest.Description
'''<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)")>
Public Overridable Property SourceType As ObjectTypes? Implements ITimeSeriesDefinitionRequest.SourceType
'''<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)")>
Public Overridable Property AutoCollectionQuery As String Implements ITimeSeriesDefinitionRequest.AutoCollectionQuery
'''<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")>
Public Overridable Property AutoCollectionInterval As Integer? Implements ITimeSeriesDefinitionRequest.AutoCollectionInterval
'''<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")>
Public Overridable Property AutoCollectionIntervalUnit As IntervalUnits? Implements ITimeSeriesDefinitionRequest.AutoCollectionIntervalUnit
'''<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")>
Public Overridable Property AutoCollectionTime As TimeOnly? Implements ITimeSeriesDefinitionRequest.AutoCollectionTime
'''<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")>
Public Overridable Property AutoCollection As Boolean Implements ITimeSeriesDefinitionRequest.AutoCollection
'''<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")>
Public Overridable Property RetentionTimeMonths As Double?
End Class
End Namespace
Namespace CoreService.ServiceModel.Dtos.TimeSeries.Reponses
Public Partial Class TimeSeriesDefinitionDto
Public Overridable Property Id As Guid
Public Overridable Property Name As String
Public Overridable Property Description As String
Public Overridable Property SourceType As ObjectTypes
Public Overridable Property AutoCollectionQuery As String
Public Overridable Property AutoCollectionInterval As Double?
Public Overridable Property AutoCollectionIntervalUnit As IntervalUnits?
Public Overridable Property AutoCollectionTime As TimeOnly?
Public Overridable Property LastAutoCollected As Date?
Public Overridable Property AutoCollection As Boolean
Public Overridable Property RetentionTimeMonths As Integer?
End Class
End Namespace
Namespace YCO.Dune.Models.Enums
Public Enum IntervalUnits
Second
Minute
Hour
Day
Week
Month
Year
End Enum
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 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
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}