| Required roles: | TenantReader, TenantAdmin |
| POST | /api/timeseries/ | Creates a new time series definition | |
|---|---|---|---|
| POST | /timeseries/ | Creates a new time series definition |
import java.math.*;
import java.util.*;
import java.io.InputStream;
import net.servicestack.client.*;
public class dtos
{
/**
* Creates a new time series definition
*/
@Api(Description="Creates a new time series definition")
@ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=TimeSeriesDefinitionDto.class, StatusCode=201)
public static class CreateTimeSeriesDefinition implements ICreateRequest, IHasTenantName, IPost, ITimeSeriesDefinitionRequest
{
@ApiMember(DataType="string", IsRequired=true, ParameterType="header")
@Validate(Validator="NotEmpty")
public String tenantName = null;
/**
* The unique name of the time series
*/
@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 String name = null;
/**
* The time series display name
*/
@ApiMember(DataType="string", Description="The time series display name", ParameterType="body")
@Validate(Validator="MaximumLength(250)")
public String displayName = null;
/**
* A more detailed description for the series
*/
@ApiMember(DataType="string", Description="A more detailed description for the series", ParameterType="body")
@Validate(Validator="MaximumLength(8000)")
public String description = null;
/**
* The source type of the time series. Only used when AutoCollection is true
*/
@ApiMember(DataType="string", Description="The source type of the time series. Only used when AutoCollection is true", ParameterType="body")
@Validate(Validator="MaximumLength(50)")
public ObjectTypes sourceType = null;
/**
* The query used to extract datapoints from source table. Only used when AutoCollection is true
*/
@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 String autoCollectionQuery = null;
/**
* How often a datapoint will be collected, Only used when AutoCollection is true
*/
@ApiMember(DataType="int", Description="How often a datapoint will be collected, Only used when AutoCollection is true", ParameterType="body")
public Integer autoCollectionInterval = null;
/**
* The interval unit for auto collection, Only used when AutoCollection is true
*/
@ApiMember(DataType="int", Description="The interval unit for auto collection, Only used when AutoCollection is true", ParameterType="body")
public IntervalUnits autoCollectionIntervalUnit = null;
/**
* The time (UTC), when the query will be executed to collect the datapoints, Only used when AutoCollection is true
*/
@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 TimeSpan autoCollectionTime = null;
/**
* How often a datapoint will be collected, Only used when AutoCollection is true
*/
@ApiMember(DataType="bool", Description="How often a datapoint will be collected, Only used when AutoCollection is true", ParameterType="body")
public Boolean autoCollection = null;
/**
* How many months to keep data in the time series before deleting them
*/
@ApiMember(DataType="double", Description="How many months to keep data in the time series before deleting them", ParameterType="body")
public Double retentionTimeMonths = null;
public String getTenantName() { return tenantName; }
public CreateTimeSeriesDefinition setTenantName(String value) { this.tenantName = value; return this; }
public String getName() { return name; }
public CreateTimeSeriesDefinition setName(String value) { this.name = value; return this; }
public String getDisplayName() { return displayName; }
public CreateTimeSeriesDefinition setDisplayName(String value) { this.displayName = value; return this; }
public String getDescription() { return description; }
public CreateTimeSeriesDefinition setDescription(String value) { this.description = value; return this; }
public ObjectTypes getSourceType() { return sourceType; }
public CreateTimeSeriesDefinition setSourceType(ObjectTypes value) { this.sourceType = value; return this; }
public String getAutoCollectionQuery() { return autoCollectionQuery; }
public CreateTimeSeriesDefinition setAutoCollectionQuery(String value) { this.autoCollectionQuery = value; return this; }
public Integer getAutoCollectionInterval() { return autoCollectionInterval; }
public CreateTimeSeriesDefinition setAutoCollectionInterval(Integer value) { this.autoCollectionInterval = value; return this; }
public IntervalUnits getAutoCollectionIntervalUnit() { return autoCollectionIntervalUnit; }
public CreateTimeSeriesDefinition setAutoCollectionIntervalUnit(IntervalUnits value) { this.autoCollectionIntervalUnit = value; return this; }
public TimeSpan getAutoCollectionTime() { return autoCollectionTime; }
public CreateTimeSeriesDefinition setAutoCollectionTime(TimeSpan value) { this.autoCollectionTime = value; return this; }
public Boolean isAutoCollection() { return autoCollection; }
public CreateTimeSeriesDefinition setAutoCollection(Boolean value) { this.autoCollection = value; return this; }
public Double getRetentionTimeMonths() { return retentionTimeMonths; }
public CreateTimeSeriesDefinition setRetentionTimeMonths(Double value) { this.retentionTimeMonths = value; return this; }
}
public static 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;
}
public static enum IntervalUnits
{
Second,
Minute,
Hour,
Day,
Week,
Month,
Year;
}
public static class TimeSeriesDefinitionDto
{
public UUID id = null;
public String name = null;
public String description = null;
public ObjectTypes sourceType = null;
public String autoCollectionQuery = null;
public Double autoCollectionInterval = null;
public IntervalUnits autoCollectionIntervalUnit = null;
public TimeSpan autoCollectionTime = null;
public Date lastAutoCollected = null;
public Boolean autoCollection = null;
public Integer retentionTimeMonths = null;
public UUID getId() { return id; }
public TimeSeriesDefinitionDto setId(UUID value) { this.id = value; return this; }
public String getName() { return name; }
public TimeSeriesDefinitionDto setName(String value) { this.name = value; return this; }
public String getDescription() { return description; }
public TimeSeriesDefinitionDto setDescription(String value) { this.description = value; return this; }
public ObjectTypes getSourceType() { return sourceType; }
public TimeSeriesDefinitionDto setSourceType(ObjectTypes value) { this.sourceType = value; return this; }
public String getAutoCollectionQuery() { return autoCollectionQuery; }
public TimeSeriesDefinitionDto setAutoCollectionQuery(String value) { this.autoCollectionQuery = value; return this; }
public Double getAutoCollectionInterval() { return autoCollectionInterval; }
public TimeSeriesDefinitionDto setAutoCollectionInterval(Double value) { this.autoCollectionInterval = value; return this; }
public IntervalUnits getAutoCollectionIntervalUnit() { return autoCollectionIntervalUnit; }
public TimeSeriesDefinitionDto setAutoCollectionIntervalUnit(IntervalUnits value) { this.autoCollectionIntervalUnit = value; return this; }
public TimeSpan getAutoCollectionTime() { return autoCollectionTime; }
public TimeSeriesDefinitionDto setAutoCollectionTime(TimeSpan value) { this.autoCollectionTime = value; return this; }
public Date getLastAutoCollected() { return lastAutoCollected; }
public TimeSeriesDefinitionDto setLastAutoCollected(Date value) { this.lastAutoCollected = value; return this; }
public Boolean isAutoCollection() { return autoCollection; }
public TimeSeriesDefinitionDto setAutoCollection(Boolean value) { this.autoCollection = value; return this; }
public Integer getRetentionTimeMonths() { return retentionTimeMonths; }
public TimeSeriesDefinitionDto setRetentionTimeMonths(Integer value) { this.retentionTimeMonths = value; return this; }
}
}
Java 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}