| Requires any of the roles: | TenantReader, Admin, TenantAdmin |
| POST | /api/patching/windows | Creates a new patching window | |
|---|---|---|---|
| POST | /patching/windows | Creates a new patching window |
import 'package:servicestack/servicestack.dart';
enum MonthlyDayOccurence
{
First,
Second,
Third,
Fourth,
}
class PatchingWindowDto implements IConvertible
{
String id = "";
String name = "";
DayOfWeek dayOfWeek;
MonthlyDayOccurence monthlyOccurence;
Duration timeOfDay;
Duration duration;
bool isDefault;
PatchingWindowDto({this.id,this.name,this.dayOfWeek,this.monthlyOccurence,this.timeOfDay,this.duration,this.isDefault});
PatchingWindowDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
dayOfWeek = JsonConverters.fromJson(json['dayOfWeek'],'DayOfWeek',context!);
monthlyOccurence = JsonConverters.fromJson(json['monthlyOccurence'],'MonthlyDayOccurence',context!);
timeOfDay = JsonConverters.fromJson(json['timeOfDay'],'Duration',context!);
duration = JsonConverters.fromJson(json['duration'],'Duration',context!);
isDefault = json['isDefault'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'dayOfWeek': JsonConverters.toJson(dayOfWeek,'DayOfWeek',context!),
'monthlyOccurence': JsonConverters.toJson(monthlyOccurence,'MonthlyDayOccurence',context!),
'timeOfDay': JsonConverters.toJson(timeOfDay,'Duration',context!),
'duration': JsonConverters.toJson(duration,'Duration',context!),
'isDefault': isDefault
};
getTypeName() => "PatchingWindowDto";
TypeContext? context = _ctx;
}
/**
* Create a new patching window
*/
// @Api(Description="Create a new patching window")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(PatchingWindowDto), StatusCode=201)
class CreatePatchingWindow implements IBaseRequest, IPost, IHasTenantName, IConvertible
{
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
String tenantName = "";
/**
* Occurence of week day in the month
*/
// @ApiMember(Description="Occurence of week day in the month", IsRequired=true)
MonthlyDayOccurence monthlyOccurence;
/**
* The day of the week, when patching will happen
*/
// @ApiMember(Description="The day of the week, when patching will happen", IsRequired=true)
DayOfWeek dayOfWeek;
/**
* The time, when the patching window will start
*/
// @ApiMember(DataType="string", Description="The time, when the patching window will start", Format="time", IsRequired=true, ParameterType="body")
Duration timeOfDay;
/**
* The max duration (hours) of the window wherein patchings can be started
*/
// @ApiMember(DataType="string", Description="The max duration (hours) of the window wherein patchings can be started", Format="time", ParameterType="body")
Duration? duration;
/**
* It's the default patching window for new resource groups
*/
// @ApiMember(DataType="boolean", Description="It's the default patching window for new resource groups", ParameterType="body")
bool isDefault;
CreatePatchingWindow({this.tenantName,this.monthlyOccurence,this.dayOfWeek,this.timeOfDay,this.duration,this.isDefault});
CreatePatchingWindow.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
tenantName = json['tenantName'];
monthlyOccurence = JsonConverters.fromJson(json['monthlyOccurence'],'MonthlyDayOccurence',context!);
dayOfWeek = JsonConverters.fromJson(json['dayOfWeek'],'DayOfWeek',context!);
timeOfDay = JsonConverters.fromJson(json['timeOfDay'],'Duration',context!);
duration = JsonConverters.fromJson(json['duration'],'Duration',context!);
isDefault = json['isDefault'];
return this;
}
Map<String, dynamic> toJson() => {
'tenantName': tenantName,
'monthlyOccurence': JsonConverters.toJson(monthlyOccurence,'MonthlyDayOccurence',context!),
'dayOfWeek': JsonConverters.toJson(dayOfWeek,'DayOfWeek',context!),
'timeOfDay': JsonConverters.toJson(timeOfDay,'Duration',context!),
'duration': JsonConverters.toJson(duration,'Duration',context!),
'isDefault': isDefault
};
getTypeName() => "CreatePatchingWindow";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'duneframework.com', types: <String, TypeInfo> {
'MonthlyDayOccurence': TypeInfo(TypeOf.Enum, enumValues:MonthlyDayOccurence.values),
'PatchingWindowDto': TypeInfo(TypeOf.Class, create:() => PatchingWindowDto()),
'DayOfWeek': TypeInfo(TypeOf.Class, create:() => DayOfWeek()),
'CreatePatchingWindow': TypeInfo(TypeOf.Class, create:() => CreatePatchingWindow()),
});
Dart CreatePatchingWindow 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/patching/windows HTTP/1.1
Host: core.starburst.svc
Accept: application/json
Content-Type: application/json
Content-Length: length
{"tenantName":"String","monthlyOccurence":"First","dayOfWeek":"Sunday","timeOfDay":"00:00:00","duration":"00:00:00","isDefault":false,"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","dayOfWeek":"Sunday","monthlyOccurence":"First","timeOfDay":"00:00:00","duration":"00:00:00","isDefault":false}