/*
* 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
{
///
/// BucketShardMapping
///
[DataContract]
public partial class BucketShardMapping : IEquatable
{
///
/// Initializes a new instance of the class.
///
[JsonConstructorAttribute]
protected BucketShardMapping()
{
}
///
/// Initializes a new instance of the class.
///
/// oldId (required).
/// newId (required).
public BucketShardMapping(long? oldId = default, long? newId = default)
{
// to ensure "oldId" is required (not null)
if (oldId == null)
{
throw new InvalidDataException(
"oldId is a required property for BucketShardMapping and cannot be null");
}
OldId = oldId;
// to ensure "newId" is required (not null)
if (newId == null)
{
throw new InvalidDataException(
"newId is a required property for BucketShardMapping and cannot be null");
}
NewId = newId;
}
///
/// Gets or Sets OldId
///
[DataMember(Name = "oldId", EmitDefaultValue = false)]
public long? OldId { get; set; }
///
/// Gets or Sets NewId
///
[DataMember(Name = "newId", EmitDefaultValue = false)]
public long? NewId { 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 BucketShardMapping {\n");
sb.Append(" OldId: ").Append(OldId).Append("\n");
sb.Append(" NewId: ").Append(NewId).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 BucketShardMapping);
}
///
/// Returns true if BucketShardMapping instances are equal
///
/// Instance of BucketShardMapping to be compared
/// Boolean
public bool Equals(BucketShardMapping input)
{
if (input == null)
{
return false;
}
return
(
OldId == input.OldId ||
OldId != null && OldId.Equals(input.OldId)
) &&
(
NewId == input.NewId ||
NewId != null && NewId.Equals(input.NewId)
);
}
///
/// Gets the hash code
///
/// Hash code
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
var hashCode = 41;
if (OldId != null)
{
hashCode = hashCode * 59 + OldId.GetHashCode();
}
if (NewId != null)
{
hashCode = hashCode * 59 + NewId.GetHashCode();
}
return hashCode;
}
}
}
}