| 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 java.math.*;
import java.util.*;
import java.io.InputStream;
import net.servicestack.client.*;
public class dtos
{
/**
* Create a new patching window
*/
@Api(Description="Create a new patching window")
@ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=PatchingWindowDto.class, StatusCode=201)
public static class CreatePatchingWindow implements IBaseRequest, IPost, IHasTenantName
{
@ApiMember(DataType="string", IsRequired=true, ParameterType="header")
@Validate(Validator="NotEmpty")
public String tenantName = null;
/**
* Occurence of week day in the month
*/
@ApiMember(Description="Occurence of week day in the month", IsRequired=true)
public MonthlyDayOccurence monthlyOccurence = null;
/**
* The day of the week, when patching will happen
*/
@ApiMember(Description="The day of the week, when patching will happen", IsRequired=true)
public DayOfWeek dayOfWeek = null;
/**
* 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")
public TimeSpan timeOfDay = null;
/**
* 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")
public TimeSpan duration = null;
/**
* 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")
public Boolean isDefault = null;
public String getTenantName() { return tenantName; }
public CreatePatchingWindow setTenantName(String value) { this.tenantName = value; return this; }
public MonthlyDayOccurence getMonthlyOccurence() { return monthlyOccurence; }
public CreatePatchingWindow setMonthlyOccurence(MonthlyDayOccurence value) { this.monthlyOccurence = value; return this; }
public DayOfWeek getDayOfWeek() { return dayOfWeek; }
public CreatePatchingWindow setDayOfWeek(DayOfWeek value) { this.dayOfWeek = value; return this; }
public TimeSpan getTimeOfDay() { return timeOfDay; }
public CreatePatchingWindow setTimeOfDay(TimeSpan value) { this.timeOfDay = value; return this; }
public TimeSpan getDuration() { return duration; }
public CreatePatchingWindow setDuration(TimeSpan value) { this.duration = value; return this; }
public Boolean getIsDefault() { return isDefault; }
public CreatePatchingWindow setIsDefault(Boolean value) { this.isDefault = value; return this; }
}
public static enum MonthlyDayOccurence
{
First(1),
Second(2),
Third(3),
Fourth(4);
private final int value;
MonthlyDayOccurence(final int intValue) { value = intValue; }
public int getValue() { return value; }
}
public static class PatchingWindowDto
{
public UUID id = null;
public String name = null;
public DayOfWeek dayOfWeek = null;
public MonthlyDayOccurence monthlyOccurence = null;
public TimeSpan timeOfDay = null;
public TimeSpan duration = null;
public Boolean isDefault = null;
public UUID getId() { return id; }
public PatchingWindowDto setId(UUID value) { this.id = value; return this; }
public String getName() { return name; }
public PatchingWindowDto setName(String value) { this.name = value; return this; }
public DayOfWeek getDayOfWeek() { return dayOfWeek; }
public PatchingWindowDto setDayOfWeek(DayOfWeek value) { this.dayOfWeek = value; return this; }
public MonthlyDayOccurence getMonthlyOccurence() { return monthlyOccurence; }
public PatchingWindowDto setMonthlyOccurence(MonthlyDayOccurence value) { this.monthlyOccurence = value; return this; }
public TimeSpan getTimeOfDay() { return timeOfDay; }
public PatchingWindowDto setTimeOfDay(TimeSpan value) { this.timeOfDay = value; return this; }
public TimeSpan getDuration() { return duration; }
public PatchingWindowDto setDuration(TimeSpan value) { this.duration = value; return this; }
public Boolean getIsDefault() { return isDefault; }
public PatchingWindowDto setIsDefault(Boolean value) { this.isDefault = value; return this; }
}
}
Java 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}