Trim Build2 SDK (#219)

* Trim Build2 SDK REST API methods
* Remove unused files
This commit is contained in:
Julio Barba
2019-12-12 13:53:12 -05:00
committed by GitHub
parent 181dac1c07
commit f78d35dc4e
140 changed files with 1 additions and 22539 deletions

View File

@@ -1,12 +0,0 @@
using System;
using GitHub.Services.Common;
namespace GitHub.Build.WebApi {
[GenerateAllConstants]
public static class AgentTargetExecutionType {
public const Int32 Normal = 0;
public const Int32 VariableMultipliers = 1;
public const Int32 MultipleAgents = 2;
}
}

View File

@@ -1,76 +1,14 @@
using System;
using System.ComponentModel;
using GitHub.Services.Common;
namespace GitHub.Build.WebApi
{
[Obsolete("Use ArtifactResourceTypes instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static class WellKnownArtifactResourceTypes
{
public const String FilePath = ArtifactResourceTypes.FilePath;
public const String SymbolStore = ArtifactResourceTypes.SymbolStore;
public const String VersionControl = ArtifactResourceTypes.VersionControl;
public const String Container = ArtifactResourceTypes.Container;
public const String GitRef = ArtifactResourceTypes.GitRef;
public const String TfvcLabel = ArtifactResourceTypes.TfvcLabel;
public const String SymbolRequest = ArtifactResourceTypes.SymbolRequest;
}
[GenerateAllConstants]
public static class ArtifactResourceTypes
{
/// <summary>
/// UNC or local folder path
/// E.g. \\vscsstor\CIDrops\CloudU.Gated\140317.115955 or file://vscsstor/CIDrops/CloudU.Gated/140317.115955
/// </summary>
public const String FilePath = "FilePath";
/// <summary>
/// Symbol store UNC path
/// E.g. \\symbolstore
/// </summary>
public const String SymbolStore = "SymbolStore";
/// <summary>
/// TF VC server folder path
/// E.g. $/Dev1/Drops/CloudU.Gated/140317.115955
/// </summary>
public const String VersionControl = "VersionControl";
/// <summary>
/// Build container reference
/// E.g. #/2121/drop
/// </summary>
public const String Container = "Container";
/// <summary>
/// Git ref
/// E.g. refs/tags/MyCIDefinition.Buildable
/// </summary>
public const String GitRef = "GitRef";
/// <summary>
/// TFVC label
/// </summary>
public const String TfvcLabel = "TfvcLabel";
/// <summary>
/// Symbol store URL
/// E.g. https://mseng.artifacts.visualstudio.com/...
/// </summary>
public const String SymbolRequest = "SymbolRequest";
/// <summary>
/// Dedup Drop (old name fo PipelineArtifact)
/// E.g. drop1
/// </summary>
public const String Drop = "Drop";
/// <summary>
/// Dedup'ed pipeline artifact
/// E.g. artifact1
/// </summary>
public const String PipelineArtifact = "PipelineArtifact";
}
}

View File

@@ -1,17 +0,0 @@
using GitHub.Services.Common;
namespace GitHub.Build.WebApi
{
public static class BuildDefinitionExtensions
{
public static T GetProcess<T>(
this BuildDefinition definition) where T : BuildProcess
{
ArgumentUtility.CheckForNull(definition, nameof(definition));
ArgumentUtility.CheckForNull(definition.Process, nameof(definition.Process));
ArgumentUtility.CheckType<T>(definition.Process, nameof(definition.Process), nameof(T));
return definition.Process as T;
}
}
}

View File

@@ -1,44 +0,0 @@
using System;
using System.IO;
using System.Text;
using GitHub.Build.WebApi.Internals;
using GitHub.Services.WebApi;
using Newtonsoft.Json;
namespace GitHub.Build.WebApi
{
public static class BuildDefinitionHelpers
{
public static BuildDefinition Deserialize(
String definitionString)
{
var definition = JsonUtility.FromString<BuildDefinition>(definitionString);
if (definition?.Process == null)
{
var legacyDefinition = JsonConvert.DeserializeObject<BuildDefinition3_2>(definitionString);
definition = legacyDefinition.ToBuildDefinition();
}
return definition;
}
public static BuildDefinitionTemplate GetTemplateFromStream(
Stream stream)
{
String templateString;
using (var reader = new StreamReader(stream, Encoding.UTF8, false, 1024, true))
{
templateString = reader.ReadToEnd();
}
var template = JsonConvert.DeserializeObject<BuildDefinitionTemplate>(templateString);
if (template?.Template?.Process == null)
{
var legacyTemplate = JsonConvert.DeserializeObject<BuildDefinitionTemplate3_2>(templateString);
template = legacyTemplate.ToBuildDefinitionTemplate();
}
return template;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +0,0 @@
using System;
namespace GitHub.Build.WebApi
{
public static class BuildIssueKeys
{
public const String CodeCategory = "code";
public const String SourcePath = "sourcePath";
public const String LineNumber = "lineNumber";
public const String Message = "message";
}
[Obsolete("Use BuildIssueKeys instead.")]
public static class WellKnownBuildKeys
{
public const String BuildIssueCodeCategory = BuildIssueKeys.CodeCategory;
public const String BuildIssueFileKey = BuildIssueKeys.SourcePath;
public const String BuildIssueLineNumberKey = BuildIssueKeys.LineNumber;
public const String BuildIssueMessageKey = BuildIssueKeys.Message;
}
}

View File

@@ -1,12 +0,0 @@
using System;
using GitHub.Services.Common;
namespace GitHub.Build.WebApi
{
[GenerateAllConstants]
public static class BuildOrchestrationType
{
public const Int32 Build = 1;
public const Int32 Cleanup = 2;
}
}

View File

@@ -1,40 +0,0 @@
using System;
namespace GitHub.Build.WebApi
{
public static class BuildPermissions
{
public static readonly Int32 ViewBuilds = 1;
public static readonly Int32 EditBuildQuality = 2;
public static readonly Int32 RetainIndefinitely = 4;
public static readonly Int32 DeleteBuilds = 8;
public static readonly Int32 ManageBuildQualities = 16;
public static readonly Int32 DestroyBuilds = 32;
public static readonly Int32 UpdateBuildInformation = 64;
public static readonly Int32 QueueBuilds = 128;
public static readonly Int32 ManageBuildQueue = 256;
public static readonly Int32 StopBuilds = 512;
public static readonly Int32 ViewBuildDefinition = 1024;
public static readonly Int32 EditBuildDefinition = 2048;
public static readonly Int32 DeleteBuildDefinition = 4096;
public static readonly Int32 OverrideBuildCheckInValidation = 8192;
public static readonly Int32 AdministerBuildPermissions = 16384;
public static readonly Int32 AllPermissions =
ViewBuilds |
EditBuildQuality |
RetainIndefinitely |
DeleteBuilds |
ManageBuildQualities |
DestroyBuilds |
UpdateBuildInformation |
QueueBuilds |
ManageBuildQueue |
StopBuilds |
ViewBuildDefinition |
EditBuildDefinition |
DeleteBuildDefinition |
OverrideBuildCheckInValidation |
AdministerBuildPermissions;
}
}

View File

@@ -1,165 +1,10 @@
using System;
using GitHub.Services.Common;
namespace GitHub.Build.WebApi
{
[GenerateAllConstants(alternateName: "Build2ResourceIds")]
public static class BuildResourceIds
{
// keep these sorted
public const String AreaId = "5D6898BB-45EC-463F-95F9-54D49C71752E";
public const String AreaName = "build";
public static readonly Guid Artifacts = new Guid("{1DB06C96-014E-44E1-AC91-90B2D4B3E984}");
public const String ArtifactsResource = "artifacts";
public const String AttachmentLocation = "AF5122D3-3438-485E-A25A-2DBBFDE84EE6";
public static readonly Guid Attachment = new Guid(AttachmentLocation);
public const String AttachmentsLocation = "F2192269-89FA-4F94-BAF6-8FB128C55159";
public static readonly Guid Attachments = new Guid(AttachmentsLocation);
public const String AttachmentsResource = "attachments";
public static readonly Guid BuildBadge = new Guid("21b3b9ce-fad5-4567-9ad0-80679794e003");
public const String BuildBadgeResource = "buildbadge";
public const String BuildChangesLocationId = "54572C7B-BBD3-45D4-80DC-28BE08941620";
public static readonly Guid BuildChangesBetweenBuilds = new Guid("{F10F0EA5-18A1-43EC-A8FB-2042C7BE9B43}");
public static readonly Guid BuildChanges = new Guid(BuildChangesLocationId);
public const String BuildChangesResource = "changes";
public static readonly Guid BuildDefinitionBadge = new Guid("de6a4df8-22cd-44ee-af2d-39f6aa7a4261");
public const String BuildDefinitionBadgeResource = "badge";
public static readonly Guid BuildDeployments = new Guid("{F275BE9A-556A-4EE9-B72F-F9C8370CCAEE}");
public const String BuildDeploymentsResource = "deployments";
public static readonly Guid BuildLogs = new Guid("{35A80DAF-7F30-45FC-86E8-6B813D9C90DF}");
public const String BuildLogsResource = "logs";
public const String BuildPropertiesLocationString = "0A6312E9-0627-49B7-8083-7D74A64849C9";
public static readonly Guid BuildProperties = new Guid(BuildPropertiesLocationString);
public static readonly Guid BuildReport = new Guid("{45BCAA88-67E1-4042-A035-56D3B4A7D44C}");
public const String BuildReportResource = "report";
public static readonly Guid Builds = new Guid("{0CD358E1-9217-4D94-8269-1C1EE6F93DCF}");
public const String BuildsResource = "builds";
public const String BuildTagsLocationIdString = "6E6114B2-8161-44C8-8F6C-C5505782427F";
public static readonly Guid BuildTags = new Guid(BuildTagsLocationIdString);
public const String BuildTagsResource = "tags";
public const String BuildWorkItemsLocationId = "5A21F5D2-5642-47E4-A0BD-1356E6731BEE";
public static readonly Guid BuildWorkItemsBetweenBuilds = new Guid("{52BA8915-5518-42E3-A4BB-B0182D159E2D}");
public static readonly Guid BuildWorkItems = new Guid(BuildWorkItemsLocationId);
public const String BuildWorkItemsResource = "workitems";
public const String ControllersLocationString = "{FCAC1932-2EE1-437F-9B6F-7F696BE858F6}";
public static readonly Guid Controllers = new Guid(ControllersLocationString);
public const String ControllersResource = "Controllers";
public const String DefinitionMetricsLocationString = "D973B939-0CE0-4FEC-91D8-DA3940FA1827";
public static readonly Guid DefinitionMetrics = new Guid(DefinitionMetricsLocationString);
public const String DefinitionMetricsResource = "metrics";
public const String DefinitionPropertiesLocationString = "D9826AD7-2A68-46A9-A6E9-677698777895";
public static readonly Guid DefinitionProperties = new Guid(DefinitionPropertiesLocationString);
public static readonly Guid DefinitionResources = new Guid("ea623316-1967-45eb-89ab-e9e6110cf2d6");
public const String DefinitionResourcesResource = "resources";
public static readonly Guid DefinitionRevisions = new Guid("{7C116775-52E5-453E-8C5D-914D9762D8C4}");
public const String DefinitionRevisionsResource = "revisions";
public static readonly Guid Definitions = new Guid("{DBEAF647-6167-421A-BDA9-C9327B25E2E6}");
public const String DefinitionsResource = "definitions";
public const String DefinitionTagsLocationIdString = "CB894432-134A-4D31-A839-83BECEAACE4B";
public static readonly Guid DefinitionTags = new Guid(DefinitionTagsLocationIdString);
public static readonly Guid Folders = new Guid("{A906531B-D2DA-4F55-BDA7-F3E676CC50D9}");
public const String FoldersResource = "folders";
// information nodes for XAML builds
public static readonly Guid InformationNodes = new Guid("9F094D42-B41C-4920-95AA-597581A79821");
public static readonly Guid InputValuesQuery = new Guid("{2182A7F0-B363-4B2D-B89E-ED0A0B721E95}");
public const String InputValuesQueryResource = "InputValuesQuery";
public static readonly Guid LatestBuildLocationId = new Guid("54481611-01F4-47F3-998F-160DA0F0C229");
public const String LatestBuildResource = "latest";
public static readonly Guid Metrics = new Guid("104AD424-B758-4699-97B7-7E7DA427F9C2");
public const String MetricsResource = "Metrics";
public static readonly Guid Options = new Guid("{591CB5A4-2D46-4F3A-A697-5CD42B6BD332}");
public const String OptionsResource = "options";
public const String ProjectMetricsLocationString = "7433FAE7-A6BC-41DC-A6E2-EEF9005CE41A";
public static readonly Guid ProjectMetrics = new Guid(ProjectMetricsLocationString);
public static readonly Guid ProjectAuthorizedResources = new Guid("398c85bc-81aa-4822-947c-a194a05f0fef");
public const String ProjectAuthorizedResourcesResource = "authorizedresources";
public const String PropertiesResource = "properties";
public static readonly Guid Queues = new Guid("{09F2A4B8-08C9-4991-85C3-D698937568BE}");
public const String QueuesResource = "queues";
public static readonly Guid Settings = new Guid("{AA8C1C9C-EF8B-474A-B8C4-785C7B191D0D}");
public const String SettingsResource = "settings";
public const String SourceProviderBranchesResource = "branches";
public const String SourceProviderBranchesLocationIdString = "E05D4403-9B81-4244-8763-20FDE28D1976";
public static readonly Guid SourceProviderBranchesLocationId = new Guid(SourceProviderBranchesLocationIdString);
public const String SourceProviderFileContentsResource = "fileContents";
public const String SourceProviderFileContentsLocationIdString = "29D12225-B1D9-425F-B668-6C594A981313";
public static readonly Guid SourceProviderFileContentsLocationId = new Guid(SourceProviderFileContentsLocationIdString);
public const String SourceProviderPathContentsResource = "pathContents";
public const String SourceProviderPathContentsLocationIdString = "7944D6FB-DF01-4709-920A-7A189AA34037";
public static readonly Guid SourceProviderPathContentsLocationId = new Guid(SourceProviderPathContentsLocationIdString);
public const String SourceProviderPullRequestsResource = "pullRequests";
public const String SourceProviderPullRequestsLocationIdString = "D8763EC7-9FF0-4FB4-B2B2-9D757906FF14";
public static readonly Guid SourceProviderPullRequestsLocationId = new Guid(SourceProviderPullRequestsLocationIdString);
public const String SourceProviderRepositoriesResource = "repositories";
public const String SourceProviderRepositoriesLocationIdString = "D44D1680-F978-4834-9B93-8C6E132329C9";
public static readonly Guid SourceProviderRepositoriesLocationId = new Guid(SourceProviderRepositoriesLocationIdString);
public const String SourceProviderRestoreWebhooksLocationIdString = "793BCEB8-9736-4030-BD2F-FB3CE6D6B478";
public static readonly Guid SourceProviderRestoreWebhooksLocationId = new Guid(SourceProviderRestoreWebhooksLocationIdString);
public const String SourceProvidersResource = "sourceProviders";
public const String SourceProvidersLocationIdString = "3CE81729-954F-423D-A581-9FEA01D25186";
public static readonly Guid SourceProviders = new Guid(SourceProvidersLocationIdString);
public const String SourceProviderWebhooksResource = "webhooks";
public const String SourceProviderWebhooksLocationIdString = "8F20FF82-9498-4812-9F6E-9C01BDC50E99";
public static readonly Guid SourceProviderWebhooksLocationId = new Guid(SourceProviderWebhooksLocationIdString);
public const String SourcesLocationId = "56EFDCDC-CF90-4028-9D2F-D41000682202";
public static readonly Guid Sources = new Guid(SourcesLocationId);
public const String SourcesResource = "sources";
public const String StatusBadgeLocationIdString = "07ACFDCE-4757-4439-B422-DDD13A2FCC10";
public static readonly Guid StatusBadgeLocationId = new Guid(StatusBadgeLocationIdString);
public const String StatusBadgeResource = "status";
public const String TagsLocationIdString = "D84AC5C6-EDC7-43D5-ADC9-1B34BE5DEA09";
public static readonly Guid Tags = new Guid(TagsLocationIdString);
public static readonly Guid Templates = new Guid("{E884571E-7F92-4D6A-9274-3F5649900835}");
public const String TemplatesResource = "templates";
public static readonly Guid Timelines = new Guid("8baac422-4c6e-4de5-8532-db96d92acffa");
public const String TimelinesResource = "Timeline";
public static readonly Guid Usage = new Guid("3813d06c-9e36-4ea1-aac3-61a485d60e3d");
public const String UsageResource = "ResourceUsage";
}
}

View File

@@ -1,29 +0,0 @@
using System;
using GitHub.Services.Common;
namespace GitHub.Build.WebApi
{
[GenerateAllConstants]
public static class BuildTemplateCategories
{
public static readonly String All = "All";
public static readonly String Build = "Build";
public static readonly String Utility = "Utility";
public static readonly String Test = "Test";
public static readonly String Package = "Package";
public static readonly String Deploy = "Deploy";
public static readonly String Tool = "Tool";
public static readonly String Custom = "Custom";
public static readonly String[] AllCategories = new String[] {
All,
Build,
Utility,
Test,
Package,
Deploy,
Tool,
Custom
};
}
}

View File

@@ -1,87 +1,13 @@
using System;
using GitHub.Services.Common;
namespace GitHub.Build.WebApi
{
/* IMPORTANT NOTE: if you're adding a new build variable that's designed to hold PII data
(e.g. names, addresses, phone numbers, IP addresses, emails), please add a corresponding reference to `PiiVariables` at
https://github.com/Microsoft/azure-pipelines-agent/blob/master/src/Agent.Worker/Variables.cs
This is so the agent can scrub the variable value from the diagnostics log. */
[GenerateAllConstants]
public static class BuildVariables
{
public const String CollectionId = "system.collectionId";
public const String DefinitionId = "system.definitionId";
public const String HostType = "system.hosttype";
public const String IsFork = "system.pullRequest.isFork";
public const String ForkSecretsRemoved= "system.pullRequest.forkSecretsRemoved";
public const String PullRequestId = "system.pullRequest.pullRequestId";
public const String PullRequestNumber = "system.pullRequest.pullRequestNumber";
public const String PullRequestIterationId = "system.pullRequest.pullRequestIteration";
public const String PullRequestSourceBranch = "system.pullRequest.sourceBranch";
public const String PullRequestTargetBranch = "system.pullRequest.targetBranch";
public const String PullRequestSourceRepositoryUri = "system.pullRequest.sourceRepositoryUri";
public const String PullRequestSourceCommitId = "system.pullRequest.sourceCommitId";
public const String PullRequestMergedAt = "system.pullRequest.mergedAt";
public const String System = "system";
public const String TeamProject = "system.teamProject";
public const String TeamProjectId = "system.teamProjectId";
public const String BuildId = "build.buildId";
public const String BuildNumber = "build.buildNumber";
public const String BuildUri = "build.buildUri";
public const String ContainerId = "build.containerId";
public const String DefinitionName = "build.definitionName";
public const String DefinitionVersion = "build.definitionVersion";
public const String JobAuthorizeAs = "Job.AuthorizeAs";
public const String JobAuthorizeAsId = "Job.AuthorizeAsId";
public const String QueuedBy = "build.queuedBy";
public const String QueuedById = "build.queuedById";
public const String Reason = "build.reason";
public const String RepoUri = "build.repository.uri";
public const String RequestedFor = "build.requestedFor";
public const String RequestedForEmail = "build.requestedForEmail";
public const String RequestedForId = "build.requestedForId";
public const String SourceBranch = "build.sourceBranch";
public const String SourceBranchName = "build.sourceBranchName";
public const String SourceTfvcShelveset = "build.sourceTfvcShelveset";
public const String SourceVersion = "build.sourceVersion";
public const String SourceVersionAuthor = "build.sourceVersionAuthor";
public const String SourceVersionMessage = "build.sourceVersionMessage";
public const String SyncSources = "build.syncSources";
}
[Obsolete("Use BuildVariables instead.")]
public static class WellKnownBuildVariables
{
public const String System = BuildVariables.System;
public const String CollectionId = BuildVariables.CollectionId;
public const String TeamProject = BuildVariables.TeamProject;
public const String TeamProjectId = BuildVariables.TeamProjectId;
public const String DefinitionId = BuildVariables.DefinitionId;
public const String HostType = BuildVariables.HostType;
public const String IsFork = BuildVariables.IsFork;
public const String DefinitionName = BuildVariables.DefinitionName;
public const String DefinitionVersion = BuildVariables.DefinitionVersion;
public const String QueuedBy = BuildVariables.QueuedBy;
public const String QueuedById = BuildVariables.QueuedById;
public const String Reason = BuildVariables.Reason;
public const String RequestedFor = BuildVariables.RequestedFor;
public const String RequestedForId = BuildVariables.RequestedForId;
public const String RequestedForEmail = BuildVariables.RequestedForEmail;
public const String SourceBranch = BuildVariables.SourceBranch;
public const String SourceBranchName = BuildVariables.SourceBranchName;
public const String SourceVersion = BuildVariables.SourceVersion;
public const String SourceVersionAuthor = BuildVariables.SourceVersionAuthor;
public const String SourceVersionMessage = BuildVariables.SourceVersionMessage;
public const String SourceTfvcShelveset = BuildVariables.SourceTfvcShelveset;
public const String BuildId = BuildVariables.BuildId;
public const String BuildUri = BuildVariables.BuildUri;
public const String BuildNumber = BuildVariables.BuildNumber;
public const String ContainerId = BuildVariables.ContainerId;
public const String SyncSources = BuildVariables.SyncSources;
public const String JobAuthorizeAs = BuildVariables.JobAuthorizeAs;
public const String JobAuthorizeAsId = BuildVariables.JobAuthorizeAsId;
public const String RepoUri = BuildVariables.RepoUri;
}
}

View File

@@ -1,134 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.Common;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a queue for running builds.
/// </summary>
[DataContract]
#pragma warning disable 618
public class AgentPoolQueue : ShallowReference, ISecuredObject
#pragma warning restore 618
{
public AgentPoolQueue()
{
}
internal AgentPoolQueue(
ISecuredObject securedObject)
{
this.m_securedObject = securedObject;
}
/// <summary>
/// The ID of the queue.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public new Int32 Id
{
get
{
return base.Id;
}
set
{
base.Id = value;
}
}
/// <summary>
/// The name of the queue.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public new String Name
{
get
{
return base.Name;
}
set
{
base.Name = value;
}
}
/// <summary>
/// The full http link to the resource.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public new String Url
{
get
{
return base.Url;
}
set
{
base.Url = value;
}
}
/// <summary>
/// The pool used by this queue.
/// </summary>
[DataMember]
public TaskAgentPoolReference Pool
{
get;
set;
}
/// <summary>
/// The links to other objects related to this object.
/// </summary>
public ReferenceLinks Links
{
get
{
if (m_links == null)
{
m_links = new ReferenceLinks();
}
return m_links;
}
}
[DataMember(Name = "_links", EmitDefaultValue = false)]
private ReferenceLinks m_links;
#region ISecuredObject implementation
[IgnoreDataMember]
Guid ISecuredObject.NamespaceId
{
get
{
ArgumentUtility.CheckForNull(m_securedObject, nameof(m_securedObject));
return m_securedObject.NamespaceId;
}
}
[IgnoreDataMember]
Int32 ISecuredObject.RequiredPermissions
{
get
{
ArgumentUtility.CheckForNull(m_securedObject, nameof(m_securedObject));
return m_securedObject.RequiredPermissions;
}
}
String ISecuredObject.GetToken()
{
ArgumentUtility.CheckForNull(m_securedObject, nameof(m_securedObject));
return m_securedObject.GetToken();
}
private ISecuredObject m_securedObject;
#endregion
}
}

View File

@@ -1,102 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Describes how a phase should run against an agent queue.
/// </summary>
[DataContract]
public class AgentPoolQueueTarget : PhaseTarget
{
public AgentPoolQueueTarget()
: this(null)
{
}
internal AgentPoolQueueTarget(
ISecuredObject securedObject)
: base(PhaseTargetType.Agent, securedObject)
{
}
/// <summary>
/// The queue.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public AgentPoolQueue Queue
{
get;
set;
}
/// <summary>
/// Agent specification of the target.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public AgentSpecification AgentSpecification
{
get;
set;
}
/// <summary>
/// The list of demands required for the queue.
/// </summary>
public List<Demand> Demands
{
get
{
if (m_demands == null)
{
m_demands = new List<Demand>();
}
return m_demands;
}
set
{
m_demands = new List<Demand>(value);
}
}
/// <summary>
/// The execution options.
/// </summary>
[DataMember]
public AgentTargetExecutionOptions ExecutionOptions
{
get;
set;
}
/// <summary>
/// Enables scripts and other processes launched while executing phase to access the OAuth token
/// </summary>
[DataMember]
public Boolean AllowScriptsAuthAccessOption
{
get;
set;
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedDemands, ref m_demands, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_demands, ref m_serializedDemands);
}
[DataMember(Name = "Demands", EmitDefaultValue = false)]
private List<Demand> m_serializedDemands;
private List<Demand> m_demands;
}
}

View File

@@ -1,28 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Specification of the agent defined by the pool provider.
/// </summary>
[DataContract]
public class AgentSpecification: BaseSecuredObject
{
public AgentSpecification()
{
}
public AgentSpecification(ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// Agent specification unique identifier.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Identifier { get; set; }
}
}

View File

@@ -1,51 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
using Newtonsoft.Json;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Additional options for running phases against an agent queue.
/// </summary>
[DataContract]
[KnownType(typeof(MultipleAgentExecutionOptions))]
[KnownType(typeof(VariableMultipliersAgentExecutionOptions))]
[JsonConverter(typeof(AgentTargetExecutionOptionsJsonConverter))]
public class AgentTargetExecutionOptions : BaseSecuredObject
{
public AgentTargetExecutionOptions()
: this(AgentTargetExecutionType.Normal)
{
}
protected AgentTargetExecutionOptions(Int32 type)
: this(type, null)
{
}
internal AgentTargetExecutionOptions(
ISecuredObject securedObject)
: this(AgentTargetExecutionType.Normal, securedObject)
{
}
internal AgentTargetExecutionOptions(
Int32 type,
ISecuredObject securedObject)
: base(securedObject)
{
this.Type = type;
}
/// <summary>
/// Indicates the type of execution options.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Int32 Type
{
get;
set;
}
}
}

View File

@@ -1,42 +0,0 @@
using System;
namespace GitHub.Build.WebApi
{
internal sealed class AgentTargetExecutionOptionsJsonConverter : TypePropertyJsonConverter<AgentTargetExecutionOptions>
{
protected override AgentTargetExecutionOptions GetInstance(Type objectType)
{
if (objectType == typeof(AgentTargetExecutionType))
{
return new AgentTargetExecutionOptions();
}
else if (objectType == typeof(VariableMultipliersAgentExecutionOptions))
{
return new VariableMultipliersAgentExecutionOptions();
}
else if (objectType == typeof(MultipleAgentExecutionOptions))
{
return new MultipleAgentExecutionOptions();
}
else
{
return base.GetInstance(objectType);
}
}
protected override AgentTargetExecutionOptions GetInstance(Int32 targetType)
{
switch (targetType)
{
case AgentTargetExecutionType.Normal:
return new AgentTargetExecutionOptions();
case AgentTargetExecutionType.VariableMultipliers:
return new VariableMultipliersAgentExecutionOptions();
case AgentTargetExecutionType.MultipleAgents:
return new MultipleAgentExecutionOptions();
default:
return null;
}
}
}
}

View File

@@ -50,46 +50,5 @@ namespace GitHub.Build.WebApi
get;
set;
}
/// <summary>
/// The full http link to the resource.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String Url
{
get;
set;
}
/// <summary>
/// A link to download the resource.
/// </summary>
/// <remarks>
/// This might include things like query parameters to download as a zip file.
/// </remarks>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String DownloadUrl
{
get;
set;
}
/// <summary>
/// The links to other objects related to this object.
/// </summary>
public ReferenceLinks Links
{
get
{
if (m_links == null)
{
m_links = new ReferenceLinks();
}
return m_links;
}
}
[DataMember(Name = "_links", EmitDefaultValue = false)]
private ReferenceLinks m_links;
}
}

