CoreService

<back to all web services

GetUpdate

Patching - CRUD

Returns a single update by its id

Requires Authentication
Requires the role:TenantReader
The following routes are available for this service:
GET/api/patching/updates/{Id}Returns a single update by its id
GET/patching/updates/{Id}Returns a single update by its id
<?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};


class UpdateDto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $id='',
        /** @var string */
        public string $name='',
        /** @description The severity of the vulnerability this update fixes (e.g. Critical, Important, Moderate, etc.) */
        /** @var string|null */
        public ?string $severity=null,
        /** @description The time the update was first published */
        /** @var DateTime */
        public DateTime $published=new DateTime(),
        /** @description Update classification/type (e.g. Critical Update, Definition Update, Security Update, etc.) */
        /** @var array<string>|null */
        public ?array $classifications=null,
        /** @description Whether the update needs a reboot or not */
        /** @var bool|null */
        public ?bool $isRebootRequired=null,
        /** @description In case of windows this is the KB id */
        /** @var string|null */
        public ?string $extId=null,
        /** @description In case of linux this is the update package version */
        /** @var string|null */
        public ?string $version=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['severity'])) $this->severity = $o['severity'];
        if (isset($o['published'])) $this->published = JsonConverters::from('DateTime', $o['published']);
        if (isset($o['classifications'])) $this->classifications = JsonConverters::fromArray('string', $o['classifications']);
        if (isset($o['isRebootRequired'])) $this->isRebootRequired = $o['isRebootRequired'];
        if (isset($o['extId'])) $this->extId = $o['extId'];
        if (isset($o['version'])) $this->version = $o['version'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->severity)) $o['severity'] = $this->severity;
        if (isset($this->published)) $o['published'] = JsonConverters::to('DateTime', $this->published);
        if (isset($this->classifications)) $o['classifications'] = JsonConverters::toArray('string', $this->classifications);
        if (isset($this->isRebootRequired)) $o['isRebootRequired'] = $this->isRebootRequired;
        if (isset($this->extId)) $o['extId'] = $this->extId;
        if (isset($this->version)) $o['version'] = $this->version;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Returns a single update by its id */
// @Api(Description="Returns a single update by its id")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType="typeof(CoreService.ServiceModel.Dtos.Patching.Responses.UpdateDto)", StatusCode=200)
class GetUpdate implements IBaseRequest, IHasId, IHasTenantName, IGet, JsonSerializable
{
    public function __construct(
        /** @description The primary key of every config item */
        // @ApiMember(DataType="string", Description="The primary key of every config item", Format="guid", IsRequired=true, ParameterType="path")
        /** @var string */
        public string $id='',

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

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

PHP GetUpdate 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/patching/updates/{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","name":"String","severity":"String","published":"0001-01-01T00:00:00.0000000Z","classifications":["String"],"isRebootRequired":false,"extId":"String","version":"String"}