| Required role: | TenantReader |
| POST | /api/usernotes | Creates a user note on a deployment or resource | |
|---|---|---|---|
| POST | /usernotes | Creates a user note on a deployment or resource |
<?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';
}
class UserNoteDto implements JsonSerializable
{
public function __construct(
/** @var string */
public string $id='',
/** @var string */
public string $message='',
/** @var string */
public string $configItemId='',
/** @var ObjectTypes|null */
public ?ObjectTypes $configItemType=null,
/** @var string */
public string $configItemName='',
/** @var string */
public string $tenantId='',
/** @var DateTime */
public DateTime $created=new DateTime(),
/** @var string */
public string $createUser='',
/** @var string */
public string $createUserId='',
/** @var DateTime */
public DateTime $modified=new DateTime(),
/** @var string */
public string $modifyUser='',
/** @var string */
public string $modifyUserId='',
/** @var string */
public string $selfLink='',
/** @var ObjectTypes|null */
public ?ObjectTypes $objectType=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['message'])) $this->message = $o['message'];
if (isset($o['configItemId'])) $this->configItemId = $o['configItemId'];
if (isset($o['configItemType'])) $this->configItemType = JsonConverters::from('ObjectTypes', $o['configItemType']);
if (isset($o['configItemName'])) $this->configItemName = $o['configItemName'];
if (isset($o['tenantId'])) $this->tenantId = $o['tenantId'];
if (isset($o['created'])) $this->created = JsonConverters::from('DateTime', $o['created']);
if (isset($o['createUser'])) $this->createUser = $o['createUser'];
if (isset($o['createUserId'])) $this->createUserId = $o['createUserId'];
if (isset($o['modified'])) $this->modified = JsonConverters::from('DateTime', $o['modified']);
if (isset($o['modifyUser'])) $this->modifyUser = $o['modifyUser'];
if (isset($o['modifyUserId'])) $this->modifyUserId = $o['modifyUserId'];
if (isset($o['selfLink'])) $this->selfLink = $o['selfLink'];
if (isset($o['objectType'])) $this->objectType = JsonConverters::from('ObjectTypes', $o['objectType']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->message)) $o['message'] = $this->message;
if (isset($this->configItemId)) $o['configItemId'] = $this->configItemId;
if (isset($this->configItemType)) $o['configItemType'] = JsonConverters::to('ObjectTypes', $this->configItemType);
if (isset($this->configItemName)) $o['configItemName'] = $this->configItemName;
if (isset($this->tenantId)) $o['tenantId'] = $this->tenantId;
if (isset($this->created)) $o['created'] = JsonConverters::to('DateTime', $this->created);
if (isset($this->createUser)) $o['createUser'] = $this->createUser;
if (isset($this->createUserId)) $o['createUserId'] = $this->createUserId;
if (isset($this->modified)) $o['modified'] = JsonConverters::to('DateTime', $this->modified);
if (isset($this->modifyUser)) $o['modifyUser'] = $this->modifyUser;
if (isset($this->modifyUserId)) $o['modifyUserId'] = $this->modifyUserId;
if (isset($this->selfLink)) $o['selfLink'] = $this->selfLink;
if (isset($this->objectType)) $o['objectType'] = JsonConverters::to('ObjectTypes', $this->objectType);
return empty($o) ? new class(){} : $o;
}
}
/** @description Creates a user note on a deployment or resource */
// @Api(Description="Creates a user note on a deployment or resource")
// @ApiResponse(Description="Created", ResponseType="typeof(CoreService.ServiceModel.Dtos.Notes.Responses.UserNoteDto)", StatusCode=201)
class CreateUserNote implements IBaseRequest, IHasTenantName, IPost, JsonSerializable
{
public function __construct(
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
/** @var string */
public string $tenantName='',
/** @description The id of the deployment or resource the note is attached to */
// @ApiMember(DataType="string", Description="The id of the deployment or resource the note is attached to", Format="guid", IsRequired=true, ParameterType="body")
/** @var string */
public string $configItemId='',
/** @description The type of the config item (Deployment or a Resource type) */
// @ApiMember(Description="The type of the config item (Deployment or a Resource type)", IsRequired=true, ParameterType="body")
// @Validate(Validator="NotNull")
/** @var ObjectTypes|null */
public ?ObjectTypes $configItemType=null,
/** @description The note text (max 1000 chars) */
// @ApiMember(DataType="string", Description="The note text (max 1000 chars)", IsRequired=true, ParameterType="body")
// @Validate(Validator="NotEmpty")
// @Validate(Validator="MaximumLength(1000)")
/** @var string */
public string $message=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['tenantName'])) $this->tenantName = $o['tenantName'];
if (isset($o['configItemId'])) $this->configItemId = $o['configItemId'];
if (isset($o['configItemType'])) $this->configItemType = JsonConverters::from('ObjectTypes', $o['configItemType']);
if (isset($o['message'])) $this->message = $o['message'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->tenantName)) $o['tenantName'] = $this->tenantName;
if (isset($this->configItemId)) $o['configItemId'] = $this->configItemId;
if (isset($this->configItemType)) $o['configItemType'] = JsonConverters::to('ObjectTypes', $this->configItemType);
if (isset($this->message)) $o['message'] = $this->message;
return empty($o) ? new class(){} : $o;
}
}
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/usernotes HTTP/1.1
Host: core.starburst.svc
Accept: application/json
Content-Type: application/json
Content-Length: length
{"tenantName":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","message":"String","txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"id":"00000000-0000-0000-0000-000000000000","message":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","configItemName":"String","tenantId":"00000000-0000-0000-0000-000000000000","created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","selfLink":"/usernotes/00000000-0000-0000-0000-000000000000","objectType":"UserNote"}