View File

@@ -1,51 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents an attachment to a build.
/// </summary>
[DataContract]
public class Attachment : BaseSecuredObject
{
public Attachment()
{
}
internal Attachment(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The name of the attachment.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// The links to other objects related to this object.
/// </summary>
public ReferenceLinks Links
{
get
{
if (m_links == null)
{
m_links = new ReferenceLinks();
}
return m_links;
}
}
[DataMember(Name = "_links", EmitDefaultValue = false)]
private ReferenceLinks m_links;
}
}

View File

@@ -1,605 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using GitHub.Core.WebApi;
//using GitHub.Core.WebApi;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Data representation of a build.
/// </summary>
[DataContract]
public class Build : ISecuredObject
{
public Build()
{
Reason = BuildReason.Manual;
Priority = QueuePriority.Normal;
}
#region BuildReference members
// these are also present in BuildReference. ideally this class would inherit from that.
// however, moving them to a base class changes the order in which they are serialized to xml
// which breaks compat with subscribers (like RM) who may not be on the same milestone
// TODO: remove these when we figure out how to version service bus events
/// <summary>
/// The ID of the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
[Key]
public Int32 Id
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The build number/name of the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String BuildNumber
{
get;
set;
}
/// <summary>
/// The status of the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildStatus? Status
{
get;
set;
}
/// <summary>
/// The build result.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildResult? Result
{
get;
set;
}
/// <summary>
/// The time that the build was queued.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime? QueueTime
{
get;
set;
}
/// <summary>
/// The time that the build was started.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime? StartTime
{
get;
set;
}
/// <summary>
/// The time that the build was completed.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime? FinishTime
{
get;
set;
}
/// <summary>
/// The links to other objects related to this object.
/// </summary>
public ReferenceLinks Links
{
get
{
if (m_links == null)
{
m_links = new ReferenceLinks();
}
return m_links;
}
}
[DataMember(Name = "_links", EmitDefaultValue = false)]
private ReferenceLinks m_links;
#endregion
/// <summary>
/// The REST URL of the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Url
{
get;
set;
}
/// <summary>
/// The definition associated with the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DefinitionReference Definition
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The build number revision.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32? BuildNumberRevision
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The team project.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public TeamProjectReference Project
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The URI of the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Uri Uri
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The source branch.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String SourceBranch
{
get;
set;
}
/// <summary>
/// The source version.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String SourceVersion
{
get;
set;
}
/// <summary>
/// The queue. This is only set if the definition type is Build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public AgentPoolQueue Queue
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The agent specification for the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public AgentSpecification AgentSpecification
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The current position of the build in the queue.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32? QueuePosition
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The build's priority.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public QueuePriority Priority
{
get;
set;
}
/// <summary>
/// The reason that the build was created.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildReason Reason
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The identity on whose behalf the build was queued.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef RequestedFor
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The identity that queued the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef RequestedBy
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The date the build was last changed.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime LastChangedDate
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The identity representing the process or person that last changed the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef LastChangedBy
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The date the build was deleted.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime? DeletedDate
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The identity of the process or person that deleted the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef DeletedBy
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The description of how the build was deleted.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String DeletedReason
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The parameters for the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Parameters
{
get;
set;
}
/// <summary>
/// A list of demands that represents the agent capabilities required by this build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public List<Demand> Demands
{
get;
set;
}
/// <summary>
/// The orchestration plan for the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public TaskOrchestrationPlanReference OrchestrationPlan
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The list of Orchestration plans associated with the build.
/// </summary>
/// <remarks>
/// The build may have plans in addition to the main plan. For example, the cleanup job may have an orchestration plan associated with it.
/// </remarks>
public List<TaskOrchestrationPlanReference> Plans
{
get
{
if (m_plans == null)
{
m_plans = new List<TaskOrchestrationPlanReference>();
}
return m_plans;
}
set
{
m_plans = value;
}
}
/// <summary>
/// Information about the build logs.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildLogReference Logs
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildRepository Repository
{
get;
set;
}
/// <summary>
/// Additional options for queueing the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public QueueOptions QueueOptions
{
get;
set;
}
/// <summary>
/// Indicates whether the build has been deleted.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean Deleted
{
get;
set;
}
/// <summary>
/// A collection of properties which may be used to extend the storage fields available
/// for a given build.
/// </summary>
public PropertiesCollection Properties
{
get
{
if (m_properties == null)
{
m_properties = new PropertiesCollection();
}
return m_properties;
}
internal set
{
m_properties = value;
}
}
/// <summary>
/// A collection of tags associated with the build.
/// </summary>
public List<String> Tags
{
get
{
if (m_tags == null)
{
m_tags = new List<String>();
}
return m_tags;
}
internal set
{
m_tags = value;
}
}
/// <summary>
/// The list of validation errors and warnings.
/// </summary>
public List<BuildRequestValidationResult> ValidationResults
{
get
{
if (m_validationResults == null)
{
m_validationResults = new List<BuildRequestValidationResult>();
}
return m_validationResults;
}
}
/// <summary>
/// Indicates whether the build should be skipped by retention policies.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean? KeepForever
{
get;
set;
}
/// <summary>
/// The quality of the xaml build (good, bad, etc.)
/// </summary>
/// <remarks>
/// This is only used for XAML builds.
/// </remarks>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String Quality
{
get;
set;
}
/// <summary>
/// Indicates whether the build is retained by a release.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean? RetainedByRelease
{
get;
set;
}
/// <summary>
/// The build that triggered this build via a Build completion trigger.
/// </summary>
[DataMember]
public Build TriggeredByBuild { get; set; }
/// <summary>
/// Trigger-specific information about the build.
/// </summary>
public IDictionary<String, String> TriggerInfo
{
get
{
if (m_triggerInfo == null)
{
m_triggerInfo = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
}
return m_triggerInfo;
}
internal set
{
if (value != null)
{
m_triggerInfo = new Dictionary<String, String>(value, StringComparer.OrdinalIgnoreCase);
}
}
}
[DataMember(EmitDefaultValue = false, Name = "Properties")]
private PropertiesCollection m_properties;
[DataMember(EmitDefaultValue = false, Name = "Tags")]
private List<String> m_tags;
[DataMember(EmitDefaultValue = false, Name = "ValidationResults")]
private List<BuildRequestValidationResult> m_validationResults;
/// <summary>
/// Orchestration plans associated with the build (build, cleanup)
/// </summary>
[DataMember(EmitDefaultValue = false, Name = "Plans")]
private List<TaskOrchestrationPlanReference> m_plans;
/// <summary>
/// Sourceprovider-specific information about what triggered the build
/// </summary>
/// <remarks>Added in 3.2-preview.3</remarks>
[DataMember(EmitDefaultValue = false, Name = "TriggerInfo")]
private Dictionary<String, String> m_triggerInfo;
#region ISecuredObject implementation
Guid ISecuredObject.NamespaceId => Security.BuildNamespaceId;
Int32 ISecuredObject.RequiredPermissions => BuildPermissions.ViewBuilds;
String ISecuredObject.GetToken()
{
if (!String.IsNullOrEmpty(m_nestingToken))
{
return m_nestingToken;
}
return ((ISecuredObject)this.Definition)?.GetToken();
}
internal void SetNestingSecurityToken(String tokenValue)
{
// Spike: investigate imposing restrictions on the amount of information being returned
// when a nesting security token is being used.
m_nestingToken = tokenValue;
}
private String m_nestingToken = String.Empty;
#endregion
}
}

View File

@@ -1,36 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a build badge.
/// </summary>
[DataContract]
public class BuildBadge
{
public BuildBadge()
{
}
/// <summary>
/// The ID of the build represented by this badge.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 BuildId
{
get;
set;
}
/// <summary>
/// A link to the SVG resource.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String ImageUrl
{
get;
set;
}
}
}

View File

