-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding RemoteApp cmdlet to release #216
Merged
Merged
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
3ef3a17
Initial version of the Azure RemoteApp PowerShell cmdlet
yadavbdev 782014a
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
yadavbdev 64f6321
Changed to use the Context from Azure Authentication
yadavbdev 28715bd
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
yadavb fe60f9f
Adding RemoteApp projects in to the .sln
yadavb b8e838d
Updated RemoteApp project to use the public version of Azure RemoteAp…
yadavb e495a49
Merge branch 'using_public_sdk' into dev
yadavb 2de5272
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
yadavbdev 07e643c
Upgrading to use Azure RemoteApp v1.0.7
yadavbdev 0ec01db
Updated to use the Azure RemoteApp v1.0.7
yadavbdev b166d38
Merge branch 'dev' of https://github.com/yadavbdev/azure-powershell i…
xamarsinx 35aa503
Fixing the CI build break
yadavbdev 312f697
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
yadavbdev 09e51ec
Bug 1796479:OneSDK: Address feedback from Azure PS team
yadavbdev 1f51213
Bug 1827560:*Get-AzureRemoteAppCollection should not show vnet if it …
relmer f19825b
Bug 1856319:$ Remove Get-AzureRemoteAppUploadScript
relmer 5e53e38
Bug 1856290:Remove Get-AzureRemoteAppResetVpnSharedKey -- make Reset-…
yadavbdev 3fe6eac
Bug 1856407:$Set-AzureRemoteAppCollection -- remove OU
relmer 575a09b
Ignoring all the failing tests for now, will revisit later
yadavbdev 97788a2
Merge branch 'bugfix' into dev
yadavbdev d48983c
Merge branch 'dev' of https://github.com/relmer/azure-powershell into…
yadavbdev c7f0c4d
Parameter help message updated to include wild card support.
yadavbdev ac94a29
Bug 1856505:$Vnet cmdlets: param should be VNetName, not VnetName.
relmer d0f46c3
Fixed the potential null ref issue
yadavbdev 6f7ae0c
Merge branch 'dev' of https://github.com/yadavbdev/azure-powershell i…
xamarsinx a1e3ac5
Bug 1857745:New-AzureRemoteAppTemplateImage is not catching errors in…
xamarsinx 88966d4
Bug 1856575:*Some cmdlets aren't showing all params in get-help
relmer d8de3f1
getting region from VNet
xamarsinx edd4405
adding Region in details
xamarsinx d84fb76
Merge branch 'dev' of https://github.com/yadavbdev/azure-powershell i…
relmer 2f48d99
Merge branch 'dev' of https://github.com/relmer/azure-powershell into…
yadavbdev 546b0e6
Bug 1856603:Add/Remove user should be a common cmdlet, not separate f…
yadavbdev d0aeed6
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
yadavbdev 4d22570
review comment
xamarsinx 18d840e
Merge branch 'robdev' into dev
yadavbdev e7552e0
Merge branch 'dev' of https://github.com/Amarsi/azure-powershell into…
yadavbdev 7717e38
Merged several fixes from Bob done in private repo
yadavbdev f8abc5e
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
yadavbdev 7bfabf1
Applying user principal validation pattern
yadavbdev bf59dfe
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
yadavbdev 99c224a
removing bad merge of files outside of RemoteApp project scope
yadavbdev e2d88d0
bad merge
yadavbdev 0c39461
Revert "bad merge"
yadavbdev 8c87894
Revert "removing bad merge of files outside of RemoteApp project scope"
yadavbdev 699a7f0
Revert "Merge branch 'dev' of https://github.com/yadavbdev/azure-powe…
yadavb b8ae503
Merge branch 'dev' of https://github.com/yadavbdev/azure-powershell i…
yadavb 48b8847
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
relmer 5fe8009
Fix bogus moq version
relmer 46b8c9c
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
yadavb b5d2574
Add RemoteApp reference to Commands.Resources
relmer 67557a4
Merge branch 'dev' of https://github.com/relmer/azure-powershell into…
yadavb 0d2384d
Changing Region -> Location and BillingPlan -> Plan
yadavbdev 094692d
BUG 1879333:Mohoro: Gold image import from Azure IAAS - OneSDK PS cmd…
xamarsinx 11ee869
Updated based on the Azure CR feedback
yadavbdev 37633af
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
yadavbdev fff91f6
Merge branch 'dev' of https://github.com/amarsi/azure-powershell into…
yadavbdev bc68d11
Removing the MS Test cases from the build
yadavbdev f0925a0
Removing the referece to the absolute binary for a System.Management.…
yadavbdev ebd7e3f
Merge branch 'release-0.8.15' of https://github.com/Azure/azure-power…
yadavbdev f1e365d
Updated the RemoteApp csproj file as per the review comment
yadavbdev 3cbbcbe
Reverting the changes brought in from files out side of RA project
yadavbdev 2db9d3b
Merge branch 'release-0.8.15' of https://github.com/Azure/azure-power…
yadavbdev bf5d8c6
Add RemoteApp reference to Commands.Resources
relmer 03a6800
Updated the RemoteApp project to use Compute 9.2 version like others
yadavbdev 1859d23
Updated the wxi file for the package changes in RemoteApp project.
yadavbdev 40eea94
Added code signing instructions in the project file
yadavbdev e56c6f1
Fixing the parameter name
yadavbdev 4de056e
Fixing the code signing issue
yadavbdev 76fcebe
Corrected the parameter message
yadavbdev 4e0309b
Merge branch 'release-0.8.15' of https://github.com/Azure/azure-power…
yadavbdev e0e2839
Updating the wxi file to include RemoteApp binaries
yadavbdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
39 changes: 39 additions & 0 deletions
39
src/ServiceManagement/RemoteApp/Commands.RemoteApp/Billing/GetAzureRemoteAppPlan.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,39 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Microsoft.Azure.Commands.RemoteApp; | ||
using Microsoft.Azure.Management.RemoteApp.Models; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
|
||
namespace Microsoft.Azure.Management.RemoteApp.Cmdlets | ||
{ | ||
[Cmdlet(VerbsCommon.Get, "AzureRemoteAppPlan"), OutputType(typeof(BillingPlan))] | ||
public class GetAzureRemoteAppPlan : RdsCmdlet | ||
{ | ||
public override void ExecuteCmdlet() | ||
{ | ||
ListBillingPlansResult billingPlans = CallClient(() => Client.Account.ListBillingPlans(), Client.Account); | ||
|
||
if (billingPlans.PlanList.Count > 0) | ||
{ | ||
WriteObject(billingPlans.PlanList, true); | ||
} | ||
else | ||
{ | ||
WriteVerboseWithTimestamp(Commands_RemoteApp.NoPlansFoundMessage); | ||
} | ||
} | ||
} | ||
} |
112 changes: 112 additions & 0 deletions
112
src/ServiceManagement/RemoteApp/Commands.RemoteApp/Collection/GetAzureRemoteAppCollection.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,112 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Microsoft.Azure.Commands.RemoteApp; | ||
using Microsoft.Azure.Management.RemoteApp; | ||
using Microsoft.Azure.Management.RemoteApp.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Management.Automation; | ||
|
||
namespace Microsoft.Azure.Management.RemoteApp.Cmdlets | ||
{ | ||
[Cmdlet(VerbsCommon.Get, "AzureRemoteAppCollection"), OutputType(typeof(LocalModels.Collection))] | ||
public class GetAzureRemoteAppCollection : RdsCmdlet | ||
{ | ||
[Parameter(Mandatory = false, | ||
Position = 1, | ||
HelpMessage = "RemoteApp collection name. Wildcards are permitted.")] | ||
[ValidatePattern(NameValidatorStringWithWildCards)] | ||
public string CollectionName { get; set; } | ||
|
||
private bool showAllCollections = false; | ||
|
||
private bool found = false; | ||
|
||
private bool GetAllCollections() | ||
{ | ||
CollectionListResult response = null; | ||
IEnumerable<Collection> spList = null; | ||
LocalModels.Collection collection = null; | ||
|
||
response = CallClient(() => Client.Collections.List(), Client.Collections); | ||
|
||
if (response != null) | ||
{ | ||
if (UseWildcard) | ||
{ | ||
spList = response.Collections.Where(col => Wildcard.IsMatch(col.Name)); | ||
} | ||
else | ||
{ | ||
spList = response.Collections; | ||
} | ||
|
||
if (spList != null && spList.Count() > 0) | ||
{ | ||
foreach( Collection c in spList) | ||
{ | ||
collection = new LocalModels.Collection(c); | ||
WriteObject(collection); | ||
} | ||
found = true; | ||
} | ||
} | ||
|
||
return found; | ||
} | ||
|
||
private bool GetCollection(string collectionName) | ||
{ | ||
CollectionResult response = null; | ||
LocalModels.Collection collection = null; | ||
|
||
response = CallClient(() => Client.Collections.Get(collectionName), Client.Collections); | ||
|
||
if (response != null) | ||
{ | ||
collection = new LocalModels.Collection(response.Collection); | ||
WriteObject(collection); | ||
found = true; | ||
} | ||
|
||
return found; | ||
} | ||
|
||
public override void ExecuteCmdlet() | ||
{ | ||
showAllCollections = String.IsNullOrWhiteSpace(CollectionName); | ||
|
||
if (showAllCollections == false) | ||
{ | ||
CreateWildcardPattern(CollectionName); | ||
} | ||
|
||
if (ExactMatch) | ||
{ | ||
found = GetCollection(CollectionName); | ||
} | ||
else | ||
{ | ||
found = GetAllCollections(); | ||
} | ||
|
||
if (!found) | ||
{ | ||
WriteVerboseWithTimestamp(String.Format(Commands_RemoteApp.CollectionNotFoundByNameFormat, CollectionName)); | ||
} | ||
} | ||
} | ||
} |
146 changes: 146 additions & 0 deletions
146
...gement/RemoteApp/Commands.RemoteApp/Collection/GetAzureRemoteAppCollectionUsageDetails.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,146 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Microsoft.Azure.Commands.RemoteApp; | ||
using Microsoft.Azure.Management.RemoteApp; | ||
using Microsoft.Azure.Management.RemoteApp.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Management.Automation; | ||
using System.Net; | ||
|
||
namespace Microsoft.Azure.Management.RemoteApp.Cmdlets | ||
{ | ||
|
||
[Cmdlet(VerbsCommon.Get, "AzureRemoteAppCollectionUsageDetails"), OutputType(typeof(string))] | ||
public class GetAzureRemoteAppCollectionUsageDetails : RdsCmdlet | ||
{ | ||
[Parameter( | ||
Position = 0, | ||
Mandatory = true, | ||
ValueFromPipelineByPropertyName = true, | ||
HelpMessage = "RemoteApp collection name")] | ||
public string CollectionName { get; set; } | ||
|
||
[Parameter(Mandatory = false, | ||
Position = 1, | ||
HelpMessage = "Number of the month (MM) to report usage")] | ||
[ValidatePattern(TwoDigitMonthPattern)] | ||
public string UsageMonth { get; set; } | ||
|
||
[Parameter(Mandatory = false, | ||
Position = 2, | ||
HelpMessage = "Year (YYYY) to report usage")] | ||
[ValidatePattern(FullYearPattern)] | ||
public string UsageYear { get; set; } | ||
|
||
public override void ExecuteCmdlet() | ||
{ | ||
DateTime today = DateTime.Now; | ||
CollectionUsageDetailsResult detailsUsage = null; | ||
string locale = String.Empty; | ||
RemoteAppOperationStatusResult operationResult = null; | ||
int maxRetryCount = 600; | ||
|
||
if (String.IsNullOrWhiteSpace(UsageMonth)) | ||
{ | ||
UsageMonth = today.Month.ToString(); | ||
} | ||
|
||
if (String.IsNullOrWhiteSpace(UsageYear)) | ||
{ | ||
UsageYear = today.Year.ToString(); | ||
} | ||
|
||
locale = System.Globalization.CultureInfo.CurrentCulture.ToString(); | ||
|
||
detailsUsage = CallClient(() => Client.Collections.GetUsageDetails(CollectionName, UsageYear, UsageMonth, locale), Client.Collections); | ||
|
||
if (detailsUsage == null) | ||
{ | ||
return; | ||
} | ||
|
||
// The request is async and we have to wait for the usage details to be produced here | ||
do | ||
{ | ||
System.Threading.Thread.Sleep(5000); | ||
|
||
operationResult = CallClient(() => Client.OperationResults.Get(detailsUsage.UsageDetails.OperationTrackingId), Client.OperationResults); | ||
} | ||
while(operationResult.RemoteAppOperationResult.Status != RemoteAppOperationStatus.Success || | ||
operationResult.RemoteAppOperationResult.Status != RemoteAppOperationStatus.Failed || | ||
--maxRetryCount > 0); | ||
|
||
if (operationResult.RemoteAppOperationResult.Status == RemoteAppOperationStatus.Success) | ||
{ | ||
WriteUsageDetails(detailsUsage); | ||
} | ||
else | ||
{ | ||
if (operationResult.RemoteAppOperationResult.Status == RemoteAppOperationStatus.Failed) | ||
{ | ||
ErrorRecord error = RemoteAppCollectionErrorState.CreateErrorRecordFromString( | ||
Commands_RemoteApp.DetailedUsageFailureMessage, | ||
String.Empty, | ||
Client.Collections, | ||
ErrorCategory.ResourceUnavailable); | ||
|
||
WriteError(error); | ||
} | ||
else if (maxRetryCount <= 0) | ||
{ | ||
ErrorRecord error = RemoteAppCollectionErrorState.CreateErrorRecordFromString( | ||
Commands_RemoteApp.RequestTimedOut, | ||
String.Empty, | ||
Client.Collections, | ||
ErrorCategory.OperationTimeout); | ||
|
||
WriteError(error); | ||
} | ||
} | ||
} | ||
|
||
private void WriteUsageDetails(CollectionUsageDetailsResult detailsUsage) | ||
{ | ||
// | ||
// Display the content pointed to by the returned URI | ||
// | ||
WebResponse response = null; | ||
|
||
WebRequest request = WebRequest.Create(detailsUsage.UsageDetails.SasUri); | ||
|
||
try | ||
{ | ||
response = (HttpWebResponse)request.GetResponse(); | ||
} | ||
catch (Exception e) | ||
{ | ||
ErrorRecord error = RemoteAppCollectionErrorState.CreateErrorRecordFromException(e, String.Empty, Client.Collections, ErrorCategory.InvalidResult); | ||
WriteError(error); | ||
} | ||
|
||
using (Stream dataStream = response.GetResponseStream()) | ||
{ | ||
using (StreamReader reader = new StreamReader(dataStream)) | ||
{ | ||
String csvContent = reader.ReadToEnd(); | ||
WriteObject(csvContent); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It used to pass all the tests with this in, so bringing it in. Removing fails many tests.