mirror of
https://github.com/actions/runner.git
synced 2025-12-28 04:17:51 +08:00
delete un-used code.
This commit is contained in:
committed by
TingluoHuang
parent
f78d35dc4e
commit
f2db563c89
@@ -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,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,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,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,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,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,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,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,162 +96,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
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);
|
||||
}
|
||||
|
||||
public Task<TaskAgentJobRequest> RenewAgentRequestAsync(
|
||||
Int32 poolId,
|
||||
Int64 requestId,
|
||||
@@ -279,390 +123,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,
|
||||
|
||||
@@ -52,321 +52,5 @@ namespace GitHub.DistributedTask.WebApi
|
||||
: 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,168 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentPoolMaintenanceDefinition
|
||||
{
|
||||
internal TaskAgentPoolMaintenanceDefinition()
|
||||
{
|
||||
}
|
||||
|
||||
private TaskAgentPoolMaintenanceDefinition(TaskAgentPoolMaintenanceDefinition maintenanceDefinitionToBeCloned)
|
||||
{
|
||||
this.Enabled = maintenanceDefinitionToBeCloned.Enabled;
|
||||
this.JobTimeoutInMinutes = maintenanceDefinitionToBeCloned.JobTimeoutInMinutes;
|
||||
this.MaxConcurrentAgentsPercentage = maintenanceDefinitionToBeCloned.MaxConcurrentAgentsPercentage;
|
||||
|
||||
if (maintenanceDefinitionToBeCloned.Pool != null)
|
||||
{
|
||||
this.Pool = new TaskAgentPoolReference
|
||||
{
|
||||
Id = maintenanceDefinitionToBeCloned.Pool.Id,
|
||||
Name = maintenanceDefinitionToBeCloned.Pool.Name,
|
||||
Scope = maintenanceDefinitionToBeCloned.Pool.Scope,
|
||||
PoolType = maintenanceDefinitionToBeCloned.Pool.PoolType
|
||||
};
|
||||
}
|
||||
|
||||
this.m_options = maintenanceDefinitionToBeCloned.Options.Clone();
|
||||
this.m_retentionPolicy = maintenanceDefinitionToBeCloned.RetentionPolicy.Clone();
|
||||
this.m_scheduleSetting = maintenanceDefinitionToBeCloned.ScheduleSetting.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 Id
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pool reference for the maintenance definition
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentPoolReference Pool
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enable maintenance
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Boolean Enabled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maintenance job timeout per agent
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 JobTimeoutInMinutes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Max percentage of agents within a pool running maintenance job at given time
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 MaxConcurrentAgentsPercentage
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maintenance option for the definition
|
||||
/// </summary>
|
||||
public TaskAgentPoolMaintenanceOptions Options
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_options == null)
|
||||
{
|
||||
m_options = new TaskAgentPoolMaintenanceOptions()
|
||||
{
|
||||
WorkingDirectoryExpirationInDays = 0,
|
||||
};
|
||||
}
|
||||
|
||||
return m_options;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_options = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The retention setting for the pool maintenance definition.
|
||||
/// </summary>
|
||||
public TaskAgentPoolMaintenanceRetentionPolicy RetentionPolicy
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_retentionPolicy == null)
|
||||
{
|
||||
m_retentionPolicy = new TaskAgentPoolMaintenanceRetentionPolicy()
|
||||
{
|
||||
NumberOfHistoryRecordsToKeep = 1,
|
||||
};
|
||||
}
|
||||
|
||||
return m_retentionPolicy;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_retentionPolicy = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The schedule setting for the pool maintenance job.
|
||||
/// </summary>
|
||||
public TaskAgentPoolMaintenanceSchedule ScheduleSetting
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_scheduleSetting == null)
|
||||
{
|
||||
m_scheduleSetting = new TaskAgentPoolMaintenanceSchedule()
|
||||
{
|
||||
DaysToBuild = TaskAgentPoolMaintenanceScheduleDays.None,
|
||||
};
|
||||
}
|
||||
|
||||
return m_scheduleSetting;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_scheduleSetting = value;
|
||||
}
|
||||
}
|
||||
|
||||
public TaskAgentPoolMaintenanceDefinition Clone()
|
||||
{
|
||||
return new TaskAgentPoolMaintenanceDefinition(this);
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "Options")]
|
||||
public TaskAgentPoolMaintenanceOptions m_options;
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "RetentionPolicy")]
|
||||
private TaskAgentPoolMaintenanceRetentionPolicy m_retentionPolicy;
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "ScheduleSetting")]
|
||||
private TaskAgentPoolMaintenanceSchedule m_scheduleSetting;
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
using GitHub.Services.WebApi;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentPoolMaintenanceJob
|
||||
{
|
||||
internal TaskAgentPoolMaintenanceJob()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Id of the maintenance job
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 JobId
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pool reference for the maintenance job
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentPoolReference Pool
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Orchestration/Plan Id for the maintenance job
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Guid OrchestrationId
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The maintenance definition for the maintenance job
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 DefinitionId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Status of the maintenance job
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public TaskAgentPoolMaintenanceJobStatus Status
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The maintenance job result
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentPoolMaintenanceJobResult? Result
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Time that the maintenance job was queued
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime? QueueTime
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Time that the maintenance job was started
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime? StartTime
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Time that the maintenance job was completed
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime? FinishTime
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The identity that queued the maintenance job
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IdentityRef RequestedBy
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The total error counts during the maintenance job
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 ErrorCount
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The total warning counts during the maintenance job
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 WarningCount
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The log download url for the maintenance job
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String LogsDownloadUrl
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// All agents that the maintenance job will run on
|
||||
/// </summary>
|
||||
public List<TaskAgentPoolMaintenanceJobTargetAgent> TargetAgents
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_targetAgents == null)
|
||||
{
|
||||
m_targetAgents = new List<TaskAgentPoolMaintenanceJobTargetAgent>();
|
||||
}
|
||||
|
||||
return m_targetAgents;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
m_targetAgents = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "TargetAgents")]
|
||||
private List<TaskAgentPoolMaintenanceJobTargetAgent> m_targetAgents;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public enum TaskAgentPoolMaintenanceJobResult
|
||||
{
|
||||
[EnumMember]
|
||||
Succeeded = 1,
|
||||
|
||||
[EnumMember]
|
||||
Failed = 2,
|
||||
|
||||
[EnumMember]
|
||||
Canceled = 4,
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public enum TaskAgentPoolMaintenanceJobStatus
|
||||
{
|
||||
[EnumMember]
|
||||
InProgress = 1,
|
||||
|
||||
[EnumMember]
|
||||
Completed = 2,
|
||||
|
||||
[EnumMember]
|
||||
Cancelling = 4,
|
||||
|
||||
[EnumMember]
|
||||
Queued = 8,
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskAgentPoolMaintenanceJobTargetAgent
|
||||
{
|
||||
internal TaskAgentPoolMaintenanceJobTargetAgent()
|
||||
{
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Int32 JobId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public TaskAgentReference Agent
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentPoolMaintenanceJobStatus? Status
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentPoolMaintenanceJobResult? Result
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class TaskAgentPoolMaintenanceOptions
|
||||
{
|
||||
internal TaskAgentPoolMaintenanceOptions()
|
||||
{
|
||||
}
|
||||
|
||||
private TaskAgentPoolMaintenanceOptions(TaskAgentPoolMaintenanceOptions maintenanceOptionToBeCloned)
|
||||
{
|
||||
this.WorkingDirectoryExpirationInDays = maintenanceOptionToBeCloned.WorkingDirectoryExpirationInDays;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// time to consider a System.DefaultWorkingDirectory is stale
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 WorkingDirectoryExpirationInDays
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public TaskAgentPoolMaintenanceOptions Clone()
|
||||
{
|
||||
return new TaskAgentPoolMaintenanceOptions(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class TaskAgentPoolMaintenanceRetentionPolicy
|
||||
{
|
||||
internal TaskAgentPoolMaintenanceRetentionPolicy()
|
||||
{ }
|
||||
|
||||
private TaskAgentPoolMaintenanceRetentionPolicy(TaskAgentPoolMaintenanceRetentionPolicy maintenanceRetentionPolicyToBeCloned)
|
||||
{
|
||||
this.NumberOfHistoryRecordsToKeep = maintenanceRetentionPolicyToBeCloned.NumberOfHistoryRecordsToKeep;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Number of records to keep for maintenance job executed with this definition.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 NumberOfHistoryRecordsToKeep
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_numberOfHistoryRecordsToKeep;
|
||||
}
|
||||
internal set
|
||||
{
|
||||
if (value < 1)
|
||||
{
|
||||
m_numberOfHistoryRecordsToKeep = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_numberOfHistoryRecordsToKeep = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TaskAgentPoolMaintenanceRetentionPolicy Clone()
|
||||
{
|
||||
return new TaskAgentPoolMaintenanceRetentionPolicy(this);
|
||||
}
|
||||
|
||||
private Int32 m_numberOfHistoryRecordsToKeep;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class TaskAgentPoolMaintenanceSchedule
|
||||
{
|
||||
internal TaskAgentPoolMaintenanceSchedule()
|
||||
{
|
||||
this.DaysToBuild = TaskAgentPoolMaintenanceScheduleDays.None;
|
||||
}
|
||||
|
||||
private TaskAgentPoolMaintenanceSchedule(TaskAgentPoolMaintenanceSchedule maintenanceScheduleToBeCloned)
|
||||
{
|
||||
this.ScheduleJobId = maintenanceScheduleToBeCloned.ScheduleJobId;
|
||||
this.StartHours = maintenanceScheduleToBeCloned.StartHours;
|
||||
this.StartMinutes = maintenanceScheduleToBeCloned.StartMinutes;
|
||||
this.TimeZoneId = maintenanceScheduleToBeCloned.TimeZoneId;
|
||||
this.DaysToBuild = maintenanceScheduleToBeCloned.DaysToBuild;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Job Id of the Scheduled job that will queue the pool maintenance job.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Guid ScheduleJobId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time zone of the build schedule (string representation of the time zone id)
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String TimeZoneId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Local timezone hour to start
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 StartHours { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Local timezone minute to start
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 StartMinutes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Days for a build (flags enum for days of the week)
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public TaskAgentPoolMaintenanceScheduleDays DaysToBuild { get; set; }
|
||||
|
||||
public TaskAgentPoolMaintenanceSchedule Clone()
|
||||
{
|
||||
return new TaskAgentPoolMaintenanceSchedule(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public enum TaskAgentPoolMaintenanceScheduleDays
|
||||
{
|
||||
/// <summary>
|
||||
/// Do not run.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Run on Monday.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Monday = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Run on Tuesday.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Tuesday = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Run on Wednesday.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Wednesday = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Run on Thursday.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Thursday = 8,
|
||||
|
||||
/// <summary>
|
||||
/// Run on Friday.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Friday = 16,
|
||||
|
||||
/// <summary>
|
||||
/// Run on Saturday.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Saturday = 32,
|
||||
|
||||
/// <summary>
|
||||
/// Run on Sunday.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
Sunday = 64,
|
||||
|
||||
/// <summary>
|
||||
/// Run on all days of the week.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
All = Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday,
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// An agent queue.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class TaskAgentQueue
|
||||
{
|
||||
public TaskAgentQueue()
|
||||
{
|
||||
}
|
||||
|
||||
private TaskAgentQueue(TaskAgentQueue queueToBeCloned)
|
||||
{
|
||||
this.Id = queueToBeCloned.Id;
|
||||
this.ProjectId = queueToBeCloned.ProjectId;
|
||||
this.Name = queueToBeCloned.Name;
|
||||
#pragma warning disable 0618
|
||||
this.GroupScopeId = queueToBeCloned.GroupScopeId;
|
||||
this.Provisioned = queueToBeCloned.Provisioned;
|
||||
#pragma warning restore 0618
|
||||
if (queueToBeCloned.Pool != null)
|
||||
{
|
||||
this.Pool = queueToBeCloned.Pool.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ID of the queue
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Int32 Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Project ID
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid ProjectId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name of the queue
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pool reference for this queue
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskAgentPoolReference Pool
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
#region Obsolete Properties
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This property is no longer used and will be removed in a future version.", false)]
|
||||
public Guid GroupScopeId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This property is no longer used and will be removed in a future version.", false)]
|
||||
public Boolean Provisioned
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public TaskAgentQueue Clone()
|
||||
{
|
||||
return new TaskAgentQueue(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Filters queues based on whether the calling user has permission to use or manage the queue.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
[DataContract]
|
||||
public enum TaskAgentQueueActionFilter
|
||||
{
|
||||
[EnumMember]
|
||||
None = 0,
|
||||
|
||||
[EnumMember]
|
||||
Manage = 2,
|
||||
|
||||
[EnumMember]
|
||||
Use = 16,
|
||||
}
|
||||
}
|
||||
@@ -1,552 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
[DebuggerDisplay("Id: {Id}, Name: {Name}, Version: {Version}")]
|
||||
public class TaskDefinition
|
||||
{
|
||||
public TaskDefinition()
|
||||
{
|
||||
this.DefinitionType = TaskDefinitionType.Task;
|
||||
}
|
||||
|
||||
protected TaskDefinition(TaskDefinition taskDefinitionToClone)
|
||||
{
|
||||
if (taskDefinitionToClone.AgentExecution != null)
|
||||
{
|
||||
this.AgentExecution = taskDefinitionToClone.AgentExecution.Clone();
|
||||
}
|
||||
|
||||
if (taskDefinitionToClone.PreJobExecution != null)
|
||||
{
|
||||
this.m_preJobExecution = new Dictionary<String, JObject>(taskDefinitionToClone.m_preJobExecution);
|
||||
}
|
||||
|
||||
if (taskDefinitionToClone.Execution != null)
|
||||
{
|
||||
this.m_execution = new Dictionary<String, JObject>(taskDefinitionToClone.m_execution);
|
||||
}
|
||||
|
||||
if (taskDefinitionToClone.PostJobExecution != null)
|
||||
{
|
||||
this.m_postJobExecution = new Dictionary<String, JObject>(taskDefinitionToClone.m_postJobExecution);
|
||||
}
|
||||
|
||||
this.Author = taskDefinitionToClone.Author;
|
||||
this.Category = taskDefinitionToClone.Category;
|
||||
this.HelpMarkDown = taskDefinitionToClone.HelpMarkDown;
|
||||
this.HelpUrl = taskDefinitionToClone.HelpUrl;
|
||||
this.ContentsUploaded = taskDefinitionToClone.ContentsUploaded;
|
||||
|
||||
if (taskDefinitionToClone.m_visibilities != null)
|
||||
{
|
||||
this.m_visibilities = new List<String>(taskDefinitionToClone.m_visibilities);
|
||||
}
|
||||
|
||||
if (taskDefinitionToClone.m_runsOn != null)
|
||||
{
|
||||
this.m_runsOn = new List<String>(taskDefinitionToClone.m_runsOn);
|
||||
}
|
||||
|
||||
if (this.m_runsOn == null)
|
||||
{
|
||||
this.m_runsOn = new List<String>(TaskRunsOnConstants.DefaultValue);
|
||||
}
|
||||
|
||||
if (taskDefinitionToClone.m_demands != null)
|
||||
{
|
||||
this.m_demands = new List<Demand>(taskDefinitionToClone.m_demands.Select(x => x.Clone()));
|
||||
}
|
||||
|
||||
this.Description = taskDefinitionToClone.Description;
|
||||
this.FriendlyName = taskDefinitionToClone.FriendlyName;
|
||||
this.HostType = taskDefinitionToClone.HostType;
|
||||
this.IconUrl = taskDefinitionToClone.IconUrl;
|
||||
this.Id = taskDefinitionToClone.Id;
|
||||
|
||||
if (taskDefinitionToClone.m_inputs != null)
|
||||
{
|
||||
this.m_inputs = new List<TaskInputDefinition>(taskDefinitionToClone.m_inputs.Select(x => x.Clone()));
|
||||
}
|
||||
|
||||
if (taskDefinitionToClone.m_satisfies != null)
|
||||
{
|
||||
this.m_satisfies = new List<String>(taskDefinitionToClone.m_satisfies);
|
||||
}
|
||||
|
||||
if (taskDefinitionToClone.m_sourceDefinitions != null)
|
||||
{
|
||||
this.m_sourceDefinitions = new List<TaskSourceDefinition>(taskDefinitionToClone.m_sourceDefinitions.Select(x => x.Clone()));
|
||||
}
|
||||
|
||||
if (taskDefinitionToClone.m_dataSourceBindings != null)
|
||||
{
|
||||
this.m_dataSourceBindings = new List<DataSourceBinding>(taskDefinitionToClone.m_dataSourceBindings.Select(x => x.Clone()));
|
||||
}
|
||||
|
||||
if (taskDefinitionToClone.m_groups != null)
|
||||
{
|
||||
this.m_groups = new List<TaskGroupDefinition>(taskDefinitionToClone.m_groups.Select(x => x.Clone()));
|
||||
}
|
||||
|
||||
if (taskDefinitionToClone.m_outputVariables != null)
|
||||
{
|
||||
this.m_outputVariables = new List<TaskOutputVariable>(taskDefinitionToClone.m_outputVariables.Select(x => x.Clone()));
|
||||
}
|
||||
|
||||
this.InstanceNameFormat = taskDefinitionToClone.InstanceNameFormat;
|
||||
this.MinimumAgentVersion = taskDefinitionToClone.MinimumAgentVersion;
|
||||
this.Name = taskDefinitionToClone.Name;
|
||||
this.PackageLocation = taskDefinitionToClone.PackageLocation;
|
||||
this.PackageType = taskDefinitionToClone.PackageType;
|
||||
this.ServerOwned = taskDefinitionToClone.ServerOwned;
|
||||
this.SourceLocation = taskDefinitionToClone.SourceLocation;
|
||||
this.Version = taskDefinitionToClone.Version.Clone();
|
||||
this.ContributionIdentifier = taskDefinitionToClone.ContributionIdentifier;
|
||||
this.ContributionVersion = taskDefinitionToClone.ContributionVersion;
|
||||
this.Deprecated = taskDefinitionToClone.Deprecated;
|
||||
this.Disabled = taskDefinitionToClone.Disabled;
|
||||
this.DefinitionType = taskDefinitionToClone.DefinitionType;
|
||||
this.ShowEnvironmentVariables = taskDefinitionToClone.ShowEnvironmentVariables;
|
||||
this.Preview = taskDefinitionToClone.Preview;
|
||||
this.ReleaseNotes = taskDefinitionToClone.ReleaseNotes;
|
||||
|
||||
if (this.DefinitionType == null)
|
||||
{
|
||||
this.DefinitionType = TaskDefinitionType.Task;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Members to identify this task
|
||||
//
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid Id
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskVersion Version
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Obsolete("Ecosystem property is not currently supported.")]
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Ecosystem
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Boolean ServerOwned
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Boolean ContentsUploaded
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String IconUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// Location Information for acquisition
|
||||
//
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String HostType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String PackageType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String PackageLocation
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String SourceLocation
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String MinimumAgentVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// Helpful Metadata for discovery and designer
|
||||
//
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String FriendlyName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Category
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String HelpMarkDown
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String HelpUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String ReleaseNotes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Boolean Preview
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Boolean Deprecated
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String ContributionIdentifier
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String ContributionVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Boolean Disabled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String DefinitionType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Boolean ShowEnvironmentVariables
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IList<String> Visibility
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_visibilities == null)
|
||||
{
|
||||
m_visibilities = new List<String>();
|
||||
}
|
||||
return m_visibilities;
|
||||
}
|
||||
}
|
||||
|
||||
public IList<String> RunsOn
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_runsOn == null)
|
||||
{
|
||||
m_runsOn = new List<String>(TaskRunsOnConstants.DefaultValue);
|
||||
}
|
||||
|
||||
return m_runsOn;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Author { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IList<Demand> Demands
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_demands == null)
|
||||
{
|
||||
m_demands = new List<Demand>();
|
||||
}
|
||||
return m_demands;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IList<TaskGroupDefinition> Groups
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_groups == null)
|
||||
{
|
||||
m_groups = new List<TaskGroupDefinition>();
|
||||
}
|
||||
return m_groups;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IList<TaskInputDefinition> Inputs
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_inputs == null)
|
||||
{
|
||||
m_inputs = new List<TaskInputDefinition>();
|
||||
}
|
||||
return m_inputs;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IList<String> Satisfies
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_satisfies == null)
|
||||
{
|
||||
m_satisfies = new List<String>();
|
||||
}
|
||||
return m_satisfies;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IList<TaskSourceDefinition> SourceDefinitions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_sourceDefinitions == null)
|
||||
{
|
||||
m_sourceDefinitions = new List<TaskSourceDefinition>();
|
||||
}
|
||||
return m_sourceDefinitions;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IList<DataSourceBinding> DataSourceBindings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_dataSourceBindings == null)
|
||||
{
|
||||
m_dataSourceBindings = new List<DataSourceBinding>();
|
||||
}
|
||||
return m_dataSourceBindings;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String InstanceNameFormat
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
//
|
||||
// Execution members
|
||||
//
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IDictionary<String, JObject> PreJobExecution
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_preJobExecution == null)
|
||||
{
|
||||
m_preJobExecution = new Dictionary<String, JObject>();
|
||||
}
|
||||
return m_preJobExecution;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IDictionary<String, JObject> Execution
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_execution == null)
|
||||
{
|
||||
m_execution = new Dictionary<String, JObject>();
|
||||
}
|
||||
return m_execution;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IDictionary<String, JObject> PostJobExecution
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_postJobExecution == null)
|
||||
{
|
||||
m_postJobExecution = new Dictionary<String, JObject>();
|
||||
}
|
||||
return m_postJobExecution;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskExecution AgentExecution
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IList<TaskOutputVariable> OutputVariables
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_outputVariables == null)
|
||||
{
|
||||
m_outputVariables = new List<TaskOutputVariable>();
|
||||
}
|
||||
return m_outputVariables;
|
||||
}
|
||||
}
|
||||
|
||||
internal TaskDefinition Clone()
|
||||
{
|
||||
return new TaskDefinition(this);
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_serializedVisibilities, ref m_visibilities, true);
|
||||
SerializationHelper.Copy(ref m_serializedRunsOn, ref m_runsOn, true);
|
||||
RenameLegacyRunsOnValues(m_runsOn);
|
||||
SerializationHelper.Copy(ref m_serializedOutputVariables, ref m_outputVariables, true);
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_visibilities, ref m_serializedVisibilities);
|
||||
RenameLegacyRunsOnValues(m_runsOn);
|
||||
SerializationHelper.Copy(ref m_runsOn, ref m_serializedRunsOn);
|
||||
SerializationHelper.Copy(ref m_outputVariables, ref m_serializedOutputVariables);
|
||||
}
|
||||
|
||||
[OnSerialized]
|
||||
private void OnSerialized(StreamingContext context)
|
||||
{
|
||||
m_serializedVisibilities = null;
|
||||
m_serializedRunsOn = null;
|
||||
m_serializedOutputVariables = null;
|
||||
}
|
||||
|
||||
private static void RenameLegacyRunsOnValues(IList<string> runsOn)
|
||||
{
|
||||
for (int i = 0; i < runsOn?.Count(); i++)
|
||||
{
|
||||
if (runsOn[i].Equals(TaskRunsOnConstants.RunsOnMachineGroup, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
runsOn[i] = TaskRunsOnConstants.RunsOnDeploymentGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Private
|
||||
//
|
||||
[DataMember(Name = "Visibility", EmitDefaultValue = false)]
|
||||
private List<String> m_serializedVisibilities;
|
||||
|
||||
[DataMember(Name = "RunsOn", EmitDefaultValue = false)]
|
||||
private List<String> m_serializedRunsOn;
|
||||
|
||||
[DataMember(Name = "OutputVariables", EmitDefaultValue = false)]
|
||||
private List<TaskOutputVariable> m_serializedOutputVariables;
|
||||
|
||||
private Dictionary<String, JObject> m_preJobExecution;
|
||||
private Dictionary<String, JObject> m_execution;
|
||||
private Dictionary<String, JObject> m_postJobExecution;
|
||||
private List<Demand> m_demands;
|
||||
private List<TaskInputDefinition> m_inputs;
|
||||
private List<String> m_satisfies;
|
||||
private List<TaskSourceDefinition> m_sourceDefinitions;
|
||||
private List<DataSourceBinding> m_dataSourceBindings;
|
||||
private List<TaskGroupDefinition> m_groups;
|
||||
private List<TaskOutputVariable> m_outputVariables;
|
||||
private List<String> m_visibilities;
|
||||
private List<String> m_runsOn;
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskDefinitionEndpoint
|
||||
{
|
||||
/// <summary>
|
||||
/// The scope as understood by Connected Services.
|
||||
/// Essentialy, a project-id for now.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String Scope
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// URL to GET.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String Url
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An XPath/Json based selector to filter response returned by fetching
|
||||
/// the endpoint <c>Url</c>. An XPath based selector must be prefixed with
|
||||
/// the string "xpath:". A Json based selector must be prefixed with "jsonpath:".
|
||||
/// <example>
|
||||
/// The following selector defines an XPath for extracting nodes named 'ServiceName'.
|
||||
/// <code>
|
||||
/// endpoint.Selector = "xpath://ServiceName";
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String Selector
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An Json based keyselector to filter response returned by fetching
|
||||
/// the endpoint <c>Url</c>.A Json based keyselector must be prefixed with "jsonpath:".
|
||||
/// KeySelector can be used to specify the filter to get the keys for the values specified with Selector.
|
||||
/// <example>
|
||||
/// The following keyselector defines an Json for extracting nodes named 'ServiceName'.
|
||||
/// <code>
|
||||
/// endpoint.KeySelector = "jsonpath://ServiceName";
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String KeySelector
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An ID that identifies a service connection to be used for authenticating
|
||||
/// endpoint requests.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String ConnectionId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TaskId that this endpoint belongs to.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String TaskId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskDefinitionReference
|
||||
{
|
||||
public TaskDefinitionReference()
|
||||
{
|
||||
// Default is Task
|
||||
this.DefinitionType = TaskDefinitionType.Task;
|
||||
}
|
||||
|
||||
private TaskDefinitionReference(TaskDefinitionReference definitionReference)
|
||||
{
|
||||
this.Id = definitionReference.Id;
|
||||
this.VersionSpec = definitionReference.VersionSpec;
|
||||
|
||||
// If it is null, we set it to task
|
||||
this.DefinitionType = definitionReference.DefinitionType ?? TaskDefinitionType.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of task.
|
||||
/// </summary>
|
||||
[DataMember(IsRequired = true)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the version specification of task.
|
||||
/// </summary>
|
||||
[DataMember(IsRequired = true)]
|
||||
public String VersionSpec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the definition type. Values can be 'task' or 'metaTask'.
|
||||
/// </summary>
|
||||
[DataMember(IsRequired = true)]
|
||||
public String DefinitionType
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_definitionType ?? (this.m_definitionType = TaskDefinitionType.Task);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.m_definitionType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var toEqual = (TaskDefinitionReference)obj;
|
||||
if (toEqual == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.Id.Equals(toEqual.Id) &&
|
||||
(this.VersionSpec?.Equals(toEqual.VersionSpec) ?? this.VersionSpec == toEqual.VersionSpec) &&
|
||||
(this.DefinitionType?.Equals(toEqual.DefinitionType) ?? this.DefinitionType == toEqual.DefinitionType);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.ToString().GetHashCode();
|
||||
}
|
||||
|
||||
internal TaskDefinitionReference Clone()
|
||||
{
|
||||
return new TaskDefinitionReference(this);
|
||||
}
|
||||
|
||||
private String m_definitionType;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
using System;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public class TaskDefinitionType
|
||||
{
|
||||
public const String Task = "task";
|
||||
|
||||
public const String MetaTask = "metaTask";
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskExecution
|
||||
{
|
||||
public TaskExecution()
|
||||
{
|
||||
}
|
||||
|
||||
private TaskExecution(TaskExecution taskExecutionToBeCloned)
|
||||
{
|
||||
if (taskExecutionToBeCloned.ExecTask != null)
|
||||
{
|
||||
this.ExecTask = taskExecutionToBeCloned.ExecTask.Clone();
|
||||
}
|
||||
|
||||
if (taskExecutionToBeCloned.PlatformInstructions != null)
|
||||
{
|
||||
this.PlatformInstructions = new Dictionary<String, Dictionary<String, String>>(taskExecutionToBeCloned.PlatformInstructions, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The utility task to run. Specifying this means that this task definition is simply a meta task to call another task.
|
||||
/// This is useful for tasks that call utility tasks like powershell and commandline
|
||||
/// </summary>
|
||||
[DataMember(Order = 10, EmitDefaultValue = false)]
|
||||
public TaskReference ExecTask
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If a task is going to run code, then this provides the type/script etc... information by platform.
|
||||
/// For example, it might look like.
|
||||
/// net45: {
|
||||
/// typeName: "GitHub.Automation.Tasks.PowerShellTask",
|
||||
/// assemblyName: "GitHub.Automation.Tasks.PowerShell.dll"
|
||||
/// }
|
||||
/// net20: {
|
||||
/// typeName: "GitHub.Automation.Tasks.PowerShellTask",
|
||||
/// assemblyName: "GitHub.Automation.Tasks.PowerShell.dll"
|
||||
/// }
|
||||
/// java: {
|
||||
/// jar: "powershelltask.tasks.automation.teamfoundation.microsoft.com",
|
||||
/// }
|
||||
/// node: {
|
||||
/// script: "powershellhost.js",
|
||||
/// }
|
||||
/// </summary>
|
||||
[DataMember(Order = 20, EmitDefaultValue = false)]
|
||||
public Dictionary<String, Dictionary<String, String>> PlatformInstructions
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
internal TaskExecution Clone()
|
||||
{
|
||||
return new TaskExecution(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskGroup: TaskDefinition
|
||||
{
|
||||
/// <summary>
|
||||
/// A task group lets you to encapsulate a sequence of tasks already defined in a build definition, a release definition or a task group into a single reusable task.
|
||||
/// </summary>
|
||||
public TaskGroup()
|
||||
{
|
||||
this.DefinitionType = TaskDefinitionType.MetaTask;
|
||||
}
|
||||
|
||||
private TaskGroup(TaskGroup definition) : base(definition)
|
||||
{
|
||||
this.DefinitionType = TaskDefinitionType.MetaTask;
|
||||
|
||||
this.Owner = definition.Owner;
|
||||
this.Revision = definition.Revision;
|
||||
this.CreatedOn = definition.CreatedOn;
|
||||
this.ModifiedOn = definition.ModifiedOn;
|
||||
this.Comment = definition.Comment;
|
||||
this.ParentDefinitionId = definition.ParentDefinitionId;
|
||||
|
||||
if (definition.Tasks != null)
|
||||
{
|
||||
this.Tasks = new List<TaskGroupStep>(definition.Tasks.Select(x => x.Clone()));
|
||||
}
|
||||
|
||||
if (definition.CreatedBy != null)
|
||||
{
|
||||
this.CreatedBy = definition.CreatedBy.Clone();
|
||||
}
|
||||
|
||||
if (definition.ModifiedBy != null)
|
||||
{
|
||||
this.ModifiedBy = definition.ModifiedBy.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
public IList<TaskGroupStep> Tasks
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_tasks == null)
|
||||
{
|
||||
m_tasks = new List<TaskGroupStep>();
|
||||
}
|
||||
|
||||
return m_tasks;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
m_tasks = new List<TaskGroupStep>();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_tasks = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the owner.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Owner
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets revision.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 Revision
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identity who created.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public IdentityRef CreatedBy
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets date on which it got created.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public DateTime CreatedOn
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identity who modified.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public IdentityRef ModifiedBy
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets date on which it got modified.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public DateTime ModifiedOn
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets comment.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Comment
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets parent task group Id. This is used while creating a draft task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid? ParentDefinitionId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets as 'true' to indicate as deleted, 'false' otherwise.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public bool Deleted
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
internal new TaskGroup Clone()
|
||||
{
|
||||
return new TaskGroup(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tasks.
|
||||
/// </summary>
|
||||
[DataMember(Name = "Tasks")]
|
||||
private IList<TaskGroupStep> m_tasks;
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskGroupCreateParameter
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets name of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets friendly name of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String FriendlyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets author name of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Author { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets description of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets parent task group Id. This is used while creating a draft task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid? ParentDefinitionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets url icon of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets display name of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String InstanceNameFormat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets category of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets version of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskVersion Version { get; set; }
|
||||
|
||||
public IList<String> RunsOn
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_runsOn == null)
|
||||
{
|
||||
m_runsOn = new List<String>(TaskRunsOnConstants.DefaultValue);
|
||||
}
|
||||
|
||||
return m_runsOn;
|
||||
}
|
||||
}
|
||||
|
||||
public IList<TaskGroupStep> Tasks
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_tasks == null)
|
||||
{
|
||||
m_tasks = new List<TaskGroupStep>();
|
||||
}
|
||||
|
||||
return m_tasks;
|
||||
}
|
||||
}
|
||||
|
||||
public IList<TaskInputDefinition> Inputs
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_inputs == null)
|
||||
{
|
||||
m_inputs = new List<TaskInputDefinition>();
|
||||
}
|
||||
return m_inputs;
|
||||
}
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_serializedRunsOn, ref m_runsOn, true);
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_runsOn, ref m_serializedRunsOn);
|
||||
}
|
||||
|
||||
[OnSerialized]
|
||||
private void OnSerialized(StreamingContext context)
|
||||
{
|
||||
m_serializedRunsOn = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets RunsOn of the task group. Value can be 'Agent', 'Server' or 'DeploymentGroup'.
|
||||
/// </summary>
|
||||
[DataMember(Name = "RunsOn", EmitDefaultValue = false)]
|
||||
private List<String> m_serializedRunsOn;
|
||||
|
||||
/// <summary>
|
||||
/// Sets tasks for the task group.
|
||||
/// </summary>
|
||||
[DataMember(Name = "Tasks", EmitDefaultValue = false)]
|
||||
private IList<TaskGroupStep> m_tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Sets input for the task group.
|
||||
/// </summary>
|
||||
[DataMember(Name = "Inputs", EmitDefaultValue = false)]
|
||||
private List<TaskInputDefinition> m_inputs;
|
||||
|
||||
private List<String> m_runsOn;
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskGroupDefinition
|
||||
{
|
||||
public TaskGroupDefinition()
|
||||
{
|
||||
IsExpanded = false;
|
||||
}
|
||||
|
||||
private TaskGroupDefinition(TaskGroupDefinition inputDefinitionToClone)
|
||||
{
|
||||
this.IsExpanded = inputDefinitionToClone.IsExpanded;
|
||||
this.Name = inputDefinitionToClone.Name;
|
||||
this.DisplayName = inputDefinitionToClone.DisplayName;
|
||||
this.VisibleRule = inputDefinitionToClone.VisibleRule;
|
||||
|
||||
if (inputDefinitionToClone.m_tags != null)
|
||||
{
|
||||
this.m_tags = new List<String>(inputDefinitionToClone.m_tags);
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String DisplayName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = true)]
|
||||
public Boolean IsExpanded
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String VisibleRule
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IList<String> Tags
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_tags == null)
|
||||
{
|
||||
m_tags = new List<String>();
|
||||
}
|
||||
return m_tags;
|
||||
}
|
||||
}
|
||||
|
||||
public TaskGroupDefinition Clone()
|
||||
{
|
||||
return new TaskGroupDefinition(this);
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_serializedTags, ref m_tags, true);
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_tags, ref m_serializedTags);
|
||||
}
|
||||
|
||||
[OnSerialized]
|
||||
private void OnSerialized(StreamingContext context)
|
||||
{
|
||||
m_serializedTags = null;
|
||||
}
|
||||
|
||||
[DataMember(Name = "Tags", EmitDefaultValue = false)]
|
||||
private List<String> m_serializedTags;
|
||||
|
||||
private List<String> m_tags;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
using System;
|
||||
|
||||
[Flags]
|
||||
public enum TaskGroupExpands
|
||||
{
|
||||
None = 0,
|
||||
Tasks = 2,
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="TaskGroupQueryOrder.cs" company="Microsoft Corporation">
|
||||
// 2012-2023, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the desired ordering of taskGroups.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public enum TaskGroupQueryOrder
|
||||
{
|
||||
/// <summary>
|
||||
/// Order by createdon ascending.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
CreatedOnAscending = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Order by createdon descending.
|
||||
/// </summary>
|
||||
[EnumMember]
|
||||
CreatedOnDescending = 1,
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskGroupRevision
|
||||
{
|
||||
[DataMember]
|
||||
public Guid TaskGroupId { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public Int32 Revision { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public Int32 MajorVersion { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public IdentityRef ChangedBy { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public DateTime ChangedDate { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public AuditAction ChangeType { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public Int32 FileId { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public String Comment { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents tasks in the task group.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class TaskGroupStep
|
||||
{
|
||||
public TaskGroupStep()
|
||||
{
|
||||
}
|
||||
|
||||
private TaskGroupStep(TaskGroupStep taskGroupStep)
|
||||
{
|
||||
this.DisplayName = taskGroupStep.DisplayName;
|
||||
this.AlwaysRun = taskGroupStep.AlwaysRun;
|
||||
this.ContinueOnError = taskGroupStep.ContinueOnError;
|
||||
this.Enabled = taskGroupStep.Enabled;
|
||||
this.TimeoutInMinutes = taskGroupStep.TimeoutInMinutes;
|
||||
this.Inputs = new Dictionary<String, String>(taskGroupStep.Inputs);
|
||||
|
||||
if (taskGroupStep.m_environment != null)
|
||||
{
|
||||
foreach (var property in taskGroupStep.m_environment)
|
||||
{
|
||||
this.Environment[property.Key] = property.Value;
|
||||
}
|
||||
}
|
||||
|
||||
this.Task = taskGroupStep.Task.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the display name.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public String DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_displayName == null)
|
||||
{
|
||||
this.m_displayName = String.Empty;
|
||||
}
|
||||
|
||||
return this.m_displayName;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_displayName = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets as 'true' to run the task always, 'false' otherwise.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public bool AlwaysRun { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets as 'true' to continue on error, 'false' otherwise.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public bool ContinueOnError { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets condition for the task.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Condition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets as task is enabled or not.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum time, in minutes, that a task is allowed to execute on agent before being cancelled by server. A zero value indicates an infinite timeout.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public int TimeoutInMinutes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets dictionary of inputs.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public IDictionary<String, String> Inputs { get; set; }
|
||||
|
||||
public IDictionary<string, string> Environment
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_environment == null)
|
||||
{
|
||||
m_environment = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
}
|
||||
return m_environment;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets dictionary of environment variables.
|
||||
/// </summary>
|
||||
[DataMember(Name = "Environment", EmitDefaultValue = false)]
|
||||
private Dictionary<string, string> m_environment;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference of the task.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public TaskDefinitionReference Task { get; set; }
|
||||
|
||||
public static bool EqualsAndOldTaskInputsAreSubsetOfNewTaskInputs(
|
||||
TaskGroupStep oldTaskGroupStep,
|
||||
TaskGroupStep newTaskGroupStep)
|
||||
{
|
||||
if (!oldTaskGroupStep.DisplayName.Equals(newTaskGroupStep.DisplayName)
|
||||
|| oldTaskGroupStep.AlwaysRun != newTaskGroupStep.AlwaysRun
|
||||
|| oldTaskGroupStep.Enabled != newTaskGroupStep.Enabled
|
||||
|| oldTaskGroupStep.ContinueOnError != newTaskGroupStep.ContinueOnError
|
||||
|| !oldTaskGroupStep.Task.Equals(newTaskGroupStep.Task))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(oldTaskGroupStep.Inputs != null && newTaskGroupStep.Inputs != null
|
||||
&& oldTaskGroupStep.Inputs.Keys.All(key => newTaskGroupStep.Inputs.ContainsKey(key)
|
||||
&& newTaskGroupStep.Inputs[key].Equals(oldTaskGroupStep.Inputs[key]))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(oldTaskGroupStep.Environment != null
|
||||
&& oldTaskGroupStep.Environment.Keys.All(key => newTaskGroupStep.Environment.ContainsKey(key)
|
||||
&& newTaskGroupStep.Environment[key].Equals(oldTaskGroupStep.Environment[key]))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
internal TaskGroupStep Clone()
|
||||
{
|
||||
return new TaskGroupStep(this);
|
||||
}
|
||||
|
||||
private String m_displayName;
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskGroupUpdateParameter
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets the unique identifier of this field.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets name of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets friendly name of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String FriendlyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets author name of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Author { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets description of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets comment of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Comment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets revision of the task group.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 Revision { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets parent task group Id. This is used while creating a draft task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid? ParentDefinitionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets url icon of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets display name of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String InstanceNameFormat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets category of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets version of the task group.
|
||||
/// </summary>
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskVersion Version { get; set; }
|
||||
|
||||
public IList<TaskGroupStep> Tasks
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_tasks == null)
|
||||
{
|
||||
m_tasks = new List<TaskGroupStep>();
|
||||
}
|
||||
|
||||
return m_tasks;
|
||||
}
|
||||
}
|
||||
|
||||
public IList<TaskInputDefinition> Inputs
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_inputs == null)
|
||||
{
|
||||
m_inputs = new List<TaskInputDefinition>();
|
||||
}
|
||||
return m_inputs;
|
||||
}
|
||||
}
|
||||
|
||||
public IList<String> RunsOn
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_runsOn == null)
|
||||
{
|
||||
m_runsOn = new List<String>(TaskRunsOnConstants.DefaultValue);
|
||||
}
|
||||
|
||||
return m_runsOn;
|
||||
}
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_serializedRunsOn, ref m_runsOn, true);
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_runsOn, ref m_serializedRunsOn);
|
||||
}
|
||||
|
||||
[OnSerialized]
|
||||
private void OnSerialized(StreamingContext context)
|
||||
{
|
||||
m_serializedRunsOn = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets tasks for the task group.
|
||||
/// </summary>
|
||||
[DataMember(Name = "Tasks")]
|
||||
private IList<TaskGroupStep> m_tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Sets input for the task group.
|
||||
/// </summary>
|
||||
[DataMember(Name = "Inputs", EmitDefaultValue = false)]
|
||||
private List<TaskInputDefinition> m_inputs;
|
||||
|
||||
/// <summary>
|
||||
/// Sets RunsOn of the task group. Value can be 'Agent', 'Server' or 'DeploymentGroup'.
|
||||
/// </summary>
|
||||
[DataMember(Name = "RunsOn", EmitDefaultValue = false)]
|
||||
private List<String> m_serializedRunsOn;
|
||||
|
||||
private List<String> m_runsOn;
|
||||
}
|
||||
}
|
||||
@@ -128,20 +128,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
public Task<TaskAgentJob> GetAgentRequestJobAsync(
|
||||
Guid scopeIdentifier,
|
||||
String planType,
|
||||
String orchestrationId,
|
||||
CancellationToken cancellationToken = default(CancellationToken),
|
||||
Object userState = null)
|
||||
{
|
||||
return base.GetJobInstanceAsync(scopeIdentifier,
|
||||
planType,
|
||||
orchestrationId,
|
||||
userState,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
private readonly ApiResourceVersion m_currentApiVersion = new ApiResourceVersion(2.0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class TaskHubLicenseDetails
|
||||
{
|
||||
public static readonly Int32 DefaultFreeLicenseCount = 0;
|
||||
|
||||
[DataMember(Name = "FreeLicenseCount")]
|
||||
public Int32 FreePrivateLicenseCount;
|
||||
|
||||
[DataMember]
|
||||
public Int32 FreeHostedLicenseCount;
|
||||
|
||||
[DataMember]
|
||||
public Int32 EnterpriseUsersCount;
|
||||
|
||||
/// <summary>
|
||||
/// Self-hosted licenses purchased from VSTS directly.
|
||||
/// </summary>
|
||||
[DataMember(Name = "PurchasedLicenseCount")]
|
||||
public Int32 PurchasedPrivateLicenseCount;
|
||||
|
||||
/// <summary>
|
||||
/// Microsoft-hosted licenses purchased from VSTS directly.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Int32 PurchasedHostedLicenseCount;
|
||||
|
||||
[DataMember]
|
||||
public Boolean HostedLicensesArePremium;
|
||||
|
||||
/// <summary>
|
||||
/// Microsoft-hosted licenses purchased from secondary marketplaces.
|
||||
/// </summary>
|
||||
public List<MarketplacePurchasedLicense> MarketplacePurchasedHostedLicenses
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_marketplacePurchasedHostedLicenses == null)
|
||||
{
|
||||
m_marketplacePurchasedHostedLicenses = new List<MarketplacePurchasedLicense>();
|
||||
}
|
||||
return m_marketplacePurchasedHostedLicenses;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Int32 TotalLicenseCount;
|
||||
|
||||
[DataMember]
|
||||
public Boolean HasLicenseCountEverUpdated;
|
||||
|
||||
[DataMember]
|
||||
public Int32 MsdnUsersCount;
|
||||
|
||||
[DataMember]
|
||||
public Int32 HostedAgentMinutesFreeCount;
|
||||
|
||||
[DataMember]
|
||||
public Int32 HostedAgentMinutesUsedCount;
|
||||
|
||||
[DataMember]
|
||||
public Boolean FailedToReachAllProviders;
|
||||
|
||||
[DataMember]
|
||||
public Int32 TotalPrivateLicenseCount;
|
||||
|
||||
[DataMember]
|
||||
public Int32 TotalHostedLicenseCount;
|
||||
|
||||
[DataMember(Name = "MarketplacePurchasedHostedLicenses", EmitDefaultValue = false)]
|
||||
private List<MarketplacePurchasedLicense> m_marketplacePurchasedHostedLicenses;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.WebApi;
|
||||
using CommonContracts = GitHub.DistributedTask.Common.Contracts;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskInputDefinition : CommonContracts.TaskInputDefinitionBase
|
||||
{
|
||||
public TaskInputDefinition()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
private TaskInputDefinition(TaskInputDefinition inputDefinitionToClone)
|
||||
: base(inputDefinitionToClone)
|
||||
{
|
||||
}
|
||||
|
||||
private TaskInputDefinition(TaskInputDefinition inputDefinitionToClone, ISecuredObject securedObject)
|
||||
: base(inputDefinitionToClone, securedObject)
|
||||
{
|
||||
}
|
||||
|
||||
public TaskInputDefinition Clone()
|
||||
{
|
||||
return new TaskInputDefinition(this);
|
||||
}
|
||||
|
||||
public override CommonContracts.TaskInputDefinitionBase Clone(ISecuredObject securedObject)
|
||||
{
|
||||
return base.Clone(securedObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using CommonContracts = GitHub.DistributedTask.Common.Contracts;
|
||||
using System.Runtime.Serialization;
|
||||
using System;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
public static class TaskInputType
|
||||
{
|
||||
public const String String = CommonContracts.TaskInputType.String;
|
||||
public const String Repository = CommonContracts.TaskInputType.Repository;
|
||||
public const String Boolean = CommonContracts.TaskInputType.Boolean;
|
||||
public const String KeyValue = CommonContracts.TaskInputType.KeyValue;
|
||||
public const String FilePath = CommonContracts.TaskInputType.FilePath;
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class TaskInstance : TaskReference
|
||||
{
|
||||
public TaskInstance()
|
||||
{
|
||||
// Enabled defaults to true
|
||||
this.Enabled = true;
|
||||
}
|
||||
|
||||
private TaskInstance(TaskInstance taskToBeCloned)
|
||||
: base(taskToBeCloned)
|
||||
{
|
||||
this.InstanceId = taskToBeCloned.InstanceId;
|
||||
this.DisplayName = taskToBeCloned.DisplayName;
|
||||
this.Enabled = taskToBeCloned.Enabled;
|
||||
this.Condition = taskToBeCloned.Condition;
|
||||
this.ContinueOnError = taskToBeCloned.ContinueOnError;
|
||||
this.AlwaysRun = taskToBeCloned.AlwaysRun;
|
||||
this.TimeoutInMinutes = taskToBeCloned.TimeoutInMinutes;
|
||||
this.RefName = taskToBeCloned.RefName;
|
||||
|
||||
if (taskToBeCloned.m_environment != null)
|
||||
{
|
||||
m_environment = new Dictionary<String, String>(taskToBeCloned.m_environment, StringComparer.Ordinal);
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Guid InstanceId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String DisplayName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Boolean Enabled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String Condition
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Boolean ContinueOnError
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Boolean AlwaysRun
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public int TimeoutInMinutes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String RefName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public IDictionary<String, String> Environment
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_environment == null)
|
||||
{
|
||||
m_environment = new Dictionary<String, String>(StringComparer.Ordinal);
|
||||
}
|
||||
return m_environment;
|
||||
}
|
||||
}
|
||||
|
||||
public override TaskReference Clone()
|
||||
{
|
||||
return new TaskInstance(this);
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_serializedEnvironment, ref m_environment, StringComparer.Ordinal, true);
|
||||
}
|
||||
|
||||
[OnSerializing]
|
||||
private void OnSerializing(StreamingContext context)
|
||||
{
|
||||
SerializationHelper.Copy(ref m_environment, ref m_serializedEnvironment);
|
||||
}
|
||||
|
||||
[OnSerialized]
|
||||
private void OnSerialized(StreamingContext context)
|
||||
{
|
||||
m_serializedEnvironment = null;
|
||||
}
|
||||
|
||||
private IDictionary<String, String> m_environment;
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Name = "Environment")]
|
||||
private IDictionary<String, String> m_serializedEnvironment;
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class TaskOrchestrationContainer : TaskOrchestrationItem, IOrchestrationProcess
|
||||
{
|
||||
public TaskOrchestrationContainer()
|
||||
: base(TaskOrchestrationItemType.Container)
|
||||
{
|
||||
ContinueOnError = true;
|
||||
MaxConcurrency = Int32.MaxValue;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Boolean Parallel
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public List<TaskOrchestrationItem> Children
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_children == null)
|
||||
{
|
||||
m_children = new List<TaskOrchestrationItem>();
|
||||
}
|
||||
|
||||
return m_children;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskOrchestrationContainer Rollback
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = true)]
|
||||
public Boolean ContinueOnError
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = true)]
|
||||
public Int32 MaxConcurrency
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get additional specifications for this container.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This provides an extensibility for consumers of DT SDK to pass additional data
|
||||
/// to Orchestrations. Each Orchestration is free to interpret this data as appropriate.
|
||||
/// </remarks>
|
||||
public IDictionary<String, String> Data
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_data == null)
|
||||
{
|
||||
m_data = new Dictionary<String, String>();
|
||||
}
|
||||
|
||||
return m_data;
|
||||
}
|
||||
}
|
||||
|
||||
OrchestrationProcessType IOrchestrationProcess.ProcessType
|
||||
{
|
||||
get
|
||||
{
|
||||
return OrchestrationProcessType.Container;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<TaskOrchestrationJob> GetJobs()
|
||||
{
|
||||
var containerQueue = new Queue<TaskOrchestrationContainer>();
|
||||
containerQueue.Enqueue(this);
|
||||
|
||||
while (containerQueue.Count > 0)
|
||||
{
|
||||
var currentContainer = containerQueue.Dequeue();
|
||||
foreach (var item in currentContainer.Children)
|
||||
{
|
||||
switch (item.ItemType)
|
||||
{
|
||||
case TaskOrchestrationItemType.Container:
|
||||
containerQueue.Enqueue((TaskOrchestrationContainer)item);
|
||||
break;
|
||||
|
||||
case TaskOrchestrationItemType.Job:
|
||||
yield return item as TaskOrchestrationJob;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(Name = "Children")]
|
||||
private List<TaskOrchestrationItem> m_children;
|
||||
|
||||
[DataMember(Name = "Data", EmitDefaultValue = false)]
|
||||
private IDictionary<String, String> m_data;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
[KnownType(typeof(TaskOrchestrationContainer))]
|
||||
[KnownType(typeof(TaskOrchestrationJob))]
|
||||
[JsonConverter(typeof(TaskOrchestrationItemJsonConverter))]
|
||||
public abstract class TaskOrchestrationItem
|
||||
{
|
||||
protected TaskOrchestrationItem(TaskOrchestrationItemType itemType)
|
||||
{
|
||||
this.ItemType = itemType;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public TaskOrchestrationItemType ItemType
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
using GitHub.Services.WebApi;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
internal sealed class TaskOrchestrationItemJsonConverter : VssSecureJsonConverter
|
||||
{
|
||||
public override Boolean CanConvert(Type objectType)
|
||||
{
|
||||
return typeof(TaskOrchestrationItem).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;
|
||||
}
|
||||
|
||||
var contract = serializer.ContractResolver.ResolveContract(objectType) as JsonObjectContract;
|
||||
if (contract == null)
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
|
||||
JsonProperty property = contract.Properties.GetClosestMatchProperty("ItemType");
|
||||
if (property == null)
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
|
||||
JToken itemTypeValue;
|
||||
TaskOrchestrationItemType itemType;
|
||||
JObject value = JObject.Load(reader);
|
||||
if (!value.TryGetValue(property.PropertyName, out itemTypeValue))
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemTypeValue.Type == JTokenType.Integer)
|
||||
{
|
||||
itemType = (TaskOrchestrationItemType)(Int32)itemTypeValue;
|
||||
}
|
||||
else if (itemTypeValue.Type != JTokenType.String ||
|
||||
!Enum.TryParse<TaskOrchestrationItemType>((String)itemTypeValue, true, out itemType))
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
}
|
||||
|
||||
Object newValue = null;
|
||||
switch (itemType)
|
||||
{
|
||||
case TaskOrchestrationItemType.Container:
|
||||
newValue = new TaskOrchestrationContainer();
|
||||
break;
|
||||
|
||||
case TaskOrchestrationItemType.Job:
|
||||
newValue = new TaskOrchestrationJob();
|
||||
break;
|
||||
}
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public enum TaskOrchestrationItemType
|
||||
{
|
||||
[EnumMember]
|
||||
Container,
|
||||
|
||||
[EnumMember]
|
||||
Job,
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using GitHub.Services.WebApi;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public sealed class TaskOrchestrationJob : TaskOrchestrationItem
|
||||
{
|
||||
internal TaskOrchestrationJob()
|
||||
: base(TaskOrchestrationItemType.Job)
|
||||
{
|
||||
this.ExecutionMode = JobExecutionModeTypes.Agent;
|
||||
}
|
||||
|
||||
public TaskOrchestrationJob(
|
||||
Guid instanceId,
|
||||
String name,
|
||||
String refName,
|
||||
string executionMode = JobExecutionModeTypes.Agent)
|
||||
: base(TaskOrchestrationItemType.Job)
|
||||
{
|
||||
this.InstanceId = instanceId;
|
||||
this.Name = name;
|
||||
this.RefName = refName;
|
||||
this.ExecutionMode = executionMode;
|
||||
}
|
||||
|
||||
private TaskOrchestrationJob(TaskOrchestrationJob jobToBeCloned)
|
||||
: base(jobToBeCloned.ItemType)
|
||||
{
|
||||
this.InstanceId = jobToBeCloned.InstanceId;
|
||||
this.Name = jobToBeCloned.Name;
|
||||
this.RefName = jobToBeCloned.RefName;
|
||||
this.ExecutionMode = jobToBeCloned.ExecutionMode;
|
||||
this.ExecutionTimeout = jobToBeCloned.ExecutionTimeout;
|
||||
|
||||
if (jobToBeCloned.ExecuteAs != null)
|
||||
{
|
||||
this.ExecuteAs = new IdentityRef
|
||||
{
|
||||
DisplayName = jobToBeCloned.ExecuteAs.DisplayName,
|
||||
Id = jobToBeCloned.ExecuteAs.Id,
|
||||
ImageUrl = jobToBeCloned.ExecuteAs.ImageUrl,
|
||||
IsAadIdentity = jobToBeCloned.ExecuteAs.IsAadIdentity,
|
||||
IsContainer = jobToBeCloned.ExecuteAs.IsContainer,
|
||||
ProfileUrl = jobToBeCloned.ExecuteAs.ProfileUrl,
|
||||
UniqueName = jobToBeCloned.ExecuteAs.UniqueName,
|
||||
Url = jobToBeCloned.ExecuteAs.Url,
|
||||
};
|
||||
}
|
||||
|
||||
if (jobToBeCloned.m_demands != null)
|
||||
{
|
||||
m_demands = jobToBeCloned.Demands.Select(x => x.Clone()).ToList();
|
||||
}
|
||||
|
||||
if (jobToBeCloned.m_variables != null)
|
||||
{
|
||||
m_variables = new Dictionary<String, String>(jobToBeCloned.m_variables, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
if (jobToBeCloned.m_tasks != null)
|
||||
{
|
||||
m_tasks = jobToBeCloned.m_tasks.Select(x => (TaskInstance)x.Clone()).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Guid InstanceId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public String RefName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public string ExecutionMode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public IdentityRef ExecuteAs
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TimeSpan? ExecutionTimeout
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public List<Demand> Demands
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_demands == null)
|
||||
{
|
||||
m_demands = new List<Demand>();
|
||||
}
|
||||
|
||||
return m_demands;
|
||||
}
|
||||
}
|
||||
|
||||
public IDictionary<String, String> Variables
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_variables == null)
|
||||
{
|
||||
m_variables = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
return m_variables;
|
||||
}
|
||||
}
|
||||
|
||||
public List<TaskInstance> Tasks
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_tasks == null)
|
||||
{
|
||||
m_tasks = new List<TaskInstance>();
|
||||
}
|
||||
|
||||
return m_tasks;
|
||||
}
|
||||
}
|
||||
|
||||
public TaskOrchestrationJob Clone()
|
||||
{
|
||||
return new TaskOrchestrationJob(this);
|
||||
}
|
||||
|
||||
[DataMember(Name = "Demands", EmitDefaultValue = false)]
|
||||
private List<Demand> m_demands;
|
||||
|
||||
[DataMember(Name = "Variables", EmitDefaultValue = false)]
|
||||
private IDictionary<String, String> m_variables;
|
||||
|
||||
[DataMember(Name = "Tasks", EmitDefaultValue = false)]
|
||||
private List<TaskInstance> m_tasks;
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskOrchestrationPlan : TaskOrchestrationPlanReference
|
||||
{
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime? StartTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public DateTime? FinishTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public TaskOrchestrationPlanState State
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskResult? Result
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public String ResultCode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TimelineReference Timeline
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public PlanEnvironment Environment
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_environment;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_environment = value;
|
||||
m_processEnvironment = value;
|
||||
}
|
||||
}
|
||||
|
||||
public TaskOrchestrationContainer Implementation
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_implementation;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_process = value;
|
||||
m_implementation = value;
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public IOrchestrationProcess Process
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_process;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_process = value;
|
||||
m_implementation = value as TaskOrchestrationContainer;
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public IOrchestrationEnvironment ProcessEnvironment
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_processEnvironment;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_processEnvironment = value;
|
||||
m_environment = value as PlanEnvironment;
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid RequestedById
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public Guid RequestedForId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
internal PlanTemplateType TemplateType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(EmitDefaultValue = false)]
|
||||
public TaskLogReference InitializationLog
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// Currently these members are not serialized on the wire since that would technically be an API break for
|
||||
// the 1.0 version. While additive, existing clients wouldn't understand it and could blow up. Until this
|
||||
// public model is finalized we will not send this data over the wire and will not revision the API.
|
||||
private IOrchestrationProcess m_process;
|
||||
private IOrchestrationEnvironment m_processEnvironment;
|
||||
|
||||
[DataMember(Name = "Environment", EmitDefaultValue = false)]
|
||||
private PlanEnvironment m_environment;
|
||||
|
||||
[DataMember(Name = "Implementation", EmitDefaultValue = false)]
|
||||
private TaskOrchestrationContainer m_implementation;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
[DataContract]
|
||||
public class TaskOrchestrationPlanGroupsQueueMetrics
|
||||
{
|
||||
[DataMember]
|
||||
public PlanGroupStatus Status
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public Int32 Count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user