@@ -1,365 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.DistributedTask.Common.Contracts;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a build definition.
/// </summary>
[DataContract]
public class BuildDefinition : BuildDefinitionReference
{
public BuildDefinition()
{
this.JobAuthorizationScope = BuildAuthorizationScope.ProjectCollection;
}
/// <summary>
/// The build number format.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String BuildNumberFormat
{
get;
set;
}
/// <summary>
/// A save-time comment for the definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Comment
{
get;
set;
}
/// <summary>
/// The description.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Description
{
get;
set;
}
/// <summary>
/// The drop location for the definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String DropLocation
{
get;
set;
}
/// <summary>
/// The job authorization scope for builds queued against this definition.
/// </summary>
[DataMember]
public BuildAuthorizationScope JobAuthorizationScope
{
get;
set;
}
/// <summary>
/// The job execution timeout (in minutes) for builds queued against this definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 JobTimeoutInMinutes
{
get;
set;
}
/// <summary>
/// The job cancel timeout (in minutes) for builds cancelled by user for this definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 JobCancelTimeoutInMinutes
{
get;
set;
}
/// <summary>
/// Indicates whether badges are enabled for this definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean BadgeEnabled
{
get;
set;
}
/// <summary>
/// The list of steps for this definition.
/// </summary>
[Obsolete]
[EditorBrowsable(EditorBrowsableState.Never)]
public List<BuildDefinitionStep> Steps
{
get;
}
/// <summary>
/// The build process.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildProcess Process
{
get;
set;
}
/// <summary>
/// A list of build options used by this definition.
/// </summary>
public List<BuildOption> Options
{
get
{
if (m_options == null)
{
m_options = new List<BuildOption>();
}
return m_options;
}
internal set
{
m_options = value;
}
}
/// <summary>
/// The repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildRepository Repository
{
get;
set;
}
/// <summary>
/// The process parameters for this definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public ProcessParameters ProcessParameters
{
get;
set;
}
/// <summary>
/// The list of triggers for this definition.
/// </summary>
public List<BuildTrigger> Triggers
{
get
{
if (m_triggers == null)
{
m_triggers = new List<BuildTrigger>();
}
return m_triggers;
}
internal set
{
m_triggers = value;
}
}
/// <summary>
/// The variables used by this definition.
/// </summary>
public IDictionary<String, BuildDefinitionVariable> Variables
{
get
{
if (m_variables == null)
{
m_variables = new Dictionary<String, BuildDefinitionVariable>(StringComparer.OrdinalIgnoreCase);
}
return m_variables;
}
internal set
{
m_variables = new Dictionary<String, BuildDefinitionVariable>(value, StringComparer.OrdinalIgnoreCase);
}
}
/// <summary>
/// The variable groups used by this definition.
/// </summary>
public List<VariableGroup> VariableGroups
{
get
{
if (m_variableGroups == null)
{
m_variableGroups = new List<VariableGroup>();
}
return m_variableGroups;
}
internal set
{
m_variableGroups = value;
}
}
/// <summary>
/// The list of demands that represents the capabilities required by all agents for this definition.
/// </summary>
public List<Demand> Demands
{
get
{
if (m_demands == null)
{
m_demands = new List<Demand>();
}
return m_demands;
}
internal set
{
m_demands = value;
}
}
/// <summary>
/// The list of retention policies for this definition.
/// </summary>
public List<RetentionPolicy> RetentionRules
{
get
{
if (m_retentionRules == null)
{
m_retentionRules = new List<RetentionPolicy>();
}
return m_retentionRules;
}
internal set
{
m_retentionRules = value;
}
}
/// <summary>
/// A collection of properties which may be used to extend the storage fields available
/// for a given definition.
/// </summary>
public PropertiesCollection Properties
{
get
{
if (m_properties == null)
{
m_properties = new PropertiesCollection();
}
return m_properties;
}
internal set
{
m_properties = value;
}
}
/// <summary>
/// A collection of tags associated with the build definition.
/// </summary>
public List<String> Tags
{
get
{
if (m_tags == null)
{
m_tags = new List<String>();
}
return m_tags;
}
internal set
{
m_tags = value;
}
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedOptions, ref m_options, true);
SerializationHelper.Copy(ref m_serializedTriggers, ref m_triggers, true);
SerializationHelper.Copy(ref m_serializedVariables, ref m_variables, StringComparer.OrdinalIgnoreCase, true);
SerializationHelper.Copy(ref m_serializedVariableGroups, ref m_variableGroups, true);
SerializationHelper.Copy(ref m_serializedDemands, ref m_demands, true);
SerializationHelper.Copy(ref m_serializedRetentionRules, ref m_retentionRules, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_options, ref m_serializedOptions);
SerializationHelper.Copy(ref m_triggers, ref m_serializedTriggers);
SerializationHelper.Copy(ref m_variables, ref m_serializedVariables, StringComparer.OrdinalIgnoreCase);
SerializationHelper.Copy(ref m_variableGroups, ref m_serializedVariableGroups);
SerializationHelper.Copy(ref m_demands, ref m_serializedDemands);
SerializationHelper.Copy(ref m_retentionRules, ref m_serializedRetentionRules);
}
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
m_serializedOptions = null;
m_serializedTriggers = null;
m_serializedVariables = null;
m_serializedVariableGroups = null;
m_serializedRetentionRules = null;
}
[DataMember(Name = "Options", EmitDefaultValue = false)]
private List<BuildOption> m_serializedOptions;
[DataMember(Name = "Triggers", EmitDefaultValue = false)]
private List<BuildTrigger> m_serializedTriggers;
[DataMember(Name = "Variables", EmitDefaultValue = false)]
private IDictionary<String, BuildDefinitionVariable> m_serializedVariables;
[DataMember(Name = "VariableGroups", EmitDefaultValue = false)]
private List<VariableGroup> m_serializedVariableGroups;
[DataMember(Name = "Demands", EmitDefaultValue = false)]
private List<Demand> m_serializedDemands;
[DataMember(Name = "RetentionRules", EmitDefaultValue = false)]
private List<RetentionPolicy> m_serializedRetentionRules;
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Properties")]
private PropertiesCollection m_properties;
[DataMember(EmitDefaultValue = false, Name = "Tags")]
private List<String> m_tags;
private List<Demand> m_demands;
private List<BuildOption> m_options;
private List<BuildTrigger> m_triggers;
private List<RetentionPolicy> m_retentionRules;
private List<VariableGroup> m_variableGroups;
private IDictionary<String, BuildDefinitionVariable> m_variables;
}
}

View File

@@ -1,162 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to a build definition.
/// </summary>
[DataContract]
public class BuildDefinitionReference : DefinitionReference
{
public BuildDefinitionReference()
{
Type = DefinitionType.Build;
QueueStatus = DefinitionQueueStatus.Enabled;
}
/// <summary>
/// The quality of the definition document (draft, etc.)
/// </summary>
[DataMember(EmitDefaultValue = false, Name = "Quality")]
public DefinitionQuality? DefinitionQuality
{
get;
set;
}
/// <summary>
/// The author of the definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef AuthoredBy
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// A reference to the definition that this definition is a draft of, if this is a draft definition.
/// </summary>
[DataMember(EmitDefaultValue = false, Name = "draftOf")]
public DefinitionReference ParentDefinition
{
get;
set;
}
/// <summary>
/// The list of drafts associated with this definition, if this is not a draft definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public List<DefinitionReference> Drafts
{
get
{
return m_drafts ?? (m_drafts = new List<DefinitionReference>());
}
internal set
{
m_drafts = value;
}
}
/// <summary>
/// The default queue for builds run against this definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public AgentPoolQueue Queue
{
get;
set;
}
/// <summary>
/// The metrics for this definition.
/// </summary>
public List<BuildMetric> Metrics
{
get
{
return m_metrics ?? (m_metrics = new List<BuildMetric>());
}
internal set
{
m_metrics = value;
}
}
/// <summary>
/// The latest build for this definition.
/// </summary>
public Build LatestBuild
{
get
{
return m_latestBuild;
}
internal set
{
m_latestBuild = value;
}
}
/// <summary>
/// The latest completed build for this definition.
/// </summary>
public Build LatestCompletedBuild
{
get
{
return m_latestCompletedBuild;
}
internal set
{
m_latestCompletedBuild = value;
}
}
/// <summary>
/// The links to other objects related to this object.
/// </summary>
public ReferenceLinks Links => m_links ?? (m_links = new ReferenceLinks());
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedMetrics, ref m_metrics, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_metrics, ref m_serializedMetrics);
}
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
m_serializedMetrics = null;
}
[DataMember(Name = "Metrics", EmitDefaultValue = false)]
private List<BuildMetric> m_serializedMetrics;
[DataMember(Name = "_links", EmitDefaultValue = false)]
private ReferenceLinks m_links;
private List<BuildMetric> m_metrics;
private List<DefinitionReference> m_drafts;
[DataMember(EmitDefaultValue = false, Name = "LatestBuild")]
private Build m_latestBuild;
[DataMember(EmitDefaultValue = false, Name = "LatestCompletedBuild")]
private Build m_latestCompletedBuild;
}
}

View File

@@ -1,86 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a revision of a build definition.
/// </summary>
[DataContract]
public class BuildDefinitionRevision
{
/// <summary>
/// The revision number.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 Revision
{
get;
set;
}
/// <summary>
/// The name of the definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// The identity of the person or process that changed the definition.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false, Order = 30)]
public IdentityRef ChangedBy
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The date and time that the definition was changed.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime ChangedDate
{
get;
set;
}
/// <summary>
/// The change type (add, edit, delete).
/// </summary>
[DataMember(EmitDefaultValue = false)]
public AuditAction ChangeType
{
get;
set;
}
/// <summary>
/// The comment associated with the change.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Comment
{
get;
set;
}
/// <summary>
/// A link to the definition at this revision.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String DefinitionUrl
{
get;
set;
}
}
}

View File

@@ -1,250 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.Common;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// A reference to a task definition.
/// </summary>
[DataContract]
public class TaskDefinitionReference : BaseSecuredObject
{
public TaskDefinitionReference()
{
}
public TaskDefinitionReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The ID of the task.
/// </summary>
[DataMember(IsRequired = true)]
public Guid Id
{
get;
set;
}
/// <summary>
/// The version of the task.
/// </summary>
[DataMember(IsRequired = true)]
public String VersionSpec
{
get;
set;
}
/// <summary>
/// The type of task (task or task group).
/// </summary>
[DataMember(IsRequired = false)]
public String DefinitionType
{
get;
set;
}
/// <summary>
/// A clone of this reference.
/// </summary>
/// <returns></returns>
public TaskDefinitionReference Clone()
{
return (TaskDefinitionReference)this.MemberwiseClone();
}
}
/// <summary>
/// Represents a step in a build phase.
/// </summary>
[DataContract]
public class BuildDefinitionStep : BaseSecuredObject
{
public BuildDefinitionStep()
{
}
internal BuildDefinitionStep(
ISecuredObject securedObject)
: base(securedObject)
{
}
private BuildDefinitionStep(BuildDefinitionStep toClone)
{
ArgumentUtility.CheckForNull(toClone, nameof(toClone));
this.Enabled = toClone.Enabled;
this.ContinueOnError = toClone.ContinueOnError;
this.AlwaysRun = toClone.AlwaysRun;
this.DisplayName = toClone.DisplayName;
this.TimeoutInMinutes = toClone.TimeoutInMinutes;
this.Condition = toClone.Condition;
this.RefName = toClone.RefName;
// Cloning the reference type variables since memberwiseclone does a shallow copy
if (toClone.TaskDefinition != null)
{
this.TaskDefinition = toClone.TaskDefinition.Clone();
}
if (toClone.m_inputs != null)
{
foreach (var property in toClone.m_inputs)
{
this.Inputs.Add(property.Key, property.Value);
}
}
if (toClone.m_environment != null)
{
foreach (var property in toClone.m_environment)
{
this.Environment.Add(property.Key, property.Value);
}
}
}
/// <summary>
/// The task associated with this step.
/// </summary>
[DataMember(IsRequired = true, Order = 1, Name = "Task")]
public TaskDefinitionReference TaskDefinition
{
get;
set;
}
/// <summary>
/// The inputs used by this step.
/// </summary>
public IDictionary<String, String> Inputs
{
get
{
if (m_inputs == null)
{
m_inputs = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
}
return m_inputs;
}
set
{
m_inputs = new Dictionary<String, String>(value, StringComparer.OrdinalIgnoreCase);
}
}
/// <summary>
/// Indicates whether the step is enabled.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Boolean Enabled
{
get;
set;
}
/// <summary>
/// Indicates whether the phase should continue even if this step fails.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Boolean ContinueOnError
{
get;
set;
}
/// <summary>
/// Indicates whether this step should run even if a previous step fails.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Boolean AlwaysRun
{
get;
set;
}
/// <summary>
/// The display name for this step.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String DisplayName
{
get;
set;
}
/// <summary>
/// The time, in minutes, that this step is allowed to run.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Int32 TimeoutInMinutes
{
get;
set;
}
/// <summary>
/// A condition that determines whether this step should run.
/// </summary>
[DataMember(EmitDefaultValue = false, IsRequired = false)]
public String Condition
{
get;
set;
}
/// <summary>
/// The reference name for this step.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String RefName
{
get;
set;
}
/// <summary>
/// The run-time environment for this step.
/// </summary>
public IDictionary<String, String> Environment
{
get
{
if (m_environment == null)
{
m_environment = new Dictionary<String, String>(StringComparer.Ordinal);
}
return m_environment;
}
set
{
m_environment = new Dictionary<String, String>(value, StringComparer.Ordinal);
}
}
/// <summary>
/// A clone of this step.
/// </summary>
/// <returns></returns>
public BuildDefinitionStep Clone()
{
return new BuildDefinitionStep(this);
}
[DataMember(Name = "Environment", EmitDefaultValue = false)]
private Dictionary<String, String> m_environment;
[DataMember(Name = "Inputs", EmitDefaultValue = false, Order = 2)]
private Dictionary<String, String> m_inputs;
}
}

View File

@@ -1,122 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a template from which new build definitions can be created.
/// </summary>
[DataContract]
public class BuildDefinitionTemplate
{
public BuildDefinitionTemplate()
{
Category = "Custom";
}
/// <summary>
/// The ID of the template.
/// </summary>
[DataMember(IsRequired = true)]
public String Id
{
get;
set;
}
/// <summary>
/// The name of the template.
/// </summary>
[DataMember(IsRequired = true)]
public String Name
{
get;
set;
}
/// <summary>
/// Indicates whether the template can be deleted.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Boolean CanDelete
{
get;
set;
}
/// <summary>
/// The template category.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public String Category
{
get;
set;
}
/// <summary>
/// An optional hosted agent queue for the template to use by default.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public String DefaultHostedQueue
{
get;
set;
}
/// <summary>
/// The ID of the task whose icon is used when showing this template in the UI.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Guid IconTaskId
{
get;
set;
}
/// <summary>
/// A description of the template.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Description
{
get;
set;
}
/// <summary>
/// The actual template.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildDefinition Template
{
get;
set;
}
/// <summary>
/// A dictionary of media type strings to icons for this template.
/// </summary>
public IDictionary<String, String> Icons
{
get
{
if (m_icons == null)
{
m_icons = new Dictionary<String, String>(StringComparer.Ordinal);
}
return m_icons;
}
internal set
{
m_icons = new Dictionary<String, String>(value, StringComparer.Ordinal);
}
}
[DataMember(EmitDefaultValue = false, Name = "Icons")]
private Dictionary<String, String> m_icons;
}
}

View File

@@ -1,69 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a variable used by a build definition.
/// </summary>
[DataContract]
public class BuildDefinitionVariable : BaseSecuredObject
{
public BuildDefinitionVariable()
{
}
internal BuildDefinitionVariable(
ISecuredObject securedObject)
: base(securedObject)
{
}
private BuildDefinitionVariable(BuildDefinitionVariable variableToClone)
{
Value = variableToClone.Value;
AllowOverride = variableToClone.AllowOverride;
IsSecret = variableToClone.IsSecret;
}
/// <summary>
/// The value of the variable.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public String Value
{
get;
set;
}
/// <summary>
/// Indicates whether the value can be set at queue time.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean AllowOverride
{
get;
set;
}
/// <summary>
/// Indicates whether the variable's value is a secret.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean IsSecret
{
get;
set;
}
/// <summary>
/// A clone of this BuildDefinitionVariable.
/// </summary>
/// <returns>A new BuildDefinitionVariable</returns>
public BuildDefinitionVariable Clone()
{
return new BuildDefinitionVariable(this);
}
}
}

View File

@@ -1,53 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a build log.
/// </summary>
[DataContract]
public class BuildLog : BuildLogReference
{
public BuildLog()
{
}
public BuildLog(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The number of lines in the log.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int64 LineCount
{
get;
set;
}
/// <summary>
/// The date and time the log was created.
/// </summary>
[DataMember]
public DateTime? CreatedOn
{
get;
set;
}
/// <summary>
/// The date and time the log was last changed.
/// </summary>
[DataMember]
public DateTime? LastChangedOn
{
get;
set;
}
}
}

View File

@@ -1,54 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to a build log.
/// </summary>
[DataContract]
public class BuildLogReference : BaseSecuredObject
{
public BuildLogReference()
{
}
internal BuildLogReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The ID of the log.
/// </summary>
// EmitDefaultValue is true to ensure that id = 0 is sent for XAML builds' "ActivityLog.xml"
[DataMember(IsRequired = false, EmitDefaultValue = true)]
public Int32 Id
{
get;
set;
}
/// <summary>
/// The type of the log location.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String Type
{
get;
set;
}
/// <summary>
/// A full link to the log resource.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String Url
{
get;
set;
}
}
}

View File

@@ -1,63 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents metadata about builds in the system.
/// </summary>
[DataContract]
public class BuildMetric : BaseSecuredObject
{
public BuildMetric()
{
}
internal BuildMetric(
ISecuredObject securedObject)
:base(securedObject)
{
}
/// <summary>
/// The name of the metric.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// The scope.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Scope
{
get;
set;
}
/// <summary>
/// The value.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Int32 IntValue
{
get;
set;
}
/// <summary>
/// The date for the scope.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime? Date
{
get;
set;
}
}
}

View File

@@ -1,67 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents the application of an optional behavior to a build definition.
/// </summary>
[DataContract]
public class BuildOption : BaseSecuredObject
{
public BuildOption()
{
}
internal BuildOption(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// A reference to the build option.
/// </summary>
[DataMember(IsRequired = true, Order = 1, Name = "Definition")]
public virtual BuildOptionDefinitionReference BuildOptionDefinition
{
get;
set;
}
/// <summary>
/// The inputs that configure the behavior.
/// </summary>
public virtual IDictionary<String, String> Inputs
{
get
{
if (m_inputs == null)
{
m_inputs = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
}
return m_inputs;
}
internal set
{
m_inputs = new Dictionary<String, String>(value, StringComparer.OrdinalIgnoreCase);
}
}
/// <summary>
/// Indicates whether the behavior is enabled.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public virtual Boolean Enabled
{
get;
set;
}
[DataMember(Name = "Inputs", EmitDefaultValue = false, Order = 2)]
private Dictionary<String, String> m_inputs;
}
}

View File

@@ -1,100 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents an optional behavior that can be applied to a build definition.
/// </summary>
[DataContract]
public class BuildOptionDefinition : BuildOptionDefinitionReference
{
public BuildOptionDefinition()
{
}
internal BuildOptionDefinition(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// A value that indicates the relative order in which the behavior should be applied.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 Ordinal
{
get;
set;
}
/// <summary>
/// The name of the build option.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// The description.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Description
{
get;
set;
}
/// <summary>
/// The list of inputs defined for the build option.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IList<BuildOptionInputDefinition> Inputs
{
get
{
if (m_inputs == null)
{
m_inputs = new List<BuildOptionInputDefinition>();
}
return m_inputs;
}
set
{
m_inputs = new List<BuildOptionInputDefinition>(value);
}
}
/// <summary>
/// The list of input groups defined for the build option.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IList<BuildOptionGroupDefinition> Groups
{
get
{
if (m_groups == null)
{
m_groups = new List<BuildOptionGroupDefinition>();
}
return m_groups;
}
set
{
m_groups = new List<BuildOptionGroupDefinition>(value);
}
}
private List<BuildOptionInputDefinition> m_inputs;
private List<BuildOptionGroupDefinition> m_groups;
}
}

View File

@@ -1,33 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to a build option definition.
/// </summary>
[DataContract]
public class BuildOptionDefinitionReference : BaseSecuredObject
{
public BuildOptionDefinitionReference()
{
}
internal BuildOptionDefinitionReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The ID of the referenced build option.
/// </summary>
[DataMember(IsRequired = true, Order = 1)]
public Guid Id
{
get;
set;
}
}
}

View File

@@ -1,53 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a group of inputs for a build option.
/// </summary>
[DataContract]
public class BuildOptionGroupDefinition : BaseSecuredObject
{
public BuildOptionGroupDefinition()
{
}
internal BuildOptionGroupDefinition(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The internal name of the group.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// The name of the group to display in the UI.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String DisplayName
{
get;
set;
}
/// <summary>
/// Indicates whether the group is initially displayed as expanded in the UI.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean IsExpanded
{
get;
set;
}
}
}

View File

@@ -1,144 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents an input for a build option.
/// </summary>
[DataContract]
public class BuildOptionInputDefinition : BaseSecuredObject
{
public BuildOptionInputDefinition()
: this(null)
{
}
internal BuildOptionInputDefinition(
ISecuredObject securedObject)
: base(securedObject)
{
InputType = BuildOptionInputType.String;
DefaultValue = String.Empty;
Required = false;
}
/// <summary>
/// The name of the input.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// The label for the input.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Label
{
get;
set;
}
/// <summary>
/// The default value.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String DefaultValue
{
get;
set;
}
/// <summary>
/// Indicates whether the input is required to have a value.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean Required
{
get;
set;
}
/// <summary>
/// Indicates the type of the input value.
/// </summary>
[DataMember(Name = "Type")]
public BuildOptionInputType InputType
{
get;
set;
}
/// <summary>
/// The rule that is applied to determine whether the input is visible in the UI.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String VisibleRule
{
// Typical format is "NAMEOFTHEDEPENDENTINPUT = VALUETOBEBOUND"
get;
set;
}
/// <summary>
/// The name of the input group that this input belongs to.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String GroupName
{
get;
set;
}
/// <summary>
/// A dictionary of options for this input.
/// </summary>
public Dictionary<String, String> Options
{
get
{
if (m_Options == null)
{
m_Options = new Dictionary<String, String>();
}
return m_Options;
}
set
{
m_Options = value;
}
}
/// <summary>
/// A dictionary of help documents for this input.
/// </summary>
public Dictionary<String, String> HelpDocuments
{
get
{
if (m_HelpDocuments == null)
{
m_HelpDocuments = new Dictionary<String, String>();
}
return m_HelpDocuments;
}
set
{
m_HelpDocuments = new Dictionary<String, String>(value);
}
}
[DataMember(Name = "Options", EmitDefaultValue = false)]
private Dictionary<String, String> m_Options;
[DataMember(Name = "Help", EmitDefaultValue = false)]
private Dictionary<String, String> m_HelpDocuments;
}
}

