mirror of
https://github.com/actions/runner.git
synced 2025-12-14 13:43:33 +00:00
delete un-used code. (#218)
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.WebApi;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
|
||||
public sealed class AgentJobRequestMessage : JobRequestMessage
|
||||
{
|
||||
[JsonConstructor]
|
||||
internal AgentJobRequestMessage() : base(JobRequestMessageTypes.AgentJobRequest)
|
||||
{
|
||||
}
|
||||
|
||||
public AgentJobRequestMessage(
|
||||
TaskOrchestrationPlanReference plan,
|
||||
TimelineReference timeline,
|
||||
Guid jobId,
|
||||
String jobName,
|
||||
String jobRefName,
|
||||
JobEnvironment environment,
|
||||
IEnumerable<TaskInstance> tasks)
|
||||
: base(JobRequestMessageTypes.AgentJobRequest, plan, timeline, jobId, jobName, jobRefName, environment)
|
||||
{
|
||||
m_tasks = new List<TaskInstance>(tasks);
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Int64 RequestId
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Guid LockToken
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public DateTime LockedUntil
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public ReadOnlyCollection<TaskInstance> Tasks
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_tasks == null)
|
||||
{
|
||||
m_tasks = new List<TaskInstance>();
|
||||
}
|
||||
return m_tasks.AsReadOnly();
|
||||
}
|
||||
}
|
||||
|
||||
public TaskAgentMessage GetAgentMessage()
|
||||
{
|
||||
var body = JsonUtility.ToString(this);
|
||||
|
||||
return new TaskAgentMessage
|
||||
{
|
||||
Body = body,
|
||||
MessageType = JobRequestMessageTypes.AgentJobRequest
|
||||
};
|
||||
}
|
||||
|
||||
[DataMember(Name = "Tasks", EmitDefaultValue = false)]
|
||||
private List<TaskInstance> m_tasks;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
public enum AuditAction
|
||||
{
|
||||
[EnumMember]
|
||||
Add = 1,
|
||||
|
||||
[EnumMember]
|
||||
Update = 2,
|
||||
|
||||
[EnumMember]
|
||||
Delete = 3,
|
||||
|
||||
[EnumMember]
|
||||
Undelete = 4
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class AzureKeyVaultVariableGroupProviderData : VariableGroupProviderData
|
||||
{
|
||||
[DataMember(EmitDefaultValue = true)]
|
||||
public Guid ServiceEndpointId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Vault
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime LastRefreshedOn
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class AzureKeyVaultVariableValue: VariableValue
|
||||
{
|
||||
public AzureKeyVaultVariableValue()
|
||||
{
|
||||
}
|
||||
|
||||
public AzureKeyVaultVariableValue(AzureKeyVaultVariableValue value)
|
||||
: this(value.Value, value.IsSecret, value.Enabled, value.ContentType, value.Expires)
|
||||
{
|
||||
}
|
||||
|
||||
public AzureKeyVaultVariableValue(String value, Boolean isSecret, Boolean enabled, String contentType, DateTime? expires)
|
||||
:base(value, isSecret)
|
||||
{
|
||||
Enabled = enabled;
|
||||
ContentType = contentType;
|
||||
Expires = expires;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = true)]
|
||||
public Boolean Enabled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = true)]
|
||||
public String ContentType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime? Expires
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
using GitHub.Services.Common;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
[JsonConverter(typeof(DemandJsonConverter))]
|
||||
public abstract class Demand
|
||||
{
|
||||
protected Demand(
|
||||
String name,
|
||||
String value)
|
||||
{
|
||||
ArgumentUtility.CheckStringForNullOrEmpty(name, "name");
|
||||
this.Name = name;
|
||||
this.Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Value
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override sealed Boolean Equals(Object obj)
|
||||
{
|
||||
Demand demand = obj as Demand;
|
||||
return demand != null && demand.ToString().Equals(this.ToString(), StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public override sealed Int32 GetHashCode()
|
||||
{
|
||||
return this.ToString().ToUpperInvariant().GetHashCode();
|
||||
}
|
||||
|
||||
public override sealed String ToString()
|
||||
{
|
||||
return GetExpression();
|
||||
}
|
||||
|
||||
public abstract Demand Clone();
|
||||
|
||||
protected abstract String GetExpression();
|
||||
|
||||
public abstract Boolean IsSatisfied(IDictionary<String, String> capabilities);
|
||||
|
||||
public static Boolean TryParse(
|
||||
String input,
|
||||
out Demand demand)
|
||||
{
|
||||
demand = null;
|
||||
|
||||
Match match = s_demandRegex.Match(input);
|
||||
if (!match.Success)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
String name = match.Groups["name"].Value;
|
||||
String opcode = match.Groups["opcode"].Value;
|
||||
String value = match.Groups["value"].Value;
|
||||
|
||||
if (String.IsNullOrEmpty(opcode))
|
||||
{
|
||||
demand = new DemandExists(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (opcode)
|
||||
{
|
||||
case "equals":
|
||||
demand = new DemandEquals(name, value);
|
||||
break;
|
||||
case "gtVersion":
|
||||
demand = new DemandMinimumVersion(name, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return demand != null;
|
||||
}
|
||||
|
||||
public void Update(String value)
|
||||
{
|
||||
ArgumentUtility.CheckStringForNullOrEmpty(value, "value");
|
||||
this.Value = value;
|
||||
}
|
||||
|
||||
private static readonly Regex s_demandRegex = new Regex(@"^(?<name>\S+)(\s+\-(?<opcode>\S+)\s+(?<value>.*))?$", RegexOptions.Compiled);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.Common;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class DemandEquals : Demand
|
||||
{
|
||||
public DemandEquals(
|
||||
String name,
|
||||
String value)
|
||||
: base(name, value)
|
||||
{
|
||||
ArgumentUtility.CheckStringForNullOrEmpty(value, "value");
|
||||
}
|
||||
|
||||
public override Demand Clone()
|
||||
{
|
||||
return new DemandEquals(this.Name, this.Value);
|
||||
}
|
||||
|
||||
protected override String GetExpression()
|
||||
{
|
||||
return String.Format(CultureInfo.InvariantCulture, "{0} -equals {1}", this.Name, this.Value);
|
||||
}
|
||||
|
||||
public override Boolean IsSatisfied(IDictionary<String, String> capabilities)
|
||||
{
|
||||
String value;
|
||||
return capabilities.TryGetValue(this.Name, out value) && this.Value.Equals(value, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class DemandExists : Demand
|
||||
{
|
||||
public DemandExists(String name)
|
||||
: base(name, null)
|
||||
{
|
||||
}
|
||||
|
||||
public override Demand Clone()
|
||||
{
|
||||
return new DemandExists(this.Name);
|
||||
}
|
||||
|
||||
protected override String GetExpression()
|
||||
{
|
||||
return this.Name;
|
||||
}
|
||||
|
||||
public override Boolean IsSatisfied(IDictionary<String, String> capabilities)
|
||||
{
|
||||
return capabilities.ContainsKey(this.Name);
|
||||
}
|
||||
|
||||
public new void Update(String value)
|
||||
{
|
||||
// Exists can not override value
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using GitHub.Services.WebApi;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
internal sealed class DemandJsonConverter : VssSecureJsonConverter
|
||||
{
|
||||
public override Boolean CanConvert(Type objectType)
|
||||
{
|
||||
return typeof(Demand).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
|
||||
}
|
||||
|
||||
public override Object ReadJson(
|
||||
JsonReader reader,
|
||||
Type objectType,
|
||||
Object existingValue,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
if (existingValue == null && reader.TokenType == JsonToken.String)
|
||||
{
|
||||
Demand demand;
|
||||
if (Demand.TryParse((String)reader.Value, out demand))
|
||||
{
|
||||
existingValue = demand;
|
||||
}
|
||||
}
|
||||
|
||||
return existingValue;
|
||||
}
|
||||
|
||||
public override void WriteJson(
|
||||
JsonWriter writer,
|
||||
Object value,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
base.WriteJson(writer, value, serializer);
|
||||
if (value != null)
|
||||
{
|
||||
writer.WriteValue(value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
using GitHub.DistributedTask.Pipelines;
|
||||
using GitHub.Services.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class DemandMinimumVersion : Demand
|
||||
{
|
||||
public DemandMinimumVersion(
|
||||
String name,
|
||||
String value)
|
||||
: base(name, value)
|
||||
{
|
||||
ArgumentUtility.CheckStringForNullOrEmpty(value, "value");
|
||||
}
|
||||
|
||||
public override Demand Clone()
|
||||
{
|
||||
return new DemandMinimumVersion(this.Name, this.Value);
|
||||
}
|
||||
|
||||
protected override String GetExpression()
|
||||
{
|
||||
return String.Format(CultureInfo.InvariantCulture, "{0} -gtVersion {1}", this.Name, this.Value);
|
||||
}
|
||||
|
||||
public override Boolean IsSatisfied(IDictionary<String, String> capabilities)
|
||||
{
|
||||
String value;
|
||||
if (capabilities.TryGetValue(this.Name, out value))
|
||||
{
|
||||
// return true if our version is less than or equal to the capability version from the agent
|
||||
return CompareVersion(this.Value, value) <= 0;
|
||||
}
|
||||
|
||||
// same as capabilityVersion == null
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Int32 CompareVersion(String semanticVersion1, String semanticVersion2)
|
||||
{
|
||||
// compare == first - second (-1 means second is greater, 1 means first is greater, 0 means they are equal)
|
||||
Version version1 = ParseVersion(semanticVersion1);
|
||||
Version version2 = ParseVersion(semanticVersion2);
|
||||
if (version1 == null && version2 == null)
|
||||
{
|
||||
// they are both null, so they are equal
|
||||
return 0;
|
||||
}
|
||||
else if (version1 == null)
|
||||
{
|
||||
// version2 is greater
|
||||
return -1;
|
||||
}
|
||||
else if (version2 == null)
|
||||
{
|
||||
// version1 is greater
|
||||
return 1;
|
||||
}
|
||||
|
||||
return version1.CompareTo(version2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the minimum agent version demand from the specified set of demands. Agent version demands are removed
|
||||
/// from the input set.
|
||||
/// </summary>
|
||||
/// <param name="demands">The demands</param>
|
||||
/// <returns>The highest minimum version required based in the input set</returns>
|
||||
public static DemandMinimumVersion MaxAndRemove(ISet<Demand> demands)
|
||||
{
|
||||
DemandMinimumVersion minAgentVersion = null;
|
||||
var demandsCopy = demands.Where(x => x.Name.Equals(PipelineConstants.AgentVersionDemandName, StringComparison.OrdinalIgnoreCase)).OfType<DemandMinimumVersion>().ToList();
|
||||
foreach (var demand in demandsCopy)
|
||||
{
|
||||
if (minAgentVersion == null || CompareVersion(demand.Value, minAgentVersion.Value) > 0)
|
||||
{
|
||||
minAgentVersion = demand;
|
||||
}
|
||||
|
||||
demands.Remove(demand);
|
||||
}
|
||||
|
||||
return minAgentVersion;
|
||||
}
|
||||
|
||||
public static DemandMinimumVersion Max(IEnumerable<Demand> demands)
|
||||
{
|
||||
DemandMinimumVersion minAgentVersion = null;
|
||||
foreach (var demand in demands.Where(x => x.Name.Equals(PipelineConstants.AgentVersionDemandName, StringComparison.OrdinalIgnoreCase)).OfType<DemandMinimumVersion>())
|
||||
{
|
||||
if (minAgentVersion == null || CompareVersion(demand.Value, minAgentVersion.Value) > 0)
|
||||
{
|
||||
minAgentVersion = demand;
|
||||
}
|
||||
}
|
||||
|
||||
return minAgentVersion;
|
||||
}
|
||||
|
||||
public static Version ParseVersion(String versionString)
|
||||
{
|
||||
Version version = null;
|
||||
if (!String.IsNullOrEmpty(versionString))
|
||||
{
|
||||
int index = versionString.IndexOf('-');
|
||||
if (index > 0)
|
||||
{
|
||||
versionString = versionString.Substring(0, index);
|
||||
}
|
||||
|
||||
if (!Version.TryParse(versionString, out version))
|
||||
{
|
||||
// If we couldn't parse it, set it back to null
|
||||
version = null;
|
||||
}
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Deployment group.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class DeploymentGroup : DeploymentGroupReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of deployment targets in the deployment group.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 MachineCount
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of deployment targets in the deployment group.
|
||||
/// </summary>
|
||||
public IList<DeploymentMachine> Machines
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_machines == null)
|
||||
{
|
||||
m_machines = new List<DeploymentMachine>();
|
||||
}
|
||||
return m_machines;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_machines = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Description of the deployment group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of unique tags across all deployment targets in the deployment group.
|
||||
/// </summary>
|
||||
public IList<String> MachineTags
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_tags == null)
|
||||
{
|
||||
m_tags = new List<String>();
|
||||
}
|
||||
return m_tags;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_tags = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of deployment targets in the deployment group.
|
||||
/// </summary>
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Machines")]
|
||||
private IList<DeploymentMachine> m_machines;
|
||||
|
||||
/// <summary>
|
||||
/// List of unique tags across all deployment targets in the deployment group.
|
||||
/// </summary>
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "MachineTags")]
|
||||
private IList<String> m_tags;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// This is useful in getting a list of deployment groups, filtered for which caller has permissions to take a particular action.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum DeploymentGroupActionFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// All deployment groups.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Only deployment groups for which caller has **manage** permission.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Manage = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Only deployment groups for which caller has **use** permission.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Use = 16,
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
using GitHub.Services.WebApi;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Properties to create Deployment group.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class DeploymentGroupCreateParameter
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the deployment group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Description of the deployment group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifier of the deployment pool in which deployment agents are registered.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32 PoolId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deployment pool in which deployment agents are registered.
|
||||
/// This is obsolete. Kept for compatibility. Will be marked obsolete explicitly by M132.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
[ClientInternalUseOnly(OmitFromTypeScriptDeclareFile = false)]
|
||||
public DeploymentGroupCreateParameterPoolProperty Pool
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Properties of Deployment pool to create Deployment group.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class DeploymentGroupCreateParameterPoolProperty
|
||||
{
|
||||
/// <summary>
|
||||
/// Deployment pool identifier.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32 Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Properties to be included or expanded in deployment group objects. This is useful when getting a single or list of deployment grouops.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum DeploymentGroupExpands
|
||||
{
|
||||
/// <summary>
|
||||
/// No additional properties.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Deprecated: Include all the deployment targets.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Machines = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Include unique list of tags across all deployment targets.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Tags = 4
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Deployment group metrics.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public sealed class DeploymentGroupMetrics
|
||||
{
|
||||
/// <summary>
|
||||
/// Deployment group.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public DeploymentGroupReference DeploymentGroup
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of deployment group properties. And types of metrics provided for those properties.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public MetricsColumnsHeader ColumnsHeader
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Values of properties and the metrics.
|
||||
/// E.g. 1: total count of deployment targets for which 'TargetState' is 'offline'.
|
||||
/// E.g. 2: Average time of deployment to the deployment targets for which 'LastJobStatus' is 'passed' and 'TargetState' is 'online'.
|
||||
/// </summary>
|
||||
public IList<MetricsRow> Rows
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_rows == null)
|
||||
{
|
||||
m_rows = new List<MetricsRow>();
|
||||
}
|
||||
|
||||
return m_rows;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_rows = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Values of properties and the metrics.
|
||||
/// E.g. 1: total count of deployment targets for which 'TargetState' is 'offline'.
|
||||
/// E.g. 2: Average time of deployment to the deployment targets for which 'LastJobStatus' is 'passed' and 'TargetState' is 'online'.
|
||||
/// </summary>
|
||||
[DataMember(Name = "Rows")]
|
||||
private IList<MetricsRow> m_rows;
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Deployment group reference. This is useful for referring a deployment group in another object.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class DeploymentGroupReference
|
||||
{
|
||||
[JsonConstructor]
|
||||
public DeploymentGroupReference()
|
||||
{
|
||||
}
|
||||
|
||||
private DeploymentGroupReference(DeploymentGroupReference referenceToClone)
|
||||
{
|
||||
this.Id = referenceToClone.Id;
|
||||
this.Name = referenceToClone.Name;
|
||||
|
||||
if (referenceToClone.Project != null)
|
||||
{
|
||||
this.Project = new ProjectReference
|
||||
{
|
||||
Id = referenceToClone.Project.Id,
|
||||
Name = referenceToClone.Project.Name,
|
||||
};
|
||||
}
|
||||
|
||||
if (referenceToClone.Pool != null)
|
||||
{
|
||||
this.Pool = new TaskAgentPoolReference
|
||||
{
|
||||
Id = referenceToClone.Pool.Id,
|
||||
IsHosted = referenceToClone.Pool.IsHosted,
|
||||
Name = referenceToClone.Pool.Name,
|
||||
PoolType = referenceToClone.Pool.PoolType,
|
||||
Scope = referenceToClone.Pool.Scope,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deployment group identifier.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32 Id
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Project to which the deployment group belongs.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public ProjectReference Project
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name of the deployment group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deployment pool in which deployment agents are registered.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentPoolReference Pool
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public virtual DeploymentGroupReference Clone()
|
||||
{
|
||||
return new DeploymentGroupReference(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Deployment group update parameter.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class DeploymentGroupUpdateParameter
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the deployment group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Description of the deployment group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Deployment target.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class DeploymentMachine : ICloneable
|
||||
{
|
||||
public DeploymentMachine()
|
||||
{
|
||||
}
|
||||
|
||||
private DeploymentMachine(DeploymentMachine machineToBeCloned)
|
||||
{
|
||||
this.Id = machineToBeCloned.Id;
|
||||
this.Tags = (Tags == null) ? null : new List<String>(machineToBeCloned.Tags);
|
||||
this.Agent = machineToBeCloned.Agent?.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deployment target Identifier.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tags of the deployment target.
|
||||
/// </summary>
|
||||
public IList<String> Tags
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_tags;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_tags = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deployment agent.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgent Agent
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public PropertiesCollection Properties
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_properties == null)
|
||||
{
|
||||
m_properties = new PropertiesCollection();
|
||||
}
|
||||
|
||||
return m_properties;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_properties = value;
|
||||
}
|
||||
}
|
||||
|
||||
object ICloneable.Clone()
|
||||
{
|
||||
return this.Clone();
|
||||
}
|
||||
|
||||
public DeploymentMachine Clone()
|
||||
{
|
||||
return new DeploymentMachine(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tags of the deployment target.
|
||||
/// </summary>
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Tags")]
|
||||
private IList<String> m_tags;
|
||||
|
||||
/// <summary>
|
||||
/// Properties of the deployment target.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false, Name = "Properties")]
|
||||
private PropertiesCollection m_properties;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum DeploymentMachineExpands
|
||||
{
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
[EnumMember]
|
||||
Capabilities = 2,
|
||||
|
||||
[EnumMember]
|
||||
AssignedRequest = 4
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class DeploymentMachineGroup : DeploymentMachineGroupReference
|
||||
{
|
||||
[DataMember]
|
||||
public Int32 Size
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public IList<DeploymentMachine> Machines
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_machines == null)
|
||||
{
|
||||
m_machines = new List<DeploymentMachine>();
|
||||
}
|
||||
|
||||
return m_machines;
|
||||
}
|
||||
|
||||
internal set
|
||||
{
|
||||
m_machines = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Machines")]
|
||||
private IList<DeploymentMachine> m_machines;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class DeploymentMachineGroupReference
|
||||
{
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32 Id
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public ProjectReference Project
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentPoolReference Pool
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Deployment pool summary.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public sealed class DeploymentPoolSummary
|
||||
{
|
||||
/// <summary>
|
||||
/// Deployment pool.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public TaskAgentPoolReference Pool
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Number of deployment agents that are online.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 OnlineAgentsCount
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Number of deployment agents that are offline.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 OfflineAgentsCount
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Virtual machine Resource referring in pool.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public EnvironmentResourceReference Resource
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of deployment groups referring to the deployment pool.
|
||||
/// </summary>
|
||||
public IList<DeploymentGroupReference> DeploymentGroups
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_deploymentGroups == null)
|
||||
{
|
||||
m_deploymentGroups = new List<DeploymentGroupReference>();
|
||||
}
|
||||
return m_deploymentGroups;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_deploymentGroups = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of deployment groups referring to the deployment pool.
|
||||
/// </summary>
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "DeploymentGroups")]
|
||||
private IList<DeploymentGroupReference> m_deploymentGroups;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Properties to be included or expanded in deployment pool summary objects. This is useful when getting a single or list of deployment pool summaries.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum DeploymentPoolSummaryExpands
|
||||
{
|
||||
/// <summary>
|
||||
/// No additional properties
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Include deployment groups referring to the deployment pool.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
DeploymentGroups = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Include Resource referring to the deployment pool.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Resource = 4
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Properties to be included or expanded in deployment target objects. This is useful when getting a single or list of deployment targets.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum DeploymentTargetExpands
|
||||
{
|
||||
/// <summary>
|
||||
/// No additional properties.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Include capabilities of the deployment agent.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Capabilities = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Include the job request assigned to the deployment agent.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
AssignedRequest = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Include the last completed job request of the deployment agent.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
LastCompletedRequest = 8
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Deployment target update parameter.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class DeploymentTargetUpdateParameter
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifier of the deployment target.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tags of the deployment target..
|
||||
/// </summary>
|
||||
public IList<String> Tags
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_tags;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_tags = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Tags")]
|
||||
private IList<String> m_tags;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public enum EnableAccessTokenType
|
||||
{
|
||||
None,
|
||||
Variable,
|
||||
True = Variable,
|
||||
SecretVariable,
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Properties to create Environment.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class EnvironmentCreateParameter
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the environment.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Description of the environment.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// EnvironmentDeploymentExecutionRecord.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class EnvironmentDeploymentExecutionRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Id of the Environment deployment execution history record
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int64 Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request identifier of the Environment deployment execution history record
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String RequestIdentifier
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Id of the Environment
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 EnvironmentId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Service owner Id
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid ServiceOwner
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Project Id
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid ScopeId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resource Id
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32? ResourceId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Plan type of the environment deployment execution record
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String PlanType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Plan Id
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid PlanId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stage name
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String StageName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Job name
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String JobName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stage Attempt
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32 StageAttempt
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Job Attempt
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32 JobAttempt
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definition of the environment deployment execution owner
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskOrchestrationOwner Definition
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Owner of the environment deployment execution record
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskOrchestrationOwner Owner
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Result of the environment deployment execution
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskResult? Result
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue time of the environment deployment execution
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime QueueTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start time of the environment deployment execution
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime? StartTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finish time of the environment deployment execution
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime? FinishTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Properties to be included or expanded in environment objects. This is useful when getting a single environment.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum EnvironmentExpands
|
||||
{
|
||||
/// <summary>
|
||||
/// No additional properties
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Include resource references referring to the environment.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
ResourceReferences = 1
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Environment.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class EnvironmentInstance
|
||||
{
|
||||
/// <summary>
|
||||
/// Id of the Environment
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name of the Environment.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Description of the Environment.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identity reference of the user who created the Environment.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IdentityRef CreatedBy
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creation time of the Environment
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public DateTime CreatedOn
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identity reference of the user who last modified the Environment.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IdentityRef LastModifiedBy
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Last modified time of the Environment
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public DateTime LastModifiedOn
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of resources
|
||||
/// </summary>
|
||||
public IList<EnvironmentResourceReference> Resources
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.resources == null)
|
||||
{
|
||||
this.resources = new List<EnvironmentResourceReference>();
|
||||
}
|
||||
|
||||
return this.resources;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resources that defined or used for this environment.
|
||||
/// We use this for deployment job's resource authorization.
|
||||
/// </summary>
|
||||
public Pipelines.PipelineResources ReferencedResources
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Resources")]
|
||||
private IList<EnvironmentResourceReference> resources;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// EnvironmentLinkedResourceReference.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class EnvironmentLinkedResourceReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Id of the resource.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Type of resource.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String TypeName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class EnvironmentReference
|
||||
{
|
||||
[DataMember]
|
||||
public Int32 Id { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public abstract class EnvironmentResource
|
||||
{
|
||||
[DataMember]
|
||||
public Int32 Id { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Environment resource type
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public EnvironmentResourceType Type { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public IdentityRef CreatedBy { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public DateTime CreatedOn { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public IdentityRef LastModifiedBy { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public DateTime LastModifiedOn { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public EnvironmentReference EnvironmentReference { get; set; }
|
||||
|
||||
protected EnvironmentResource()
|
||||
{
|
||||
Name = string.Empty;
|
||||
|
||||
CreatedBy = new IdentityRef();
|
||||
|
||||
LastModifiedBy = new IdentityRef();
|
||||
|
||||
this.EnvironmentReference = new EnvironmentReference();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// EnvironmentResourceReference.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class EnvironmentResourceReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Id of the resource.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name of the resource.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Type of the resource.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public EnvironmentResourceType Type
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of linked resources
|
||||
/// </summary>
|
||||
public IList<EnvironmentLinkedResourceReference> LinkedResources
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_linkedResources == null)
|
||||
{
|
||||
m_linkedResources = new List<EnvironmentLinkedResourceReference>();
|
||||
}
|
||||
|
||||
return m_linkedResources;
|
||||
}
|
||||
}
|
||||
|
||||
private IList<EnvironmentLinkedResourceReference> m_linkedResources;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// EnvironmentResourceType.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Flags]
|
||||
public enum EnvironmentResourceType
|
||||
{
|
||||
Undefined = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Unknown resource type
|
||||
/// </summary>
|
||||
Generic = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Virtual machine resource type
|
||||
/// </summary>
|
||||
VirtualMachine = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Kubernetes resource type
|
||||
/// </summary>
|
||||
Kubernetes = 4
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Properties to update Environment.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class EnvironmentUpdateParameter
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the environment.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Description of the environment.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class KubernetesResource : EnvironmentResource
|
||||
{
|
||||
[DataMember]
|
||||
public String Namespace { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String ClusterName { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public Guid ServiceEndpointId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class KubernetesResourceCreateParameters
|
||||
{
|
||||
[DataMember]
|
||||
public String Name { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String Namespace { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String ClusterName { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public Guid ServiceEndpointId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class VirtualMachine
|
||||
{
|
||||
[DataMember]
|
||||
public Int32 Id { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public TaskAgent Agent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of tags
|
||||
/// </summary>
|
||||
public IList<String> Tags
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.tags == null)
|
||||
{
|
||||
this.tags = new List<String>();
|
||||
}
|
||||
|
||||
return this.tags;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.tags = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Tags")]
|
||||
private IList<String> tags;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class VirtualMachineGroup : EnvironmentResource
|
||||
{
|
||||
[DataMember]
|
||||
public Int32 PoolId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class VirtualMachineGroupCreateParameters
|
||||
{
|
||||
[DataMember]
|
||||
public String Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class ExpressionValidationItem : ValidationItem
|
||||
{
|
||||
public ExpressionValidationItem()
|
||||
: base(InputValidationTypes.Expression)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.DistributedTask.Pipelines;
|
||||
using GitHub.Services.WebApi;
|
||||
using GitHub.Services.WebApi.Internal;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[ClientIgnore]
|
||||
[DataContract]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public enum OrchestrationProcessType
|
||||
{
|
||||
[DataMember]
|
||||
Container = 1,
|
||||
|
||||
[DataMember]
|
||||
Pipeline = 2,
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[JsonConverter(typeof(OrchestrationEnvironmentJsonConverter))]
|
||||
public interface IOrchestrationEnvironment
|
||||
{
|
||||
OrchestrationProcessType ProcessType { get; }
|
||||
|
||||
IDictionary<String, VariableValue> Variables { get; }
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[JsonConverter(typeof(OrchestrationProcessJsonConverter))]
|
||||
public interface IOrchestrationProcess
|
||||
{
|
||||
OrchestrationProcessType ProcessType { get; }
|
||||
}
|
||||
|
||||
internal sealed class OrchestrationProcessJsonConverter : VssSecureJsonConverter
|
||||
{
|
||||
public override Boolean CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override Boolean CanConvert(Type objectType)
|
||||
{
|
||||
return typeof(IOrchestrationProcess).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
|
||||
}
|
||||
|
||||
public override Object ReadJson(
|
||||
JsonReader reader,
|
||||
Type objectType,
|
||||
Object existingValue,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType != JsonToken.StartObject)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
JObject value = JObject.Load(reader);
|
||||
IOrchestrationProcess process = null;
|
||||
if (value.TryGetValue("stages", StringComparison.OrdinalIgnoreCase, out _) ||
|
||||
value.TryGetValue("phases", StringComparison.OrdinalIgnoreCase, out _))
|
||||
{
|
||||
process = new PipelineProcess();
|
||||
}
|
||||
else if (value.TryGetValue("children", StringComparison.OrdinalIgnoreCase, out _))
|
||||
{
|
||||
process = new TaskOrchestrationContainer();
|
||||
}
|
||||
|
||||
if (process != null)
|
||||
{
|
||||
using (var objectReader = value.CreateReader())
|
||||
{
|
||||
serializer.Populate(objectReader, process);
|
||||
}
|
||||
}
|
||||
|
||||
return process;
|
||||
}
|
||||
|
||||
public override void WriteJson(
|
||||
JsonWriter writer,
|
||||
Object value,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class OrchestrationEnvironmentJsonConverter : VssSecureJsonConverter
|
||||
{
|
||||
public override Boolean CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override Boolean CanConvert(Type objectType)
|
||||
{
|
||||
return typeof(IOrchestrationEnvironment).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
|
||||
}
|
||||
|
||||
public override Object ReadJson(
|
||||
JsonReader reader,
|
||||
Type objectType,
|
||||
Object existingValue,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType != JsonToken.StartObject)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
JToken propertyValue;
|
||||
JObject value = JObject.Load(reader);
|
||||
IOrchestrationEnvironment environment = null;
|
||||
OrchestrationProcessType processType = OrchestrationProcessType.Container;
|
||||
if (value.TryGetValue("ProcessType", StringComparison.OrdinalIgnoreCase, out propertyValue))
|
||||
{
|
||||
if (propertyValue.Type == JTokenType.Integer)
|
||||
{
|
||||
processType = (OrchestrationProcessType)(Int32)propertyValue;
|
||||
}
|
||||
else if (propertyValue.Type != JTokenType.String || !Enum.TryParse((String)propertyValue, true, out processType))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
switch (processType)
|
||||
{
|
||||
case OrchestrationProcessType.Container:
|
||||
environment = new PlanEnvironment();
|
||||
break;
|
||||
|
||||
case OrchestrationProcessType.Pipeline:
|
||||
environment = new PipelineEnvironment();
|
||||
break;
|
||||
}
|
||||
|
||||
if (environment != null)
|
||||
{
|
||||
using (var objectReader = value.CreateReader())
|
||||
{
|
||||
serializer.Populate(objectReader, environment);
|
||||
}
|
||||
}
|
||||
|
||||
return environment;
|
||||
}
|
||||
|
||||
public override void WriteJson(
|
||||
JsonWriter writer,
|
||||
Object value,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public interface ITaskDefinitionReference
|
||||
{
|
||||
Guid Id { get; }
|
||||
|
||||
String Name { get; }
|
||||
|
||||
String Version { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
internal static class IdentityRefExtensions
|
||||
{
|
||||
public static IdentityRef Clone(this IdentityRef source)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new IdentityRef
|
||||
{
|
||||
DisplayName = source.DisplayName,
|
||||
Id = source.Id,
|
||||
ImageUrl = source.ImageUrl,
|
||||
IsAadIdentity = source.IsAadIdentity,
|
||||
IsContainer = source.IsContainer,
|
||||
ProfileUrl = source.ProfileUrl,
|
||||
UniqueName = source.UniqueName,
|
||||
Url = source.Url,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class InputBindingContext
|
||||
{
|
||||
/// <summary>
|
||||
/// Value of the input
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Value
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class InputValidationItem : ValidationItem
|
||||
{
|
||||
public InputValidationItem()
|
||||
: base(InputValidationTypes.Input)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides binding context for the expression to evaluate
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public InputBindingContext Context
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,294 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.DistributedTask.Pipelines;
|
||||
using GitHub.Services.Common;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the context of variables and vectors for a job request.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public sealed class JobEnvironment : ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new <c>JobEnvironment</c> with empty collections of repositories, vectors,
|
||||
/// and variables.
|
||||
/// </summary>
|
||||
public JobEnvironment()
|
||||
{
|
||||
}
|
||||
|
||||
public JobEnvironment(
|
||||
IDictionary<String, VariableValue> variables,
|
||||
List<MaskHint> maskhints,
|
||||
JobResources resources)
|
||||
{
|
||||
if (resources!= null)
|
||||
{
|
||||
this.Endpoints.AddRange(resources.Endpoints.Where(x => !String.Equals(x.Name, WellKnownServiceEndpointNames.SystemVssConnection, StringComparison.OrdinalIgnoreCase)));
|
||||
this.SystemConnection = resources.Endpoints.FirstOrDefault(x => String.Equals(x.Name, WellKnownServiceEndpointNames.SystemVssConnection, StringComparison.OrdinalIgnoreCase));
|
||||
this.SecureFiles.AddRange(resources.SecureFiles);
|
||||
}
|
||||
|
||||
if (maskhints != null)
|
||||
{
|
||||
this.MaskHints.AddRange(maskhints);
|
||||
}
|
||||
|
||||
if (variables != null)
|
||||
{
|
||||
foreach (var variable in variables)
|
||||
{
|
||||
this.Variables[variable.Key] = variable.Value?.Value;
|
||||
|
||||
if (variable.Value?.IsSecret == true)
|
||||
{
|
||||
// Make sure we propagate secret variables into the mask hints
|
||||
this.MaskHints.Add(new MaskHint { Type = MaskType.Variable, Value = variable.Key });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Extract(
|
||||
Dictionary<String, VariableValue> variables,
|
||||
HashSet<MaskHint> maskhints,
|
||||
JobResources jobResources)
|
||||
{
|
||||
// construct variables
|
||||
HashSet<String> secretVariables = new HashSet<string>(this.MaskHints.Where(t => t.Type == MaskType.Variable).Select(v => v.Value), StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var variable in this.Variables)
|
||||
{
|
||||
variables[variable.Key] = new VariableValue(variable.Value, secretVariables.Contains(variable.Key));
|
||||
}
|
||||
|
||||
// construct maskhints
|
||||
maskhints.AddRange(this.MaskHints.Where(x => !(x.Type == MaskType.Variable && secretVariables.Contains(x.Value))).Select(x => x.Clone()));
|
||||
|
||||
// constuct job resources (endpoints, securefiles and systemconnection)
|
||||
jobResources.SecureFiles.AddRange(this.SecureFiles.Select(x => x.Clone()));
|
||||
jobResources.Endpoints.AddRange(this.Endpoints.Select(x => x.Clone()));
|
||||
|
||||
if (this.SystemConnection != null)
|
||||
{
|
||||
jobResources.Endpoints.Add(this.SystemConnection.Clone());
|
||||
}
|
||||
}
|
||||
|
||||
public JobEnvironment(PlanEnvironment environment)
|
||||
{
|
||||
ArgumentUtility.CheckForNull(environment, nameof(environment));
|
||||
|
||||
if (environment.MaskHints.Count > 0)
|
||||
{
|
||||
m_maskHints = new List<MaskHint>(environment.MaskHints.Select(x => x.Clone()));
|
||||
}
|
||||
|
||||
if (environment.Options.Count > 0)
|
||||
{
|
||||
m_options = environment.Options.ToDictionary(x => x.Key, x => x.Value.Clone());
|
||||
}
|
||||
|
||||
if (environment.Variables.Count > 0)
|
||||
{
|
||||
m_variables = new Dictionary<String, String>(environment.Variables, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
private JobEnvironment(JobEnvironment environmentToClone)
|
||||
{
|
||||
if (environmentToClone.SystemConnection != null)
|
||||
{
|
||||
this.SystemConnection = environmentToClone.SystemConnection.Clone();
|
||||
}
|
||||
|
||||
if (environmentToClone.m_maskHints != null)
|
||||
{
|
||||
m_maskHints = environmentToClone.m_maskHints.Select(x => x.Clone()).ToList();
|
||||
}
|
||||
|
||||
if (environmentToClone.m_endpoints != null)
|
||||
{
|
||||
m_endpoints = environmentToClone.m_endpoints.Select(x => x.Clone()).ToList();
|
||||
}
|
||||
|
||||
if (environmentToClone.m_secureFiles != null)
|
||||
{
|
||||
m_secureFiles = environmentToClone.m_secureFiles.Select(x => x.Clone()).ToList();
|
||||
}
|
||||
|
||||
if (environmentToClone.m_options != null)
|
||||
{
|
||||
m_options = environmentToClone.m_options.ToDictionary(x => x.Key, x => x.Value.Clone());
|
||||
}
|
||||
|
||||
if (environmentToClone.m_variables != null)
|
||||
{
|
||||
m_variables = new Dictionary<String, String>(environmentToClone.m_variables, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the endpoint used for communicating back to the calling service.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public ServiceEndpoint SystemConnection
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of mask hints
|
||||
/// </summary>
|
||||
public List<MaskHint> MaskHints
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_maskHints == null)
|
||||
{
|
||||
m_maskHints = new List<MaskHint>();
|
||||
}
|
||||
return m_maskHints;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of endpoints associated with the current context.
|
||||
/// </summary>
|
||||
public List<ServiceEndpoint> Endpoints
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_endpoints == null)
|
||||
{
|
||||
m_endpoints = new List<ServiceEndpoint>();
|
||||
}
|
||||
return m_endpoints;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of secure files associated with the current context
|
||||
/// </summary>
|
||||
public List<SecureFile> SecureFiles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_secureFiles == null)
|
||||
{
|
||||
m_secureFiles = new List<SecureFile>();
|
||||
}
|
||||
return m_secureFiles;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of options associated with the current context. (Deprecated, use by 1.x agent)
|
||||
/// </summary>
|
||||
public IDictionary<Guid, JobOption> Options
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_options == null)
|
||||
{
|
||||
m_options = new Dictionary<Guid, JobOption>();
|
||||
}
|
||||
return m_options;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of variables associated with the current context.
|
||||
/// </summary>
|
||||
public IDictionary<String, String> Variables
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_variables == null)
|
||||
{
|
||||
m_variables = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
return m_variables;
|
||||
}
|
||||
}
|
||||
|
||||
Object ICloneable.Clone()
|
||||
{
|
||||
return this.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the job environment.
|
||||
/// </summary>
|
||||
/// <returns>A deep copy of the job environment</returns>
|
||||
public JobEnvironment Clone()
|
||||
{
|
||||
return new JobEnvironment(this);
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context)
|
||||
{
|
||||
if (m_serializedMaskHints != null && m_serializedMaskHints.Count > 0)
|
||||
{
|
||||
m_maskHints = new List<MaskHint>(m_serializedMaskHints.Distinct());
|
||||
}
|
||||
|
||||
m_serializedMaskHints = null;
|
||||
|
||||
SerializationHelper.Copy(ref m_serializedVariables, ref m_variables, true);
|
||||
SerializationHelper.Copy(ref m_serializedEndpoints, ref m_endpoints, true);
|
||||
SerializationHelper.Copy(ref m_serializedSecureFiles, ref m_secureFiles, true);
|
||||
SerializationHelper.Copy(ref m_serializedOptions, ref m_options, true);
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
if (this.m_maskHints != null && this.m_maskHints.Count > 0)
|
||||
{
|
||||
m_serializedMaskHints = new List<MaskHint>(this.m_maskHints.Distinct());
|
||||
}
|
||||
|
||||
SerializationHelper.Copy(ref m_variables, ref m_serializedVariables);
|
||||
SerializationHelper.Copy(ref m_endpoints, ref m_serializedEndpoints);
|
||||
SerializationHelper.Copy(ref m_secureFiles, ref m_serializedSecureFiles);
|
||||
SerializationHelper.Copy(ref m_options, ref m_serializedOptions);
|
||||
}
|
||||
|
||||
[OnSerialized]
|
||||
private void OnSerialized(StreamingContext context)
|
||||
{
|
||||
m_serializedMaskHints = null;
|
||||
m_serializedVariables = null;
|
||||
m_serializedEndpoints = null;
|
||||
m_serializedSecureFiles = null;
|
||||
m_serializedOptions = null;
|
||||
}
|
||||
|
||||
private List<MaskHint> m_maskHints;
|
||||
private List<ServiceEndpoint> m_endpoints;
|
||||
private List<SecureFile> m_secureFiles;
|
||||
private IDictionary<Guid, JobOption> m_options;
|
||||
private IDictionary<String, String> m_variables;
|
||||
|
||||
[DataMember(Name = "Endpoints", EmitDefaultValue = false)]
|
||||
private List<ServiceEndpoint> m_serializedEndpoints;
|
||||
|
||||
[DataMember(Name = "SecureFiles", EmitDefaultValue = false)]
|
||||
private List<SecureFile> m_serializedSecureFiles;
|
||||
|
||||
[DataMember(Name = "Options", EmitDefaultValue = false)]
|
||||
private IDictionary<Guid, JobOption> m_serializedOptions;
|
||||
|
||||
[DataMember(Name = "Mask", EmitDefaultValue = false)]
|
||||
private List<MaskHint> m_serializedMaskHints;
|
||||
|
||||
[DataMember(Name = "Variables", EmitDefaultValue = false)]
|
||||
private IDictionary<String, String> m_serializedVariables;
|
||||
}
|
||||
}
|
||||
@@ -16,22 +16,12 @@ namespace GitHub.DistributedTask.WebApi
|
||||
public const String JobCompleted = "JobCompleted";
|
||||
|
||||
public const String JobStarted = "JobStarted";
|
||||
|
||||
public const String TaskAssigned = "TaskAssigned";
|
||||
|
||||
public const String TaskStarted = "TaskStarted";
|
||||
|
||||
public const String TaskCompleted = "TaskCompleted";
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[KnownType(typeof(JobAssignedEvent))]
|
||||
[KnownType(typeof(JobCompletedEvent))]
|
||||
[KnownType(typeof(JobStartedEvent))]
|
||||
[KnownType(typeof(TaskAssignedEvent))]
|
||||
[KnownType(typeof(TaskStartedEvent))]
|
||||
[KnownType(typeof(TaskCompletedEvent))]
|
||||
[KnownType(typeof(TaskLocalExecutionCompletedEvent))]
|
||||
[JsonConverter(typeof(JobEventJsonConverter))]
|
||||
public abstract class JobEvent
|
||||
{
|
||||
@@ -179,89 +169,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public sealed class TaskAssignedEvent : TaskEvent
|
||||
{
|
||||
public TaskAssignedEvent()
|
||||
: base(JobEventTypes.TaskAssigned)
|
||||
{
|
||||
}
|
||||
|
||||
public TaskAssignedEvent(
|
||||
Guid jobId,
|
||||
Guid taskId)
|
||||
: base(JobEventTypes.TaskAssigned, jobId, taskId)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public sealed class TaskStartedEvent : TaskEvent
|
||||
{
|
||||
public TaskStartedEvent()
|
||||
: base(JobEventTypes.TaskStarted)
|
||||
{
|
||||
}
|
||||
|
||||
public TaskStartedEvent(
|
||||
Guid jobId,
|
||||
Guid taskId)
|
||||
: base(JobEventTypes.TaskStarted, jobId, taskId)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public sealed class TaskCompletedEvent : TaskEvent
|
||||
{
|
||||
public TaskCompletedEvent()
|
||||
: base(JobEventTypes.TaskCompleted)
|
||||
{
|
||||
}
|
||||
|
||||
public TaskCompletedEvent(
|
||||
Guid jobId,
|
||||
Guid taskId,
|
||||
TaskResult taskResult)
|
||||
: base(JobEventTypes.TaskCompleted, jobId, taskId)
|
||||
{
|
||||
Result = taskResult;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public TaskResult Result
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
[ClientIgnore]
|
||||
internal sealed class TaskLocalExecutionCompletedEvent : TaskEvent
|
||||
{
|
||||
public TaskLocalExecutionCompletedEvent()
|
||||
: base(JobEventTypes.TaskCompleted)
|
||||
{
|
||||
}
|
||||
|
||||
public TaskLocalExecutionCompletedEvent(
|
||||
Guid jobId,
|
||||
Guid taskId,
|
||||
ServerTaskSectionExecutionOutput data)
|
||||
: base(JobEventTypes.TaskCompleted, jobId, taskId)
|
||||
{
|
||||
EventData = data;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public ServerTaskSectionExecutionOutput EventData
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class JobEventJsonConverter : VssSecureJsonConverter
|
||||
{
|
||||
public override Boolean CanWrite
|
||||
@@ -304,18 +211,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
jobEvent = new JobStartedEvent();
|
||||
}
|
||||
else if (String.Equals(nameValue, JobEventTypes.TaskAssigned, StringComparison.Ordinal))
|
||||
{
|
||||
jobEvent = new TaskAssignedEvent();
|
||||
}
|
||||
else if (String.Equals(nameValue, JobEventTypes.TaskStarted, StringComparison.Ordinal))
|
||||
{
|
||||
jobEvent = new TaskStartedEvent();
|
||||
}
|
||||
else if (String.Equals(nameValue, JobEventTypes.TaskCompleted, StringComparison.Ordinal))
|
||||
{
|
||||
jobEvent = new TaskCompletedEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public class JobExecutionModeTypes
|
||||
{
|
||||
public const string Server = "Server";
|
||||
|
||||
public const string Agent = "Agent";
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an option that may affect the way an agent runs the job.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class JobOption : ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new <c>JobOption</c> with an empty collection of data.
|
||||
/// </summary>
|
||||
public JobOption()
|
||||
{
|
||||
}
|
||||
|
||||
private JobOption(JobOption optionToClone)
|
||||
{
|
||||
this.Id = optionToClone.Id;
|
||||
|
||||
if (optionToClone.m_data != null)
|
||||
{
|
||||
m_data = new Dictionary<String, String>(optionToClone.m_data, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id of the option.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data associated with the option.
|
||||
/// </summary>
|
||||
public IDictionary<String, String> Data
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_data == null)
|
||||
{
|
||||
m_data = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
return m_data;
|
||||
}
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context)
|
||||
{
|
||||
if (m_serializedData != null && m_serializedData.Count > 0)
|
||||
{
|
||||
m_data = new Dictionary<String, String>(m_serializedData, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
m_serializedData = null;
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
m_serializedData = this.Data.Count > 0 ? this.Data : null;
|
||||
}
|
||||
|
||||
Object ICloneable.Clone()
|
||||
{
|
||||
return this.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the job option.
|
||||
/// </summary>
|
||||
/// <returns>A deep copy of the job option</returns>
|
||||
public JobOption Clone()
|
||||
{
|
||||
return new JobOption(this);
|
||||
}
|
||||
|
||||
private Dictionary<String, String> m_data;
|
||||
|
||||
[DataMember(Name = "Data", EmitDefaultValue = false)]
|
||||
private IDictionary<String, String> m_serializedData;
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
[JsonConverter(typeof(JobRequestMessageJsonConverter))]
|
||||
|
||||
public abstract class JobRequestMessage
|
||||
{
|
||||
protected JobRequestMessage(string messageType)
|
||||
{
|
||||
this.MessageType = messageType;
|
||||
}
|
||||
|
||||
protected JobRequestMessage(
|
||||
string messageType,
|
||||
TaskOrchestrationPlanReference plan,
|
||||
TimelineReference timeline,
|
||||
Guid jobId,
|
||||
String jobName,
|
||||
String jobRefName,
|
||||
JobEnvironment environment)
|
||||
{
|
||||
this.MessageType = messageType;
|
||||
this.Plan = plan;
|
||||
this.JobId = jobId;
|
||||
this.JobName = jobName;
|
||||
this.JobRefName = jobRefName;
|
||||
this.Timeline = timeline;
|
||||
this.Environment = environment;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String MessageType
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public TaskOrchestrationPlanReference Plan
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public TimelineReference Timeline
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Guid JobId
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String JobName
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String JobRefName
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public JobEnvironment Environment
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using GitHub.Services.WebApi;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
internal sealed class JobRequestMessageJsonConverter : VssSecureJsonConverter
|
||||
{
|
||||
public override Boolean CanConvert(Type objectType)
|
||||
{
|
||||
return typeof(JobRequestMessage).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
|
||||
}
|
||||
|
||||
public override Boolean CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override Object ReadJson(
|
||||
JsonReader reader,
|
||||
Type objectType,
|
||||
Object existingValue,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType != JsonToken.StartObject)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Object newValue = null;
|
||||
JToken propertyValue;
|
||||
JObject value = JObject.Load(reader);
|
||||
|
||||
if (value.TryGetValue("MessageType", StringComparison.OrdinalIgnoreCase, out propertyValue))
|
||||
{
|
||||
if (propertyValue.Type == JTokenType.String)
|
||||
{
|
||||
var messageType = (String)propertyValue;
|
||||
|
||||
switch (messageType)
|
||||
{
|
||||
case JobRequestMessageTypes.AgentJobRequest:
|
||||
newValue = new AgentJobRequestMessage();
|
||||
break;
|
||||
|
||||
case JobRequestMessageTypes.ServerTaskRequest:
|
||||
case JobRequestMessageTypes.ServerJobRequest:
|
||||
newValue = new ServerTaskRequestMessage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newValue == null)
|
||||
{
|
||||
if (value.TryGetValue("RequestId", StringComparison.OrdinalIgnoreCase, out propertyValue))
|
||||
{
|
||||
newValue = new AgentJobRequestMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if (newValue == null)
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
|
||||
using (JsonReader objectReader = value.CreateReader())
|
||||
{
|
||||
serializer.Populate(objectReader, newValue);
|
||||
}
|
||||
|
||||
return newValue;
|
||||
}
|
||||
|
||||
public override void WriteJson(
|
||||
JsonWriter writer,
|
||||
Object value,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
// The virtual method returns false for CanWrite so this should never be invoked
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public static class JobRequestMessageTypes
|
||||
{
|
||||
public const String AgentJobRequest = "JobRequest";
|
||||
|
||||
public const String ServerJobRequest = "ServerJobRequest";
|
||||
|
||||
public const String ServerTaskRequest = "ServerTaskRequest";
|
||||
|
||||
public const String PipelineAgentJobRequest = "PipelineAgentJobRequest";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum MachineGroupActionFilter
|
||||
{
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
[EnumMember]
|
||||
Manage = 2,
|
||||
|
||||
[EnumMember]
|
||||
Use = 16,
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a purchase of resource units in a secondary marketplace.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The type of resource purchased (pipelines, minutes) is not represented here.
|
||||
/// </remarks>
|
||||
[DataContract]
|
||||
public sealed class MarketplacePurchasedLicense
|
||||
{
|
||||
/// <summary>
|
||||
/// The Marketplace display name.
|
||||
/// </summary>
|
||||
/// <example>"GitHub"</example>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String MarketplaceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the identity making the purchase as seen by the marketplace
|
||||
/// </summary>
|
||||
/// <example>"AppPreview, Microsoft, etc."</example>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String PurchaserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The quantity purchased.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32 PurchaseUnitCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Metrics columns header
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public sealed class MetricsColumnsHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// Properties of deployment group for which metrics are provided.
|
||||
/// E.g. 1: LastJobStatus
|
||||
/// E.g. 2: TargetState
|
||||
/// </summary>
|
||||
public IList<MetricsColumnMetaData> Dimensions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_dimensions == null)
|
||||
{
|
||||
m_dimensions = new List<MetricsColumnMetaData>();
|
||||
}
|
||||
|
||||
return m_dimensions;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_dimensions = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The types of metrics.
|
||||
/// E.g. 1: total count of deployment targets.
|
||||
/// E.g. 2: Average time of deployment to the deployment targets.
|
||||
/// </summary>
|
||||
public IList<MetricsColumnMetaData> Metrics
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_metrics == null)
|
||||
{
|
||||
m_metrics = new List<MetricsColumnMetaData>();
|
||||
}
|
||||
|
||||
return m_metrics;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_metrics = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Properties of deployment group for which metrics are provided.
|
||||
/// E.g. 1: LastJobStatus
|
||||
/// E.g. 2: TargetState
|
||||
/// </summary>
|
||||
[DataMember(Name = "Dimensions")]
|
||||
private IList<MetricsColumnMetaData> m_dimensions;
|
||||
|
||||
/// <summary>
|
||||
/// The types of metrics.
|
||||
/// E.g. 1: total count of deployment targets.
|
||||
/// E.g. 2: Average time of deployment to the deployment targets.
|
||||
/// </summary>
|
||||
[DataMember(Name = "Metrics")]
|
||||
private IList<MetricsColumnMetaData> m_metrics;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Meta data for a metrics column.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public sealed class MetricsColumnMetaData
|
||||
{
|
||||
/// <summary>
|
||||
/// Name.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String ColumnName
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data type.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String ColumnValueType
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Metrics row.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public sealed class MetricsRow
|
||||
{
|
||||
/// <summary>
|
||||
/// The values of the properties mentioned as 'Dimensions' in column header.
|
||||
/// E.g. 1: For a property 'LastJobStatus' - metrics will be provided for 'passed', 'failed', etc.
|
||||
/// E.g. 2: For a property 'TargetState' - metrics will be provided for 'online', 'offline' targets.
|
||||
/// </summary>
|
||||
public IList<String> Dimensions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_dimensions == null)
|
||||
{
|
||||
m_dimensions = new List<String>();
|
||||
}
|
||||
|
||||
return m_dimensions;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_dimensions = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metrics in serialized format.
|
||||
/// Should be deserialized based on the data type provided in header.
|
||||
/// </summary>
|
||||
public IList<String> Metrics
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_metrics == null)
|
||||
{
|
||||
m_metrics = new List<String>();
|
||||
}
|
||||
|
||||
return m_metrics;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_metrics = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The values of the properties mentioned as 'Dimensions' in column header.
|
||||
/// E.g. 1: For a property 'LastJobStatus' - metrics will be provided for 'passed', 'failed', etc.
|
||||
/// E.g. 2: For a property 'TargetState' - metrics will be provided for 'online', 'offline' targets.
|
||||
/// </summary>
|
||||
[DataMember(Name = "Dimensions")]
|
||||
private IList<String> m_dimensions;
|
||||
|
||||
/// <summary>
|
||||
/// Metrics in serialized format.
|
||||
/// Should be deserialized based on the data type provided in header.
|
||||
/// </summary>
|
||||
[DataMember(Name = "Metrics")]
|
||||
private IList<String> m_metrics;
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.DistributedTask.Pipelines;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class PlanEnvironment : IOrchestrationEnvironment
|
||||
{
|
||||
public PlanEnvironment()
|
||||
{
|
||||
}
|
||||
|
||||
private PlanEnvironment(PlanEnvironment environmentToClone)
|
||||
{
|
||||
if (environmentToClone.m_options != null)
|
||||
{
|
||||
m_options = m_options.ToDictionary(x => x.Key, x => x.Value.Clone());
|
||||
}
|
||||
|
||||
if (environmentToClone.m_maskHints != null)
|
||||
{
|
||||
m_maskHints = environmentToClone.m_maskHints.Select(x => x.Clone()).ToList();
|
||||
}
|
||||
|
||||
if (environmentToClone.m_variables != null)
|
||||
{
|
||||
m_variables = new VariablesDictionary(environmentToClone.m_variables);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of mask hints
|
||||
/// </summary>
|
||||
public List<MaskHint> MaskHints
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_maskHints == null)
|
||||
{
|
||||
m_maskHints = new List<MaskHint>();
|
||||
}
|
||||
return m_maskHints;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of options associated with the current context.
|
||||
/// </summary>
|
||||
/// <remarks>This is being deprecated and should not be used</remarks>
|
||||
public IDictionary<Guid, JobOption> Options
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_options == null)
|
||||
{
|
||||
m_options = new Dictionary<Guid, JobOption>();
|
||||
}
|
||||
return m_options;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of variables associated with the current context.
|
||||
/// </summary>
|
||||
public IDictionary<String, String> Variables
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_variables == null)
|
||||
{
|
||||
m_variables = new VariablesDictionary();
|
||||
}
|
||||
return m_variables;
|
||||
}
|
||||
}
|
||||
|
||||
OrchestrationProcessType IOrchestrationEnvironment.ProcessType
|
||||
{
|
||||
get
|
||||
{
|
||||
return OrchestrationProcessType.Container;
|
||||
}
|
||||
}
|
||||
|
||||
IDictionary<String, VariableValue> IOrchestrationEnvironment.Variables
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_variables == null)
|
||||
{
|
||||
m_variables = new VariablesDictionary();
|
||||
}
|
||||
return m_variables;
|
||||
}
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_serializedOptions, ref m_options, true);
|
||||
SerializationHelper.Copy(ref m_serializedMaskHints, ref m_maskHints, true);
|
||||
|
||||
var secretNames = new HashSet<String>(m_maskHints?.Where(x => x.Type == MaskType.Variable).Select(x => x.Value) ?? new String[0], StringComparer.OrdinalIgnoreCase);
|
||||
if (m_serializedVariables != null && m_serializedVariables.Count > 0)
|
||||
{
|
||||
m_variables = new VariablesDictionary();
|
||||
foreach (var variable in m_serializedVariables)
|
||||
{
|
||||
m_variables[variable.Key] = new VariableValue(variable.Value, secretNames.Contains(variable.Key));
|
||||
}
|
||||
}
|
||||
|
||||
m_serializedVariables = null;
|
||||
}
|
||||
|
||||
[OnSerialized]
|
||||
private void OnSerialized(StreamingContext context)
|
||||
{
|
||||
m_serializedOptions = null;
|
||||
m_serializedMaskHints = null;
|
||||
m_serializedVariables = null;
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_options, ref m_serializedOptions);
|
||||
SerializationHelper.Copy(ref m_maskHints, ref m_serializedMaskHints);
|
||||
|
||||
if (m_variables != null && m_variables.Count > 0)
|
||||
{
|
||||
m_serializedVariables = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var variable in m_variables)
|
||||
{
|
||||
m_serializedVariables[variable.Key] = variable.Value?.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<MaskHint> m_maskHints;
|
||||
private Dictionary<Guid, JobOption> m_options;
|
||||
private VariablesDictionary m_variables;
|
||||
|
||||
[DataMember(Name = "Mask", EmitDefaultValue = false)]
|
||||
private List<MaskHint> m_serializedMaskHints;
|
||||
|
||||
[DataMember(Name = "Options", EmitDefaultValue = false)]
|
||||
private Dictionary<Guid, JobOption> m_serializedOptions;
|
||||
|
||||
[DataMember(Name = "Variables", EmitDefaultValue = false)]
|
||||
private IDictionary<String, String> m_serializedVariables;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum PlanGroupStatus
|
||||
{
|
||||
[EnumMember]
|
||||
Running = 1,
|
||||
|
||||
[EnumMember]
|
||||
Queued = 2,
|
||||
|
||||
[EnumMember]
|
||||
All = Running | Queued
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public enum PlanTemplateType
|
||||
{
|
||||
[DataMember]
|
||||
None = 0,
|
||||
|
||||
[DataMember]
|
||||
Designer = 1,
|
||||
|
||||
[DataMember]
|
||||
System = 2,
|
||||
|
||||
[DataMember]
|
||||
Yaml = 3,
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="ProjectReference.cs" company="Microsoft Corporation">
|
||||
// 2012-2023, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class ProjectReference
|
||||
{
|
||||
[DataMember]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="PublishTaskGroupMetadata.cs" company="Microsoft Corporation">
|
||||
// 2012-2023, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public class PublishTaskGroupMetadata
|
||||
{
|
||||
public Guid TaskGroupId { get; set; }
|
||||
// This is revision of task group that is getting published
|
||||
public int TaskGroupRevision { get; set; }
|
||||
public int ParentDefinitionRevision { get; set; }
|
||||
public Boolean Preview { get; set; }
|
||||
public String Comment { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class ResourceLimit
|
||||
{
|
||||
internal ResourceLimit(
|
||||
Guid hostId,
|
||||
String parallelismTag,
|
||||
Boolean isHosted)
|
||||
{
|
||||
HostId = hostId;
|
||||
ParallelismTag = parallelismTag;
|
||||
IsHosted = isHosted;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Guid HostId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String ParallelismTag
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Boolean IsHosted
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32? TotalCount
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32? TotalMinutes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Boolean IsPremium
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Boolean FailedToReachAllProviders
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IDictionary<String, String> Data
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_resourceLimitsData == null)
|
||||
{
|
||||
m_resourceLimitsData = new Dictionary<String, String>();
|
||||
}
|
||||
|
||||
return m_resourceLimitsData;
|
||||
}
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
if (m_resourceLimitsData?.Count == 0)
|
||||
{
|
||||
m_resourceLimitsData = null;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(Name = "ResourceLimitsData", EmitDefaultValue = false)]
|
||||
private IDictionary<String, String> m_resourceLimitsData;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DataContract]
|
||||
public class ResourceUsage
|
||||
{
|
||||
[DataMember]
|
||||
public ResourceLimit ResourceLimit
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32? UsedCount
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32? UsedMinutes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IList<TaskAgentJobRequest> RunningRequests
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_runningRequests == null)
|
||||
{
|
||||
m_runningRequests = new List<TaskAgentJobRequest>();
|
||||
}
|
||||
|
||||
return m_runningRequests;
|
||||
}
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
if (m_runningRequests?.Count == 0)
|
||||
{
|
||||
m_runningRequests = null;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(Name = "RunningRequests", EmitDefaultValue = false)]
|
||||
private IList<TaskAgentJobRequest> m_runningRequests;
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class SecureFile
|
||||
{
|
||||
public SecureFile()
|
||||
{
|
||||
}
|
||||
|
||||
private SecureFile(SecureFile secureFile, Boolean shallow = false)
|
||||
{
|
||||
this.Id = secureFile.Id;
|
||||
this.Name = secureFile.Name;
|
||||
this.Ticket = secureFile.Ticket;
|
||||
|
||||
if (!shallow)
|
||||
{
|
||||
this.Properties = secureFile.Properties;
|
||||
this.CreatedBy = secureFile.CreatedBy;
|
||||
this.CreatedOn = secureFile.CreatedOn;
|
||||
this.ModifiedBy = secureFile.ModifiedBy;
|
||||
this.ModifiedOn = secureFile.ModifiedOn;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IDictionary<String, String> Properties
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_properties == null)
|
||||
{
|
||||
m_properties = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
return m_properties;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_properties = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IdentityRef CreatedBy
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime CreatedOn
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IdentityRef ModifiedBy
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime ModifiedOn
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Ticket
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public SecureFile Clone()
|
||||
{
|
||||
return new SecureFile(this);
|
||||
}
|
||||
|
||||
public SecureFile CloneShallow()
|
||||
{
|
||||
return new SecureFile(this, true);
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "Properties")]
|
||||
private IDictionary<String, String> m_properties;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum SecureFileActionFilter
|
||||
{
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
[EnumMember]
|
||||
Manage = 2,
|
||||
|
||||
[EnumMember]
|
||||
Use = 16,
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class ServerTaskRequestMessage : JobRequestMessage
|
||||
{
|
||||
internal ServerTaskRequestMessage()
|
||||
: base(JobRequestMessageTypes.ServerTaskRequest)
|
||||
{
|
||||
}
|
||||
|
||||
public ServerTaskRequestMessage(
|
||||
TaskOrchestrationPlanReference plan,
|
||||
TimelineReference timeline,
|
||||
Guid jobId,
|
||||
String jobName,
|
||||
String jobRefName,
|
||||
JobEnvironment environment,
|
||||
TaskInstance taskInstance,
|
||||
TaskDefinition taskDefinition)
|
||||
: base(JobRequestMessageTypes.ServerJobRequest, plan, timeline, jobId, jobName, jobRefName, environment)
|
||||
{
|
||||
TaskDefinition = taskDefinition;
|
||||
TaskInstance = taskInstance;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public TaskDefinition TaskDefinition
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public TaskInstance TaskInstance
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.WebApi.Internal;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
[ClientIgnore]
|
||||
public class ServerTaskSectionExecutionOutput
|
||||
{
|
||||
[DataMember]
|
||||
public Boolean? IsCompleted { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public enum AadLoginPromptOption
|
||||
{
|
||||
/// <summary>
|
||||
/// Do not provide a prompt option
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
NoOption = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Force the user to login again.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Login = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Force the user to select which account they are logging in with instead of
|
||||
/// automatically picking the user up from the session state.
|
||||
/// NOTE: This does not work for switching bewtween the variants of a dual-homed user.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
SelectAccount = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Force the user to login again.
|
||||
/// <remarks>
|
||||
/// Ignore current authentication state and force the user to authenticate again. This option should be used instead of Login.
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
FreshLogin = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Force the user to login again with mfa.
|
||||
/// <remarks>
|
||||
/// Ignore current authentication state and force the user to authenticate again. This option should be used instead of Login, if MFA is required.
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
FreshLoginWithMfa = 4
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class AadOauthTokenRequest
|
||||
{
|
||||
[DataMember]
|
||||
public String Token { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String Resource { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String TenantId { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public Boolean Refresh { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class AadOauthTokenResult
|
||||
{
|
||||
[DataMember]
|
||||
public String AccessToken { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String RefreshTokenCache { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class AzureKeyVaultPermission : AzureResourcePermission
|
||||
{
|
||||
[DataMember]
|
||||
public String Vault { get; set; }
|
||||
|
||||
public AzureKeyVaultPermission() : base(AzurePermissionResourceProviders.AzureKeyVaultPermission)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Azure Management Group
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class AzureManagementGroup
|
||||
{
|
||||
/// <summary>
|
||||
/// Azure management group name
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
[JsonProperty(PropertyName = "Name")]
|
||||
public String Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id of azure management group
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
[JsonProperty(PropertyName = "Id")]
|
||||
public String Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Display name of azure management group
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
[JsonProperty(PropertyName = "displayName")]
|
||||
public String DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id of tenant from which azure management group belogs
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String TenantId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Azure management group query result
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class AzureManagementGroupQueryResult
|
||||
{
|
||||
/// <summary>
|
||||
/// List of azure management groups
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
[JsonProperty("value")]
|
||||
public List<AzureManagementGroup> Value;
|
||||
|
||||
/// <summary>
|
||||
/// Error message in case of an exception
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string ErrorMessage;
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.WebApi;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[JsonConverter(typeof(AzurePermissionJsonConverter))]
|
||||
[KnownType(typeof(AzureKeyVaultPermission))]
|
||||
[DataContract]
|
||||
public abstract class AzurePermission
|
||||
{
|
||||
[DataMember]
|
||||
public String ResourceProvider { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = true)]
|
||||
public Boolean Provisioned { get; set; }
|
||||
|
||||
internal AzurePermission(String resourceProvider)
|
||||
{
|
||||
this.ResourceProvider = resourceProvider;
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class AzurePermissionJsonConverter : VssSecureJsonConverter
|
||||
{
|
||||
public override Boolean CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override Boolean CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override Boolean CanConvert(Type objectType)
|
||||
{
|
||||
return typeof(AzurePermission).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
|
||||
}
|
||||
|
||||
public override Object ReadJson(
|
||||
JsonReader reader,
|
||||
Type objectType,
|
||||
Object existingValue,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
if (reader == null)
|
||||
{
|
||||
throw new ArgumentNullException("reader");
|
||||
}
|
||||
|
||||
if (serializer == null)
|
||||
{
|
||||
throw new ArgumentNullException("serializer");
|
||||
}
|
||||
|
||||
if (reader.TokenType != JsonToken.StartObject)
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
|
||||
var contract = serializer.ContractResolver.ResolveContract(objectType) as JsonObjectContract;
|
||||
if (contract == null)
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
|
||||
JsonProperty resourceProviderProperty = contract.Properties.GetClosestMatchProperty("ResourceProvider");
|
||||
if (resourceProviderProperty == null)
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
|
||||
JToken itemTypeValue;
|
||||
JObject value = JObject.Load(reader);
|
||||
|
||||
if (!value.TryGetValue(resourceProviderProperty.PropertyName, StringComparison.OrdinalIgnoreCase, out itemTypeValue))
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
|
||||
if (itemTypeValue.Type != JTokenType.String)
|
||||
{
|
||||
throw new NotSupportedException("ResourceProvider property is mandatory for azure permission");
|
||||
}
|
||||
|
||||
string resourceProvider = (string)itemTypeValue;
|
||||
AzurePermission returnValue = null;
|
||||
switch (resourceProvider)
|
||||
{
|
||||
case AzurePermissionResourceProviders.AzureRoleAssignmentPermission:
|
||||
returnValue = new AzureRoleAssignmentPermission();
|
||||
break;
|
||||
case AzurePermissionResourceProviders.AzureKeyVaultPermission:
|
||||
returnValue = new AzureKeyVaultPermission();
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException($"{resourceProvider} is not a supported resource provider for azure permission");
|
||||
}
|
||||
|
||||
if (returnValue != null)
|
||||
{
|
||||
using (JsonReader objectReader = value.CreateReader())
|
||||
{
|
||||
serializer.Populate(objectReader, returnValue);
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public override void WriteJson(
|
||||
JsonWriter writer,
|
||||
Object value,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using GitHub.Services.Common;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[GenerateAllConstants]
|
||||
public static class AzurePermissionResourceProviders
|
||||
{
|
||||
public const String AzureRoleAssignmentPermission = "Microsoft.RoleAssignment";
|
||||
public const String AzureKeyVaultPermission = "Microsoft.KeyVault";
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public abstract class AzureResourcePermission : AzurePermission
|
||||
{
|
||||
[DataMember]
|
||||
public String ResourceGroup { get; set; }
|
||||
|
||||
protected AzureResourcePermission(String resourceProvider) : base(resourceProvider)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class AzureRoleAssignmentPermission : AzurePermission
|
||||
{
|
||||
|
||||
[DataMember]
|
||||
public Guid RoleAssignmentId { get; set; }
|
||||
|
||||
public AzureRoleAssignmentPermission() : base(AzurePermissionResourceProviders.AzureRoleAssignmentPermission)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class AzureSubscription
|
||||
{
|
||||
[DataMember]
|
||||
[JsonProperty(PropertyName = "displayName")]
|
||||
public String DisplayName { get; set; }
|
||||
|
||||
[DataMember]
|
||||
[JsonProperty(PropertyName = "subscriptionId")]
|
||||
public String SubscriptionId { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String SubscriptionTenantId { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String SubscriptionTenantName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class AzureSubscriptionQueryResult
|
||||
{
|
||||
[DataMember]
|
||||
[JsonProperty("value")]
|
||||
public List<AzureSubscription> Value;
|
||||
|
||||
[DataMember]
|
||||
public string ErrorMessage;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using CommonContracts = GitHub.DistributedTask.Common.Contracts;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public class DataSourceBinding : CommonContracts.DataSourceBindingBase
|
||||
{
|
||||
public DataSourceBinding()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
private DataSourceBinding(DataSourceBinding inputDefinitionToClone)
|
||||
: base(inputDefinitionToClone)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DataSourceBinding Clone()
|
||||
{
|
||||
return new DataSourceBinding(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,46 +6,12 @@ namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public sealed class EndpointAuthorizationSchemes
|
||||
{
|
||||
public const String AzureStorage = "AzureStorage";
|
||||
public const String OAuth = "OAuth";
|
||||
public const String OAuth2 = "OAuth2";
|
||||
public const String OAuthWrap = "OAuthWrap";
|
||||
public const String Certificate = "Certificate";
|
||||
public const String UsernamePassword = "UsernamePassword";
|
||||
public const String Token = "Token";
|
||||
public const String PersonalAccessToken = "PersonalAccessToken";
|
||||
public const String ServicePrincipal = "ServicePrincipal";
|
||||
public const String None = "None";
|
||||
public const String Jwt = "JWT";
|
||||
public const String InstallationToken = "InstallationToken";
|
||||
}
|
||||
|
||||
public sealed class EndpointAuthorizationParameters
|
||||
{
|
||||
public const String Username = "Username";
|
||||
public const String Password = "Password";
|
||||
public const String Certificate = "Certificate";
|
||||
public const String AccessToken = "AccessToken";
|
||||
public const String ApiToken = "ApiToken";
|
||||
public const String RefreshToken = "RefreshToken";
|
||||
public const String ServicePrincipalId = "ServicePrincipalId";
|
||||
public const String ServicePrincipalKey = "ServicePrincipalKey";
|
||||
public const String TenantId = "TenantId";
|
||||
public const String RealmName = "RealmName";
|
||||
public const String IdToken = "IdToken";
|
||||
public const String Nonce = "nonce";
|
||||
public const String Scope = "Scope";
|
||||
public const String Role = "Role";
|
||||
public const String ServerCertThumbprint = "ServerCertThumbprint";
|
||||
public const String CompleteCallbackPayload = "CompleteCallbackPayload";
|
||||
public const String ClientMail = "ClientMail";
|
||||
public const String PrivateKey = "PrivateKey";
|
||||
public const String Issuer = "Issuer";
|
||||
public const String Audience = "Audience";
|
||||
public const String StorageAccountName = "StorageAccountName";
|
||||
public const String StorageAccessKey = "StorageAccessKey";
|
||||
public const String AccessTokenType = "AccessTokenType";
|
||||
public const String Signature = "Signature";
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
|
||||
@@ -21,47 +21,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
}
|
||||
}
|
||||
|
||||
public static void Copy<T>(
|
||||
ref IList<T> source,
|
||||
ref ISet<T> target,
|
||||
IEqualityComparer<T> comparer,
|
||||
Boolean clearSource = false)
|
||||
{
|
||||
if (source != null && source.Count > 0)
|
||||
{
|
||||
target = new HashSet<T>(source, comparer);
|
||||
}
|
||||
|
||||
if (clearSource)
|
||||
{
|
||||
source = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Copy<T>(
|
||||
ref ISet<T> source,
|
||||
ref IList<T> target,
|
||||
Boolean clearSource = false)
|
||||
{
|
||||
if (source != null && source.Count > 0)
|
||||
{
|
||||
target = new List<T>(source);
|
||||
}
|
||||
|
||||
if (clearSource)
|
||||
{
|
||||
source = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Copy<TKey, TValue>(
|
||||
ref Dictionary<TKey, TValue> source,
|
||||
ref Dictionary<TKey, TValue> target,
|
||||
Boolean clearSource = false)
|
||||
{
|
||||
Copy(ref source, ref target, EqualityComparer<TKey>.Default, clearSource);
|
||||
}
|
||||
|
||||
public static void Copy<TKey, TValue>(
|
||||
ref IDictionary<TKey, TValue> source,
|
||||
ref IDictionary<TKey, TValue> target,
|
||||
@@ -70,23 +29,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
Copy(ref source, ref target, EqualityComparer<TKey>.Default, clearSource);
|
||||
}
|
||||
|
||||
public static void Copy<TKey, TValue>(
|
||||
ref Dictionary<TKey, TValue> source,
|
||||
ref Dictionary<TKey, TValue> target,
|
||||
IEqualityComparer<TKey> comparer,
|
||||
Boolean clearSource = false)
|
||||
{
|
||||
if (source != null && source.Count > 0)
|
||||
{
|
||||
target = new Dictionary<TKey, TValue>(source, comparer);
|
||||
}
|
||||
|
||||
if (clearSource)
|
||||
{
|
||||
source = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Copy<TKey, TValue>(
|
||||
ref IDictionary<TKey, TValue> source,
|
||||
ref IDictionary<TKey, TValue> target,
|
||||
|
||||
@@ -31,8 +31,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
Url = endpointToClone.Url;
|
||||
Description = endpointToClone.Description;
|
||||
GroupScopeId = endpointToClone.GroupScopeId;
|
||||
AdministratorsGroup = endpointToClone.AdministratorsGroup;
|
||||
ReadersGroup = endpointToClone.ReadersGroup;
|
||||
|
||||
if (endpointToClone.Authorization != null)
|
||||
{
|
||||
@@ -45,47 +43,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ValidateServiceEndpoint(ServiceEndpoint endpoint, ref string message)
|
||||
{
|
||||
if (endpoint == null)
|
||||
{
|
||||
message = "endpoint: null";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (endpoint.Id == Guid.Empty)
|
||||
{
|
||||
message = CommonResources.EmptyGuidNotAllowed("endpoint.Id");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(endpoint.Name))
|
||||
{
|
||||
message = string.Format("{0}:{1}", CommonResources.EmptyStringNotAllowed(), "endpoint.Name");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (endpoint.Url == null)
|
||||
{
|
||||
message = "endpoint.Url: null";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(endpoint.Type))
|
||||
{
|
||||
message = string.Format("{0}:{1}", CommonResources.EmptyStringNotAllowed(), "endpoint.Type");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (endpoint.Authorization == null)
|
||||
{
|
||||
message = "endpoint.Authorization: null";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier of this endpoint.
|
||||
/// </summary>
|
||||
@@ -136,17 +93,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identity reference for the user who created the Service endpoint.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IdentityRef CreatedBy
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description of endpoint.
|
||||
/// </summary>
|
||||
@@ -174,26 +120,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identity reference for the administrators group of the service endpoint.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IdentityRef AdministratorsGroup
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identity reference for the readers group of the service endpoint.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IdentityRef ReadersGroup
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the custom data associated with this endpoint.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public static class ServiceEndpointTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Azure endpoint
|
||||
/// </summary>
|
||||
public const String Azure = "Azure";
|
||||
|
||||
/// <summary>
|
||||
/// Chef endpoint
|
||||
/// </summary>
|
||||
public const String Chef = "Chef";
|
||||
|
||||
/// Chef endpoint
|
||||
/// </summary>
|
||||
public const String ExternalTfs = "ExternalTfs";
|
||||
|
||||
/// <summary>
|
||||
/// Generic endpoint
|
||||
/// </summary>
|
||||
public const String Generic = "Generic";
|
||||
|
||||
/// <summary>
|
||||
/// GitHub endpoint
|
||||
/// </summary>
|
||||
public const String GitHub = "GitHub";
|
||||
|
||||
/// <summary>
|
||||
/// GitHub Enterprise endpoint
|
||||
/// </summary>
|
||||
public const String GitHubEnterprise = "GitHubEnterprise";
|
||||
|
||||
/// <summary>
|
||||
/// Bitbucket endpoint
|
||||
/// </summary>
|
||||
public const String Bitbucket = "Bitbucket";
|
||||
|
||||
/// <summary>
|
||||
/// SSH endpoint
|
||||
/// </summary>
|
||||
public const String SSH = "SSH";
|
||||
|
||||
/// <summary>
|
||||
/// Subversion endpoint
|
||||
/// </summary>
|
||||
public const String Subversion = "Subversion";
|
||||
|
||||
/// <summary>
|
||||
///Gcp endpoint
|
||||
/// </summary>
|
||||
public const String Gcp = "google-cloud";
|
||||
|
||||
/// <summary>
|
||||
/// Subversion endpoint
|
||||
/// </summary>
|
||||
public const String Jenkins = "Jenkins";
|
||||
|
||||
/// <summary>
|
||||
/// External Git repository
|
||||
/// </summary>
|
||||
public const String ExternalGit = "Git";
|
||||
|
||||
/// <summary>
|
||||
/// Azure RM endpoint
|
||||
/// </summary>
|
||||
public const String AzureRM = "AzureRM";
|
||||
|
||||
/// <summary>
|
||||
/// Azure Deployment Manager
|
||||
/// </summary>
|
||||
public const String AzureDeploymentManager = "AzureDeploymentManager";
|
||||
|
||||
/// <summary>
|
||||
/// Azure Service Fabric
|
||||
/// </summary>
|
||||
public const String AzureServiceFabric = "ServiceFabric";
|
||||
|
||||
/// <summary>
|
||||
/// Azure Service Fabric
|
||||
/// </summary>
|
||||
public const String Docker = "dockerregistry";
|
||||
|
||||
/// <summary>
|
||||
/// Jira
|
||||
/// </summary>
|
||||
public const String Jira = "Jira";
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,6 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public static class AgentConstants
|
||||
{
|
||||
// 1.x agent has been deprecated.
|
||||
public static readonly String Version = "0.0.0";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A task agent.
|
||||
/// </summary>
|
||||
@@ -59,11 +53,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
m_labels = new HashSet<string>(agentToBeCloned.m_labels, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
if (agentToBeCloned.PendingUpdate != null)
|
||||
{
|
||||
this.PendingUpdate = agentToBeCloned.PendingUpdate.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -126,26 +115,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pending update for this agent.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentUpdate PendingUpdate
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The agent cloud request that's currently associated with this agent.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentCloudRequest AssignedAgentCloudRequest
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The labels of the runner
|
||||
/// </summary>
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentCloud
|
||||
{
|
||||
private TaskAgentCloud(TaskAgentCloud cloudToBeCloned)
|
||||
{
|
||||
this.Id = cloudToBeCloned.Id;
|
||||
this.AgentCloudId = cloudToBeCloned.AgentCloudId;
|
||||
this.Name = cloudToBeCloned.Name;
|
||||
this.AcquireAgentEndpoint = cloudToBeCloned.AcquireAgentEndpoint;
|
||||
this.ReleaseAgentEndpoint = cloudToBeCloned.ReleaseAgentEndpoint;
|
||||
this.SharedSecret = cloudToBeCloned.SharedSecret;
|
||||
this.Internal = cloudToBeCloned.Internal;
|
||||
|
||||
if (cloudToBeCloned.GetAgentDefinitionEndpoint != null)
|
||||
{
|
||||
this.GetAgentDefinitionEndpoint = cloudToBeCloned.GetAgentDefinitionEndpoint;
|
||||
}
|
||||
|
||||
if (cloudToBeCloned.GetAgentRequestStatusEndpoint != null)
|
||||
{
|
||||
this.GetAgentRequestStatusEndpoint = cloudToBeCloned.GetAgentRequestStatusEndpoint;
|
||||
}
|
||||
|
||||
if (cloudToBeCloned.AcquisitionTimeout != null)
|
||||
{
|
||||
this.AcquisitionTimeout = cloudToBeCloned.AcquisitionTimeout;
|
||||
}
|
||||
|
||||
if (cloudToBeCloned.GetAccountParallelismEndpoint != null)
|
||||
{
|
||||
this.GetAccountParallelismEndpoint = cloudToBeCloned.GetAccountParallelismEndpoint;
|
||||
}
|
||||
|
||||
if (cloudToBeCloned.MaxParallelism != null)
|
||||
{
|
||||
this.MaxParallelism = cloudToBeCloned.MaxParallelism;
|
||||
}
|
||||
}
|
||||
|
||||
public TaskAgentCloud()
|
||||
{
|
||||
}
|
||||
|
||||
//Id is used for interacting with pool providers, AgentCloudId is internal Id
|
||||
|
||||
[DataMember]
|
||||
public Guid Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Int32 AgentCloudId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the endpoint.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Type
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Signifies that this Agent Cloud is internal and should not be user-manageable
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Boolean Internal
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String SharedSecret
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a AcquireAgentEndpoint using which a request can be made to acquire new agent
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String AcquireAgentEndpoint
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String ReleaseAgentEndpoint
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, IsRequired = false)]
|
||||
public String GetAgentDefinitionEndpoint
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, IsRequired = false)]
|
||||
public String GetAgentRequestStatusEndpoint
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, IsRequired = false)]
|
||||
public Int32? AcquisitionTimeout
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, IsRequired = false)]
|
||||
public String GetAccountParallelismEndpoint
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, IsRequired = false)]
|
||||
public Int32? MaxParallelism
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public TaskAgentCloud Clone()
|
||||
{
|
||||
return new TaskAgentCloud(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentCloudRequest
|
||||
{
|
||||
private TaskAgentCloudRequest(TaskAgentCloudRequest requestToBeCloned)
|
||||
{
|
||||
this.AgentCloudId = requestToBeCloned.AgentCloudId;
|
||||
this.RequestId = requestToBeCloned.RequestId;
|
||||
this.AgentSpecification = requestToBeCloned.AgentSpecification;
|
||||
this.ProvisionRequestTime = requestToBeCloned.ProvisionRequestTime;
|
||||
this.ProvisionedTime = requestToBeCloned.ProvisionedTime;
|
||||
this.AgentConnectedTime = requestToBeCloned.AgentConnectedTime;
|
||||
this.ReleaseRequestTime = requestToBeCloned.ReleaseRequestTime;
|
||||
|
||||
if (requestToBeCloned.AgentData != null)
|
||||
{
|
||||
this.AgentData = new JObject(requestToBeCloned.AgentData);
|
||||
}
|
||||
|
||||
if (requestToBeCloned.Pool != null)
|
||||
{
|
||||
this.Pool = requestToBeCloned.Pool.Clone();
|
||||
}
|
||||
|
||||
if(requestToBeCloned.Agent != null)
|
||||
{
|
||||
this.Agent = requestToBeCloned.Agent.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
public TaskAgentCloudRequest()
|
||||
{
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Int32 AgentCloudId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Guid RequestId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentPoolReference Pool
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentReference Agent
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public JObject AgentSpecification
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public JObject AgentData
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public DateTime? ProvisionRequestTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public DateTime? ProvisionedTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public DateTime? AgentConnectedTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public DateTime? ReleaseRequestTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public TaskAgentCloudRequest Clone()
|
||||
{
|
||||
return new TaskAgentCloudRequest(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.FormInput;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentCloudType
|
||||
{
|
||||
|
||||
public TaskAgentCloudType()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of agent cloud type.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the display name of agnet cloud type.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String DisplayName { get; set; }
|
||||
|
||||
public List<InputDescriptor> InputDescriptors
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_inputDescriptors ?? (m_inputDescriptors = new List<InputDescriptor>());
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
m_inputDescriptors = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the input descriptors
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false, Name = "InputDescriptors")]
|
||||
private List<InputDescriptor> m_inputDescriptors;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentDelaySource : ICloneable
|
||||
{
|
||||
public TaskAgentDelaySource(TaskAgentReference taskAgent, IEnumerable<TimeSpan> delays)
|
||||
{
|
||||
TaskAgent = taskAgent;
|
||||
Delays = delays.ToList();
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public TaskAgentReference TaskAgent { get; }
|
||||
|
||||
[DataMember]
|
||||
public List<TimeSpan> Delays { get; }
|
||||
|
||||
public TimeSpan TotalDelay
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!m_delay.HasValue)
|
||||
{
|
||||
m_delay = Delays.Aggregate(TimeSpan.Zero, (sum, next) => sum + next);
|
||||
}
|
||||
|
||||
return m_delay.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private TimeSpan? m_delay;
|
||||
|
||||
Object ICloneable.Clone()
|
||||
{
|
||||
return this.Clone();
|
||||
}
|
||||
|
||||
public TaskAgentDelaySource Clone()
|
||||
{
|
||||
return new TaskAgentDelaySource(TaskAgent, new List<TimeSpan>(Delays));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,172 +84,10 @@ namespace GitHub.DistributedTask.WebApi
|
||||
bool? includeAssignedRequest = null,
|
||||
bool? includeLastCompletedRequest = null,
|
||||
IEnumerable<string> propertyFilters = null,
|
||||
IEnumerable<Demand> demands = null,
|
||||
Object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
IEnumerable<String> demandStrings = null;
|
||||
if (demands != null)
|
||||
{
|
||||
demandStrings = demands.Select(d => d.ToString());
|
||||
}
|
||||
return GetAgentsAsync(poolId, agentName, includeCapabilities, includeAssignedRequest, includeLastCompletedRequest, propertyFilters, demandStrings, userState, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API] Get a secure file
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID</param>
|
||||
/// <param name="secureFileId">The unique secure file Id</param>
|
||||
/// <param name="includeDownloadTicket">If includeDownloadTicket is true and the caller has permissions, a download ticket is included in the response.</param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<SecureFile> GetSecureFileAsync(
|
||||
Guid project,
|
||||
Guid secureFileId,
|
||||
bool? includeDownloadTicket = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
return GetSecureFileAsync(project, secureFileId, includeDownloadTicket, actionFilter: null, userState: userState, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API] Get secure files
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID or project name</param>
|
||||
/// <param name="namePattern">Name of the secure file to match. Can include wildcards to match multiple files.</param>
|
||||
/// <param name="includeDownloadTickets">If includeDownloadTickets is true and the caller has permissions, a download ticket for each secure file is included in the response.</param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<List<SecureFile>> GetSecureFilesAsync(
|
||||
string project,
|
||||
string namePattern = null,
|
||||
bool? includeDownloadTickets = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
return GetSecureFilesAsync(project, namePattern, includeDownloadTickets, actionFilter: null, userState: userState, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API] Get secure files
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID</param>
|
||||
/// <param name="namePattern">Name of the secure file to match. Can include wildcards to match multiple files.</param>
|
||||
/// <param name="includeDownloadTickets">If includeDownloadTickets is true and the caller has permissions, a download ticket for each secure file is included in the response.</param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<List<SecureFile>> GetSecureFilesAsync(
|
||||
Guid project,
|
||||
string namePattern = null,
|
||||
bool? includeDownloadTickets = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
return GetSecureFilesAsync(project, namePattern, includeDownloadTickets, actionFilter: null, userState: userState, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API] Get secure files
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID or project name</param>
|
||||
/// <param name="secureFileIds">A list of secure file Ids</param>
|
||||
/// <param name="includeDownloadTickets">If includeDownloadTickets is true and the caller has permissions, a download ticket for each secure file is included in the response.</param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<List<SecureFile>> GetSecureFilesByIdsAsync(
|
||||
string project,
|
||||
IEnumerable<Guid> secureFileIds,
|
||||
bool? includeDownloadTickets = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
return GetSecureFilesByIdsAsync(project, secureFileIds, includeDownloadTickets, actionFilter: null, userState: userState, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API] Get secure files
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID</param>
|
||||
/// <param name="secureFileIds">A list of secure file Ids</param>
|
||||
/// <param name="includeDownloadTickets">If includeDownloadTickets is true and the caller has permissions, a download ticket for each secure file is included in the response.</param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<List<SecureFile>> GetSecureFilesByIdsAsync(
|
||||
Guid project,
|
||||
IEnumerable<Guid> secureFileIds,
|
||||
bool? includeDownloadTickets = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
return GetSecureFilesByIdsAsync(project, secureFileIds, includeDownloadTickets, actionFilter: null, userState: userState, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<Stream> GetTaskContentZipAsync(
|
||||
Guid taskId,
|
||||
TaskVersion version,
|
||||
Object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
var routeValues = new { taskId = taskId, versionString = version.ToString() };
|
||||
HttpRequestMessage requestMessage = await CreateRequestMessageAsync(
|
||||
HttpMethod.Get,
|
||||
TaskResourceIds.Tasks,
|
||||
routeValues: routeValues,
|
||||
version: m_currentApiVersion).ConfigureAwait(false);
|
||||
|
||||
requestMessage.Headers.Accept.Clear();
|
||||
var header = new MediaTypeWithQualityHeaderValue("application/zip");
|
||||
header.Parameters.Add(new NameValueHeaderValue("api-version", m_currentApiVersion.ApiVersionString));
|
||||
header.Parameters.Add(new NameValueHeaderValue("res-version", "1"));
|
||||
requestMessage.Headers.Accept.Add(header);
|
||||
|
||||
HttpResponseMessage response = await SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, userState, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
if (response.StatusCode == HttpStatusCode.NoContent)
|
||||
{
|
||||
throw new Exception("no content");
|
||||
}
|
||||
|
||||
if (!VssStringComparer.ContentType.Equals(response.Content.Headers.ContentType.MediaType, "application/zip"))
|
||||
{
|
||||
throw new Exception("bad content type");
|
||||
}
|
||||
|
||||
if (response.Content.Headers.ContentEncoding.Contains("gzip", StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return new GZipStream(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), CompressionMode.Decompress);
|
||||
}
|
||||
|
||||
return await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public Task<TaskAgentJobRequest> QueueAgentRequestByPoolAsync(
|
||||
Int32 poolId,
|
||||
IList<Demand> demands,
|
||||
Guid serviceOwner,
|
||||
Guid hostId,
|
||||
Guid scopeIdentifier,
|
||||
String hubName,
|
||||
Guid planId,
|
||||
Guid jobId,
|
||||
Object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
var request = new TaskAgentJobRequest
|
||||
{
|
||||
ServiceOwner = serviceOwner,
|
||||
HostId = hostId,
|
||||
PlanType = hubName,
|
||||
ScopeId = scopeIdentifier,
|
||||
PlanId = planId,
|
||||
JobId = jobId
|
||||
};
|
||||
|
||||
return QueueAgentRequestByPoolAsync(poolId, request, userState, cancellationToken);
|
||||
return GetAgentsAsync(poolId, agentName, includeCapabilities, includeAssignedRequest, includeLastCompletedRequest, propertyFilters, null, userState, cancellationToken);
|
||||
}
|
||||
|
||||
public Task<TaskAgentJobRequest> RenewAgentRequestAsync(
|
||||
@@ -279,390 +117,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
return ReplaceAgentAsync(poolId, agent.Id, agent, userState, cancellationToken);
|
||||
}
|
||||
|
||||
public Task SendMessageAsync(
|
||||
Int32 poolId,
|
||||
Int64 requestId,
|
||||
AgentJobRequestMessage request,
|
||||
Object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
var message = new TaskAgentMessage
|
||||
{
|
||||
Body = JsonUtility.ToString(request),
|
||||
MessageType = request.MessageType,
|
||||
};
|
||||
|
||||
return SendMessageAsync(poolId, requestId, message, userState: userState, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
public Task SendMessageAsync(
|
||||
Int32 poolId,
|
||||
Int64 requestId,
|
||||
JobCancelMessage cancel,
|
||||
Object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
var message = new TaskAgentMessage
|
||||
{
|
||||
Body = JsonUtility.ToString(cancel),
|
||||
MessageType = JobCancelMessage.MessageType,
|
||||
};
|
||||
|
||||
return SendMessageAsync(poolId, requestId, message, userState: userState, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<HttpResponseMessage> UploadTaskZipAsync(
|
||||
Guid taskId,
|
||||
Stream fileStream,
|
||||
Boolean overwrite = false,
|
||||
Object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
ArgumentUtility.CheckForNull(fileStream, "fileStream");
|
||||
|
||||
HttpRequestMessage requestMessage;
|
||||
|
||||
if (fileStream.Length == 0)
|
||||
{
|
||||
throw new Exception("file stream of length 0 not allowed.");
|
||||
}
|
||||
|
||||
if (fileStream.Length > 16 * 1024 * 1024)
|
||||
{
|
||||
throw new Exception("file stream too big");
|
||||
}
|
||||
|
||||
Byte[] dataToSend = new Byte[fileStream.Length];
|
||||
|
||||
List<KeyValuePair<String, String>> queryParameters = null;
|
||||
if (overwrite)
|
||||
{
|
||||
queryParameters = new List<KeyValuePair<String, String>>();
|
||||
queryParameters.Add("overwrite", "true");
|
||||
}
|
||||
|
||||
var routeValues = new
|
||||
{
|
||||
taskId = taskId
|
||||
};
|
||||
|
||||
requestMessage = await CreateRequestMessageAsync(HttpMethod.Put,
|
||||
TaskResourceIds.Tasks,
|
||||
routeValues: routeValues,
|
||||
version: m_currentApiVersion,
|
||||
queryParameters: queryParameters,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// inorder for the upload to be retryable, we need the content to be re-readable
|
||||
// to ensure this we copy the chunk into a byte array and send that
|
||||
// chunk size ensures we can convert the length to an int
|
||||
int bytesToCopy = (int)fileStream.Length;
|
||||
using (MemoryStream ms = new MemoryStream(dataToSend))
|
||||
{
|
||||
await fileStream.CopyToAsync(ms, bytesToCopy, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// set the content and the Content-Range header
|
||||
HttpContent byteArrayContent = new ByteArrayContent(dataToSend, 0, bytesToCopy);
|
||||
byteArrayContent.Headers.ContentLength = fileStream.Length;
|
||||
byteArrayContent.Headers.ContentRange = new ContentRangeHeaderValue(0, fileStream.Length - 1, fileStream.Length);
|
||||
byteArrayContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
|
||||
|
||||
requestMessage.Content = byteArrayContent;
|
||||
return await SendAsync(requestMessage, userState, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API]
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID or project name</param>
|
||||
/// <param name="deploymentGroupName"></param>
|
||||
/// <param name="continuationToken"></param>
|
||||
/// <param name="top"></param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<IPagedList<DeploymentGroupMetrics>> GetDeploymentGroupsMetricsAsync2(
|
||||
string project,
|
||||
string deploymentGroupName = null,
|
||||
string continuationToken = null,
|
||||
int? top = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("281c6308-427a-49e1-b83a-dac0f4862189");
|
||||
object routeValues = new { project = project };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
if (!string.IsNullOrEmpty(deploymentGroupName))
|
||||
{
|
||||
queryParams.Add("deploymentGroupName", deploymentGroupName);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(continuationToken))
|
||||
{
|
||||
queryParams.Add("continuationToken", continuationToken);
|
||||
}
|
||||
if (top != null)
|
||||
{
|
||||
queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
return SendAsync<IPagedList<DeploymentGroupMetrics>>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion("4.0-preview.1"),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken,
|
||||
processResponse: GetPagedList<DeploymentGroupMetrics>);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API]
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID</param>
|
||||
/// <param name="deploymentGroupName"></param>
|
||||
/// <param name="continuationToken"></param>
|
||||
/// <param name="top"></param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<IPagedList<DeploymentGroupMetrics>> GetDeploymentGroupsMetricsAsync2(
|
||||
Guid project,
|
||||
string deploymentGroupName = null,
|
||||
string continuationToken = null,
|
||||
int? top = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("281c6308-427a-49e1-b83a-dac0f4862189");
|
||||
object routeValues = new { project = project };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
if (!string.IsNullOrEmpty(deploymentGroupName))
|
||||
{
|
||||
queryParams.Add("deploymentGroupName", deploymentGroupName);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(continuationToken))
|
||||
{
|
||||
queryParams.Add("continuationToken", continuationToken);
|
||||
}
|
||||
if (top != null)
|
||||
{
|
||||
queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
return SendAsync<IPagedList<DeploymentGroupMetrics>>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion("4.0-preview.1"),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken,
|
||||
processResponse: GetPagedList<DeploymentGroupMetrics>);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API]
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID or project name</param>
|
||||
/// <param name="deploymentGroupId"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="partialNameMatch"></param>
|
||||
/// <param name="expand"></param>
|
||||
/// <param name="agentStatus"></param>
|
||||
/// <param name="agentJobResult"></param>
|
||||
/// <param name="continuationToken"></param>
|
||||
/// <param name="top"></param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
/// <param name="propertyFilters"></param>
|
||||
public virtual Task<IPagedList<DeploymentMachine>> GetDeploymentTargetsAsyncWithContinuationToken(
|
||||
string project,
|
||||
int deploymentGroupId,
|
||||
IEnumerable<string> tags = null,
|
||||
string name = null,
|
||||
bool? partialNameMatch = null,
|
||||
DeploymentTargetExpands? expand = null,
|
||||
TaskAgentStatusFilter? agentStatus = null,
|
||||
TaskAgentJobResultFilter? agentJobResult = null,
|
||||
string continuationToken = null,
|
||||
int? top = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken),
|
||||
Boolean? enabled = null,
|
||||
IEnumerable<string> propertyFilters = null)
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("2f0aa599-c121-4256-a5fd-ba370e0ae7b6");
|
||||
object routeValues = new { project = project, deploymentGroupId = deploymentGroupId };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
if (tags != null && tags.Any())
|
||||
{
|
||||
queryParams.Add("tags", string.Join(",", tags));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
queryParams.Add("name", name);
|
||||
}
|
||||
if (partialNameMatch != null)
|
||||
{
|
||||
queryParams.Add("partialNameMatch", partialNameMatch.Value.ToString());
|
||||
}
|
||||
if (expand != null)
|
||||
{
|
||||
queryParams.Add("$expand", expand.Value.ToString());
|
||||
}
|
||||
if (agentStatus != null)
|
||||
{
|
||||
queryParams.Add("agentStatus", agentStatus.Value.ToString());
|
||||
}
|
||||
if (agentJobResult != null)
|
||||
{
|
||||
queryParams.Add("agentJobResult", agentJobResult.Value.ToString());
|
||||
}
|
||||
if (!string.IsNullOrEmpty(continuationToken))
|
||||
{
|
||||
queryParams.Add("continuationToken", continuationToken);
|
||||
}
|
||||
if (top != null)
|
||||
{
|
||||
queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
if (enabled != null)
|
||||
{
|
||||
queryParams.Add("enabled", enabled.Value.ToString());
|
||||
}
|
||||
if (propertyFilters != null && propertyFilters.Any())
|
||||
{
|
||||
queryParams.Add("propertyFilters", string.Join(",", propertyFilters));
|
||||
}
|
||||
|
||||
return SendAsync<IPagedList<DeploymentMachine>>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion("4.1-preview.1"),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken,
|
||||
processResponse: GetPagedList<DeploymentMachine>);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API]
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID</param>
|
||||
/// <param name="deploymentGroupId"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="partialNameMatch"></param>
|
||||
/// <param name="expand"></param>
|
||||
/// <param name="agentStatus"></param>
|
||||
/// <param name="agentJobResult"></param>
|
||||
/// <param name="continuationToken"></param>
|
||||
/// <param name="top"></param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
/// <param name="propertyFilters"></param>
|
||||
public virtual Task<IPagedList<DeploymentMachine>> GetDeploymentTargetsAsyncWithContinuationToken(
|
||||
Guid project,
|
||||
int deploymentGroupId,
|
||||
IEnumerable<string> tags = null,
|
||||
string name = null,
|
||||
bool? partialNameMatch = null,
|
||||
DeploymentTargetExpands? expand = null,
|
||||
TaskAgentStatusFilter? agentStatus = null,
|
||||
TaskAgentJobResultFilter? agentJobResult = null,
|
||||
string continuationToken = null,
|
||||
int? top = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken),
|
||||
Boolean? enabled = null,
|
||||
IEnumerable<string> propertyFilters = null)
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("2f0aa599-c121-4256-a5fd-ba370e0ae7b6");
|
||||
object routeValues = new { project = project, deploymentGroupId = deploymentGroupId };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
if (tags != null && tags.Any())
|
||||
{
|
||||
queryParams.Add("tags", string.Join(",", tags));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
queryParams.Add("name", name);
|
||||
}
|
||||
if (partialNameMatch != null)
|
||||
{
|
||||
queryParams.Add("partialNameMatch", partialNameMatch.Value.ToString());
|
||||
}
|
||||
if (expand != null)
|
||||
{
|
||||
queryParams.Add("$expand", expand.Value.ToString());
|
||||
}
|
||||
if (agentStatus != null)
|
||||
{
|
||||
queryParams.Add("agentStatus", agentStatus.Value.ToString());
|
||||
}
|
||||
if (agentJobResult != null)
|
||||
{
|
||||
queryParams.Add("agentJobResult", agentJobResult.Value.ToString());
|
||||
}
|
||||
if (!string.IsNullOrEmpty(continuationToken))
|
||||
{
|
||||
queryParams.Add("continuationToken", continuationToken);
|
||||
}
|
||||
if (top != null)
|
||||
{
|
||||
queryParams.Add("$top", top.Value.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
if (enabled != null)
|
||||
{
|
||||
queryParams.Add("enabled", enabled.Value.ToString());
|
||||
}
|
||||
if (propertyFilters != null && propertyFilters.Any())
|
||||
{
|
||||
queryParams.Add("propertyFilters", string.Join(",", propertyFilters));
|
||||
}
|
||||
|
||||
return SendAsync<IPagedList<DeploymentMachine>>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion("4.1-preview.1"),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken,
|
||||
processResponse: GetPagedList<DeploymentMachine>);
|
||||
}
|
||||
|
||||
protected async Task<IPagedList<T>> GetPagedList<T>(HttpResponseMessage responseMessage, CancellationToken cancellationToken)
|
||||
{
|
||||
var continuationToken = GetContinuationToken(responseMessage);
|
||||
var list = await ReadContentAsAsync<List<T>>(responseMessage, cancellationToken).ConfigureAwait(false);
|
||||
return new PagedList<T>(list, continuationToken);
|
||||
}
|
||||
|
||||
protected string GetContinuationToken(HttpResponseMessage responseMessage)
|
||||
{
|
||||
string continuationToken = null;
|
||||
|
||||
IEnumerable<string> headerValues = null;
|
||||
if (responseMessage.Headers.TryGetValues("x-ms-continuationtoken", out headerValues))
|
||||
{
|
||||
continuationToken = headerValues.FirstOrDefault();
|
||||
}
|
||||
|
||||
return continuationToken;
|
||||
}
|
||||
|
||||
protected Task<T> SendAsync<T>(
|
||||
HttpMethod method,
|
||||
Guid locationId,
|
||||
|
||||
@@ -1,372 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using GitHub.Services.Common;
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[ResourceArea(TaskResourceIds.AreaId)]
|
||||
public abstract class TaskAgentHttpClientCompatBase : VssHttpClientBase
|
||||
{
|
||||
public TaskAgentHttpClientCompatBase(
|
||||
Uri baseUrl,
|
||||
VssCredentials credentials)
|
||||
: base(baseUrl, credentials)
|
||||
{
|
||||
}
|
||||
|
||||
public TaskAgentHttpClientCompatBase(
|
||||
Uri baseUrl,
|
||||
VssCredentials credentials,
|
||||
VssHttpRequestSettings settings)
|
||||
: base(baseUrl, credentials, settings)
|
||||
{
|
||||
}
|
||||
|
||||
public TaskAgentHttpClientCompatBase(
|
||||
Uri baseUrl,
|
||||
VssCredentials credentials,
|
||||
params DelegatingHandler[] handlers)
|
||||
: base(baseUrl, credentials, handlers)
|
||||
{
|
||||
}
|
||||
|
||||
public TaskAgentHttpClientCompatBase(
|
||||
Uri baseUrl,
|
||||
VssCredentials credentials,
|
||||
VssHttpRequestSettings settings,
|
||||
params DelegatingHandler[] handlers)
|
||||
: base(baseUrl, credentials, settings, handlers)
|
||||
{
|
||||
}
|
||||
|
||||
public TaskAgentHttpClientCompatBase(
|
||||
Uri baseUrl,
|
||||
HttpMessageHandler pipeline,
|
||||
Boolean disposeHandler)
|
||||
: base(baseUrl, pipeline, disposeHandler)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API]
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID or project name</param>
|
||||
/// <param name="taskGroupId"></param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual async Task DeleteTaskGroupAsync(
|
||||
string project,
|
||||
Guid taskGroupId,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("DELETE");
|
||||
Guid locationId = new Guid("6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7");
|
||||
object routeValues = new { project = project, taskGroupId = taskGroupId };
|
||||
|
||||
using (HttpResponseMessage response = await SendAsync(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion("4.0-preview.1"),
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API]
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID</param>
|
||||
/// <param name="taskGroupId"></param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual async Task DeleteTaskGroupAsync(
|
||||
Guid project,
|
||||
Guid taskGroupId,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("DELETE");
|
||||
Guid locationId = new Guid("6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7");
|
||||
object routeValues = new { project = project, taskGroupId = taskGroupId };
|
||||
|
||||
using (HttpResponseMessage response = await SendAsync(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion("4.0-preview.1"),
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API]
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID or project name</param>
|
||||
/// <param name="taskGroupId"></param>
|
||||
/// <param name="expanded"></param>
|
||||
/// <param name="taskIdFilter"></param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<List<TaskGroup>> GetTaskGroupsAsync(
|
||||
string project,
|
||||
Guid? taskGroupId = null,
|
||||
bool? expanded = null,
|
||||
Guid? taskIdFilter = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7");
|
||||
object routeValues = new { project = project, taskGroupId = taskGroupId };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
if (expanded != null)
|
||||
{
|
||||
queryParams.Add("expanded", expanded.Value.ToString());
|
||||
}
|
||||
if (taskIdFilter != null)
|
||||
{
|
||||
queryParams.Add("taskIdFilter", taskIdFilter.Value.ToString());
|
||||
}
|
||||
|
||||
return SendAsync<List<TaskGroup>>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion("4.0-preview.1"),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API]
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID</param>
|
||||
/// <param name="taskGroupId"></param>
|
||||
/// <param name="expanded"></param>
|
||||
/// <param name="taskIdFilter"></param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<List<TaskGroup>> GetTaskGroupsAsync(
|
||||
Guid project,
|
||||
Guid? taskGroupId = null,
|
||||
bool? expanded = null,
|
||||
Guid? taskIdFilter = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7");
|
||||
object routeValues = new { project = project, taskGroupId = taskGroupId };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
if (expanded != null)
|
||||
{
|
||||
queryParams.Add("expanded", expanded.Value.ToString());
|
||||
}
|
||||
if (taskIdFilter != null)
|
||||
{
|
||||
queryParams.Add("taskIdFilter", taskIdFilter.Value.ToString());
|
||||
}
|
||||
|
||||
return SendAsync<List<TaskGroup>>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion("4.0-preview.1"),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API]
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID or project name</param>
|
||||
/// <param name="taskGroupId"></param>
|
||||
/// <param name="expanded"></param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<List<TaskGroup>> GetTaskGroupsAsync(
|
||||
string project,
|
||||
Guid? taskGroupId = null,
|
||||
bool? expanded = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7");
|
||||
object routeValues = new { project = project, taskGroupId = taskGroupId };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
if (expanded != null)
|
||||
{
|
||||
queryParams.Add("expanded", expanded.Value.ToString());
|
||||
}
|
||||
|
||||
return SendAsync<List<TaskGroup>>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion("3.2-preview.1"),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API]
|
||||
/// </summary>
|
||||
/// <param name="project">Project ID</param>
|
||||
/// <param name="taskGroupId"></param>
|
||||
/// <param name="expanded"></param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
public virtual Task<List<TaskGroup>> GetTaskGroupsAsync(
|
||||
Guid project,
|
||||
Guid? taskGroupId = null,
|
||||
bool? expanded = null,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7");
|
||||
object routeValues = new { project = project, taskGroupId = taskGroupId };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
if (expanded != null)
|
||||
{
|
||||
queryParams.Add("expanded", expanded.Value.ToString());
|
||||
}
|
||||
|
||||
return SendAsync<List<TaskGroup>>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion("3.2-preview.1"),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API] Get information about an agent.
|
||||
/// </summary>
|
||||
/// <param name="poolId">The agent pool containing the agent</param>
|
||||
/// <param name="agentId">The agent ID to get information about</param>
|
||||
/// <param name="includeCapabilities">Whether to include the agent's capabilities in the response</param>
|
||||
/// <param name="includeAssignedRequest">Whether to include details about the agent's current work</param>
|
||||
/// <param name="propertyFilters">Filter which custom properties will be returned</param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never), Obsolete]
|
||||
public virtual Task<TaskAgent> GetAgentAsync(
|
||||
int poolId,
|
||||
int agentId,
|
||||
bool? includeCapabilities,
|
||||
bool? includeAssignedRequest,
|
||||
IEnumerable<string> propertyFilters,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("e298ef32-5878-4cab-993c-043836571f42");
|
||||
object routeValues = new { poolId = poolId, agentId = agentId };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
if (includeCapabilities != null)
|
||||
{
|
||||
queryParams.Add("includeCapabilities", includeCapabilities.Value.ToString());
|
||||
}
|
||||
if (includeAssignedRequest != null)
|
||||
{
|
||||
queryParams.Add("includeAssignedRequest", includeAssignedRequest.Value.ToString());
|
||||
}
|
||||
if (propertyFilters != null && propertyFilters.Any())
|
||||
{
|
||||
queryParams.Add("propertyFilters", string.Join(",", propertyFilters));
|
||||
}
|
||||
|
||||
return SendAsync<TaskAgent>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion(5.1, 1),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Preview API] Get a list of agents.
|
||||
/// </summary>
|
||||
/// <param name="poolId">The agent pool containing the agents</param>
|
||||
/// <param name="agentName">Filter on agent name</param>
|
||||
/// <param name="includeCapabilities">Whether to include the agents' capabilities in the response</param>
|
||||
/// <param name="includeAssignedRequest">Whether to include details about the agents' current work</param>
|
||||
/// <param name="propertyFilters">Filter which custom properties will be returned</param>
|
||||
/// <param name="demands">Filter by demands the agents can satisfy</param>
|
||||
/// <param name="userState"></param>
|
||||
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never), Obsolete]
|
||||
public virtual Task<List<TaskAgent>> GetAgentsAsync(
|
||||
int poolId,
|
||||
string agentName,
|
||||
bool? includeCapabilities,
|
||||
bool? includeAssignedRequest,
|
||||
IEnumerable<string> propertyFilters,
|
||||
IEnumerable<string> demands,
|
||||
object userState = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
HttpMethod httpMethod = new HttpMethod("GET");
|
||||
Guid locationId = new Guid("e298ef32-5878-4cab-993c-043836571f42");
|
||||
object routeValues = new { poolId = poolId };
|
||||
|
||||
List<KeyValuePair<string, string>> queryParams = new List<KeyValuePair<string, string>>();
|
||||
if (agentName != null)
|
||||
{
|
||||
queryParams.Add("agentName", agentName);
|
||||
}
|
||||
if (includeCapabilities != null)
|
||||
{
|
||||
queryParams.Add("includeCapabilities", includeCapabilities.Value.ToString());
|
||||
}
|
||||
if (includeAssignedRequest != null)
|
||||
{
|
||||
queryParams.Add("includeAssignedRequest", includeAssignedRequest.Value.ToString());
|
||||
}
|
||||
if (propertyFilters != null && propertyFilters.Any())
|
||||
{
|
||||
queryParams.Add("propertyFilters", string.Join(",", propertyFilters));
|
||||
}
|
||||
if (demands != null && demands.Any())
|
||||
{
|
||||
queryParams.Add("demands", string.Join(",", demands));
|
||||
}
|
||||
|
||||
return SendAsync<List<TaskAgent>>(
|
||||
httpMethod,
|
||||
locationId,
|
||||
routeValues: routeValues,
|
||||
version: new ApiResourceVersion(5.1, 1),
|
||||
queryParameters: queryParams,
|
||||
userState: userState,
|
||||
cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentJob
|
||||
{
|
||||
public TaskAgentJob(
|
||||
Guid id,
|
||||
String name,
|
||||
String container,
|
||||
IList<TaskAgentJobStep> steps,
|
||||
IDictionary<String, String> sidecarContainers,
|
||||
IList<TaskAgentJobVariable> variables)
|
||||
{
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.Container = container;
|
||||
|
||||
m_variables = new List<TaskAgentJobVariable>(variables);
|
||||
m_steps = new List<TaskAgentJobStep>(steps);
|
||||
|
||||
if (sidecarContainers?.Count > 0)
|
||||
{
|
||||
m_sidecarContainers = new Dictionary<String, String>(sidecarContainers, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Guid Id
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Container
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public IList<TaskAgentJobStep> Steps
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_steps == null)
|
||||
{
|
||||
m_steps = new List<TaskAgentJobStep>();
|
||||
}
|
||||
return m_steps;
|
||||
}
|
||||
}
|
||||
|
||||
public IDictionary<String, String> SidecarContainers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_sidecarContainers == null)
|
||||
{
|
||||
m_sidecarContainers = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
return m_sidecarContainers;
|
||||
}
|
||||
}
|
||||
|
||||
public IList<TaskAgentJobVariable> Variables
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_variables == null)
|
||||
{
|
||||
m_variables = new List<TaskAgentJobVariable>();
|
||||
}
|
||||
return m_variables;
|
||||
}
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
if (m_sidecarContainers?.Count == 0)
|
||||
{
|
||||
m_sidecarContainers = null;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(Name = "Steps", EmitDefaultValue = false)]
|
||||
private List<TaskAgentJobStep> m_steps;
|
||||
|
||||
[DataMember(Name = "SidecarContainers", EmitDefaultValue = false)]
|
||||
private IDictionary<String, String> m_sidecarContainers;
|
||||
|
||||
[DataMember(Name = "Variables", EmitDefaultValue = false)]
|
||||
private List<TaskAgentJobVariable> m_variables;
|
||||
}
|
||||
}
|
||||
@@ -45,11 +45,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
m_matchedAgents = requestToBeCloned.m_matchedAgents.Select(x => x.Clone()).ToList();
|
||||
}
|
||||
|
||||
if (requestToBeCloned.m_agentDelays?.Count > 0)
|
||||
{
|
||||
m_agentDelays = new List<TaskAgentDelaySource>(requestToBeCloned.m_agentDelays);
|
||||
}
|
||||
|
||||
if (requestToBeCloned.ReservedAgent != null)
|
||||
{
|
||||
this.ReservedAgent = requestToBeCloned.ReservedAgent.Clone();
|
||||
@@ -228,18 +223,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A list of demands required to fulfill this request.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Order = 16, EmitDefaultValue = false)]
|
||||
[Obsolete("No more demands, use labels", true)]
|
||||
public IList<Demand> Demands
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The agent allocated for this request.
|
||||
/// </summary>
|
||||
@@ -332,23 +315,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(Order = 26, EmitDefaultValue = false)]
|
||||
public List<TaskAgentDelaySource> AgentDelays
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_agentDelays == null)
|
||||
{
|
||||
m_agentDelays = new List<TaskAgentDelaySource>();
|
||||
}
|
||||
return m_agentDelays;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_agentDelays = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(Order = 27, EmitDefaultValue = false)]
|
||||
public TimeSpan? ExpectedDuration
|
||||
{
|
||||
@@ -435,8 +401,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
|
||||
private List<TaskAgentReference> m_matchedAgents;
|
||||
|
||||
private List<TaskAgentDelaySource> m_agentDelays;
|
||||
|
||||
private IDictionary<String, String> m_requestAgentData;
|
||||
|
||||
[DataMember(Name = "MatchedAgents", Order = 18, EmitDefaultValue = false)]
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// This is useful in getting a list of deployment targets, filtered by the result of their last job.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum TaskAgentJobResultFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// Only those deployment targets on which last job failed (**Abandoned**, **Canceled**, **Failed**, **Skipped**).
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Failed = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Only those deployment targets on which last job Passed (**Succeeded**, **Succeeded with issues**).
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Passed = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Only those deployment targets that never executed a job.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
NeverDeployed = 4,
|
||||
|
||||
/// <summary>
|
||||
/// All deployment targets.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
All = Failed | Passed | NeverDeployed
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentJobStep
|
||||
{
|
||||
[DataContract]
|
||||
public enum TaskAgentJobStepType
|
||||
{
|
||||
[DataMember]
|
||||
Task = 1,
|
||||
|
||||
[DataMember]
|
||||
Action = 2
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentJobStepType Type
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Guid Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Boolean Enabled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String Condition
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Boolean ContinueOnError
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Int32 TimeoutInMinutes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public TaskAgentJobTask Task
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public IDictionary<String, String> Env
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public IDictionary<String, String> Inputs
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentJobTask
|
||||
{
|
||||
[DataMember]
|
||||
public Guid Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String Version
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentJobVariable
|
||||
{
|
||||
[DataMember]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String Value
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Boolean Secret
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
private TaskAgentPool(TaskAgentPool poolToBeCloned)
|
||||
{
|
||||
this.AutoProvision = poolToBeCloned.AutoProvision;
|
||||
this.CreatedBy = poolToBeCloned.CreatedBy?.Clone();
|
||||
this.CreatedOn = poolToBeCloned.CreatedOn;
|
||||
this.Id = poolToBeCloned.Id;
|
||||
this.IsHosted = poolToBeCloned.IsHosted;
|
||||
@@ -31,18 +30,10 @@ namespace GitHub.DistributedTask.WebApi
|
||||
this.Scope = poolToBeCloned.Scope;
|
||||
this.Size = poolToBeCloned.Size;
|
||||
this.PoolType = poolToBeCloned.PoolType;
|
||||
this.Owner = poolToBeCloned.Owner?.Clone();
|
||||
this.AgentCloudId = poolToBeCloned.AgentCloudId;
|
||||
this.TargetSize = poolToBeCloned.TargetSize;
|
||||
this.IsLegacy = poolToBeCloned.IsLegacy;
|
||||
|
||||
#pragma warning disable 0618
|
||||
this.AdministratorsGroup = poolToBeCloned.AdministratorsGroup?.Clone();
|
||||
this.GroupScopeId = poolToBeCloned.GroupScopeId;
|
||||
this.Provisioned = poolToBeCloned.Provisioned;
|
||||
this.ServiceAccountsGroup = poolToBeCloned.ServiceAccountsGroup?.Clone();
|
||||
#pragma warning restore 0618
|
||||
|
||||
if (poolToBeCloned.m_properties != null)
|
||||
{
|
||||
m_properties = new PropertiesCollection(poolToBeCloned.m_properties);
|
||||
@@ -101,27 +92,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creator of the pool. The creator of the pool is automatically added into the
|
||||
/// administrators group for the pool on creation.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public IdentityRef CreatedBy
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Owner or administrator of the pool.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public IdentityRef Owner
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Properties which may be used to extend the storage fields available
|
||||
/// for a given machine instance.
|
||||
@@ -142,54 +112,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
}
|
||||
}
|
||||
|
||||
#region Obsolete Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scope identifier for groups/roles which are owned by this pool.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This property is no longer used and will be removed in a future version.", false)]
|
||||
public Guid GroupScopeId
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether or not roles have been provisioned for this pool.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This property is no longer used and will be removed in a future version.", false)]
|
||||
public Boolean Provisioned
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the administrators group for this agent pool.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This property is no longer used and will be removed in a future version.", false)]
|
||||
public IdentityRef AdministratorsGroup
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the service accounts group for this agent pool.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This property is no longer used and will be removed in a future version.", false)]
|
||||
public IdentityRef ServiceAccountsGroup
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public new TaskAgentPool Clone()
|
||||
{
|
||||
return new TaskAgentPool(this);
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Filters pools based on whether the calling user has permission to use or manage the pool.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum TaskAgentPoolActionFilter
|
||||
{
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
[EnumMember]
|
||||
Manage = 2,
|
||||
|
||||
[EnumMember]
|
||||
Use = 16,
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user