/*
* 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
{
///
/// TaskType
///
[DataContract]
public partial class TaskType : IEquatable
{
///
/// Gets or Sets Status
///
[DataMember(Name = "status", EmitDefaultValue = false)]
public TaskStatusType? Status { get; set; }
///
/// 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; }
///
/// Initializes a new instance of the class.
///
[JsonConstructorAttribute]
protected TaskType()
{
}
///
/// Initializes a new instance of the class.
///
/// Type of the task, useful for filtering a task list..
/// ID of the organization that owns the task. (required).
/// Name of the organization that owns the task..
/// Name of the task. (required).
/// ID of the user who owns this Task..
/// Description of the task..
/// status.
/// labels.
/// ID of the authorization used when the task communicates with the query engine..
/// Flux script to run for this task. (required).
/// Interval at which the task runs. `every` also determines when the task first runs, depending on the specified time. Value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals))..
/// [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. Cron scheduling is based on system time. Value is a [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview)..
/// [Duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. The value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals)..
/// links.
public TaskType(string type = default, string orgID = default, string org = default, string name = default,
string ownerID = default, string description = default, TaskStatusType? status = default,
List labels = default, string authorizationID = default, string flux = default,
string every = default, string cron = default, string offset = default, TaskLinks links = default)
{
// to ensure "orgID" is required (not null)
if (orgID == null)
{
throw new InvalidDataException("orgID is a required property for TaskType and cannot be null");
}
OrgID = orgID;
// to ensure "name" is required (not null)
if (name == null)
{
throw new InvalidDataException("name is a required property for TaskType and cannot be null");
}
Name = name;
// to ensure "flux" is required (not null)
if (flux == null)
{
throw new InvalidDataException("flux is a required property for TaskType and cannot be null");
}
Flux = flux;
Type = type;
Org = org;
OwnerID = ownerID;
Description = description;
Status = status;
Labels = labels;
AuthorizationID = authorizationID;
Every = every;
Cron = cron;
Offset = offset;
Links = links;
}
///
/// Gets or Sets Id
///
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; private set; }
///
/// Type of the task, useful for filtering a task list.
///
/// Type of the task, useful for filtering a task list.
[DataMember(Name = "type", EmitDefaultValue = false)]
public string Type { get; set; }
///
/// ID of the organization that owns the task.
///
/// ID of the organization that owns the task.
[DataMember(Name = "orgID", EmitDefaultValue = false)]
public string OrgID { get; set; }
///
/// Name of the organization that owns the task.
///
/// Name of the organization that owns the task.
[DataMember(Name = "org", EmitDefaultValue = false)]
public string Org { get; set; }
///
/// Name of the task.
///
/// Name of the task.
[DataMember(Name = "name", EmitDefaultValue = false)]
public string Name { get; set; }
///
/// ID of the user who owns this Task.
///
/// ID of the user who owns this Task.
[DataMember(Name = "ownerID", EmitDefaultValue = false)]
public string OwnerID { get; set; }
///
/// Description of the task.
///
/// Description of the task.
[DataMember(Name = "description", EmitDefaultValue = false)]
public string Description { get; set; }
///
/// Gets or Sets Labels
///
[DataMember(Name = "labels", EmitDefaultValue = false)]
public List Labels { get; set; }
///
/// ID of the authorization used when the task communicates with the query engine.
///
/// ID of the authorization used when the task communicates with the query engine.
[DataMember(Name = "authorizationID", EmitDefaultValue = false)]
public string AuthorizationID { get; set; }
///
/// Flux script to run for this task.
///
/// Flux script to run for this task.
[DataMember(Name = "flux", EmitDefaultValue = false)]
public string Flux { get; set; }
///
/// Interval at which the task runs. `every` also determines when the task first runs, depending on the specified time. Value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals)).
///
/// Interval at which the task runs. `every` also determines when the task first runs, depending on the specified time. Value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals)).
[DataMember(Name = "every", EmitDefaultValue = false)]
public string Every { get; set; }
///
/// [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. Cron scheduling is based on system time. Value is a [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview).
///
/// [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. Cron scheduling is based on system time. Value is a [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview).
[DataMember(Name = "cron", EmitDefaultValue = false)]
public string Cron { get; set; }
///
/// [Duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. The value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals).
///
/// [Duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. The value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals).
[DataMember(Name = "offset", EmitDefaultValue = false)]
public string Offset { get; set; }
///
/// Timestamp of the latest scheduled and completed run. Value is a timestamp in [RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax).
///
/// Timestamp of the latest scheduled and completed run. Value is a timestamp in [RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax).
[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 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; }
///
/// Gets or Sets Links
///
[DataMember(Name = "links", EmitDefaultValue = false)]
public TaskLinks 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 TaskType {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" OrgID: ").Append(OrgID).Append("\n");
sb.Append(" Org: ").Append(Org).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" OwnerID: ").Append(OwnerID).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" Status: ").Append(Status).Append("\n");
sb.Append(" Labels: ").Append(Labels).Append("\n");
sb.Append(" AuthorizationID: ").Append(AuthorizationID).Append("\n");
sb.Append(" Flux: ").Append(Flux).Append("\n");
sb.Append(" Every: ").Append(Every).Append("\n");
sb.Append(" Cron: ").Append(Cron).Append("\n");
sb.Append(" Offset: ").Append(Offset).Append("\n");
sb.Append(" LatestCompleted: ").Append(LatestCompleted).Append("\n");
sb.Append(" LastRunStatus: ").Append(LastRunStatus).Append("\n");
sb.Append(" LastRunError: ").Append(LastRunError).Append("\n");
sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n");
sb.Append(" UpdatedAt: ").Append(UpdatedAt).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 TaskType);
}
///
/// Returns true if TaskType instances are equal
///
/// Instance of TaskType to be compared
/// Boolean
public bool Equals(TaskType input)
{
if (input == null)
{
return false;
}
return
(
Id == input.Id ||
Id != null && Id.Equals(input.Id)
) &&
(
Type == input.Type ||
Type != null && Type.Equals(input.Type)
) &&
(
OrgID == input.OrgID ||
OrgID != null && OrgID.Equals(input.OrgID)
) &&
(
Org == input.Org ||
Org != null && Org.Equals(input.Org)
) &&
(
Name == input.Name ||
Name != null && Name.Equals(input.Name)
) &&
(
OwnerID == input.OwnerID ||
OwnerID != null && OwnerID.Equals(input.OwnerID)
) &&
(
Description == input.Description ||
Description != null && Description.Equals(input.Description)
) &&
(
Status == input.Status ||
Status.Equals(input.Status)
) &&
(
Labels == input.Labels ||
Labels != null &&
Labels.SequenceEqual(input.Labels)
) &&
(
AuthorizationID == input.AuthorizationID ||
AuthorizationID != null && AuthorizationID.Equals(input.AuthorizationID)
) &&
(
Flux == input.Flux ||
Flux != null && Flux.Equals(input.Flux)
) &&
(
Every == input.Every ||
Every != null && Every.Equals(input.Every)
) &&
(
Cron == input.Cron ||
Cron != null && Cron.Equals(input.Cron)
) &&
(
Offset == input.Offset ||
Offset != null && Offset.Equals(input.Offset)
) &&
(
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)
) &&
(
CreatedAt == input.CreatedAt ||
CreatedAt != null && CreatedAt.Equals(input.CreatedAt)
) &&
(
UpdatedAt == input.UpdatedAt ||
UpdatedAt != null && UpdatedAt.Equals(input.UpdatedAt)
) && 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 (Id != null)
{
hashCode = hashCode * 59 + Id.GetHashCode();
}
if (Type != null)
{
hashCode = hashCode * 59 + Type.GetHashCode();
}
if (OrgID != null)
{
hashCode = hashCode * 59 + OrgID.GetHashCode();
}
if (Org != null)
{
hashCode = hashCode * 59 + Org.GetHashCode();
}
if (Name != null)
{
hashCode = hashCode * 59 + Name.GetHashCode();
}
if (OwnerID != null)
{
hashCode = hashCode * 59 + OwnerID.GetHashCode();
}
if (Description != null)
{
hashCode = hashCode * 59 + Description.GetHashCode();
}
hashCode = hashCode * 59 + Status.GetHashCode();
if (Labels != null)
{
hashCode = hashCode * 59 + Labels.GetHashCode();
}
if (AuthorizationID != null)
{
hashCode = hashCode * 59 + AuthorizationID.GetHashCode();
}
if (Flux != null)
{
hashCode = hashCode * 59 + Flux.GetHashCode();
}
if (Every != null)
{
hashCode = hashCode * 59 + Every.GetHashCode();
}
if (Cron != null)
{
hashCode = hashCode * 59 + Cron.GetHashCode();
}
if (Offset != null)
{
hashCode = hashCode * 59 + Offset.GetHashCode();
}
if (LatestCompleted != null)
{
hashCode = hashCode * 59 + LatestCompleted.GetHashCode();
}
hashCode = hashCode * 59 + LastRunStatus.GetHashCode();
if (LastRunError != null)
{
hashCode = hashCode * 59 + LastRunError.GetHashCode();
}
if (CreatedAt != null)
{
hashCode = hashCode * 59 + CreatedAt.GetHashCode();
}
if (UpdatedAt != null)
{
hashCode = hashCode * 59 + UpdatedAt.GetHashCode();
}
if (Links != null)
{
hashCode = hashCode * 59 + Links.GetHashCode();
}
return hashCode;
}
}
}
}