View File

@@ -1,45 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
using Newtonsoft.Json;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a build process.
/// </summary>
[DataContract]
[KnownType(typeof(DesignerProcess))]
[KnownType(typeof(YamlProcess))]
[KnownType(typeof(DockerProcess))]
[KnownType(typeof(JustInTimeProcess))]
[JsonConverter(typeof(BuildProcessJsonConverter))]
public class BuildProcess : BaseSecuredObject
{
protected BuildProcess(
Int32 type)
{
}
protected internal BuildProcess(
Int32 type,
ISecuredObject securedObject)
: base(securedObject)
{
this.Type = type;
}
/// <summary>
/// The type of the process.
/// </summary>
/// <remarks>
/// See <see cref="ProcessType" /> for a list of valid process types.
/// </remarks>
[DataMember(Name = "Type")]
public Int32 Type
{
get;
internal set;
}
}
}

View File

@@ -1,68 +0,0 @@
using System;
using Newtonsoft.Json.Linq;
namespace GitHub.Build.WebApi
{
internal sealed class BuildProcessJsonConverter : TypePropertyJsonConverter<BuildProcess>
{
protected override BuildProcess GetInstance(
Type objectType)
{
if (objectType == typeof(DesignerProcess))
{
return new DesignerProcess();
}
else if (objectType == typeof(YamlProcess))
{
return new YamlProcess();
}
else if (objectType == typeof(DockerProcess))
{
return new DockerProcess();
}
else if (objectType == typeof(JustInTimeProcess))
{
return new JustInTimeProcess();
}
else
{
return base.GetInstance(objectType);
}
}
protected override BuildProcess GetInstance(
Int32 targetType)
{
switch (targetType)
{
case ProcessType.Yaml:
return new YamlProcess();
case ProcessType.Docker:
return new DockerProcess();
case ProcessType.JustInTime:
return new JustInTimeProcess();
case ProcessType.Designer:
default:
return new DesignerProcess();
}
}
protected override Boolean TryInferType(
JObject value,
out Int32 type)
{
// if it has a YamlFilename property, assume it's a YamlProcess
if (value.TryGetValue("yamlFilename", StringComparison.OrdinalIgnoreCase, out JToken yamlFilename))
{
type = ProcessType.Yaml;
return true;
}
else
{
// default to Designer process
type = ProcessType.Designer;
return true;
}
}
}
}

View File

@@ -1,247 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents resources used by a build process.
/// </summary>
[DataContract]
public sealed class BuildProcessResources : BaseSecuredObject
{
public BuildProcessResources()
{
}
internal BuildProcessResources(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// Information about the queues used by the process.
/// </summary>
public IList<AgentPoolQueueReference> Queues
{
get
{
if (m_queues == null)
{
m_queues = new List<AgentPoolQueueReference>();
}
return m_queues;
}
set
{
m_queues = new List<AgentPoolQueueReference>(value);
}
}
/// <summary>
/// Information about the endpoints used by the process.
/// </summary>
public IList<ServiceEndpointReference> Endpoints
{
get
{
if (m_endpoints == null)
{
m_endpoints = new List<ServiceEndpointReference>();
}
return m_endpoints;
}
set
{
m_endpoints = new List<ServiceEndpointReference>(value);
}
}
/// <summary>
/// Information about the secure files used by the process.
/// </summary>
public IList<SecureFileReference> Files
{
get
{
if (m_files == null)
{
m_files = new List<SecureFileReference>();
}
return m_files;
}
set
{
m_files = new List<SecureFileReference>(value);
}
}
/// <summary>
/// Information about the variable groups used by the process.
/// </summary>
public IList<VariableGroupReference> VariableGroups
{
get
{
if (m_variableGroups == null)
{
m_variableGroups = new List<VariableGroupReference>();
}
return m_variableGroups;
}
set
{
m_variableGroups = new List<VariableGroupReference>(value);
}
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
if (m_queues?.Count == 0)
{
m_queues = null;
}
if (m_endpoints?.Count == 0)
{
m_endpoints = null;
}
if (m_files?.Count == 0)
{
m_files = null;
}
if (m_variableGroups?.Count == 0)
{
m_variableGroups = null;
}
}
[DataMember(Name = "Queues", EmitDefaultValue = false)]
private List<AgentPoolQueueReference> m_queues;
[DataMember(Name = "Endpoints", EmitDefaultValue = false)]
private List<ServiceEndpointReference> m_endpoints;
[DataMember(Name = "Files", EmitDefaultValue = false)]
private List<SecureFileReference> m_files;
[DataMember(Name = "VariableGroups", EmitDefaultValue = false)]
private List<VariableGroupReference> m_variableGroups;
}
/// <summary>
/// Represents a reference to a resource.
/// </summary>
[DataContract]
public abstract class ResourceReference : BaseSecuredObject
{
public ResourceReference()
{
}
protected ResourceReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// An alias to be used when referencing the resource.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Alias
{
get;
set;
}
}
/// <summary>
/// Represents a reference to an agent queue.
/// </summary>
[DataContract]
public class AgentPoolQueueReference : ResourceReference
{
public AgentPoolQueueReference()
: this(null)
{
}
internal AgentPoolQueueReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The ID of the queue.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 Id
{
get;
set;
}
}
/// <summary>
/// Represents a referenec to a service endpoint.
/// </summary>
[DataContract]
public class ServiceEndpointReference : ResourceReference
{
public ServiceEndpointReference()
: this(null)
{
}
internal ServiceEndpointReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The ID of the service endpoint.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Guid Id
{
get;
set;
}
}
/// <summary>
/// Represents a reference to a secure file.
/// </summary>
[DataContract]
public class SecureFileReference : ResourceReference
{
public SecureFileReference()
: this(null)
{
}
internal SecureFileReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The ID of the secure file.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Guid Id
{
get;
set;
}
}
}

View File

@@ -1,138 +0,0 @@
using GitHub.Services.WebApi;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to a build.
/// </summary>
[DataContract]
public class BuildReference : BaseSecuredObject
{
public BuildReference()
{
}
internal BuildReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The ID of the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
[Key]
public Int32 Id
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// The build number.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String BuildNumber
{
get;
set;
}
/// <summary>
/// The build status.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildStatus? Status
{
get;
set;
}
/// <summary>
/// The build result.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildResult? Result
{
get;
set;
}
/// <summary>
/// The time that the build was queued.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime? QueueTime
{
get;
set;
}
/// <summary>
/// The time that the build was started.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime? StartTime
{
get;
set;
}
/// <summary>
/// The time that the build was completed.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime? FinishTime
{
get;
set;
}
/// <summary>
/// The identity on whose behalf the build was queued.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef RequestedFor
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// Indicates whether the build has been deleted.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean Deleted
{
get;
set;
}
/// <summary>
/// The links to other objects related to this object.
/// </summary>
public ReferenceLinks Links
{
get
{
if (m_links == null)
{
m_links = new ReferenceLinks();
}
return m_links;
}
}
[DataMember(Name = "_links", EmitDefaultValue = false)]
private ReferenceLinks m_links;
}
}

View File

@@ -1,55 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents information about a build report.
/// </summary>
[DataContract]
public class BuildReportMetadata
{
public BuildReportMetadata()
{
}
public BuildReportMetadata(Int32 buildId, String type)
{
this.BuildId = buildId;
this.Type = type;
}
/// <summary>
/// The Id of the build.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 BuildId
{
get;
set;
}
/// <summary>
/// The content of the report.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Content
{
get;
set;
}
/// <summary>
/// The type of the report.
/// </summary>
/// <remarks>
/// See <see cref="ReportTypes" /> for a list of supported report types.
/// </remarks>
[DataMember(EmitDefaultValue = false)]
public String Type
{
get;
set;
}
}
}

View File

@@ -1,185 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a repository used by a build definition.
/// </summary>
[DataContract]
public class BuildRepository : BaseSecuredObject
{
public BuildRepository()
{
}
internal BuildRepository(
ISecuredObject securedObject)
: base(securedObject)
{
}
private BuildRepository(
BuildRepository toClone)
: base(toClone)
{
this.Id = toClone.Id;
this.Type = toClone.Type;
this.Name = toClone.Name;
this.Url = toClone.Url;
this.DefaultBranch = toClone.DefaultBranch;
this.RootFolder = toClone.RootFolder;
this.Clean = toClone.Clean;
this.CheckoutSubmodules = toClone.CheckoutSubmodules;
if (toClone.m_properties != null)
{
foreach (var property in toClone.m_properties)
{
this.Properties.Add(property.Key, property.Value);
}
}
}
/// <summary>
/// The ID of the repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Id
{
get;
set;
}
/// <summary>
/// The type of the repository.
/// </summary>
[DataMember]
public String Type
{
get;
set;
}
/// <summary>
/// The friendly name of the repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// The URL of the repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Uri Url
{
get;
set;
}
/// <summary>
/// The name of the default branch.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String DefaultBranch
{
get;
set;
}
/// <summary>
/// The root folder.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String RootFolder
{
get;
set;
}
/// <summary>
/// Indicates whether to clean the target folder when getting code from the repository.
/// </summary>
/// <remarks>
/// This is a String so that it can reference variables.
/// </remarks>
[DataMember(EmitDefaultValue = true)]
public String Clean
{
get;
set;
}
/// <summary>
/// Indicates whether to checkout submodules.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Boolean CheckoutSubmodules
{
get;
set;
}
/// <summary>
/// A dictionary that holds additional information about the repository.
/// </summary>
public IDictionary<String, String> Properties
{
// Warning: This can contain secrets too. As part of #952656, we resolve secrets, it was done considering the fact that this is not a "DataMember"
// If it's ever made a "DataMember" please be cautious, we would be leaking secrets
get
{
if (m_properties == null)
{
m_properties = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
}
return m_properties;
}
internal set
{
m_properties = new Dictionary<String, String>(value, StringComparer.OrdinalIgnoreCase);
}
}
/// <summary>
/// Clones this object.
/// </summary>
/// <returns></returns>
public BuildRepository Clone()
{
return new BuildRepository(this);
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedProperties, ref m_properties, StringComparer.OrdinalIgnoreCase, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_properties, ref m_serializedProperties, StringComparer.OrdinalIgnoreCase);
}
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
m_serializedProperties = null;
}
[DataMember(Name = "Properties", EmitDefaultValue = false)]
private IDictionary<String, String> m_serializedProperties;
// Warning: This can contain secrets too. As part of #952656, we resolve secrets, it was done considering the fact that this is not a "DataMember"
// If it's ever made a "DataMember" please be cautious, we would be leaking secrets
private IDictionary<String, String> m_properties;
}
}

View File

@@ -1,43 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents the result of validating a build request.
/// </summary>
[DataContract]
public class BuildRequestValidationResult : BaseSecuredObject
{
public BuildRequestValidationResult()
{
}
public BuildRequestValidationResult(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The result.
/// </summary>
[DataMember]
public ValidationResult Result
{
get;
set;
}
/// <summary>
/// The message associated with the result.
/// </summary>
[DataMember]
public String Message
{
get;
set;
}
}
}

View File

@@ -1,64 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents information about resources used by builds in the system.
/// </summary>
[DataContract]
public sealed class BuildResourceUsage
{
internal BuildResourceUsage()
{
}
internal BuildResourceUsage(Int32 xaml, Int32 dtAgents, Int32 paidAgentSlots, Boolean isThrottlingEnabled = false)
{
this.XamlControllers = xaml;
this.DistributedTaskAgents = dtAgents;
this.TotalUsage = this.XamlControllers + (isThrottlingEnabled ? 0 : this.DistributedTaskAgents);
this.PaidPrivateAgentSlots = paidAgentSlots;
}
/// <summary>
/// The number of XAML controllers.
/// </summary>
[DataMember]
public Int32 XamlControllers
{
get;
internal set;
}
/// <summary>
/// The number of build agents.
/// </summary>
[DataMember]
public Int32 DistributedTaskAgents
{
get;
internal set;
}
/// <summary>
/// The total usage.
/// </summary>
[DataMember]
public Int32 TotalUsage
{
get;
internal set;
}
/// <summary>
/// The number of paid private agent slots.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 PaidPrivateAgentSlots
{
get;
internal set;
}
}
}

View File

@@ -1,54 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents system-wide build settings.
/// </summary>
[DataContract]
public class BuildSettings : BaseSecuredObject
{
public BuildSettings()
: this(null)
{
}
public BuildSettings(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The default retention policy.
/// </summary>
[DataMember]
public RetentionPolicy DefaultRetentionPolicy
{
get;
set;
}
/// <summary>
/// The maximum retention policy.
/// </summary>
[DataMember]
public RetentionPolicy MaximumRetentionPolicy
{
get;
set;
}
/// <summary>
/// The number of days to keep records of deleted builds.
/// </summary>
[DataMember]
public Int32 DaysToKeepDeletedBuildsBeforeDestroy
{
get;
set;
}
}
}

View File

@@ -1,446 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
using Newtonsoft.Json;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a trigger for a buld definition.
/// </summary>
[DataContract]
[KnownType(typeof(ContinuousIntegrationTrigger))]
[KnownType(typeof(GatedCheckInTrigger))]
[KnownType(typeof(ScheduleTrigger))]
[KnownType(typeof(PullRequestTrigger))]
[JsonConverter(typeof(BuildTriggerJsonConverter))]
public abstract class BuildTrigger : BaseSecuredObject
{
protected BuildTrigger(DefinitionTriggerType triggerType)
: this(triggerType, null)
{
}
protected internal BuildTrigger(
DefinitionTriggerType triggerType,
ISecuredObject securedObject)
: base(securedObject)
{
this.TriggerType = triggerType;
}
/// <summary>
/// The type of the trigger.
/// </summary>
[DataMember]
public DefinitionTriggerType TriggerType
{
get;
private set;
}
}
/// <summary>
/// Represents a continuous integration (CI) trigger.
/// </summary>
[DataContract]
public sealed class ContinuousIntegrationTrigger : BuildTrigger
{
public ContinuousIntegrationTrigger()
: this(null)
{
}
internal ContinuousIntegrationTrigger(
ISecuredObject securedObject)
: base(DefinitionTriggerType.ContinuousIntegration, securedObject)
{
MaxConcurrentBuildsPerBranch = 1;
}
[EditorBrowsable(EditorBrowsableState.Never)]
public Int32 SettingsSourceType
{
get
{
if (m_settingsSourceType == 0)
{
m_settingsSourceType = WebApi.SettingsSourceType.Definition;
}
return m_settingsSourceType;
}
set
{
m_settingsSourceType = value;
}
}
/// <summary>
/// Indicates whether changes should be batched while another CI build is running.
/// </summary>
/// <remarks>
/// If this is true, then changes submitted while a CI build is running will be batched and built in one new CI build when the current build finishes.
/// If this is false, then a new CI build will be triggered for each change to the repository.
/// </remarks>
[DataMember]
public Boolean BatchChanges
{
get;
set;
}
/// <summary>
/// The maximum number of simultaneous CI builds that will run per branch.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Int32 MaxConcurrentBuildsPerBranch
{
get;
set;
}
/// <summary>
/// A list of filters that describe which branches will trigger builds.
/// </summary>
public List<String> BranchFilters
{
get
{
if (m_branchFilters == null)
{
m_branchFilters = new List<String>();
}
return m_branchFilters;
}
internal set
{
m_branchFilters = value;
}
}
// added in 3.0
/// <summary>
/// A list of filters that describe which paths will trigger builds.
/// </summary>
public List<String> PathFilters
{
get
{
if (m_pathFilters == null)
{
m_pathFilters = new List<String>();
}
return m_pathFilters;
}
internal set
{
m_pathFilters = value;
}
}
/// <summary>
/// The polling interval, in seconds.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Int32? PollingInterval
{
get;
set;
}
/// <summary>
/// The ID of the job used to poll an external repository.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Guid PollingJobId
{
// This is the ID of the polling job that polls the external repository.
// Once the build definition is saved/updated, this value is set.
get;
set;
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
if (m_settingsSourceType == WebApi.SettingsSourceType.Definition)
{
m_settingsSourceType = 0;
}
}
[DataMember(Name = "BranchFilters", EmitDefaultValue = false)]
private List<String> m_branchFilters;
[DataMember(Name = "PathFilters", EmitDefaultValue = false)]
private List<String> m_pathFilters;
[DataMember(Name = "SettingsSourceType", EmitDefaultValue = false)]
private Int32 m_settingsSourceType;
}
/// <summary>
/// Represents a gated check-in trigger.
/// </summary>
[DataContract]
public sealed class GatedCheckInTrigger : BuildTrigger
{
public GatedCheckInTrigger()
: this(null)
{
}
internal GatedCheckInTrigger(
ISecuredObject securedObject)
: base(DefinitionTriggerType.GatedCheckIn, securedObject)
{
}
/// <summary>
/// Indicates whether CI triggers should run after the gated check-in succeeds.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean RunContinuousIntegration
{
get;
set;
}
/// <summary>
/// Indicates whether to take workspace mappings into account when determining whether a build should run.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean UseWorkspaceMappings
{
get;
set;
}
/// <summary>
/// A list of filters that describe which paths will trigger builds.
/// </summary>
public List<String> PathFilters
{
get
{
if (m_pathFilters == null)
{
m_pathFilters = new List<String>();
}
return m_pathFilters;
}
internal set
{
m_pathFilters = value;
}
}
[DataMember(Name = "PathFilters", EmitDefaultValue = false)]
private List<String> m_pathFilters;
}
/// <summary>
/// Represents a schedule trigger.
/// </summary>
[DataContract]
public sealed class ScheduleTrigger : BuildTrigger
{
public ScheduleTrigger()
: this(null)
{
}
internal ScheduleTrigger(
ISecuredObject securedObject)
: base(DefinitionTriggerType.Schedule, securedObject)
{
}
/// <summary>
/// A list of schedule entries that describe when builds should run.
/// </summary>
public List<Schedule> Schedules
{
get
{
if (m_schedules == null)
{
m_schedules = new List<Schedule>();
}
return m_schedules;
}
set
{
m_schedules = value;
}
}
[DataMember(Name = "Schedules", EmitDefaultValue = false)]
private List<Schedule> m_schedules;
}
/// <summary>
/// Represents a pull request trigger.
/// </summary>
[DataContract]
public class PullRequestTrigger : BuildTrigger
{
public PullRequestTrigger()
: this(null)
{
}
internal PullRequestTrigger(
ISecuredObject securedObject)
: base(DefinitionTriggerType.PullRequest, securedObject)
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
public Int32 SettingsSourceType
{
get
{
if (m_settingsSourceType == 0)
{
m_settingsSourceType = WebApi.SettingsSourceType.Definition;
}
return m_settingsSourceType;
}
set
{
m_settingsSourceType = value;
}
}
/// <summary>
/// Describes if forks of a selected repository should build and use secrets.
/// </summary>
public Forks Forks
{
get
{
if (m_forks == null)
{
m_forks = new Forks();
}
return m_forks;
}
set
{
m_forks = value;
}
}
/// <summary>
/// A list of filters that describe which branches will trigger builds.
/// </summary>
public List<String> BranchFilters
{
get
{
if (m_branchFilters == null)
{
m_branchFilters = new List<String>();
}
return m_branchFilters;
}
set
{
m_branchFilters = value;
}
}
/// <summary>
/// A list of filters that describe which paths will trigger builds.
/// </summary>
public List<String> PathFilters
{
get
{
if (m_pathFilters == null)
{
m_pathFilters = new List<String>();
}
return m_pathFilters;
}
set
{
m_pathFilters = value;
}
}
/// <summary>
/// Indicates if an update to a PR should delete current in-progress builds.
/// </summary>
[DataMember(Name = "AutoCancel", EmitDefaultValue = false)]
public Boolean? AutoCancel { get; set; }
[DataMember(Name = "RequireCommentsForNonTeamMembersOnly")]
public Boolean RequireCommentsForNonTeamMembersOnly { get; set; }
[DataMember(Name = "IsCommentRequiredForPullRequest")]
public Boolean IsCommentRequiredForPullRequest { get; set; }
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
if (m_settingsSourceType == WebApi.SettingsSourceType.Definition)
{
m_settingsSourceType = 0;
}
}
[DataMember(Name = "SettingsSourceType", EmitDefaultValue = false)]
private Int32 m_settingsSourceType;
[DataMember(Name = "BranchFilters", EmitDefaultValue = false)]
private List<String> m_branchFilters;
[DataMember(Name = "Forks", EmitDefaultValue = false)]
private Forks m_forks;
[DataMember(Name = "PathFilters", EmitDefaultValue = false)]
private List<String> m_pathFilters;
}
/// <summary>
/// Represents a build completion trigger.
/// </summary>
[DataContract]
public class BuildCompletionTrigger : BuildTrigger
{
public BuildCompletionTrigger()
: this(null)
{
}
public BuildCompletionTrigger(
ISecuredObject securedObject)
: base(DefinitionTriggerType.BuildCompletion, securedObject)
{
}
/// <summary>
/// A reference to the definition that should trigger builds for this definition.
/// </summary>
[DataMember]
public DefinitionReference Definition { get; set; }
[DataMember]
public Boolean RequiresSuccessfulBuild { get; set; }
[DataMember]
public List<String> BranchFilters { get; set; }
}
}

