/*
* 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
{
///
/// DBRP
///
[DataContract]
public partial class DBRP : IEquatable
{
///
/// Initializes a new instance of the class.
///
[JsonConstructorAttribute]
protected DBRP()
{
}
///
/// Initializes a new instance of the class.
///
/// ID of the organization that owns this mapping. (required).
/// ID of the bucket used as the target for the translation. (required).
/// InfluxDB v1 database (required).
/// InfluxDB v1 retention policy (required).
/// Mapping represents the default retention policy for the database specified. (required).
/// links.
public DBRP(string orgID = default, string bucketID = default, string database = default,
string retentionPolicy = default, bool? _default = default, Links links = default)
{
// to ensure "orgID" is required (not null)
if (orgID == null)
{
throw new InvalidDataException("orgID is a required property for DBRP and cannot be null");
}
OrgID = orgID;
// to ensure "bucketID" is required (not null)
if (bucketID == null)
{
throw new InvalidDataException("bucketID is a required property for DBRP and cannot be null");
}
BucketID = bucketID;
// to ensure "database" is required (not null)
if (database == null)
{
throw new InvalidDataException("database is a required property for DBRP and cannot be null");
}
Database = database;
// to ensure "retentionPolicy" is required (not null)
if (retentionPolicy == null)
{
throw new InvalidDataException("retentionPolicy is a required property for DBRP and cannot be null");
}
RetentionPolicy = retentionPolicy;
// to ensure "_default" is required (not null)
if (_default == null)
{
throw new InvalidDataException("_default is a required property for DBRP and cannot be null");
}
Default = _default;
Links = links;
}
///
/// ID of the DBRP mapping.
///
/// ID of the DBRP mapping.
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; private set; }
///
/// ID of the organization that owns this mapping.
///
/// ID of the organization that owns this mapping.
[DataMember(Name = "orgID", EmitDefaultValue = false)]
public string OrgID { get; set; }
///
/// ID of the bucket used as the target for the translation.
///
/// ID of the bucket used as the target for the translation.
[DataMember(Name = "bucketID", EmitDefaultValue = false)]
public string BucketID { get; set; }
///
/// InfluxDB v1 database
///
/// InfluxDB v1 database
[DataMember(Name = "database", EmitDefaultValue = false)]
public string Database { get; set; }
///
/// InfluxDB v1 retention policy
///
/// InfluxDB v1 retention policy
[DataMember(Name = "retention_policy", EmitDefaultValue = false)]
public string RetentionPolicy { get; set; }
///
/// Mapping represents the default retention policy for the database specified.
///
/// Mapping represents the default retention policy for the database specified.
[DataMember(Name = "default", EmitDefaultValue = false)]
public bool? Default { get; set; }
///
/// Gets or Sets Links
///
[DataMember(Name = "links", EmitDefaultValue = false)]
public Links 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 DBRP {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" OrgID: ").Append(OrgID).Append("\n");
sb.Append(" BucketID: ").Append(BucketID).Append("\n");
sb.Append(" Database: ").Append(Database).Append("\n");
sb.Append(" RetentionPolicy: ").Append(RetentionPolicy).Append("\n");
sb.Append(" Default: ").Append(Default).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 DBRP);
}
///
/// Returns true if DBRP instances are equal
///
/// Instance of DBRP to be compared
/// Boolean
public bool Equals(DBRP input)
{
if (input == null)
{
return false;
}
return
(
Id == input.Id ||
Id != null && Id.Equals(input.Id)
) &&
(
OrgID == input.OrgID ||
OrgID != null && OrgID.Equals(input.OrgID)
) &&
(
BucketID == input.BucketID ||
BucketID != null && BucketID.Equals(input.BucketID)
) &&
(
Database == input.Database ||
Database != null && Database.Equals(input.Database)
) &&
(
RetentionPolicy == input.RetentionPolicy ||
RetentionPolicy != null && RetentionPolicy.Equals(input.RetentionPolicy)
) &&
(
Default == input.Default ||
Default != null && Default.Equals(input.Default)
) && 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 (OrgID != null)
{
hashCode = hashCode * 59 + OrgID.GetHashCode();
}
if (BucketID != null)
{
hashCode = hashCode * 59 + BucketID.GetHashCode();
}
if (Database != null)
{
hashCode = hashCode * 59 + Database.GetHashCode();
}
if (RetentionPolicy != null)
{
hashCode = hashCode * 59 + RetentionPolicy.GetHashCode();
}
if (Default != null)
{
hashCode = hashCode * 59 + Default.GetHashCode();
}
if (Links != null)
{
hashCode = hashCode * 59 + Links.GetHashCode();
}
return hashCode;
}
}
}
}