/*
* InfluxDB OSS API Service
*
* The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint.
*
* OpenAPI spec version: 2.0.0
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using OpenAPIDateConverter = InfluxDB.Client.Api.Client.OpenAPIDateConverter;
namespace InfluxDB.Client.Api.Domain
{
///
/// NotificationRuleBase
///
[DataContract]
public partial class NotificationRuleBase : IEquatable
{
///
/// Defines LastRunStatus
///
[JsonConverter(typeof(StringEnumConverter))]
public enum LastRunStatusEnum
{
///
/// Enum Failed for value: failed
///
[EnumMember(Value = "failed")] Failed = 1,
///
/// Enum Success for value: success
///
[EnumMember(Value = "success")] Success = 2,
///
/// Enum Canceled for value: canceled
///
[EnumMember(Value = "canceled")] Canceled = 3
}
///
/// Gets or Sets LastRunStatus
///
[DataMember(Name = "lastRunStatus", EmitDefaultValue = false)]
public LastRunStatusEnum? LastRunStatus { get; set; }
///
/// Gets or Sets Status
///
[DataMember(Name = "status", EmitDefaultValue = false)]
public TaskStatusType Status { get; set; }
///
/// Initializes a new instance of the class.
///
[JsonConstructorAttribute]
protected NotificationRuleBase()
{
}
///
/// Initializes a new instance of the class.
///
/// endpointID (required).
/// The ID of the organization that owns this notification rule. (required).
/// The ID of the task associated with this notification rule..
/// status (required).
/// Human-readable name describing the notification rule. (required).
/// sleepUntil.
/// The notification repetition interval..
/// Duration to delay after the schedule, before executing check..
/// runbookLink.
/// Don't notify me more than <limit> times every <limitEvery> seconds. If set, limit cannot be empty..
/// Don't notify me more than <limit> times every <limitEvery> seconds. If set, limitEvery cannot be empty..
/// List of tag rules the notification rule attempts to match..
/// An optional description of the notification rule..
/// List of status rules the notification rule attempts to match. (required).
/// labels.
/// links.
public NotificationRuleBase(string endpointID = default, string orgID = default, string taskID = default,
TaskStatusType status = default, string name = default, string sleepUntil = default, string every = default,
string offset = default, string runbookLink = default, int? limitEvery = default, int? limit = default,
List tagRules = default, string description = default, List statusRules = default,
List labels = default, NotificationRuleBaseLinks links = default)
{
// to ensure "endpointID" is required (not null)
if (endpointID == null)
{
throw new InvalidDataException(
"endpointID is a required property for NotificationRuleBase and cannot be null");
}
EndpointID = endpointID;
// to ensure "orgID" is required (not null)
if (orgID == null)
{
throw new InvalidDataException(
"orgID is a required property for NotificationRuleBase and cannot be null");
}
OrgID = orgID;
// to ensure "status" is required (not null)
Status = status;
// to ensure "name" is required (not null)
if (name == null)
{
throw new InvalidDataException(
"name is a required property for NotificationRuleBase and cannot be null");
}
Name = name;
// to ensure "statusRules" is required (not null)
if (statusRules == null)
{
throw new InvalidDataException(
"statusRules is a required property for NotificationRuleBase and cannot be null");
}
StatusRules = statusRules;
TaskID = taskID;
SleepUntil = sleepUntil;
Every = every;
Offset = offset;
RunbookLink = runbookLink;
LimitEvery = limitEvery;
Limit = limit;
TagRules = tagRules;
Description = description;
Labels = labels;
Links = links;
}
///
/// Timestamp (in RFC3339 date/time format](https://datatracker.ietf.org/doc/html/rfc3339)) of the latest scheduled and completed run.
///
/// Timestamp (in RFC3339 date/time format](https://datatracker.ietf.org/doc/html/rfc3339)) of the latest scheduled and completed run.
[DataMember(Name = "latestCompleted", EmitDefaultValue = false)]
public DateTime? LatestCompleted { get; private set; }
///
/// Gets or Sets LastRunError
///
[DataMember(Name = "lastRunError", EmitDefaultValue = false)]
public string LastRunError { get; private set; }
///
/// Gets or Sets Id
///
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; private set; }
///
/// Gets or Sets EndpointID
///
[DataMember(Name = "endpointID", EmitDefaultValue = false)]
public string EndpointID { get; set; }
///
/// The ID of the organization that owns this notification rule.
///
/// The ID of the organization that owns this notification rule.
[DataMember(Name = "orgID", EmitDefaultValue = false)]
public string OrgID { get; set; }
///
/// The ID of the task associated with this notification rule.
///
/// The ID of the task associated with this notification rule.
[DataMember(Name = "taskID", EmitDefaultValue = false)]
public string TaskID { get; set; }
///
/// The ID of creator used to create this notification rule.
///
/// The ID of creator used to create this notification rule.
[DataMember(Name = "ownerID", EmitDefaultValue = false)]
public string OwnerID { get; private set; }
///
/// Gets or Sets CreatedAt
///
[DataMember(Name = "createdAt", EmitDefaultValue = false)]
public DateTime? CreatedAt { get; private set; }
///
/// Gets or Sets UpdatedAt
///
[DataMember(Name = "updatedAt", EmitDefaultValue = false)]
public DateTime? UpdatedAt { get; private set; }
///
/// Human-readable name describing the notification rule.
///
/// Human-readable name describing the notification rule.
[DataMember(Name = "name", EmitDefaultValue = false)]
public string Name { get; set; }
///
/// Gets or Sets SleepUntil
///
[DataMember(Name = "sleepUntil", EmitDefaultValue = false)]
public string SleepUntil { get; set; }
///
/// The notification repetition interval.
///
/// The notification repetition interval.
[DataMember(Name = "every", EmitDefaultValue = false)]
public string Every { get; set; }
///
/// Duration to delay after the schedule, before executing check.
///
/// Duration to delay after the schedule, before executing check.
[DataMember(Name = "offset", EmitDefaultValue = false)]
public string Offset { get; set; }
///
/// Gets or Sets RunbookLink
///
[DataMember(Name = "runbookLink", EmitDefaultValue = false)]
public string RunbookLink { get; set; }
///
/// Don't notify me more than <limit> times every <limitEvery> seconds. If set, limit cannot be empty.
///
/// Don't notify me more than <limit> times every <limitEvery> seconds. If set, limit cannot be empty.
[DataMember(Name = "limitEvery", EmitDefaultValue = false)]
public int? LimitEvery { get; set; }
///
/// Don't notify me more than <limit> times every <limitEvery> seconds. If set, limitEvery cannot be empty.
///
/// Don't notify me more than <limit> times every <limitEvery> seconds. If set, limitEvery cannot be empty.
[DataMember(Name = "limit", EmitDefaultValue = false)]
public int? Limit { get; set; }
///
/// List of tag rules the notification rule attempts to match.
///
/// List of tag rules the notification rule attempts to match.
[DataMember(Name = "tagRules", EmitDefaultValue = false)]
public List TagRules { get; set; }
///
/// An optional description of the notification rule.
///
/// An optional description of the notification rule.
[DataMember(Name = "description", EmitDefaultValue = false)]
public string Description { get; set; }
///
/// List of status rules the notification rule attempts to match.
///
/// List of status rules the notification rule attempts to match.
[DataMember(Name = "statusRules", EmitDefaultValue = false)]
public List StatusRules { get; set; }
///
/// Gets or Sets Labels
///
[DataMember(Name = "labels", EmitDefaultValue = false)]
public List Labels { get; set; }
///
/// Gets or Sets Links
///
[DataMember(Name = "links", EmitDefaultValue = false)]
public NotificationRuleBaseLinks Links { get; set; }
///
/// Returns the string presentation of the object
///
/// String presentation of the object
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class NotificationRuleBase {\n");
sb.Append(" LatestCompleted: ").Append(LatestCompleted).Append("\n");
sb.Append(" LastRunStatus: ").Append(LastRunStatus).Append("\n");
sb.Append(" LastRunError: ").Append(LastRunError).Append("\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" EndpointID: ").Append(EndpointID).Append("\n");
sb.Append(" OrgID: ").Append(OrgID).Append("\n");
sb.Append(" TaskID: ").Append(TaskID).Append("\n");
sb.Append(" OwnerID: ").Append(OwnerID).Append("\n");
sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n");
sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n");
sb.Append(" Status: ").Append(Status).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" SleepUntil: ").Append(SleepUntil).Append("\n");
sb.Append(" Every: ").Append(Every).Append("\n");
sb.Append(" Offset: ").Append(Offset).Append("\n");
sb.Append(" RunbookLink: ").Append(RunbookLink).Append("\n");
sb.Append(" LimitEvery: ").Append(LimitEvery).Append("\n");
sb.Append(" Limit: ").Append(Limit).Append("\n");
sb.Append(" TagRules: ").Append(TagRules).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" StatusRules: ").Append(StatusRules).Append("\n");
sb.Append(" Labels: ").Append(Labels).Append("\n");
sb.Append(" Links: ").Append(Links).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
///
/// Returns the JSON string presentation of the object
///
/// JSON string presentation of the object
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
///
/// Returns true if objects are equal
///
/// Object to be compared
/// Boolean
public override bool Equals(object input)
{
return Equals(input as NotificationRuleBase);
}
///
/// Returns true if NotificationRuleBase instances are equal
///
/// Instance of NotificationRuleBase to be compared
/// Boolean
public bool Equals(NotificationRuleBase input)
{
if (input == null)
{
return false;
}
return
(
LatestCompleted == input.LatestCompleted ||
LatestCompleted != null && LatestCompleted.Equals(input.LatestCompleted)
) &&
(
LastRunStatus == input.LastRunStatus ||
LastRunStatus.Equals(input.LastRunStatus)
) &&
(
LastRunError == input.LastRunError ||
LastRunError != null && LastRunError.Equals(input.LastRunError)
) &&
(
Id == input.Id ||
Id != null && Id.Equals(input.Id)
) &&
(
EndpointID == input.EndpointID ||
EndpointID != null && EndpointID.Equals(input.EndpointID)
) &&
(
OrgID == input.OrgID ||
OrgID != null && OrgID.Equals(input.OrgID)
) &&
(
TaskID == input.TaskID ||
TaskID != null && TaskID.Equals(input.TaskID)
) &&
(
OwnerID == input.OwnerID ||
OwnerID != null && OwnerID.Equals(input.OwnerID)
) &&
(
CreatedAt == input.CreatedAt ||
CreatedAt != null && CreatedAt.Equals(input.CreatedAt)
) &&
(
UpdatedAt == input.UpdatedAt ||
UpdatedAt != null && UpdatedAt.Equals(input.UpdatedAt)
) &&
(
Status == input.Status ||
Status.Equals(input.Status)
) &&
(
Name == input.Name ||
Name != null && Name.Equals(input.Name)
) &&
(
SleepUntil == input.SleepUntil ||
SleepUntil != null && SleepUntil.Equals(input.SleepUntil)
) &&
(
Every == input.Every ||
Every != null && Every.Equals(input.Every)
) &&
(
Offset == input.Offset ||
Offset != null && Offset.Equals(input.Offset)
) &&
(
RunbookLink == input.RunbookLink ||
RunbookLink != null && RunbookLink.Equals(input.RunbookLink)
) &&
(
LimitEvery == input.LimitEvery ||
LimitEvery != null && LimitEvery.Equals(input.LimitEvery)
) &&
(
Limit == input.Limit ||
Limit != null && Limit.Equals(input.Limit)
) &&
(
TagRules == input.TagRules ||
TagRules != null &&
TagRules.SequenceEqual(input.TagRules)
) &&
(
Description == input.Description ||
Description != null && Description.Equals(input.Description)
) &&
(
StatusRules == input.StatusRules ||
StatusRules != null &&
StatusRules.SequenceEqual(input.StatusRules)
) &&
(
Labels == input.Labels ||
Labels != null &&
Labels.SequenceEqual(input.Labels)
) && Links != null && Links.Equals(input.Links);
}
///
/// Gets the hash code
///
/// Hash code
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
var hashCode = 41;
if (LatestCompleted != null)
{
hashCode = hashCode * 59 + LatestCompleted.GetHashCode();
}
hashCode = hashCode * 59 + LastRunStatus.GetHashCode();
if (LastRunError != null)
{
hashCode = hashCode * 59 + LastRunError.GetHashCode();
}
if (Id != null)
{
hashCode = hashCode * 59 + Id.GetHashCode();
}
if (EndpointID != null)
{
hashCode = hashCode * 59 + EndpointID.GetHashCode();
}
if (OrgID != null)
{
hashCode = hashCode * 59 + OrgID.GetHashCode();
}
if (TaskID != null)
{
hashCode = hashCode * 59 + TaskID.GetHashCode();
}
if (OwnerID != null)
{
hashCode = hashCode * 59 + OwnerID.GetHashCode();
}
if (CreatedAt != null)
{
hashCode = hashCode * 59 + CreatedAt.GetHashCode();
}
if (UpdatedAt != null)
{
hashCode = hashCode * 59 + UpdatedAt.GetHashCode();
}
hashCode = hashCode * 59 + Status.GetHashCode();
if (Name != null)
{
hashCode = hashCode * 59 + Name.GetHashCode();
}
if (SleepUntil != null)
{
hashCode = hashCode * 59 + SleepUntil.GetHashCode();
}
if (Every != null)
{
hashCode = hashCode * 59 + Every.GetHashCode();
}
if (Offset != null)
{
hashCode = hashCode * 59 + Offset.GetHashCode();
}
if (RunbookLink != null)
{
hashCode = hashCode * 59 + RunbookLink.GetHashCode();
}
if (LimitEvery != null)
{
hashCode = hashCode * 59 + LimitEvery.GetHashCode();
}
if (Limit != null)
{
hashCode = hashCode * 59 + Limit.GetHashCode();
}
if (TagRules != null)
{
hashCode = hashCode * 59 + TagRules.GetHashCode();
}
if (Description != null)
{
hashCode = hashCode * 59 + Description.GetHashCode();
}
if (StatusRules != null)
{
hashCode = hashCode * 59 + StatusRules.GetHashCode();
}
if (Labels != null)
{
hashCode = hashCode * 59 + Labels.GetHashCode();
}
if (Links != null)
{
hashCode = hashCode * 59 + Links.GetHashCode();
}
return hashCode;
}
}
}
}