public static UniversalId NewInstance() { var id = new UniversalId(); id.Init(); return(id); }
/// <summary> /// Returns true if Person instances are equal /// </summary> /// <param name="other">Instance of Person to be compared</param> /// <returns>Boolean</returns> public bool Equals(Person other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( UniversalId == other.UniversalId || UniversalId != null && UniversalId.Equals(other.UniversalId) ) && ( FirstName == other.FirstName || FirstName != null && FirstName.Equals(other.FirstName) ) && ( Surname == other.Surname || Surname != null && Surname.Equals(other.Surname) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( TelephoneNumber == other.TelephoneNumber || TelephoneNumber != null && TelephoneNumber.Equals(other.TelephoneNumber) ) && ( Links == other.Links || Links != null && other.Links != null && Links.SequenceEqual(other.Links) )); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (UniversalId != null) { hashCode = hashCode * 59 + UniversalId.GetHashCode(); } if (FirstName != null) { hashCode = hashCode * 59 + FirstName.GetHashCode(); } if (Surname != null) { hashCode = hashCode * 59 + Surname.GetHashCode(); } if (Email != null) { hashCode = hashCode * 59 + Email.GetHashCode(); } if (TelephoneNumber != null) { hashCode = hashCode * 59 + TelephoneNumber.GetHashCode(); } if (Links != null) { hashCode = hashCode * 59 + Links.GetHashCode(); } return(hashCode); } }
/// <summary> /// Process Record /// </summary> protected override void ProcessRecord() { Model.ProtectionJob currentProtectionjob = null; if (!string.IsNullOrWhiteSpace(Name)) { var job = RestApiCommon.GetProtectionJobByName(Session.ApiClient, Name); Id = (long)job.Id; currentProtectionjob = job; } if (JobRunId == null) { var job = RestApiCommon.GetProtectionJobById(Session.ApiClient, Id); JobRunId = (long)job.LastRun.BackupRun.JobRunId; currentProtectionjob = job; } UniversalId copyTaskUid = null; CopyRun copyRun = null; if (StopArchivalJob) { copyRun = currentProtectionjob.LastRun.CopyRun.Find(x => x.Target.Type == SnapshotTargetSettings.TypeEnum.KArchival); if (null == copyRun) { WriteObject("Could not find the archival task."); return; } } if (StopCloudSpinJob) { copyRun = currentProtectionjob.LastRun.CopyRun.Find(x => x.Target.Type == SnapshotTargetSettings.TypeEnum.KCloudDeploy); if (null == copyRun) { WriteObject("Could not find the cloud deploy task."); return; } } if (StopReplicationJob) { copyRun = currentProtectionjob.LastRun.CopyRun.Find(x => x.Target.Type == SnapshotTargetSettings.TypeEnum.KRemote); if (null == copyRun) { WriteObject("Could not find the replication task."); return; } } object body; if (null != copyRun) { copyTaskUid = copyRun.TaskUid; // When the non-local job is being stopped body = new CancelProtectionJobRunParam { // The copy task uid and job id would be used for Archival, Cloud spin and Remote targets CopyTaskUid = copyTaskUid, }; } else { // When the local job is being stopped body = new CancelProtectionJobRunParam { JobRunId = this.JobRunId }; } var url = $"/public/protectionRuns/cancel/{Id.ToString()}"; Session.ApiClient.Post(url, body); WriteObject("Protection Job Run cancelled."); }