View File

@@ -1,115 +0,0 @@
using System;
using System.Reflection;
using GitHub.Services.WebApi;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
namespace GitHub.Build.WebApi
{
internal sealed class BuildTriggerJsonConverter : VssSecureJsonConverter
{
public override Boolean CanConvert(Type objectType)
{
return typeof(BuildTrigger).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
}
public override Boolean CanRead
{
get
{
return true;
}
}
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("TriggerType");
if (property == null)
{
return existingValue;
}
JToken itemTypeValue;
DefinitionTriggerType triggerType;
JObject value = JObject.Load(reader);
if (!value.TryGetValue(property.PropertyName, StringComparison.OrdinalIgnoreCase, out itemTypeValue))
{
return existingValue;
}
else
{
if (itemTypeValue.Type == JTokenType.Integer)
{
triggerType = (DefinitionTriggerType)(Int32)itemTypeValue;
}
else if (itemTypeValue.Type != JTokenType.String ||
!Enum.TryParse<DefinitionTriggerType>((String)itemTypeValue, true, out triggerType))
{
return existingValue;
}
}
Object returnValue = null;
switch (triggerType)
{
case DefinitionTriggerType.ContinuousIntegration:
returnValue = new ContinuousIntegrationTrigger();
break;
case DefinitionTriggerType.GatedCheckIn:
returnValue = new GatedCheckInTrigger();
break;
case DefinitionTriggerType.Schedule:
returnValue = new ScheduleTrigger();
break;
case DefinitionTriggerType.PullRequest:
returnValue = new PullRequestTrigger();
break;
case DefinitionTriggerType.BuildCompletion:
returnValue = new BuildCompletionTrigger();
break;
}
if (value != null && 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();
}
}
}

View File

@@ -1,68 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents an entry in a workspace mapping.
/// </summary>
[DataContract]
public class MappingDetails
{
/// <summary>
/// The server path.
/// </summary>
[DataMember(Name = "serverPath")]
public String ServerPath
{
get;
set;
}
/// <summary>
/// The mapping type.
/// </summary>
[DataMember(Name = "mappingType")]
public String MappingType
{
get;
set;
}
/// <summary>
/// The local path.
/// </summary>
[DataMember(Name = "localPath")]
public String LocalPath
{
get;
set;
}
}
/// <summary>
/// Represents a workspace mapping.
/// </summary>
[DataContract]
public class BuildWorkspace
{
/// <summary>
/// The list of workspace mapping entries.
/// </summary>
public List<MappingDetails> Mappings
{
get
{
if (m_mappings == null)
{
m_mappings = new List<MappingDetails>();
}
return m_mappings;
}
}
[DataMember(Name = "mappings")]
private List<MappingDetails> m_mappings;
}
}

View File

@@ -1,114 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a change associated with a build.
/// </summary>
[DataContract]
public class Change : BaseSecuredObject
{
public Change()
: this(null)
{
}
internal Change(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The identifier for the change. For a commit, this would be the SHA1. For a TFVC changeset, this would be the changeset ID.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Id
{
get;
set;
}
/// <summary>
/// The description of the change. This might be a commit message or changeset description.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Message
{
get;
set;
}
/// <summary>
/// The type of change. "commit", "changeset", etc.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Type
{
get;
set;
}
/// <summary>
/// The author of the change.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef Author
{
get;
set;
}
/// <summary>
/// The timestamp for the change.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime? Timestamp
{
get;
set;
}
/// <summary>
/// The location of the full representation of the resource.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Uri Location
{
get;
set;
}
/// <summary>
/// Indicates whether the message was truncated.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean MessageTruncated
{
get;
set;
}
/// <summary>
/// The location of a user-friendly representation of the resource.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Uri DisplayUri
{
get;
set;
}
/// <summary>
/// The person or process that pushed the change.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Pusher
{
get;
set;
}
}
}

View File

@@ -1,195 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Core.WebApi;
using GitHub.Services.WebApi;
using Newtonsoft.Json;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to a definition.
/// </summary>
[DataContract]
[KnownType(typeof(BuildDefinition))]
[KnownType(typeof(BuildDefinitionReference))]
[JsonConverter(typeof(DefinitionReferenceJsonConverter))]
#pragma warning disable 618
public class DefinitionReference : ShallowReference, ISecuredObject
#pragma warning restore 618
{
/// <summary>
/// The ID of the referenced definition.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public new Int32 Id
{
get
{
return base.Id;
}
set
{
base.Id = value;
}
}
/// <summary>
/// The name of the referenced definition.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public new String Name
{
get
{
return base.Name;
}
set
{
base.Name = value;
}
}
/// <summary>
/// The REST URL of the definition.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public new String Url
{
get
{
return base.Url;
}
set
{
base.Url = value;
}
}
/// <summary>
/// The definition's URI.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Uri Uri
{
get;
set;
}
/// <summary>
/// The folder path of the definition.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String Path
{
get;
set;
}
/// <summary>
/// The type of the definition.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public DefinitionType Type
{
get;
set;
}
/// <summary>
/// A value that indicates whether builds can be queued against this definition.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
public DefinitionQueueStatus QueueStatus
{
get;
set;
}
/// <summary>
/// The definition revision number.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32? Revision
{
get;
set;
}
/// <summary>
/// The date this version of the definition was created.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime CreatedDate
{
get;
set;
}
/// <summary>
/// A reference to the project.
/// </summary>
[DataMember(EmitDefaultValue = false, Order = 1000)]
public TeamProjectReference Project
{
get;
set;
}
#region ISecuredObject implementation
Guid ISecuredObject.NamespaceId => Security.BuildNamespaceId;
Int32 ISecuredObject.RequiredPermissions => m_requiredPermissions;
String ISecuredObject.GetToken()
{
if (!String.IsNullOrEmpty(m_nestingSecurityToken))
{
return m_nestingSecurityToken;
}
return GetToken(this.Project, this.Path, this.Id);
}
internal void SetRequiredPermissions(
Int32 newValue)
{
m_requiredPermissions = newValue;
}
internal void SetNestingSecurityToken(
String tokenValue)
{
// For anything more detailed than a DefinitionReference,
// we don't let you use a nesting security token.
if (this is BuildDefinitionReference)
{
// Debug.Fail("Nesting security tokens is not allowed for anything more detailed than a DefinitionReference");
m_nestingSecurityToken = String.Empty;
return;
}
m_nestingSecurityToken = tokenValue;
}
internal static String GetToken(
TeamProjectReference project,
String path,
Int32 definitionId)
{
return GetToken(project?.Id, path, definitionId);
}
internal static String GetToken(
Guid? projectId,
String path,
Int32 definitionId)
{
return String.Concat(projectId?.ToString("D") ?? String.Empty, Security.GetSecurityTokenPath(path ?? String.Empty), definitionId);
}
private Int32 m_requiredPermissions = BuildPermissions.ViewBuildDefinition;
private String m_nestingSecurityToken = String.Empty;
#endregion
}
}

View File

@@ -1,61 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
[DataContract]
public class DefinitionResourceReference : BaseSecuredObject
{
public DefinitionResourceReference()
: this(null)
{
}
internal DefinitionResourceReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// A friendly name for the resource.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// The type of the resource.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Type
{
get;
set;
}
/// <summary>
/// The id of the resource.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Id
{
get;
set;
}
/// <summary>
/// Indicates whether the resource is authorized for use.
/// </summary>
[DataMember]
public Boolean Authorized
{
get;
set;
}
}
}

View File

@@ -1,117 +0,0 @@
using System;
using System.Text.RegularExpressions;
using GitHub.Services.Common;
using GitHub.Services.WebApi;
using Newtonsoft.Json;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a demand used by a definition or build.
/// </summary>
[JsonConverter(typeof(DemandJsonConverter))]
public abstract class Demand : BaseSecuredObject
{
protected Demand(
String name,
String value)
: this(name, value, null)
{
}
protected Demand(
String name,
String value,
ISecuredObject securedObject)
: base(securedObject)
{
ArgumentUtility.CheckStringForNullOrEmpty(name, "name");
this.Name = name;
this.Value = value;
}
/// <summary>
/// The name of the capability referenced by the demand.
/// </summary>
public String Name
{
get;
private set;
}
/// <summary>
/// The demanded value.
/// </summary>
public String Value
{
get;
private set;
}
public override sealed Boolean Equals(Object obj)
{
Demand demand = obj as Demand;
return demand != null && demand.ToString().Equals(this.ToString(), StringComparison.OrdinalIgnoreCase);
}
public override sealed Int32 GetHashCode()
{
return this.ToString().ToUpperInvariant().GetHashCode();
}
public override sealed String ToString()
{
return GetExpression();
}
/// <summary>
/// Clones this object.
/// </summary>
/// <returns></returns>
public abstract Demand Clone();
protected abstract String GetExpression();
/// <summary>
/// Parses a string into a Demand instance.
/// </summary>
/// <param name="input"></param>
/// <param name="demand"></param>
/// <returns></returns>
public static Boolean TryParse(
String input,
out Demand demand)
{
demand = null;
Match match = s_demandRegex.Match(input);
if (!match.Success)
{
return false;
}
String name = match.Groups["name"].Value;
String opcode = match.Groups["opcode"].Value;
String value = match.Groups["value"].Value;
if (String.IsNullOrEmpty(opcode))
{
demand = new DemandExists(name);
}
else
{
switch (opcode)
{
case "equals":
demand = new DemandEquals(name, value);
break;
}
}
return demand != null;
}
private static readonly Regex s_demandRegex = new Regex(@"^(?<name>[^ ]+)([ ]+\-(?<opcode>[^ ]+)[ ]+(?<value>.*))?$",
RegexOptions.Compiled);
}
}

View File

@@ -1,46 +0,0 @@
using System;
using System.Globalization;
using GitHub.Services.Common;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents an "equals" demand.
/// </summary>
/// <remarks>
/// This demand is satisfied when the value of the named capability matches the value stored in the demand.
/// </remarks>
public sealed class DemandEquals : Demand
{
public DemandEquals(
String name,
String value)
: this(name, value, null)
{
}
public DemandEquals(
String name,
String value,
ISecuredObject securedObject)
: base(name, value, securedObject)
{
ArgumentUtility.CheckStringForNullOrEmpty(value, "value");
}
/// <summary>
/// Clones this object.
/// </summary>
/// <returns></returns>
public override Demand Clone()
{
return new DemandEquals(this.Name, this.Value);
}
protected override String GetExpression()
{
return String.Format(CultureInfo.InvariantCulture, "{0} -equals {1}", this.Name, this.Value);
}
}
}

View File

@@ -1,41 +0,0 @@
using System;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents an "exists" demand.
/// </summary>
/// <remarks>
/// This demand is satisfied as long as the named capability exists, regardless of its value.
/// </remarks>
public sealed class DemandExists : Demand
{
public DemandExists(
String name)
: this(name, null)
{
}
public DemandExists(
String name,
ISecuredObject securedObject)
: base(name, null, securedObject)
{
}
/// <summary>
/// Clones this object.
/// </summary>
/// <returns></returns>
public override Demand Clone()
{
return new DemandExists(this.Name);
}
protected override String GetExpression()
{
return this.Name;
}
}
}

View File

@@ -1,46 +0,0 @@
using GitHub.Services.WebApi;
using Newtonsoft.Json;
using System;
using System.Reflection;
namespace GitHub.Build.WebApi
{
internal sealed class DemandJsonConverter : VssSecureJsonConverter
{
public override Boolean CanConvert(Type objectType)
{
return typeof(Demand).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
}
public override Object ReadJson(
JsonReader reader,
Type objectType,
Object existingValue,
JsonSerializer serializer)
{
if (existingValue == null && reader.TokenType == JsonToken.String)
{
Demand demand;
if (Demand.TryParse((String)reader.Value, out demand))
{
existingValue = demand;
}
}
return existingValue;
}
public override void WriteJson(
JsonWriter writer,
Object value,
JsonSerializer serializer)
{
base.WriteJson(writer, value, serializer);
if (value != null)
{
writer.WriteValue(value.ToString());
}
}
}
}

View File

@@ -1,43 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a dependency.
/// </summary>
[DataContract]
public class Dependency : BaseSecuredObject
{
public Dependency()
{
}
internal Dependency(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The scope. This names the object referenced by the dependency.
/// </summary>
[DataMember]
public String Scope
{
get;
set;
}
/// <summary>
/// The event. The dependency is satisfied when the referenced object emits this event.
/// </summary>
[DataMember]
public String Event
{
get;
set;
}
}
}

View File

@@ -1,441 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.DistributedTask.Common.Contracts;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi.Internals
{
/// <summary>
/// For back-compat with extensions that use the old Steps format instead of Process and Phases
/// </summary>
[DataContract]
[EditorBrowsable(EditorBrowsableState.Never)]
public class BuildDefinition3_2 : BuildDefinitionReference3_2
{
public BuildDefinition3_2()
{
this.JobAuthorizationScope = BuildAuthorizationScope.ProjectCollection;
}
/// <summary>
/// The build number format
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String BuildNumberFormat
{
get;
set;
}
/// <summary>
/// The comment entered when saving the definition
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Comment
{
get;
set;
}
/// <summary>
/// The description
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Description
{
get;
set;
}
/// <summary>
/// The drop location for the definition
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String DropLocation
{
get;
set;
}
/// <summary>
/// The job authorization scope for builds which are queued against this definition
/// </summary>
[DataMember]
public BuildAuthorizationScope JobAuthorizationScope
{
get;
set;
}
/// <summary>
/// The job execution timeout in minutes for builds which are queued against this definition
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 JobTimeoutInMinutes
{
get;
set;
}
/// <summary>
/// The job cancel timeout in minutes for builds which are cancelled by user for this definition
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 JobCancelTimeoutInMinutes
{
get;
set;
}
/// <summary>
/// Indicates whether badges are enabled for this definition
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean BadgeEnabled
{
get;
set;
}
/// <summary>
/// The list of steps for this definition.
/// </summary>
public List<BuildDefinitionStep> Steps
{
get
{
if (m_steps == null)
{
m_steps = new List<BuildDefinitionStep>();
}
return m_steps;
}
}
/// <summary>
/// Build options
/// </summary>
public List<BuildOption> Options
{
get
{
if (m_options == null)
{
m_options = new List<BuildOption>();
}
return m_options;
}
}
/// <summary>
/// The repository
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildRepository Repository
{
get;
set;
}
/// <summary>
/// Process Parameters
/// </summary>
[DataMember(EmitDefaultValue = false)]
public ProcessParameters ProcessParameters
{
get;
set;
}
/// <summary>
/// The triggers
/// </summary>
public List<BuildTrigger> Triggers
{
get
{
if (m_triggers == null)
{
m_triggers = new List<BuildTrigger>();
}
return m_triggers;
}
}
/// <summary>
/// The variables.
/// </summary>
public IDictionary<String, BuildDefinitionVariable> Variables
{
get
{
if (m_variables == null)
{
m_variables = new Dictionary<String, BuildDefinitionVariable>(StringComparer.OrdinalIgnoreCase);
}
return m_variables;
}
}
/// <summary>
/// The demands.
/// </summary>
public List<Demand> Demands
{
get
{
if (m_demands == null)
{
m_demands = new List<Demand>();
}
return m_demands;
}
}
/// <summary>
/// The retention rules.
/// </summary>
public List<RetentionPolicy> RetentionRules
{
get
{
if (m_retentionRules == null)
{
m_retentionRules = new List<RetentionPolicy>();
}
return m_retentionRules;
}
}
/// <summary>
/// A collection of properties which may be used to extend the storage fields available
/// for a given definition.
/// </summary>
public PropertiesCollection Properties
{
get
{
if (m_properties == null)
{
m_properties = new PropertiesCollection();
}
return m_properties;
}
internal set
{
m_properties = value;
}
}
/// <summary>
/// A collection of tags associated with the build definition.
/// </summary>
public List<String> Tags
{
get
{
if (m_tags == null)
{
m_tags = new List<String>();
}
return m_tags;
}
}
/// <summary>
/// The latest build for this definition.
/// </summary>
public Build LatestBuild
{
get
{
return m_latestBuild;
}
internal set
{
m_latestBuild = value;
}
}
/// <summary>
/// The latest completed build for this definition.
/// </summary>
public Build LatestCompletedBuild
{
get
{
return m_latestCompletedBuild;
}
internal set
{
m_latestCompletedBuild = value;
}
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedOptions, ref m_options, true);
SerializationHelper.Copy(ref m_serializedSteps, ref m_steps, true);
SerializationHelper.Copy(ref m_serializedTriggers, ref m_triggers, true);
SerializationHelper.Copy(ref m_serializedVariables, ref m_variables, StringComparer.OrdinalIgnoreCase, true);
SerializationHelper.Copy(ref m_serializedDemands, ref m_demands, true);
SerializationHelper.Copy(ref m_serializedRetentionRules, ref m_retentionRules, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_options, ref m_serializedOptions);
SerializationHelper.Copy(ref m_steps, ref m_serializedSteps);
SerializationHelper.Copy(ref m_triggers, ref m_serializedTriggers);
SerializationHelper.Copy(ref m_variables, ref m_serializedVariables, StringComparer.OrdinalIgnoreCase);
SerializationHelper.Copy(ref m_demands, ref m_serializedDemands);
SerializationHelper.Copy(ref m_retentionRules, ref m_serializedRetentionRules);
}
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
m_serializedSteps = null;
m_serializedOptions = null;
m_serializedTriggers = null;
m_serializedVariables = null;
m_serializedRetentionRules = null;
}
[DataMember(Name = "Build", EmitDefaultValue = false)]
private List<BuildDefinitionStep> m_serializedSteps;
[DataMember(Name = "Options", EmitDefaultValue = false)]
private List<BuildOption> m_serializedOptions;
[DataMember(Name = "Triggers", EmitDefaultValue = false)]
private List<BuildTrigger> m_serializedTriggers;
[DataMember(Name = "Variables", EmitDefaultValue = false)]
private IDictionary<String, BuildDefinitionVariable> m_serializedVariables;
[DataMember(Name = "Demands", EmitDefaultValue = false)]
private List<Demand> m_serializedDemands;
[DataMember(Name = "RetentionRules", EmitDefaultValue = false)]
private List<RetentionPolicy> m_serializedRetentionRules;
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "Properties")]
private PropertiesCollection m_properties;
[DataMember(EmitDefaultValue = false, Name = "Tags")]
private List<String> m_tags;
[DataMember(EmitDefaultValue = false, Name = "LatestBuild")]
private Build m_latestBuild;
[DataMember(EmitDefaultValue = false, Name = "LatestCompletedBuild")]
private Build m_latestCompletedBuild;
private List<Demand> m_demands;
private List<BuildOption> m_options;
private List<BuildTrigger> m_triggers;
private List<RetentionPolicy> m_retentionRules;
private List<BuildDefinitionStep> m_steps;
private IDictionary<String, BuildDefinitionVariable> m_variables;
}
internal static class BuildDefinition3_2Extensions
{
public static BuildDefinition ToBuildDefinition(
this BuildDefinition3_2 source)
{
if (source == null)
{
return null;
}
var result = new BuildDefinition()
{
AuthoredBy = source.AuthoredBy,
BadgeEnabled = source.BadgeEnabled,
BuildNumberFormat = source.BuildNumberFormat,
Comment = source.Comment,
CreatedDate = source.CreatedDate,
DefinitionQuality = source.DefinitionQuality,
Description = source.Description,
DropLocation = source.DropLocation,
Id = source.Id,
JobAuthorizationScope = source.JobAuthorizationScope,
JobCancelTimeoutInMinutes = source.JobCancelTimeoutInMinutes,
JobTimeoutInMinutes = source.JobTimeoutInMinutes,
LatestBuild = source.LatestBuild,
LatestCompletedBuild = source.LatestCompletedBuild,
Name = source.Name,
ParentDefinition = source.ParentDefinition,
Path = source.Path,
ProcessParameters = source.ProcessParameters,
Project = source.Project,
Queue = source.Queue,
QueueStatus = source.QueueStatus,
Repository = source.Repository,
Revision = source.Revision,
Type = source.Type,
Uri = source.Uri,
Url = source.Url
};
if (source.Demands.Count > 0)
{
result.Demands.AddRange(source.Demands);
}
if (source.Metrics.Count > 0)
{
result.Metrics.AddRange(source.Metrics);
}
if (source.Options.Count > 0)
{
result.Options.AddRange(source.Options);
}
var process = new DesignerProcess();
result.Process = process;
var phase = new Phase();
process.Phases.Add(phase);
if (source.Steps.Count > 0)
{
phase.Steps.AddRange(source.Steps);
}
foreach (var property in source.Properties)
{
result.Properties.Add(property.Key, property.Value);
}
if (source.RetentionRules.Count > 0)
{
result.RetentionRules.AddRange(source.RetentionRules);
}
if (source.Tags.Count > 0)
{
result.Tags.AddRange(source.Tags);
}
if (source.Triggers.Count > 0)
{
result.Triggers.AddRange(source.Triggers);
}
foreach (var variablePair in source.Variables)
{
result.Variables.Add(variablePair.Key, variablePair.Value);
}
return result;
}
}
}

