-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move to Definition namespace * Update GetBuildDefinition * Add SetTeamProject -Description * Add StartBuild * Refactor NewTeamProjectController to use Awaiter * Refactor result type * Fix get default team * Fix Area/Iteration field names * Add QueryContributionNodeAsync * Add Get-TeamProjectMember * Add release notes * Update release notes * Update docs * Add AsIdentity mode * Add formatting * Update release notes +semver: minor
- Loading branch information
Showing
36 changed files
with
488 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace TfsCmdlets.Models | ||
{ | ||
[DataContract] | ||
public class ContributionNodeQuery | ||
{ | ||
[DataMember(EmitDefaultValue = false, Name = "dataProviderContext")] | ||
public DataProviderContext DataProviderContext; | ||
|
||
[DataMember(Name = "queryOptions", EmitDefaultValue = false)] | ||
public ContributionQueryOptions QueryOptions { get; set; } | ||
|
||
[DataMember(Name = "contributionIds")] | ||
public IEnumerable<string> ContributionIds { get; set; } | ||
|
||
[DataMember(Name = "includeProviderDetails", EmitDefaultValue = false)] | ||
public bool IncludeProviderDetails { get; set; } | ||
} | ||
|
||
[DataContract] | ||
public class ContributionNodeResponse | ||
{ | ||
[DataMember(Name = "dataProviderSharedData")] | ||
public DataProviderSharedData DataProviderSharedData { get; set; } | ||
|
||
[DataMember(Name = "dataProviders")] | ||
public DataProviders DataProviders { get; set; } | ||
} | ||
|
||
|
||
[DataContract] | ||
public class DataProviderContext | ||
{ | ||
[DataMember(Name = "properties")] | ||
public Dictionary<string, object> Properties { get; set; } | ||
|
||
[DataMember(Name = "sharedData", EmitDefaultValue = false)] | ||
public DataProviderSharedData SharedData { get; set; } | ||
} | ||
|
||
[DataContract] | ||
public class DataProviderSharedData : Dictionary<string, object> | ||
{ | ||
} | ||
|
||
[DataContract] | ||
public class DataProviders : Dictionary<string, JObject> | ||
{ | ||
} | ||
|
||
[Flags] | ||
public enum ContributionQueryOptions | ||
{ | ||
[EnumMember(Value = "none")] None = 0, | ||
[EnumMember(Value = "includeSelf")] IncludeSelf = 16, | ||
[EnumMember(Value = "includeChildren")] IncludeChildren = 32, | ||
[EnumMember(Value = "includeSubTree")] IncludeSubTree = 96, | ||
[EnumMember(Value = "includeAll")] IncludeAll = IncludeSubTree | IncludeSelf, | ||
[EnumMember(Value = "ignoreConstraints")] IgnoreConstraints = 256, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Runtime.Serialization; | ||
|
||
namespace TfsCmdlets.Models | ||
{ | ||
/// <summary> | ||
/// Represents a member of a Team Foundation / Azure DevOps Team | ||
/// </summary> | ||
[DataContract] | ||
public class TeamProjectMember | ||
{ | ||
public string TeamProject { get; set; } | ||
|
||
[DataMember(Name = "name")] | ||
public string Name { get; set; } | ||
|
||
[DataMember(Name = "id")] | ||
public Guid Id { get; set; } | ||
|
||
[DataMember(Name = "mail")] | ||
public string Email { get; set; } | ||
} | ||
|
||
[DataContract] | ||
public class TeamProjectMemberCollection | ||
{ | ||
[DataMember(Name = "isCurrentUserAdmin")] | ||
public bool IsCurrentUserAdmin { get; set; } | ||
|
||
[DataMember(Name = "count")] | ||
public int Count { get; set; } | ||
|
||
[DataMember(Name = "hasMore")] | ||
public bool HasMore { get; set; } | ||
|
||
[DataMember(Name = "members")] | ||
public TeamProjectMember[] Members { get; set; } | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
CSharp/TfsCmdlets.Common/Services/IAsyncOperationAwaiter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.Services.Operations; | ||
|
||
namespace TfsCmdlets.Services | ||
{ | ||
public interface IAsyncOperationAwaiter | ||
{ | ||
Operation Wait(Task<OperationReference> operation, string errorMessage, int waitTimeInSecs = 2); | ||
Operation Wait(OperationReference operation, int waitTimeInSecs = 2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
CSharp/TfsCmdlets.Common/Services/Impl/AsyncOperationAwaiterImpl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.Services.Operations; | ||
|
||
namespace TfsCmdlets.Services.Impl | ||
{ | ||
[Export(typeof(IAsyncOperationAwaiter))] | ||
internal class AsyncOperationAwaiterImpl: IAsyncOperationAwaiter | ||
{ | ||
private IDataManager Data { get; } | ||
|
||
public Operation Wait(Task<OperationReference> operation, string errorMessage, int waitTimeInSecs = 2) | ||
{ | ||
return Wait(operation.GetResult(errorMessage), waitTimeInSecs); | ||
} | ||
|
||
public Operation Wait(OperationReference operation, int waitTimeInSecs = 2) | ||
{ | ||
var client = Data.GetClient<OperationsHttpClient>(); | ||
var token = client.GetOperation(operation.Id) | ||
.GetResult("Error getting operation status"); | ||
while ( | ||
(token.Status != OperationStatus.Succeeded) && | ||
(token.Status != OperationStatus.Failed) && | ||
(token.Status != OperationStatus.Cancelled)) | ||
{ | ||
Thread.Sleep(waitTimeInSecs * 1000); | ||
token = client.GetOperation(operation.Id) | ||
.GetResult("Error getting operation status"); | ||
} | ||
return token; | ||
} | ||
|
||
[ImportingConstructor] | ||
public AsyncOperationAwaiterImpl(IDataManager dataManager) | ||
{ | ||
Data = dataManager; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../Pipeline/Build/DisableBuildDefinition.cs → ...uild/Definition/DisableBuildDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/Pipeline/Build/EnableBuildDefinition.cs → ...Build/Definition/EnableBuildDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lets/Pipeline/Build/GetBuildDefinition.cs → ...ne/Build/Definition/GetBuildDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/Pipeline/Build/ResumeBuildDefinition.cs → ...Build/Definition/ResumeBuildDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../Pipeline/Build/SuspendBuildDefinition.cs → ...uild/Definition/SuspendBuildDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
layout: module | ||
title: Pipeline Definitions | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Microsoft.TeamFoundation.Build.WebApi; | ||
|
||
namespace TfsCmdlets.Cmdlets.Pipeline.Build | ||
{ | ||
/// <summary> | ||
/// Gets one or more build/pipeline definitions in a team project. | ||
/// </summary> | ||
[TfsCmdlet(CmdletScope.Project, OutputType = typeof(BuildDefinitionReference))] | ||
partial class StartBuild | ||
{ | ||
/// <summary> | ||
/// Specifies the pipeline to start. | ||
/// </summary> | ||
[Parameter(Position = 0, ValueFromPipeline = true)] | ||
[Alias("Path", "Pipeline")] | ||
public object Definition { get; set; } | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
CSharp/TfsCmdlets/Cmdlets/TeamProject/Member/GetTeamProjectMember.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Management.Automation; | ||
using TfsCmdlets.Models; | ||
|
||
namespace TfsCmdlets.Cmdlets.TeamProject.Member | ||
{ | ||
/// <summary> | ||
/// Gets the members of a team project. | ||
/// </summary> | ||
[TfsCmdlet(CmdletScope.Project, OutputType = typeof(TeamProjectMember))] | ||
[OutputType(typeof(WebApiIdentity), ParameterSetName = new[] { "As Identity" })] | ||
partial class GetTeamProjectMember | ||
{ | ||
/// <summary> | ||
/// Specifies the name of a team project member. Wildcards are supported. | ||
/// When omitted, all team project members are returned. | ||
/// </summary> | ||
[Parameter()] | ||
public object Member { get; set; } = "*"; | ||
|
||
/// <summary> | ||
/// Returns the members as fully resolved <see cref="WebApiIdentity"/> objects. | ||
/// When omitted, it returns only the name, ID and email of the users. | ||
/// </summary> | ||
[Parameter()] | ||
public SwitchParameter AsIdentity { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
layout: module | ||
title: Team Project Members | ||
--- | ||
|
Oops, something went wrong.