using GitHub.Services.WebApi; using System; using System.Runtime.Serialization; namespace GitHub.DistributedTask.WebApi { /// /// A reference to an agent. /// [DataContract] public class TaskAgentReference : ICloneable { public TaskAgentReference() { } protected TaskAgentReference(TaskAgentReference referenceToBeCloned) { this.Id = referenceToBeCloned.Id; this.Name = referenceToBeCloned.Name; this.Version = referenceToBeCloned.Version; this.Enabled = referenceToBeCloned.Enabled; this.Status = referenceToBeCloned.Status; this.OSDescription = referenceToBeCloned.OSDescription; this.ProvisioningState = referenceToBeCloned.ProvisioningState; this.AccessPoint = referenceToBeCloned.AccessPoint; this.Ephemeral = referenceToBeCloned.Ephemeral; this.DisableUpdate = referenceToBeCloned.DisableUpdate; if (referenceToBeCloned.m_links != null) { m_links = referenceToBeCloned.m_links.Clone(); } } /// /// Identifier of the agent. /// [DataMember] public Int32 Id { get; set; } /// /// Name of the agent. /// [DataMember] public String Name { get; set; } /// /// Agent version. /// [DataMember] public String Version { get; set; } /// /// Agent OS. /// [DataMember(EmitDefaultValue = false)] public String OSDescription { get; set; } /// /// Whether or not this agent should run jobs. /// [DataMember(EmitDefaultValue = false)] public Boolean? Enabled { get; set; } /// /// Signifies that this Agent can only run one job and will be removed by the server after that one job finish. /// [DataMember] public bool? Ephemeral { get; set; } /// /// Whether or not this agent should auto-update to latest version. /// [DataMember(EmitDefaultValue = false)] public bool? DisableUpdate { get; set; } /// /// Whether or not the agent is online. /// [DataMember] public TaskAgentStatus Status { get; set; } /// /// Provisioning state of this agent. /// [DataMember] public String ProvisioningState { get; set; } /// /// This agent's access point. /// [DataMember(EmitDefaultValue = false)] public String AccessPoint { get; set; } /// /// Other details about the agent. /// public ReferenceLinks Links { get { if (m_links == null) { m_links = new ReferenceLinks(); } return m_links; } internal set { m_links = value; } } Object ICloneable.Clone() { return this.Clone(); } public TaskAgentReference Clone() { return new TaskAgentReference(this); } [DataMember(Name = "_links", EmitDefaultValue = false)] private ReferenceLinks m_links; } }