CoreService

<back to all web services

GetJobEvent

JobEvent - CRUD

Get jobevent

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
GET/api/jobevents/{Id}Returns the jobevent
GET/jobevents/{Id}Returns the jobevent
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


enum ObjectTypes : string
{
    case None = 'None';
    case ConfigItem = 'ConfigItem';
    case Tenant = 'Tenant';
    case Collection = 'Collection';
    case Resource = 'Resource';
    case ComputeNode = 'ComputeNode';
    case VirtualMachine = 'VirtualMachine';
    case PhysicalMachine = 'PhysicalMachine';
    case Disk = 'Disk';
    case Subnet = 'Subnet';
    case IPAddress = 'IPAddress';
    case Job = 'Job';
    case JobEvent = 'JobEvent';
    case FreezePeriod = 'FreezePeriod';
    case ResourceGroup = 'ResourceGroup';
    case Deployment = 'Deployment';
    case ResourceGroupTemplate = 'ResourceGroupTemplate';
    case DeploymentTemplate = 'DeploymentTemplate';
    case ResourceProvider = 'ResourceProvider';
    case GenericResource = 'GenericResource';
    case Role = 'Role';
    case Permission = 'Permission';
    case User = 'User';
    case PatchingWindow = 'PatchingWindow';
    case Update = 'Update';
    case ReportDefinition = 'ReportDefinition';
    case TimeSeries = 'TimeSeries';
    case DataPoint = 'DataPoint';
    case Action = 'Action';
    case ActionAssignment = 'ActionAssignment';
    case UserNote = 'UserNote';
}

enum JobEventStates : string
{
    case Started = 'Started';
    case Skipped = 'Skipped';
    case Completed = 'Completed';
    case Failed = 'Failed';
}

class JobEventDto implements IHasIdName, IHasTenantId, IHasObjectType, JsonSerializable
{
    public function __construct(
        /** @description The id of the job */
        /** @var string */
        public string $id='',
        /** @description The id of the the tenant */
        /** @var string */
        public string $tenantId='',
        /** @description The id of the parent job */
        /** @var string */
        public string $jobId='',
        /** @description The name of the event. Events will be grouped on the name */
        /** @var string */
        public string $name='',
        /** @var ObjectTypes|null */
        public ?ObjectTypes $objectType=null,
        /** @description The current state of the event */
        /** @var JobEventStates|null */
        public ?JobEventStates $state=null,
        /** @description Start time of the event */
        /** @var DateTime */
        public DateTime $startTime=new DateTime(),
        /** @description End time of the event (optional) */
        /** @var DateTime|null */
        public ?DateTime $endTime=null,
        /** @description A message with details to the current state */
        /** @var string */
        public string $message='',
        /** @description Api link pointing to this object */
        /** @var string */
        public string $selfLink='',
        /** @description The duration (in seconds) of the job event */
        /** @var int */
        public int $duration=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['tenantId'])) $this->tenantId = $o['tenantId'];
        if (isset($o['jobId'])) $this->jobId = $o['jobId'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['objectType'])) $this->objectType = JsonConverters::from('ObjectTypes', $o['objectType']);
        if (isset($o['state'])) $this->state = JsonConverters::from('JobEventStates', $o['state']);
        if (isset($o['startTime'])) $this->startTime = JsonConverters::from('DateTime', $o['startTime']);
        if (isset($o['endTime'])) $this->endTime = JsonConverters::from('DateTime', $o['endTime']);
        if (isset($o['message'])) $this->message = $o['message'];
        if (isset($o['selfLink'])) $this->selfLink = $o['selfLink'];
        if (isset($o['duration'])) $this->duration = $o['duration'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->tenantId)) $o['tenantId'] = $this->tenantId;
        if (isset($this->jobId)) $o['jobId'] = $this->jobId;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->objectType)) $o['objectType'] = JsonConverters::to('ObjectTypes', $this->objectType);
        if (isset($this->state)) $o['state'] = JsonConverters::to('JobEventStates', $this->state);
        if (isset($this->startTime)) $o['startTime'] = JsonConverters::to('DateTime', $this->startTime);
        if (isset($this->endTime)) $o['endTime'] = JsonConverters::to('DateTime', $this->endTime);
        if (isset($this->message)) $o['message'] = $this->message;
        if (isset($this->selfLink)) $o['selfLink'] = $this->selfLink;
        if (isset($this->duration)) $o['duration'] = $this->duration;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Get jobevent */
// @Api(Description="Get jobevent")
// @ApiResponse(Description="The request endend successful", IsDefaultResponse=true, ResponseType="typeof(CoreService.ServiceModel.Dtos.JobEvents.Responses.JobEventDto)", StatusCode=200)
class GetJobEvent implements IGetSingleRequest, IHasTenantName, IGet, JsonSerializable
{
    public function __construct(
        // @ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $id='',

        // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $tenantName='',

        /** @description If true, also soft deleted items will be returned */
        // @ApiMember(Description="If true, also soft deleted items will be returned", ParameterType="query")
        /** @var bool|null */
        public ?bool $includeDeleted=null,

        /** @description Returns all referenced object */
        // @ApiMember(Description="Returns all referenced object", ParameterType="query")
        /** @var bool|null */
        public ?bool $includeReferencedObjects=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['tenantName'])) $this->tenantName = $o['tenantName'];
        if (isset($o['includeDeleted'])) $this->includeDeleted = $o['includeDeleted'];
        if (isset($o['includeReferencedObjects'])) $this->includeReferencedObjects = $o['includeReferencedObjects'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->tenantName)) $o['tenantName'] = $this->tenantName;
        if (isset($this->includeDeleted)) $o['includeDeleted'] = $this->includeDeleted;
        if (isset($this->includeReferencedObjects)) $o['includeReferencedObjects'] = $this->includeReferencedObjects;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetJobEvent 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.

GET /api/jobevents/{Id} HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"id":"00000000-0000-0000-0000-000000000000","tenantId":"00000000-0000-0000-0000-000000000000","jobId":"00000000-0000-0000-0000-000000000000","name":"String","objectType":"JobEvent","state":"Started","startTime":"0001-01-01T00:00:00.0000000Z","endTime":"0001-01-01T00:00:00.0000000Z","message":"String","selfLink":"String","duration":0}