| Required role: | TenantReader |
| POST | /api/deployments/{Id}/restartresources | Restart deployment resources as defined in sequence | |
|---|---|---|---|
| POST | /deployments/{Id}/restartresources | Restart deployment resources as defined in sequence |
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 ObjectTypes(str, Enum):
NONE = 'None'
CONFIG_ITEM = 'ConfigItem'
TENANT = 'Tenant'
COLLECTION = 'Collection'
RESOURCE = 'Resource'
COMPUTE_NODE = 'ComputeNode'
VIRTUAL_MACHINE = 'VirtualMachine'
PHYSICAL_MACHINE = 'PhysicalMachine'
DISK = 'Disk'
SUBNET = 'Subnet'
IP_ADDRESS = 'IPAddress'
JOB = 'Job'
JOB_EVENT = 'JobEvent'
FREEZE_PERIOD = 'FreezePeriod'
RESOURCE_GROUP = 'ResourceGroup'
DEPLOYMENT = 'Deployment'
RESOURCE_GROUP_TEMPLATE = 'ResourceGroupTemplate'
DEPLOYMENT_TEMPLATE = 'DeploymentTemplate'
RESOURCE_PROVIDER = 'ResourceProvider'
GENERIC_RESOURCE = 'GenericResource'
ROLE = 'Role'
PERMISSION = 'Permission'
USER = 'User'
PATCHING_WINDOW = 'PatchingWindow'
UPDATE = 'Update'
REPORT_DEFINITION = 'ReportDefinition'
TIME_SERIES = 'TimeSeries'
DATA_POINT = 'DataPoint'
ACTION = 'Action'
ACTION_ASSIGNMENT = 'ActionAssignment'
USER_NOTE = 'UserNote'
class JobTypes(str, Enum):
CREATE = 'Create'
UPDATE = 'Update'
DELETE = 'Delete'
START = 'Start'
STOP = 'Stop'
RESTART = 'Restart'
BACKUP = 'Backup'
RESTORE = 'Restore'
PATCH = 'Patch'
ACTION = 'Action'
class JobStates(str, Enum):
PENDING = 'Pending'
STARTING = 'Starting'
RUNNING = 'Running'
SUSPENDED = 'Suspended'
STOPPING = 'Stopping'
COMPLETED = 'Completed'
FAILED = 'Failed'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class JobDto(IHasIdName, IHasTenantId, IAuditable, IHasObjectType):
id: Optional[str] = None
"""
The id of the job
"""
tenant_id: Optional[str] = None
"""
The id of the tenant
"""
name: Optional[str] = None
"""
The name of the job
"""
object_type: Optional[ObjectTypes] = None
message: Optional[str] = None
"""
An additional message
"""
self_link: Optional[str] = None
"""
Api link pointing to this object
"""
config_item_id: Optional[str] = None
"""
The id of the configitem the job belongs to
"""
config_item_type: Optional[ObjectTypes] = None
"""
The type of the configitem the job belongs to
"""
job_type: Optional[JobTypes] = None
"""
The job type
"""
state: Optional[JobStates] = None
"""
The current state of the job
"""
start_time: datetime.datetime = datetime.datetime(1, 1, 1)
"""
The timestamp, when the job got started
"""
end_time: Optional[datetime.datetime] = None
"""
The timestamp, when the job has finished
"""
duration: int = 0
"""
The duration (in seconds) of the job
"""
workflow_id: Optional[str] = None
"""
The id of the related workflow
"""
scheduler_id: Optional[str] = None
"""
The id of the related scheduled task
"""
progress: float = 0.0
"""
The jobs progress in percent (0...100)
"""
config: Dict[str, Object] = field(default_factory=dict)
"""
Contains various infos about the job
"""
created: datetime.datetime = datetime.datetime(1, 1, 1)
"""
The time the job was created
"""
create_user: Optional[str] = None
"""
The user the job was created with
"""
create_user_id: Optional[str] = None
"""
The user id the job was created with
"""
create_user_email: Optional[str] = None
"""
The user email the job was created with
"""
modified: datetime.datetime = datetime.datetime(1, 1, 1)
"""
The time the job was last modified
"""
modify_user: Optional[str] = None
"""
The user the job was modified with
"""
modify_user_id: Optional[str] = None
"""
The user id the job was modified with
"""
is_deleted: bool = False
"""
True if the job is deleted
"""
deleted: Optional[datetime.datetime] = None
"""
The time the job was deleted
"""
delete_user: Optional[str] = None
"""
The user the job was deleted with
"""
delete_user_id: Optional[str] = None
"""
The user id the job was deleted with
"""
send_notifications: bool = False
"""
Will be evaluated by event endpoints
"""
is_running: bool = False
"""
True if it is in any of the 'running' states
"""
needs_attention: bool = False
"""
Jobs with failed JobEvents are marked with NeedsAttention
"""
# @Api(Description="Restart deployment resources as defined in sequence")
# @ApiResponse(Description="Operation started", IsDefaultResponse=true, ResponseType=typeof(JobDto), StatusCode=202)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RestartDeploymentResources(ISchedulableRequest, IHasId, IPost):
"""
Restart deployment resources as defined in sequence
"""
# @ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")
id: Optional[str] = None
# @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
# @Validate(Validator="NotEmpty")
tenant_name: Optional[str] = None
# @ApiMember(DataType="string", Description="The cron expression for scheduling the operation", Format="Cron", ParameterType="body")
cron_expression: Optional[str] = None
"""
The cron expression for scheduling the operation
"""
# @ApiMember(DataType="bool", Description="Inform users when the job has finished", ParameterType="body")
send_notifications: Optional[bool] = None
"""
Inform users when the job has finished
"""
Python RestartDeploymentResources 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/deployments/{Id}/restartresources HTTP/1.1
Host: core.starburst.svc
Accept: application/json
Content-Type: application/json
Content-Length: length
{"id":"00000000-0000-0000-0000-000000000000","tenantName":"String","cronExpression":"String","sendNotifications":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","tenantId":"00000000-0000-0000-0000-000000000000","name":"String","objectType":"Job","message":"String","selfLink":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","jobType":"Create","state":"Pending","startTime":"0001-01-01T00:00:00.0000000Z","endTime":"0001-01-01T00:00:00.0000000Z","duration":0,"workflowId":"String","schedulerId":"String","progress":0,"config":{"String":{}},"created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","createUserEmail":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","isDeleted":false,"deleted":"0001-01-01T00:00:00.0000000Z","deleteUser":"String","deleteUserId":"String","sendNotifications":false,"isRunning":false,"needsAttention":false}