CoreService

<back to all web services

CreatePatchingWindow

Patching - CRUD

Create a new patching window

Requires Authentication
Requires any of the roles:TenantReader, Admin, TenantAdmin
The following routes are available for this service:
POST/api/patching/windowsCreates a new patching window
POST/patching/windowsCreates a new patching window
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
Object = TypeVar('Object')


class MonthlyDayOccurence(IntEnum):
    FIRST = 1
    SECOND = 2
    THIRD = 3
    FOURTH = 4


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PatchingWindowDto:
    id: Optional[str] = None
    name: Optional[str] = None
    day_of_week: Optional[DayOfWeek] = None
    monthly_occurence: Optional[MonthlyDayOccurence] = None
    time_of_day: datetime.timedelta = datetime.timedelta()
    duration: datetime.timedelta = datetime.timedelta()
    is_default: bool = False


# @Api(Description="Create a new patching window")
# @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(PatchingWindowDto), StatusCode=201)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreatePatchingWindow(IBaseRequest, IPost, IHasTenantName):
    """
    Create a new patching window
    """

    # @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    # @Validate(Validator="NotEmpty")
    tenant_name: Optional[str] = None

    # @ApiMember(Description="Occurence of week day in the month", IsRequired=true)
    monthly_occurence: Optional[MonthlyDayOccurence] = None
    """
    Occurence of week day in the month
    """


    # @ApiMember(Description="The day of the week, when patching will happen", IsRequired=true)
    day_of_week: Optional[DayOfWeek] = None
    """
    The day of the week, when patching will happen
    """


    # @ApiMember(DataType="string", Description="The time, when the patching window will start", Format="time", IsRequired=true, ParameterType="body")
    time_of_day: datetime.timedelta = datetime.timedelta()
    """
    The time, when the patching window will start
    """


    # @ApiMember(DataType="string", Description="The max duration (hours) of the window wherein patchings can be started", Format="time", ParameterType="body")
    duration: Optional[datetime.timedelta] = None
    """
    The max duration (hours) of the window wherein patchings can be started
    """


    # @ApiMember(DataType="boolean", Description="It's the default patching window for new resource groups", ParameterType="body")
    is_default: bool = False
    """
    It's the default patching window for new resource groups
    """

Python 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

HTTP + JSON

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}