View File

@@ -1,127 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// For back-compat with extensions that use the old Steps format instead of Process and Phases
/// </summary>
[DataContract]
[EditorBrowsable(EditorBrowsableState.Never)]
public class BuildDefinitionReference3_2 : DefinitionReference
{
public BuildDefinitionReference3_2()
{
Type = DefinitionType.Build;
QueueStatus = DefinitionQueueStatus.Enabled;
}
/// <summary>
/// The quality of the definition document (draft, etc.)
/// </summary>
[DataMember(EmitDefaultValue = false, Name = "Quality")]
public DefinitionQuality? DefinitionQuality
{
get;
set;
}
/// <summary>
/// The author of the definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef AuthoredBy
{
get;
[EditorBrowsable(EditorBrowsableState.Never)]
set;
}
/// <summary>
/// A reference to the definition that this definition is a draft of, if this is a draft definition.
/// </summary>
[DataMember(EmitDefaultValue = false, Name = "draftOf")]
public DefinitionReference ParentDefinition
{
get;
set;
}
/// <summary>
/// The list of drafts associated with this definition, if this is not a draft definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public List<DefinitionReference> Drafts
{
get
{
return m_drafts ?? (m_drafts = new List<DefinitionReference>());
}
internal set
{
m_drafts = value;
}
}
/// <summary>
/// The default queue for builds run against this definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public AgentPoolQueue Queue
{
get;
set;
}
/// <summary>
/// The metrics for this definition.
/// </summary>
public List<BuildMetric> Metrics
{
get
{
return m_metrics ?? (m_metrics = new List<BuildMetric>());
}
internal set
{
m_metrics = value;
}
}
/// <summary>
/// The links to other objects related to this object.
/// </summary>
public ReferenceLinks Links => m_links ?? (m_links = new ReferenceLinks());
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedMetrics, ref m_metrics, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_metrics, ref m_serializedMetrics);
}
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
m_serializedMetrics = null;
}
[DataMember(Name = "Metrics", EmitDefaultValue = false)]
private List<BuildMetric> m_serializedMetrics;
[DataMember(Name = "_links", EmitDefaultValue = false)]
private ReferenceLinks m_links;
private List<BuildMetric> m_metrics;
private List<DefinitionReference> m_drafts;
}
}

View File

@@ -1,123 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi.Internals
{
/// <summary>
/// For back-compat with extensions that use the old Steps format instead of Process and Phases
/// </summary>
[DataContract]
[EditorBrowsable(EditorBrowsableState.Never)]
public class BuildDefinitionTemplate3_2
{
public BuildDefinitionTemplate3_2()
{
Category = "Custom";
}
[DataMember(IsRequired = true)]
public String Id
{
get;
set;
}
[DataMember(IsRequired = true)]
public String Name
{
get;
set;
}
[DataMember(EmitDefaultValue = true)]
public Boolean CanDelete
{
get;
set;
}
[DataMember(EmitDefaultValue = true)]
public String Category
{
get;
set;
}
[DataMember(EmitDefaultValue = true)]
public String DefaultHostedQueue
{
get;
set;
}
[DataMember(EmitDefaultValue = false)]
public Guid IconTaskId
{
get;
set;
}
[DataMember(EmitDefaultValue = false)]
public String Description
{
get;
set;
}
[DataMember(EmitDefaultValue = false)]
public BuildDefinition3_2 Template
{
get;
set;
}
public IDictionary<String, String> Icons
{
get
{
if (m_icons == null)
{
m_icons = new Dictionary<String, String>(StringComparer.Ordinal);
}
return m_icons;
}
}
[DataMember(EmitDefaultValue = false, Name = "Icons")]
private Dictionary<String, String> m_icons;
}
internal static class BuildDefinitionTemplate3_2Extensions
{
public static BuildDefinitionTemplate ToBuildDefinitionTemplate(
this BuildDefinitionTemplate3_2 source)
{
if (source == null)
{
return null;
}
var result = new BuildDefinitionTemplate()
{
CanDelete = source.CanDelete,
Category = source.Category,
DefaultHostedQueue = source.DefaultHostedQueue,
Description = source.Description,
IconTaskId = source.IconTaskId,
Id = source.Id,
Name = source.Name,
Template = source.Template.ToBuildDefinition()
};
foreach (var iconPair in source.Icons)
{
result.Icons.Add(iconPair.Key, iconPair.Value);
}
return result;
}
}
}

View File

@@ -1,48 +0,0 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a build process supported by the build definition designer.
/// </summary>
[DataContract]
public class DesignerProcess : BuildProcess
{
public DesignerProcess()
:this(null)
{
}
internal DesignerProcess(
ISecuredObject securedObject)
: base(ProcessType.Designer, securedObject)
{
}
/// <summary>
/// The list of phases.
/// </summary>
public List<Phase> Phases
{
get
{
if (m_phases == null)
{
m_phases = new List<Phase>();
}
return m_phases;
}
}
[DataMember(Name = "Phases", EmitDefaultValue = false)]
private List<Phase> m_phases;
/// <summary>
/// The target for the build process.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DesignerProcessTarget Target { get; set; }
}
}

View File

@@ -1,27 +0,0 @@
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents the target for the build process.
/// </summary>
[DataContract]
public class DesignerProcessTarget : BaseSecuredObject
{
public DesignerProcessTarget()
{
}
public DesignerProcessTarget(ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// Agent specification for the build process.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public AgentSpecification AgentSpecification { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
[DataContract]
public class DockerProcess : BuildProcess
{
public DockerProcess()
: this(null)
{
}
internal DockerProcess(
ISecuredObject securedObject)
: base(ProcessType.Docker, securedObject)
{
}
[DataMember(EmitDefaultValue = false)]
public DockerProcessTarget Target { get; set; }
}
}

View File

@@ -1,21 +0,0 @@
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents the target for the docker build process.
/// </summary>
[DataContract]
public class DockerProcessTarget: DesignerProcessTarget
{
public DockerProcessTarget()
{
}
public DockerProcessTarget(ISecuredObject securedObject)
: base(securedObject)
{
}
}
}

View File

@@ -1,119 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Core.WebApi;
using GitHub.Services.Common;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a folder that contains build definitions.
/// </summary>
[DataContract]
public class Folder : ISecuredObject
{
public Folder()
{
}
/// <summary>
/// The full path.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Path
{
get;
set;
}
/// <summary>
/// The description.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Description
{
get;
set;
}
/// <summary>
/// The date the folder was created.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime CreatedOn
{
get;
set;
}
/// <summary>
/// The process or person who created the folder.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef CreatedBy
{
get;
set;
}
/// <summary>
/// The date the folder was last changed.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public DateTime? LastChangedDate
{
get;
set;
}
/// <summary>
/// The process or person that last changed the folder.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef LastChangedBy
{
get;
set;
}
/// <summary>
/// The project.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public TeamProjectReference Project
{
get;
set;
}
#region ISecuredObject implementation
// We don't have folder-specific permissions. Folders are secured by the project.
public Guid NamespaceId
{
get
{
ArgumentUtility.CheckForNull(Project, nameof(Project));
return ((ISecuredObject)Project).NamespaceId;
}
}
public Int32 RequiredPermissions
{
get
{
ArgumentUtility.CheckForNull(Project, nameof(Project));
return ((ISecuredObject)Project).RequiredPermissions;
}
}
public String GetToken()
{
ArgumentUtility.CheckForNull(Project, nameof(Project));
return ((ISecuredObject)Project).GetToken();
}
#endregion
}
}

View File

@@ -1,43 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents the ability to build forks of the selected repository.
/// </summary>
[DataContract]
public sealed class Forks : BaseSecuredObject
{
public Forks()
{
}
internal Forks(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// Indicates whether the trigger should queue builds for forks of the selected repository.
/// </summary>
[DataMember]
public Boolean Enabled
{
get;
set;
}
/// <summary>
/// Indicates whether a build should use secrets when building forks of the selected repository.
/// </summary>
[DataMember]
public Boolean AllowSecrets
{
get;
set;
}
}
}

View File

@@ -1,98 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents an issue (error, warning) associated with a build.
/// </summary>
[DataContract]
public class Issue : BaseSecuredObject
{
public Issue()
{
}
internal Issue(
ISecuredObject securedObject)
: base(securedObject)
{
}
private Issue(
Issue issueToBeCloned)
: base(issueToBeCloned)
{
this.Type = issueToBeCloned.Type;
this.Category = issueToBeCloned.Category;
this.Message = issueToBeCloned.Message;
if (issueToBeCloned.m_data != null)
{
foreach (var item in issueToBeCloned.m_data)
{
this.Data.Add(item);
}
}
}
/// <summary>
/// The type (error, warning) of the issue.
/// </summary>
[DataMember(Order = 1)]
public IssueType Type
{
get;
set;
}
/// <summary>
/// The category.
/// </summary>
[DataMember(Order = 2)]
public String Category
{
get;
set;
}
/// <summary>
/// A description of the issue.
/// </summary>
[DataMember(Order = 3)]
public String Message
{
get;
set;
}
/// <summary>
/// A dictionary containing details about the issue.
/// </summary>
public IDictionary<String, String> Data
{
get
{
if (m_data == null)
{
m_data = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
}
return m_data;
}
}
/// <summary>
/// Clones this object.
/// </summary>
/// <returns></returns>
public Issue Clone()
{
return new Issue(this);
}
[DataMember(Name = "Data", EmitDefaultValue = false, Order = 4)]
private IDictionary<String, String> m_data;
}
}

View File

@@ -1,20 +0,0 @@
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
[DataContract]
public class JustInTimeProcess : BuildProcess
{
public JustInTimeProcess()
: this(null)
{
}
internal JustInTimeProcess(
ISecuredObject securedObject)
: base(ProcessType.JustInTime, securedObject)
{
}
}
}

View File

@@ -1,46 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents options for running a phase against multiple agents.
/// </summary>
[DataContract]
public class MultipleAgentExecutionOptions : AgentTargetExecutionOptions
{
public MultipleAgentExecutionOptions()
: this(null)
{
}
internal MultipleAgentExecutionOptions(
ISecuredObject securedObject)
: base(AgentTargetExecutionType.MultipleAgents, securedObject)
{
MaxConcurrency = 1;
}
/// <summary>
/// The maximum number of agents to use simultaneously.
/// </summary>
[DataMember(EmitDefaultValue=true)]
[DefaultValue(1)]
public Int32 MaxConcurrency {
get;
set;
}
/// <summary>
/// Indicates whether failure on one agent should prevent the phase from running on other agents.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Boolean ContinueOnError
{
get;
set;
}
}
}

View File

@@ -1,186 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a phase of a build definition.
/// </summary>
[DataContract]
public class Phase : BaseSecuredObject
{
public Phase()
{
}
internal Phase(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The name of the phase.
/// </summary>
[DataMember]
public String Name
{
get;
set;
}
/// <summary>
/// The unique ref name of the phase.
/// </summary>
[DataMember]
public String RefName
{
get;
set;
}
/// <summary>
/// The list of steps run by the phase.
/// </summary>
public List<BuildDefinitionStep> Steps
{
get
{
if (m_steps == null)
{
m_steps = new List<BuildDefinitionStep>();
}
return m_steps;
}
set
{
m_steps = value;
}
}
/// <summary>
/// The list of variables defined on the phase.
/// </summary>
public IDictionary<String, BuildDefinitionVariable> Variables
{
get
{
if (m_variables == null)
{
m_variables = new Dictionary<String, BuildDefinitionVariable>(StringComparer.OrdinalIgnoreCase);
}
return m_variables;
}
set
{
m_variables = new Dictionary<String, BuildDefinitionVariable>(value, StringComparer.OrdinalIgnoreCase);
}
}
/// <summary>
/// The list of dependencies for this phase.
/// </summary>
public List<Dependency> Dependencies
{
get
{
if (m_dependencies == null)
{
m_dependencies = new List<Dependency>();
}
return m_dependencies;
}
set
{
m_dependencies = value;
}
}
/// <summary>
/// The condition that must be true for this phase to execute.
/// </summary>
/// <remarks>
/// The condition is evaluated after all dependencies are satisfied.
/// </remarks>
[DataMember(EmitDefaultValue = false, IsRequired = false)]
public String Condition
{
get;
set;
}
/// <summary>
/// The target (agent, server, etc.) for this phase.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public PhaseTarget Target
{
get;
set;
}
/// <summary>
/// The job authorization scope for builds queued against this definition.
/// </summary>
[DataMember]
public BuildAuthorizationScope JobAuthorizationScope
{
get;
set;
}
/// <summary>
/// The job execution timeout, in minutes, for builds queued against this definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 JobTimeoutInMinutes
{
get;
set;
}
/// <summary>
/// The cancellation timeout, in minutes, for builds queued against this definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 JobCancelTimeoutInMinutes
{
get;
set;
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedDependencies, ref m_dependencies, true);
SerializationHelper.Copy(ref m_serializedSteps, ref m_steps, true);
SerializationHelper.Copy(ref m_serializedVariables, ref m_variables, StringComparer.OrdinalIgnoreCase, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_dependencies, ref m_serializedDependencies);
SerializationHelper.Copy(ref m_steps, ref m_serializedSteps);
SerializationHelper.Copy(ref m_variables, ref m_serializedVariables, StringComparer.OrdinalIgnoreCase);
}
[DataMember(Name = "Dependencies", EmitDefaultValue = false)]
private List<Dependency> m_serializedDependencies;
[DataMember(Name = "Steps", EmitDefaultValue = false)]
private List<BuildDefinitionStep> m_serializedSteps;
[DataMember(Name = "Variables", EmitDefaultValue = false)]
private IDictionary<String, BuildDefinitionVariable> m_serializedVariables;
private List<Dependency> m_dependencies;
private List<BuildDefinitionStep> m_steps;
private IDictionary<String, BuildDefinitionVariable> m_variables;
}
}

View File

@@ -1,46 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
using Newtonsoft.Json;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents the target of a phase.
/// </summary>
[DataContract]
[KnownType(typeof(AgentPoolQueueTarget))]
[KnownType(typeof(ServerTarget))]
[JsonConverter(typeof(PhaseTargetJsonConverter))]
public abstract class PhaseTarget : BaseSecuredObject
{
protected PhaseTarget()
{
}
internal protected PhaseTarget(
Int32 type,
ISecuredObject securedObject)
: base(securedObject)
{
this.Type = type;
}
protected PhaseTarget(Int32 type)
{
this.Type = type;
}
/// <summary>
/// The type of the target.
/// </summary>
/// <remarks>
/// <see cref="PhaseTargetType" /> for valid phase target types.
/// </remarks>
[DataMember]
public Int32 Type {
get;
private set;
}
}
}

View File

@@ -1,36 +0,0 @@
using System;
namespace GitHub.Build.WebApi
{
internal sealed class PhaseTargetJsonConverter : TypePropertyJsonConverter<PhaseTarget>
{
protected override PhaseTarget GetInstance(Type objectType)
{
if (objectType == typeof(AgentPoolQueueTarget))
{
return new AgentPoolQueueTarget();
}
else if (objectType == typeof(ServerTarget))
{
return new ServerTarget();
}
else
{
return base.GetInstance(objectType);
}
}
protected override PhaseTarget GetInstance(Int32 targetType)
{
switch (targetType)
{
case PhaseTargetType.Agent:
return new AgentPoolQueueTarget();
case PhaseTargetType.Server:
return new ServerTarget();
default:
return null;
}
}
}
}

View File

