| Required role: | TenantReader |
| POST | /api/resources/{Id}/enablealerting | Enables alerting in the external monitoring system | |
|---|---|---|---|
| POST | /resources/{Id}/enablealerting | Enables alerting in the external monitoring system |
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.Resources.Common.Operations;
using CoreService.ServiceModel.Dtos.Jobs.Responses;
using YCO.Dune.Models.Enums;
using CoreService.ServiceModel.Enums;
namespace CoreService.ServiceModel.Dtos.Jobs.Responses
{
public partial class JobDto
: IHasIdName, IHasTenantId, IAuditable, IHasObjectType
{
///<summary>
///The id of the job
///</summary>
public virtual Guid Id { get; set; }
///<summary>
///The id of the tenant
///</summary>
public virtual Guid TenantId { get; set; }
///<summary>
///The name of the job
///</summary>
public virtual string Name { get; set; }
public virtual ObjectTypes ObjectType { get; set; }
///<summary>
///An additional message
///</summary>
public virtual string? Message { get; set; }
///<summary>
///Api link pointing to this object
///</summary>
public virtual string SelfLink { get; set; }
///<summary>
///The id of the configitem the job belongs to
///</summary>
public virtual Guid? ConfigItemId { get; set; }
///<summary>
///The type of the configitem the job belongs to
///</summary>
public virtual ObjectTypes? ConfigItemType { get; set; }
///<summary>
///The job type
///</summary>
public virtual JobTypes JobType { get; set; }
///<summary>
///The current state of the job
///</summary>
public virtual JobStates State { get; set; }
///<summary>
///The timestamp, when the job got started
///</summary>
public virtual DateTime StartTime { get; set; }
///<summary>
///The timestamp, when the job has finished
///</summary>
public virtual DateTime? EndTime { get; set; }
///<summary>
///The duration (in seconds) of the job
///</summary>
public virtual int Duration { get; set; }
///<summary>
///The id of the related workflow
///</summary>
public virtual string? WorkflowId { get; set; }
///<summary>
///The id of the related scheduled task
///</summary>
public virtual string? SchedulerId { get; set; }
///<summary>
///The jobs progress in percent (0...100)
///</summary>
public virtual double Progress { get; set; }
///<summary>
///Contains various infos about the job
///</summary>
public virtual Dictionary<string, Object> Config { get; set; } = new();
///<summary>
///The time the job was created
///</summary>
public virtual DateTime Created { get; set; }
///<summary>
///The user the job was created with
///</summary>
public virtual string CreateUser { get; set; }
///<summary>
///The user id the job was created with
///</summary>
public virtual string CreateUserId { get; set; }
///<summary>
///The user email the job was created with
///</summary>
public virtual string CreateUserEmail { get; set; }
///<summary>
///The time the job was last modified
///</summary>
public virtual DateTime Modified { get; set; }
///<summary>
///The user the job was modified with
///</summary>
public virtual string ModifyUser { get; set; }
///<summary>
///The user id the job was modified with
///</summary>
public virtual string ModifyUserId { get; set; }
///<summary>
///True if the job is deleted
///</summary>
public virtual bool IsDeleted { get; set; }
///<summary>
///The time the job was deleted
///</summary>
public virtual DateTime? Deleted { get; set; }
///<summary>
///The user the job was deleted with
///</summary>
public virtual string? DeleteUser { get; set; }
///<summary>
///The user id the job was deleted with
///</summary>
public virtual string? DeleteUserId { get; set; }
///<summary>
///Will be evaluated by event endpoints
///</summary>
public virtual bool SendNotifications { get; set; }
///<summary>
///True if it is in any of the 'running' states
///</summary>
public virtual bool IsRunning { get; set; }
///<summary>
///Jobs with failed JobEvents are marked with NeedsAttention
///</summary>
public virtual bool NeedsAttention { get; set; }
}
}
namespace CoreService.ServiceModel.Dtos.Resources.Common.Operations
{
///<summary>
///Enables alerting in the external monitoring system
///</summary>
[Api(Description="Enables alerting in the external monitoring system")]
[ApiResponse(Description="Operation started", IsDefaultResponse=true, ResponseType=typeof(CoreService.ServiceModel.Dtos.Jobs.Responses.JobDto), StatusCode=202)]
public partial class EnableAlertingResource
: IActionRequest, IHasId, IHasTenantName, IPost
{
///<summary>
///The primary key of every config item
///</summary>
[ApiMember(DataType="string", Description="The primary key of every config item", Format="guid", IsRequired=true, ParameterType="path")]
public virtual Guid Id { get; set; }
[ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
[Validate("NotEmpty")]
public virtual string TenantName { get; set; }
///<summary>
///Inform users when the job has finished
///</summary>
[ApiMember(DataType="bool", Description="Inform users when the job has finished", ParameterType="body")]
public virtual bool? SendNotifications { get; set; }
}
}
namespace CoreService.ServiceModel.Enums
{
public enum JobStates
{
Pending,
Starting,
Running,
Suspended,
Stopping,
Completed,
Failed,
}
public enum JobTypes
{
Create,
Update,
Delete,
Start,
Stop,
Restart,
Backup,
Restore,
Patch,
Action,
}
}
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,
}
}
C# EnableAlertingResource 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/resources/{Id}/enablealerting 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","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}