CoreService

<back to all web services

GetTimeSeriesDefinition

TimeSeries - CRUD

Returns a timeseries definition by its ID

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
GET/timeseries/{Id}Returns a timeseries definition
GET/api/timeseries/{Id}Returns a timeseries definition
GET/timeseries/{Name}/bynameReturns a timeseries definition
GET/api/timeseries/{Name}/bynameReturns a timeseries definition
import 'package:servicestack/servicestack.dart';

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

enum IntervalUnits
{
    Second,
    Minute,
    Hour,
    Day,
    Week,
    Month,
    Year,
}

class TimeSeriesDefinitionDto implements IConvertible
{
    String id = "";
    String name = "";
    String? description;
    ObjectTypes sourceType;
    String? autoCollectionQuery;
    double? autoCollectionInterval;
    IntervalUnits? autoCollectionIntervalUnit;
    Duration? autoCollectionTime;
    DateTime? lastAutoCollected;
    bool autoCollection;
    int? retentionTimeMonths;

    TimeSeriesDefinitionDto({this.id,this.name,this.description,this.sourceType,this.autoCollectionQuery,this.autoCollectionInterval,this.autoCollectionIntervalUnit,this.autoCollectionTime,this.lastAutoCollected,this.autoCollection,this.retentionTimeMonths});
    TimeSeriesDefinitionDto.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        name = json['name'];
        description = json['description'];
        sourceType = JsonConverters.fromJson(json['sourceType'],'ObjectTypes',context!);
        autoCollectionQuery = json['autoCollectionQuery'];
        autoCollectionInterval = JsonConverters.toDouble(json['autoCollectionInterval']);
        autoCollectionIntervalUnit = JsonConverters.fromJson(json['autoCollectionIntervalUnit'],'IntervalUnits',context!);
        autoCollectionTime = JsonConverters.fromJson(json['autoCollectionTime'],'Duration',context!);
        lastAutoCollected = JsonConverters.fromJson(json['lastAutoCollected'],'DateTime',context!);
        autoCollection = json['autoCollection'];
        retentionTimeMonths = json['retentionTimeMonths'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'description': description,
        'sourceType': JsonConverters.toJson(sourceType,'ObjectTypes',context!),
        'autoCollectionQuery': autoCollectionQuery,
        'autoCollectionInterval': autoCollectionInterval,
        'autoCollectionIntervalUnit': JsonConverters.toJson(autoCollectionIntervalUnit,'IntervalUnits',context!),
        'autoCollectionTime': JsonConverters.toJson(autoCollectionTime,'Duration',context!),
        'lastAutoCollected': JsonConverters.toJson(lastAutoCollected,'DateTime',context!),
        'autoCollection': autoCollection,
        'retentionTimeMonths': retentionTimeMonths
    };

    getTypeName() => "TimeSeriesDefinitionDto";
    TypeContext? context = _ctx;
}

/**
* Returns a timeseries definition by its ID
*/
// @Api(Description="Returns a timeseries definition by its ID")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(TimeSeriesDefinitionDto), StatusCode=200)
class GetTimeSeriesDefinition implements IGetSingleRequest, IHasTenantName, IGet, IConvertible
{
    // @ApiMember(DataType="string", Format="guid", ParameterType="path")
    String? id;

    // @ApiMember(DataType="string", ParameterType="path")
    String? name;

    // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    // @Validate(Validator="NotEmpty")
    String tenantName = "";

    // @ApiMember(ParameterType="query", Verb="GET")
    bool? includeReferencedObjects;

    /**
    * If true, also soft deleted items will be returned
    */
    // @ApiMember(Description="If true, also soft deleted items will be returned", ParameterType="query")
    bool? includeDeleted;

    GetTimeSeriesDefinition({this.id,this.name,this.tenantName,this.includeReferencedObjects,this.includeDeleted});
    GetTimeSeriesDefinition.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        name = json['name'];
        tenantName = json['tenantName'];
        includeReferencedObjects = json['includeReferencedObjects'];
        includeDeleted = json['includeDeleted'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'tenantName': tenantName,
        'includeReferencedObjects': includeReferencedObjects,
        'includeDeleted': includeDeleted
    };

    getTypeName() => "GetTimeSeriesDefinition";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'duneframework.com', types: <String, TypeInfo> {
    'ObjectTypes': TypeInfo(TypeOf.Enum, enumValues:ObjectTypes.values),
    'IntervalUnits': TypeInfo(TypeOf.Enum, enumValues:IntervalUnits.values),
    'TimeSeriesDefinitionDto': TypeInfo(TypeOf.Class, create:() => TimeSeriesDefinitionDto()),
    'GetTimeSeriesDefinition': TypeInfo(TypeOf.Class, create:() => GetTimeSeriesDefinition()),
});

Dart GetTimeSeriesDefinition 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.

GET /timeseries/{Id} HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
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}