@@ -1,37 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
// TODO: remove this before dev16 ships. leaving it in for the dev15 cycle to avoid any issues
[Obsolete("This contract is not used by any product code")]
[EditorBrowsable(EditorBrowsableState.Never)]
[DataContract]
public sealed class PropertyValue
{
/// <summary>
/// Name in the name value mapping
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String PropertyName { get; set; }
/// <summary>
/// Value in the name value mapping
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Object Value { get; set; }
/// <summary>
/// Guid of identity that changed this property value
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Guid? ChangedBy { get; set; }
/// <summary>
/// The date this property value was changed
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public DateTime? ChangedDate { get; set; }
}
}

View File

@@ -1,91 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a pull request object. These are retrieved from Source Providers.
/// </summary>
[DataContract]
public class PullRequest: BaseSecuredObject
{
public PullRequest()
{
this.Links = new ReferenceLinks();
}
internal PullRequest(
ISecuredObject securedObject)
: base(securedObject)
{
this.Links = new ReferenceLinks();
}
/// <summary>
/// The name of the provider this pull request is associated with.
/// </summary>
[DataMember]
public String ProviderName { get; set; }
/// <summary>
/// Unique identifier for the pull request
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Id { get; set; }
/// <summary>
/// Title of the pull request.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Title { get; set; }
/// <summary>
/// Description for the pull request.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Description { get; set; }
/// <summary>
/// Current state of the pull request, e.g. open, merged, closed, conflicts, etc.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String CurrentState { get; set; }
/// <summary>
/// Author of the pull request.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef Author { get; set; }
/// <summary>
/// Owner of the source repository of this pull request
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String SourceRepositoryOwner { get; set; }
/// <summary>
/// Source branch ref of this pull request
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String SourceBranchRef { get; set; }
/// <summary>
/// Owner of the target repository of this pull request
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String TargetRepositoryOwner { get; set; }
/// <summary>
/// Target branch ref of this pull request
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String TargetBranchRef { get; set; }
/// <summary>
/// The links to other objects related to this object.
/// </summary>
[DataMember(Name = "_links", EmitDefaultValue = false)]
public ReferenceLinks Links { get; set; }
}
}

View File

@@ -1,68 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a repository's webhook returned from a source provider.
/// </summary>
[DataContract]
public class RepositoryWebhook
{
/// <summary>
/// The types of triggers the webhook was created for.
/// </summary>
public List<DefinitionTriggerType> Types
{
get
{
if (m_types == null)
{
m_types = new List<DefinitionTriggerType>();
}
return m_types;
}
set
{
m_types = value;
}
}
/// <summary>
/// The friendly name of the repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name { get; set; }
/// <summary>
/// The URL of the repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Uri Url { get; set; }
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedTypes, ref m_types, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_types, ref m_serializedTypes);
}
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
m_serializedTypes = null;
}
[DataMember(Name = nameof(Types), EmitDefaultValue = false)]
private List<DefinitionTriggerType> m_serializedTypes;
private List<DefinitionTriggerType> m_types;
}
}

View File

@@ -1,30 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
// TODO: remove this before dev16 ships. leaving it in for the dev15 cycle to avoid any issues
[Obsolete("This contract is not used by any product code")]
[DataContract]
public class RequestReference
{
/// <summary>
/// Id of the resource
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Int32 Id { get; set; }
/// <summary>
/// Full http link to the resource
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String Url { get; set; }
/// <summary>
/// Name of the requestor
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IdentityRef RequestedFor { get; set; }
}
}

View File

@@ -1,171 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a retention policy for a build definition.
/// </summary>
[DataContract]
public class RetentionPolicy : BaseSecuredObject
{
public RetentionPolicy()
: this(null)
{
}
public RetentionPolicy(
ISecuredObject securedObject)
: base(securedObject)
{
DaysToKeep = 30; // default to 30 days
MinimumToKeep = 1; // default to 1
DeleteBuildRecord = true; // default to set Deleted bit on build records
DeleteTestResults = false; // For old build definitions, it has to be false. This value in New Definitions will be handled in ts files.
}
/// <summary>
/// The list of branches affected by the retention policy.
/// </summary>
public List<String> Branches
{
get
{
if (m_branches == null)
{
m_branches = new List<String>();
}
return m_branches;
}
internal set
{
m_branches = value;
}
}
/// <summary>
/// The number of days to keep builds.
/// </summary>
[DataMember]
public Int32 DaysToKeep
{
get
{
return m_daysToKeep;
}
set
{
if (value < 0)
{
m_daysToKeep = 0;
}
else
{
m_daysToKeep = value;
}
}
}
/// <summary>
/// The minimum number of builds to keep.
/// </summary>
[DataMember]
public Int32 MinimumToKeep
{
get
{
return m_minimumToKeep;
}
set
{
if (value < 0)
{
m_minimumToKeep = 0;
}
else
{
m_minimumToKeep = value;
}
}
}
/// <summary>
/// Indicates whether the build record itself should be deleted.
/// </summary>
[DataMember]
public Boolean DeleteBuildRecord
{
get;
set;
}
/// <summary>
/// The list of artifacts to delete.
/// </summary>
public List<String> ArtifactsToDelete
{
get
{
if (m_artifactsToDelete == null)
{
m_artifactsToDelete = new List<String>();
}
return m_artifactsToDelete;
}
internal set
{
m_artifactsToDelete = value;
}
}
// This list contains the types of artifacts to be deleted.
// These are different from ArtifactsToDelete because for certain artifacts giving user a choice for every single artifact can become cumbersome.
// e.g. artifacts in file share - user can choose to delete/keep all the artifacts in file share
/// <summary>
/// The list of types of artifacts to delete.
/// </summary>
public List<String> ArtifactTypesToDelete
{
get
{
if (m_artifactTypesToDelete == null)
{
m_artifactTypesToDelete = new List<String>();
}
return m_artifactTypesToDelete;
}
internal set
{
m_artifactTypesToDelete = value;
}
}
/// <summary>
/// Indicates whether to delete test results associated with the build.
/// </summary>
[DataMember]
public Boolean DeleteTestResults
{
get;
set;
}
[DataMember(Name = "Branches", EmitDefaultValue = false)]
private List<String> m_branches;
[DataMember(Name = "Artifacts", EmitDefaultValue = false)]
private List<String> m_artifactsToDelete;
[DataMember(Name = "ArtifactTypesToDelete", EmitDefaultValue = false)]
private List<String> m_artifactTypesToDelete;
private Int32 m_daysToKeep;
private Int32 m_minimumToKeep;
}
}

View File

@@ -1,89 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
[EditorBrowsable(EditorBrowsableState.Never)]
[DataContract]
public sealed class Schedule : BaseSecuredObject
{
public Schedule()
{
}
internal Schedule(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// Time zone of the build schedule (String representation of the time zone ID)
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String TimeZoneId { get; set; }
/// <summary>
/// Local timezone hour to start
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
public Int32 StartHours { get; set; }
/// <summary>
/// Local timezone minute to start
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
public Int32 StartMinutes { get; set; }
/// <summary>
/// Days for a build (flags enum for days of the week)
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public ScheduleDays DaysToBuild { get; set; }
//TODO: We should be able to remove the ScheduleJobId field in tbl_Definition
/// <summary>
/// The Job Id of the Scheduled job that will queue the scheduled build.
/// Since a single trigger can have multiple schedules and we want a single job
/// to process a single schedule (since each schedule has a list of branches
/// to build), the schedule itself needs to define the Job Id.
/// This value will be filled in when a definition is added or updated. The UI
/// does not provide it or use it.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Guid ScheduleJobId { get; set; }
/// <summary>
/// Branches that the schedule affects
/// </summary>
public List<String> BranchFilters
{
get
{
if (m_branchFilters == null)
{
m_branchFilters = new List<String>();
}
return m_branchFilters;
}
internal set
{
m_branchFilters = value;
}
}
/// <summary>
/// Flag to determine if this schedule should only build if the associated
/// source has been changed.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = true)]
public bool ScheduleOnlyWithChanges { get; set; }
[DataMember(Name = "BranchFilters", EmitDefaultValue = false)]
private List<String> m_branchFilters;
}
}

View File

@@ -1,33 +0,0 @@
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a phase target that runs on the server.
/// </summary>
[DataContract]
public class ServerTarget : PhaseTarget
{
public ServerTarget()
: base(PhaseTargetType.Server)
{
}
internal ServerTarget(
ISecuredObject securedObject)
: base(PhaseTargetType.Server, securedObject)
{
}
/// <summary>
/// The execution options.
/// </summary>
[DataMember]
public ServerTargetExecutionOptions ExecutionOptions
{
get;
set;
}
}
}

View File

@@ -1,53 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
using Newtonsoft.Json;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents options for running a phase on the server.
/// </summary>
[DataContract]
[KnownType(typeof(VariableMultipliersServerExecutionOptions))]
[JsonConverter(typeof(ServerTargetExecutionOptionsJsonConverter))]
public class ServerTargetExecutionOptions : BaseSecuredObject
{
public ServerTargetExecutionOptions()
: this(ServerTargetExecutionType.Normal)
{
}
protected ServerTargetExecutionOptions(Int32 type)
: this(type, null)
{
}
internal ServerTargetExecutionOptions(
ISecuredObject securedObject)
: this(ServerTargetExecutionType.Normal, securedObject)
{
}
internal ServerTargetExecutionOptions(
Int32 type,
ISecuredObject securedObject)
: base(securedObject)
{
this.Type = type;
}
/// <summary>
/// The type.
/// </summary>
/// <remarks>
/// <see cref="ServerTargetExecutionType" /> for supported types.
/// </remarks>
[DataMember(EmitDefaultValue = true)]
public Int32 Type
{
get;
private set;
}
}
}

View File

@@ -1,36 +0,0 @@
using System;
namespace GitHub.Build.WebApi
{
internal sealed class ServerTargetExecutionOptionsJsonConverter : TypePropertyJsonConverter<ServerTargetExecutionOptions>
{
protected override ServerTargetExecutionOptions GetInstance(Type objectType)
{
if (objectType == typeof(ServerTargetExecutionType))
{
return new ServerTargetExecutionOptions();
}
else if (objectType == typeof(VariableMultipliersServerExecutionOptions))
{
return new VariableMultipliersServerExecutionOptions();
}
else
{
return base.GetInstance(objectType);
}
}
protected override ServerTargetExecutionOptions GetInstance(Int32 targetType)
{
switch (targetType)
{
case ServerTargetExecutionType.Normal:
return new ServerTargetExecutionOptions();
case ServerTargetExecutionType.VariableMultipliers:
return new VariableMultipliersServerExecutionOptions();
default:
return null;
}
}
}
}

View File

@@ -1,35 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// An abstracted reference to some other resource. This class is used to provide the build
/// data contracts with a uniform way to reference other resources in a way that provides easy
/// traversal through links.
/// </summary>
[Obsolete("Use one of the specific References instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
[DataContract]
public class ShallowReference // TODO: this class is here to maintain binary compat with VS 15 RTW, and should be deleted before dev16 ships
{
/// <summary>
/// Id of the resource
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Int32 Id { get; set; }
/// <summary>
/// Name of the linked resource (definition name, controller name, etc.)
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String Name { get; set; }
/// <summary>
/// Full http link to the resource
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String Url { get; set; }
}
}

View File

@@ -1,181 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
[DataContract]
public class SourceProviderAttributes
{
/// <summary>
/// The name of the source provider.
/// </summary>
[DataMember]
public string Name
{
get;
set;
}
/// <summary>
/// The types of triggers supported by this source provider.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IList<SupportedTrigger> SupportedTriggers
{
get;
set;
}
/// <summary>
/// The capabilities supported by this source provider.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IDictionary<string, bool> SupportedCapabilities
{
get;
set;
}
/// <summary>
/// The environments where this source provider is available.
/// </summary>
[IgnoreDataMember]
public SourceProviderAvailability Availability
{
get;
set;
}
/// <summary>
/// Whether the repository type is external to TFS / VSTS servers
/// </summary>
[IgnoreDataMember]
public bool IsExternal
{
get;
set;
}
#region Server-side convenience properties
[IgnoreDataMember]
public bool SupportsSourceLinks => SupportedCapabilities != null && SupportedCapabilities.TryGetValue(SourceProviderCapabilities.SourceLinks, out bool supported) && supported;
[IgnoreDataMember]
public bool SupportsYamlDefinition => SupportedCapabilities != null && SupportedCapabilities.TryGetValue(SourceProviderCapabilities.YamlDefinition, out bool supported) && supported;
[IgnoreDataMember]
public DefinitionTriggerType SupportedTriggerTypes => SupportedTriggers?.Select(t => t.Type).Aggregate(DefinitionTriggerType.None, (x, y) => x | y) ?? DefinitionTriggerType.None;
#endregion
}
[DataContract]
public class SupportedTrigger
{
/// <summary>
/// The type of trigger.
/// </summary>
[DataMember]
public DefinitionTriggerType Type { get; set; }
/// <summary>
/// How the trigger is notified of changes.
/// </summary>
/// <remarks>
/// See <see cref="TriggerNotificationTypes"/> for supported values.
/// </remarks>
[DataMember]
public string NotificationType { get; set; }
/// <summary>
/// The default interval to wait between polls (only relevant when <see cref="NotificationType"/> is <see cref="TriggerNotificationTypes.Polling"/>).
/// </summary>
[DataMember]
public int DefaultPollingInterval { get; set; }
/// <summary>
/// The capabilities supported by this trigger.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IDictionary<string, SupportLevel> SupportedCapabilities
{
get;
set;
}
}
[DataContract]
public enum SupportLevel
{
/// <summary>
/// The functionality is not supported.
/// </summary>
[EnumMember]
Unsupported,
/// <summary>
/// The functionality is supported.
/// </summary>
[EnumMember]
Supported,
/// <summary>
/// The functionality is required.
/// </summary>
[EnumMember]
Required
}
[DataContract]
public enum SourceProviderAvailability
{
/// <summary>
/// The source provider is available in the hosted environment.
/// </summary>
[EnumMember]
Hosted = 1,
/// <summary>
/// The source provider is available in the on-premises environment.
/// </summary>
[EnumMember]
OnPremises = 2,
/// <summary>
/// The source provider is available in all environments.
/// </summary>
[EnumMember]
All = Hosted | OnPremises
}
public class SourceProviderCapabilities
{
public const string CreateLabel = "createLabel";
public const string QueryBranches = "queryBranches";
public const string QueryFileContents = "queryFileContents";
public const string QueryPathContents = "queryPathContents";
public const string QueryPullRequest = "queryPullRequest";
public const string QueryRelatedWorkItems = "queryRelatedWorkItems";
public const string QueryRepositories = "queryRepositories";
public const string QueryTopRepositories = "queryTopRepositories";
public const string QueryWebhooks = "queryWebhooks";
public const string SourceLinks = "sourceLinks";
public const string YamlDefinition = "yamlDefinition";
}
public class TriggerCapabilities
{
public const string BranchFilters = "branchFilters";
public const string PathFilters = "pathFilters";
public const string BatchChanges = "batchChanges";
public const string BuildForks = "buildForks";
public const string Comments = "comments";
}
public class TriggerNotificationTypes
{
public const string None = "none";
public const string Polling = "polling";
public const string Webhook = "webhook";
}
}

View File

@@ -1,84 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a work item related to some source item.
/// These are retrieved from Source Providers.
/// </summary>
[DataContract]
public class SourceRelatedWorkItem : BaseSecuredObject
{
public SourceRelatedWorkItem()
{
}
internal SourceRelatedWorkItem(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The name of the provider the work item is associated with.
/// </summary>
[DataMember]
public String ProviderName { get; set; }
/// <summary>
/// Unique identifier for the work item
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Id { get; set; }
/// <summary>
/// Short name for the work item.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Title { get; set; }
/// <summary>
/// Long description for the work item.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Description { get; set; }
/// <summary>
/// Type of work item, e.g. Bug, Task, User Story, etc.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Type { get; set; }
/// <summary>
/// Current state of the work item, e.g. Active, Resolved, Closed, etc.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String CurrentState { get; set; }
/// <summary>
/// Identity ref for the person that the work item is assigned to.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public IdentityRef AssignedTo { get; set; }
/// <summary>
/// The links to other objects related to this object.
/// </summary>
public ReferenceLinks Links
{
get
{
if (m_links == null)
{
m_links = new ReferenceLinks();
}
return m_links;
}
}
[DataMember(Name = "_links", EmitDefaultValue = false)]
private ReferenceLinks m_links;
}
}

View File

@@ -1,171 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a repository returned from a source provider.
/// </summary>
[DataContract]
public class SourceRepository
{
/// <summary>
/// The ID of the repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Id
{
get;
set;
}
/// <summary>
/// The name of the source provider the repository is from.
/// </summary>
[DataMember]
public String SourceProviderName
{
get;
set;
}
/// <summary>
/// The friendly name of the repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// The full name of the repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String FullName
{
get;
set;
}
/// <summary>
/// The URL of the repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Uri Url
{
get;
set;
}
/// <summary>
/// The name of the default branch.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String DefaultBranch
{
get;
set;
}
// TODO: Remove the Properties property. It mainly serves as an area to put provider API URLs that are
// passed back to the VSTS API so it does not need to construct provider API URLs. This is risky and we
// should form the URLs ourselves instead of trusting the client.
/// <summary>
/// A dictionary that holds additional information about the repository.
/// </summary>
public IDictionary<String, String> Properties
{
// Warning: This can contain secrets too. As part of #952656, we resolve secrets, it was done considering the fact that this is not a "DataMember"
// If it's ever made a "DataMember" please be cautious, we would be leaking secrets
get
{
if (m_properties == null)
{
m_properties = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
}
return m_properties;
}
internal set
{
m_properties = new Dictionary<String, String>(value, StringComparer.OrdinalIgnoreCase);
}
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedProperties, ref m_properties, StringComparer.OrdinalIgnoreCase, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_properties, ref m_serializedProperties, StringComparer.OrdinalIgnoreCase);
}
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
m_serializedProperties = null;
}
[DataMember(Name = "Properties", EmitDefaultValue = false)]
private IDictionary<String, String> m_serializedProperties;
// Warning: This can contain secrets too. As part of #952656, we resolve secrets, it was done considering the fact that this is not a "DataMember"
// If it's ever made a "DataMember" please be cautious, we would be leaking secrets
private IDictionary<String, String> m_properties;
}
/// <summary>
/// A set of repositories returned from the source provider.
/// </summary>
[DataContract]
public class SourceRepositories
{
/// <summary>
/// A list of repositories
/// </summary>
[DataMember]
public List<SourceRepository> Repositories
{
get;
set;
}
/// <summary>
/// A token used to continue this paged request; 'null' if the request is complete
/// </summary>
[DataMember]
public String ContinuationToken
{
get;
set;
}
/// <summary>
/// The number of repositories requested for each page
/// </summary>
[DataMember]
public Int32 PageLength
{
get;
set;
}
/// <summary>
/// The total number of pages, or '-1' if unknown
/// </summary>
[DataMember]
public Int32 TotalPageCount
{
get;
set;
}
}
}

View File

@@ -1,36 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents an item in a repository from a source provider.
/// </summary>
[DataContract]
public class SourceRepositoryItem
{
/// <summary>
/// The type of the item (folder, file, etc).
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Type { get; set; }
/// <summary>
/// Whether the item is able to have sub-items (e.g., is a folder).
/// </summary>
[DataMember]
public Boolean IsContainer { get; set; }
/// <summary>
/// The full path of the item, relative to the root of the repository.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Path { get; set; }
/// <summary>
/// The URL of the item.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Uri Url { get; set; }
}
}

View File

