| 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 |
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using CoreService.ServiceModel.Dtos.Notes.Crud;
using YCO.Dune.Models.Enums;
using CoreService.ServiceModel.Dtos.Notes.Responses;
namespace CoreService.ServiceModel.Dtos.Notes.Crud
{
///<summary>
///Creates a user note on a deployment or resource
///</summary>
[Api(Description="Creates a user note on a deployment or resource")]
[ApiResponse(Description="Created", ResponseType=typeof(CoreService.ServiceModel.Dtos.Notes.Responses.UserNoteDto), StatusCode=201)]
public partial class CreateUserNote
: IBaseRequest, IHasTenantName, IPost
{
[ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
[Validate("NotEmpty")]
public virtual string TenantName { get; set; }
///<summary>
///The id of the deployment or resource the note is attached to
///</summary>
[ApiMember(DataType="string", Description="The id of the deployment or resource the note is attached to", Format="guid", IsRequired=true, ParameterType="body")]
public virtual Guid ConfigItemId { get; set; }
///<summary>
///The type of the config item (Deployment or a Resource type)
///</summary>
[ApiMember(Description="The type of the config item (Deployment or a Resource type)", IsRequired=true, ParameterType="body")]
[Validate("NotNull")]
public virtual ObjectTypes ConfigItemType { get; set; }
///<summary>
///The note text (max 1000 chars)
///</summary>
[ApiMember(DataType="string", Description="The note text (max 1000 chars)", IsRequired=true, ParameterType="body")]
[Validate("NotEmpty")]
[Validate("MaximumLength(1000)")]
public virtual string Message { get; set; }
}
}
namespace CoreService.ServiceModel.Dtos.Notes.Responses
{
public partial class UserNoteDto
{
public virtual Guid Id { get; set; }
public virtual string Message { get; set; }
public virtual Guid ConfigItemId { get; set; }
public virtual ObjectTypes ConfigItemType { get; set; }
public virtual string ConfigItemName { get; set; }
public virtual Guid TenantId { get; set; }
public virtual DateTime Created { get; set; }
public virtual string CreateUser { get; set; }
public virtual string CreateUserId { get; set; }
public virtual DateTime Modified { get; set; }
public virtual string ModifyUser { get; set; }
public virtual string ModifyUserId { get; set; }
public virtual string SelfLink { get; set; }
public virtual ObjectTypes ObjectType { get; set; }
}
}
namespace YCO.Dune.Models.Enums
{
public enum ObjectTypes
{
None,
ConfigItem,
Tenant,
Collection,
Resource,
ComputeNode,
VirtualMachine,
PhysicalMachine,
Disk,
Subnet,
IPAddress,
Job,
JobEvent,
FreezePeriod,
ResourceGroup,
Deployment,
ResourceGroupTemplate,
DeploymentTemplate,
ResourceProvider,
GenericResource,
Role,
Permission,
User,
PatchingWindow,
Update,
ReportDefinition,
TimeSeries,
DataPoint,
Action,
ActionAssignment,
UserNote,
}
}
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"}