| 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 |
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using CoreService.ServiceModel.Dtos.Patching.Crud;
using CoreService.ServiceModel.Enums;
using CoreService.ServiceModel.Dtos.Patching.Responses;
namespace CoreService.ServiceModel.Dtos.Patching.Crud
{
///<summary>
///Create a new patching window
///</summary>
[Api(Description="Create a new patching window")]
[ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(CoreService.ServiceModel.Dtos.Patching.Responses.PatchingWindowDto), StatusCode=201)]
public partial class CreatePatchingWindow
: IBaseRequest, IPost, IHasTenantName
{
[ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
[Validate("NotEmpty")]
public virtual string TenantName { get; set; }
///<summary>
///Occurence of week day in the month
///</summary>
[ApiMember(Description="Occurence of week day in the month", IsRequired=true)]
public virtual MonthlyDayOccurence MonthlyOccurence { get; set; }
///<summary>
///The day of the week, when patching will happen
///</summary>
[ApiMember(Description="The day of the week, when patching will happen", IsRequired=true)]
public virtual DayOfWeek DayOfWeek { get; set; }
///<summary>
///The time, when the patching window will start
///</summary>
[ApiMember(DataType="string", Description="The time, when the patching window will start", Format="time", IsRequired=true, ParameterType="body")]
public virtual TimeOnly TimeOfDay { get; set; }
///<summary>
///The max duration (hours) of the window wherein patchings can be started
///</summary>
[ApiMember(DataType="string", Description="The max duration (hours) of the window wherein patchings can be started", Format="time", ParameterType="body")]
public virtual TimeSpan? Duration { get; set; }
///<summary>
///It's the default patching window for new resource groups
///</summary>
[ApiMember(DataType="boolean", Description="It's the default patching window for new resource groups", ParameterType="body")]
public virtual bool IsDefault { get; set; }
}
}
namespace CoreService.ServiceModel.Dtos.Patching.Responses
{
public partial class PatchingWindowDto
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual DayOfWeek DayOfWeek { get; set; }
public virtual MonthlyDayOccurence MonthlyOccurence { get; set; }
public virtual TimeOnly TimeOfDay { get; set; }
public virtual TimeSpan Duration { get; set; }
public virtual bool IsDefault { get; set; }
}
}
namespace CoreService.ServiceModel.Enums
{
public enum MonthlyDayOccurence
{
First = 1,
Second = 2,
Third = 3,
Fourth = 4,
}
}
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}