@@ -1,88 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a Subversion mapping entry.
/// </summary>
[DataContract]
public class SvnMappingDetails
{
/// <summary>
/// The server path.
/// </summary>
[DataMember(Name = "serverPath")]
public String ServerPath
{
get;
set;
}
/// <summary>
/// The local path.
/// </summary>
[DataMember(Name = "localPath")]
public String LocalPath
{
get;
set;
}
/// <summary>
/// The revision.
/// </summary>
[DataMember(Name = "revision")]
public String Revision
{
get;
set;
}
/// <summary>
/// The depth.
/// </summary>
[DataMember(Name = "depth")]
public Int32 Depth
{
get;
set;
}
/// <summary>
/// Indicates whether to ignore externals.
/// </summary>
[DataMember(Name = "ignoreExternals")]
public bool IgnoreExternals
{
get;
set;
}
}
/// <summary>
/// Represents a subversion workspace.
/// </summary>
[DataContract]
public class SvnWorkspace
{
/// <summary>
/// The list of mappings.
/// </summary>
public List<SvnMappingDetails> Mappings
{
get
{
if (m_Mappings == null)
{
m_Mappings = new List<SvnMappingDetails>();
}
return m_Mappings;
}
}
[DataMember(Name = "mappings")]
private List<SvnMappingDetails> m_Mappings;
}
}

View File

@@ -1,66 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to an agent pool.
/// </summary>
[DataContract]
public class TaskAgentPoolReference : BaseSecuredObject
{
public TaskAgentPoolReference()
{
}
public TaskAgentPoolReference(Int32 id)
: this(id, null)
{
}
internal TaskAgentPoolReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
internal TaskAgentPoolReference(
Int32 id,
ISecuredObject securedObject)
: base(securedObject)
{
this.Id = id;
}
/// <summary>
/// The pool ID.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 Id
{
get;
set;
}
/// <summary>
/// The pool name.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// A value indicating whether or not this pool is managed by the service.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Boolean IsHosted
{
get;
set;
}
}
}

View File

@@ -1,30 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to a plan group.
/// </summary>
[DataContract]
public class TaskOrchestrationPlanGroupReference
{
/// <summary>
/// The project ID.
/// </summary>
[DataMember]
public Guid ProjectId
{
get; set;
}
/// <summary>
/// The name of the plan group.
/// </summary>
[DataMember]
public String PlanGroup
{
get; set;
}
}
}

View File

@@ -1,50 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to an orchestration plan.
/// </summary>
[DataContract]
public class TaskOrchestrationPlanReference : BaseSecuredObject
{
public TaskOrchestrationPlanReference()
{
OrchestrationType = BuildOrchestrationType.Build;
}
internal TaskOrchestrationPlanReference(
ISecuredObject securedObject)
: base(securedObject)
{
OrchestrationType = BuildOrchestrationType.Build;
}
/// <summary>
/// The ID of the plan.
/// </summary>
[DataMember]
public Guid PlanId
{
get;
set;
}
/// <summary>
/// The type of the plan.
/// </summary>
/// <remarks>
/// <see cref="BuildOrchestrationType" /> for supported types.
/// </remarks>
[DefaultValue(BuildOrchestrationType.Build)]
[DataMember(EmitDefaultValue = false)]
public Int32? OrchestrationType
{
get;
set;
}
}
}

View File

@@ -1,71 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to a task.
/// </summary>
[DataContract]
public class TaskReference : BaseSecuredObject
{
public TaskReference()
{
}
public TaskReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
protected TaskReference(
TaskReference taskToBeCloned)
: base(taskToBeCloned)
{
this.Id = taskToBeCloned.Id;
this.Name = taskToBeCloned.Name;
this.Version = taskToBeCloned.Version;
}
/// <summary>
/// The ID of the task definition.
/// </summary>
[DataMember]
public Guid Id
{
get;
set;
}
/// <summary>
/// The name of the task definition.
/// </summary>
[DataMember]
public String Name
{
get;
set;
}
/// <summary>
/// The version of the task definition.
/// </summary>
[DataMember]
public String Version
{
get;
set;
}
/// <summary>
/// Clones this object.
/// </summary>
/// <returns></returns>
public virtual TaskReference Clone()
{
return new TaskReference(this);
}
}
}

View File

@@ -1,89 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents the timeline of a build.
/// </summary>
[DataContract]
public sealed class Timeline : TimelineReference
{
internal Timeline()
{
}
internal Timeline(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The process or person that last changed the timeline.
/// </summary>
[DataMember]
public Guid LastChangedBy
{
get;
internal set;
}
/// <summary>
/// The time the timeline was last changed.
/// </summary>
[DataMember]
public DateTime LastChangedOn
{
get;
internal set;
}
/// <summary>
/// The list of records in this timeline.
/// </summary>
public List<TimelineRecord> Records
{
get
{
if (m_records == null)
{
m_records = new List<TimelineRecord>();
}
return m_records;
}
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
if (m_serializedRecords != null && m_serializedRecords.Count > 0)
{
m_records = new List<TimelineRecord>(m_serializedRecords);
m_serializedRecords = null;
}
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
if (m_records != null && m_records.Count > 0)
{
m_serializedRecords = new List<TimelineRecord>(m_records);
}
}
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
m_serializedRecords = null;
}
private List<TimelineRecord> m_records;
[DataMember(Name = "Records", EmitDefaultValue = false)]
private List<TimelineRecord> m_serializedRecords;
}
}

View File

@@ -1,54 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
[DataContract]
public sealed class TimelineAttempt : BaseSecuredObject
{
public TimelineAttempt()
{
}
internal TimelineAttempt(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// Gets or sets the attempt of the record.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 Attempt
{
get;
set;
}
/// <summary>
/// Gets or sets the timeline identifier which owns the record representing this attempt.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Guid TimelineId
{
get;
set;
}
/// <summary>
/// Gets or sets the record identifier located within the specified timeline.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Guid RecordId
{
get;
set;
}
}
}

View File

@@ -1,309 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents an entry in a build's timeline.
/// </summary>
[DataContract]
public sealed class TimelineRecord : BaseSecuredObject
{
public TimelineRecord()
{
}
internal TimelineRecord(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The ID of the record.
/// </summary>
[DataMember]
public Guid Id
{
get;
set;
}
/// <summary>
/// The ID of the record's parent.
/// </summary>
[DataMember]
public Guid? ParentId
{
get;
set;
}
/// <summary>
/// The type of the record.
/// </summary>
[DataMember(Name = "Type")]
public String RecordType
{
get;
set;
}
/// <summary>
/// The name.
/// </summary>
[DataMember]
public String Name
{
get;
set;
}
/// <summary>
/// The start time.
/// </summary>
[DataMember]
public DateTime? StartTime
{
get;
set;
}
/// <summary>
/// The finish time.
/// </summary>
[DataMember]
public DateTime? FinishTime
{
get;
set;
}
/// <summary>
/// A string that indicates the current operation.
/// </summary>
[DataMember]
public String CurrentOperation
{
get;
set;
}
/// <summary>
/// The current completion percentage.
/// </summary>
[DataMember]
public Int32? PercentComplete
{
get;
set;
}
/// <summary>
/// The state of the record.
/// </summary>
[DataMember]
public TimelineRecordState? State
{
get;
set;
}
/// <summary>
/// The result.
/// </summary>
[DataMember]
public TaskResult? Result
{
get;
set;
}
/// <summary>
/// The result code.
/// </summary>
[DataMember]
public String ResultCode
{
get;
set;
}
/// <summary>
/// The change ID.
/// </summary>
/// <remarks>
/// This is a monotonically-increasing number used to ensure consistency in the UI.
/// </remarks>
[DataMember]
public Int32 ChangeId
{
get;
set;
}
/// <summary>
/// The time the record was last modified.
/// </summary>
[DataMember]
public DateTime LastModified
{
get;
set;
}
/// <summary>
/// The name of the agent running the operation.
/// </summary>
[DataMember]
public String WorkerName
{
get;
set;
}
/// <summary>
/// An ordinal value relative to other records.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32? Order
{
get;
set;
}
/// <summary>
/// A reference to a sub-timeline.
/// </summary>
[DataMember]
public TimelineReference Details
{
get;
set;
}
/// <summary>
/// The number of errors produced by this operation.
/// </summary>
[DataMember]
public Int32? ErrorCount
{
get;
set;
}
/// <summary>
/// The number of warnings produced by this operation.
/// </summary>
[DataMember]
public Int32? WarningCount
{
get;
set;
}
/// <summary>
/// The list of issues produced by this operation.
/// </summary>
public List<Issue> Issues
{
get
{
if (m_issues == null)
{
m_issues = new List<Issue>();
}
return m_issues;
}
}
/// <summary>
/// The REST URL of the timeline record.
/// </summary>
[DataMember]
public Uri Url
{
get;
set;
}
/// <summary>
/// A reference to the log produced by this operation.
/// </summary>
[DataMember]
public BuildLogReference Log
{
get;
set;
}
/// <summary>
/// A reference to the task represented by this timeline record.
/// </summary>
[DataMember]
public TaskReference Task
{
get;
set;
}
/// <summary>
/// Attempt number of record.
/// </summary>
[DataMember]
public Int32 Attempt
{
get;
set;
}
/// <summary>
/// String identifier that is consistent across attempts.
/// </summary>
[DataMember]
public String Identifier
{
get;
set;
}
public IList<TimelineAttempt> PreviousAttempts
{
get
{
if (m_previousAttempts == null)
{
m_previousAttempts = new List<TimelineAttempt>();
}
return m_previousAttempts;
}
}
/// <summary>
/// The links to other objects related to this object.
/// </summary>
public ReferenceLinks Links
{
get
{
if (m_links == null)
{
m_links = new ReferenceLinks();
}
return m_links;
}
}
[DataMember(Name = "_links", EmitDefaultValue = false)]
private ReferenceLinks m_links;
[DataMember(Name = "Issues", EmitDefaultValue = false, Order = 60)]
private List<Issue> m_issues;
[DataMember(Name = "PreviousAttempts", EmitDefaultValue = false)]
private List<TimelineAttempt> m_previousAttempts;
}
}

View File

@@ -1,56 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to a timeline.
/// </summary>
[DataContract]
public class TimelineReference : BaseSecuredObject
{
internal TimelineReference()
{
}
internal TimelineReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The ID of the timeline.
/// </summary>
[DataMember(Order = 1)]
public Guid Id
{
get;
internal set;
}
/// <summary>
/// The change ID.
/// </summary>
/// <remarks>
/// This is a monotonically-increasing number used to ensure consistency in the UI.
/// </remarks>
[DataMember(Order = 2)]
public Int32 ChangeId
{
get;
internal set;
}
/// <summary>
/// The REST URL of the timeline.
/// </summary>
[DataMember(Order = 3)]
public String Url
{
get;
set;
}
}
}

View File

@@ -1,98 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a variable group.
/// </summary>
[DataContract]
public class VariableGroup : VariableGroupReference
{
public VariableGroup()
: this(null)
{
}
internal VariableGroup(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The type of the variable group.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Type
{
get;
set;
}
/// <summary>
/// The name of the variable group.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Name
{
get;
set;
}
/// <summary>
/// The description.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Description
{
get;
set;
}
/// <summary>
/// The variables in this group.
/// </summary>
public IDictionary<String, BuildDefinitionVariable> Variables
{
get
{
if (m_variables == null)
{
m_variables = new Dictionary<String, BuildDefinitionVariable>(StringComparer.OrdinalIgnoreCase);
}
return m_variables;
}
internal set
{
m_variables = new Dictionary<String, BuildDefinitionVariable>(value, StringComparer.OrdinalIgnoreCase);
}
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedVariables, ref m_variables, StringComparer.OrdinalIgnoreCase, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_variables, ref m_serializedVariables, StringComparer.OrdinalIgnoreCase);
}
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
m_serializedVariables = null;
}
[DataMember(Name = "Variables", EmitDefaultValue = false)]
private IDictionary<String, BuildDefinitionVariable> m_serializedVariables;
private IDictionary<String, BuildDefinitionVariable> m_variables;
}
}

View File

@@ -1,44 +0,0 @@
using System;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a reference to a variable group.
/// </summary>
[DataContract]
public class VariableGroupReference : BaseSecuredObject
{
public VariableGroupReference()
: this(null)
{
}
internal VariableGroupReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
/// <summary>
/// The ID of the variable group.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Int32 Id
{
get;
set;
}
/// <summary>
/// The Name of the variable group.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public String Alias
{
get;
set;
}
}
}

View File

@@ -1,84 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents options for running a phase based on values specified by a list of variables.
/// </summary>
[DataContract]
public class VariableMultipliersAgentExecutionOptions : AgentTargetExecutionOptions, IVariableMultiplierExecutionOptions
{
public VariableMultipliersAgentExecutionOptions()
: base(AgentTargetExecutionType.VariableMultipliers)
{
}
internal VariableMultipliersAgentExecutionOptions(
ISecuredObject securedObject)
: base(AgentTargetExecutionType.VariableMultipliers, securedObject)
{
MaxConcurrency = 1;
ContinueOnError = false;
}
/// <summary>
/// The maximum number of agents to use in parallel.
/// </summary>
[DataMember(EmitDefaultValue=true)]
[DefaultValue(1)]
public Int32 MaxConcurrency {
get;
set;
}
/// <summary>
/// Indicates whether failure on one agent should prevent the phase from running on other agents.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Boolean ContinueOnError
{
get;
set;
}
/// <summary>
/// The list of variables used to determine the matrix of phases to run.
/// </summary>
public List<String> Multipliers
{
get
{
if (m_multipliers == null)
{
m_multipliers = new List<String>();
}
return m_multipliers;
}
set
{
m_multipliers = value;
}
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedMultipliers, ref m_multipliers, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_multipliers, ref m_serializedMultipliers);
}
[DataMember(Name = "Multipliers", EmitDefaultValue = false)]
private List<String> m_serializedMultipliers;
private List<String> m_multipliers;
}
}

View File

@@ -1,84 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents options for running a phase based on values specified by a list of variables.
/// </summary>
[DataContract]
public class VariableMultipliersServerExecutionOptions : ServerTargetExecutionOptions, IVariableMultiplierExecutionOptions
{
public VariableMultipliersServerExecutionOptions()
: this(null)
{
}
internal VariableMultipliersServerExecutionOptions(
ISecuredObject securedObject)
: base(ServerTargetExecutionType.VariableMultipliers, securedObject)
{
MaxConcurrency = 1;
ContinueOnError = false;
}
/// <summary>
/// The maximum number of server jobs to run in parallel.
/// </summary>
[DataMember(EmitDefaultValue = true)]
[DefaultValue(1)]
public Int32 MaxConcurrency {
get;
set;
}
/// <summary>
/// Indicates whether failure of one job should prevent the phase from running in other jobs.
/// </summary>
[DataMember(EmitDefaultValue = true)]
public Boolean ContinueOnError
{
get;
set;
}
/// <summary>
/// The list of variables used to determine the matrix of phases to run.
/// </summary>
public List<String> Multipliers
{
get
{
if (m_multipliers == null)
{
m_multipliers = new List<String>();
}
return m_multipliers;
}
set
{
m_multipliers = new List<String>(value);
}
}
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
SerializationHelper.Copy(ref m_serializedMultipliers, ref m_multipliers, true);
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
SerializationHelper.Copy(ref m_multipliers, ref m_serializedMultipliers);
}
[DataMember(Name = "Multipliers", EmitDefaultValue = false)]
private List<String> m_serializedMultipliers;
private List<String> m_multipliers;
}
}

View File

@@ -1,141 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace GitHub.Build.WebApi
{
[EditorBrowsable(EditorBrowsableState.Never)]
[DataContract]
public sealed class WorkspaceTemplate
{
/// <summary>
/// Uri of the associated definition
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String DefinitionUri
{
get;
set;
}
/// <summary>
/// List of workspace mappings
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public List<WorkspaceMapping> Mappings
{
get;
set;
}
/// <summary>
/// The last time this template was modified
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public DateTime LastModifiedDate
{
get;
set;
}
/// <summary>
/// The identity that last modified this template
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String LastModifiedBy
{
get;
set;
}
/// <summary>
/// Id of the workspace for this template
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
internal Int32 WorkspaceId
{
get;
set;
}
}
/// <summary>
/// Mapping for a workspace
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[DataContract]
public sealed class WorkspaceMapping
{
/// <summary>
/// Server location of the definition
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String ServerItem
{
get;
set;
}
/// <summary>
/// local location of the definition
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public String LocalItem
{
get;
set;
}
/// <summary>
/// type of workspace mapping
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public WorkspaceMappingType MappingType
{
get;
set;
}
/// <summary>
/// Depth of this mapping
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Int32 Depth
{
get;
set;
}
/// <summary>
/// Uri of the associated definition
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
internal String DefinitionUri
{
get;
set;
}
/// <summary>
/// Id of the workspace
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
internal Int32 WorkspaceId
{
get;
set;
}
public override String ToString()
{
return String.Format(System.Globalization.CultureInfo.InvariantCulture,
"[WorkspaceMapping ServerItem={0} LocalItem={1} MappingType={2} Depth={3}]",
ServerItem,
LocalItem,
MappingType,
Depth);
}
}
}

View File

@@ -1,76 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
/// <summary>
/// Represents a YAML process.
/// </summary>
[DataContract]
public class YamlProcess : BuildProcess
{
public YamlProcess()
: this(null)
{
}
internal YamlProcess(
ISecuredObject securedObject)
: base(ProcessType.Yaml, securedObject)
{
}
/// <summary>
/// The resources used by the build definition.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public BuildProcessResources Resources
{
get;
set;
}
/// <summary>
/// The list of errors encountered when reading the YAML definition.
/// </summary>
public IList<String> Errors
{
get
{
if (m_errors == null)
{
m_errors = new List<String>();
}
return m_errors;
}
set
{
m_errors = new List<String>(value);
}
}
/// <summary>
/// The YAML filename.
/// </summary>
[DataMember]
public String YamlFilename
{
get;
set;
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
if (m_errors?.Count == 0)
{
m_errors = null;
}
}
[DataMember(Name = "Errors", EmitDefaultValue = false)]
private List<String> m_errors;
}
}

View File

@@ -1,35 +0,0 @@
using System;
using GitHub.Services.Common;
namespace GitHub.Build.WebApi
{
[GenerateAllConstants]
public static class DefinitionMetrics
{
// historic metrics
public const String SuccessfulBuilds = "SuccessfulBuilds";
public const String FailedBuilds = "FailedBuilds";
public const String PartiallySuccessfulBuilds = "PartiallySuccessfulBuilds";
public const String CanceledBuilds = "CanceledBuilds";
public const String TotalBuilds = "TotalBuilds";
// current metrics - scopeddate null
public const String CurrentBuildsInQueue = "CurrentBuildsInQueue";
public const String CurrentBuildsInProgress = "CurrentBuildsInProgress";
}
[Obsolete("Use DefinitionMetrics instead.")]
public static class WellKnownDefinitionMetrics
{
// historic metrics
public const String SuccessfulBuilds = DefinitionMetrics.SuccessfulBuilds;
public const String FailedBuilds = DefinitionMetrics.FailedBuilds;
public const String PartiallySuccessfulBuilds = DefinitionMetrics.PartiallySuccessfulBuilds;
public const String CanceledBuilds = DefinitionMetrics.CanceledBuilds;
public const String TotalBuilds = DefinitionMetrics.TotalBuilds;
// current metrics - scopeddate null
public const String CurrentBuildsInQueue = DefinitionMetrics.CurrentBuildsInQueue;
public const String CurrentBuildsInProgress = DefinitionMetrics.CurrentBuildsInProgress;
}
}

Some files were not shown because too many files have changed in this diff Show More