Skip to content

Commit 30d9907

Browse files
committed
Merge pull request #49 from AzCiS/onesdk-phase2
Onesdk phase2
2 parents 8e8c4f8 + 68c9386 commit 30d9907

15 files changed

+1032
-227
lines changed

src/ServiceManagement/Services/Commands.Utilities/Azure.psd1

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ ScriptsToProcess = @()
5757
TypesToProcess = @(
5858
'.\Services\Microsoft.WindowsAzure.Commands.Websites.Types.ps1xml',
5959
'.\Sql\Microsoft.WindowsAzure.Commands.SqlDatabase.Types.ps1xml'
60-
'.\Storage\Microsoft.WindowsAzure.Commands.Storage.Types.ps1xml'
60+
'.\Storage\Microsoft.WindowsAzure.Commands.Storage.Types.ps1xml',
61+
'.\StorSimple\Microsoft.WindowsAzure.Commands.StorSimple.Types.ps1xml'
6162
)
6263

6364
# Format files (.ps1xml) to be loaded when importing this module
@@ -70,7 +71,8 @@ FormatsToProcess = @(
7071
'.\Services\Microsoft.WindowsAzure.Commands.Scheduler.format.ps1xml',
7172
'.\Compute\Microsoft.WindowsAzure.Commands.ServiceManagement.format.ps1xml',
7273
'.\Services\Microsoft.WindowsAzure.Commands.Profile.format.ps1xml',
73-
'.\Network\Microsoft.Azure.Commands.Network.format.ps1xml'
74+
'.\Network\Microsoft.Azure.Commands.Network.format.ps1xml',
75+
'.\StorSimple\Microsoft.WindowsAzure.Commands.StorSimple.format.ps1xml'
7476
)
7577

7678
# Modules to import as nested modules of the module specified in ModuleToProcess
@@ -154,7 +156,48 @@ AliasesToExport = @(
154156
'Wait-AzureHDInsightJob',
155157
'Get-AzureStorageContainerAcl',
156158
'Start-CopyAzureStorageBlob',
157-
'Stop-CopyAzureStorageBlob'
159+
'Stop-CopyAzureStorageBlob',
160+
'Get-SSAccessControlRecord',
161+
'Get-SSDevice',
162+
'Get-SSDeviceBackup',
163+
'Get-SSDeviceBackupPolicy',
164+
'Get-SSDeviceConnectedInitiator',
165+
'Get-SSDeviceVolume',
166+
'Get-SSDeviceVolumeContainer',
167+
'Get-SSFailoverVolumeContainers',
168+
'Get-SSJob',
169+
'Get-SSResource',
170+
'Get-SSResourceContext',
171+
'Get-SSStorageAccountCredential',
172+
'Get-SSTask',
173+
'New-SSAccessControlRecord',
174+
'New-SSDeviceBackupPolicy',
175+
'New-SSDeviceBackupScheduleAddConfig',
176+
'New-SSDeviceBackupScheduleUpdateConfig',
177+
'New-SSDeviceVolume',
178+
'New-SSDeviceVolumeContainer',
179+
'New-SSInlineStorageAccountCredential',
180+
'New-SSNetworkConfig',
181+
'New-SSStorageAccountCredential',
182+
'New-SSVirtualDevice',
183+
'Remove-SSAccessControlRecord',
184+
'Remove-SSDeviceBackup',
185+
'Remove-SSDeviceBackupPolicy',
186+
'Remove-SSDeviceVolume',
187+
'Remove-SSDeviceVolumeContainer',
188+
'Remove-SSStorageAccountCredential',
189+
'Select-SSResource',
190+
'Set-SSAccessControlRecord',
191+
'Set-SSDevice',
192+
'Set-SSDeviceBackupPolicy',
193+
'Set-SSDeviceVolume',
194+
'Set-SSStorageAccountCredential',
195+
'Set-SSVirtualDevice',
196+
'Start-SSBackupCloneJob',
197+
'Start-SSDeviceBackupJob',
198+
'Start-SSDeviceBackupRestoreJob',
199+
'Start-SSDeviceFailoverJob',
200+
'Stop-SSJob'
158201
)
159202

160203
# List of all modules packaged with this module

src/ServiceManagement/Services/Commands.Utilities/ServiceManagementStartup.ps1

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,50 @@ $aliases = @{
6060

6161
# HDInsight aliases
6262
"Invoke-Hive" = "Invoke-AzureHDInsightHiveJob";
63-
"hive" = "Invoke-AzureHDInsightHiveJob"
63+
"hive" = "Invoke-AzureHDInsightHiveJob";
64+
65+
#StorSimple aliases
66+
"Get-SSAccessControlRecord" = "Get-AzureStorSimpleAccessControlRecord" ;
67+
"Get-SSDevice"= "Get-AzureStorSimpleDevice" ;
68+
"Get-SSDeviceBackup" = "Get-AzureStorSimpleDeviceBackup" ;
69+
"Get-SSDeviceBackupPolicy" = "Get-AzureStorSimpleDeviceBackupPolicy" ;
70+
"Get-SSDeviceConnectedInitiator" = "Get-AzureStorSimpleDeviceConnectedInitiator" ;
71+
"Get-SSDeviceVolume" = "Get-AzureStorSimpleDeviceVolume" ;
72+
"Get-SSDeviceVolumeContainer" = "Get-AzureStorSimpleDeviceVolumeContainer" ;
73+
"Get-SSFailoverVolumeContainers" = "Get-AzureStorSimpleFailoverVolumeContainers" ;
74+
"Get-SSJob" = "Get-AzureStorSimpleJob" ;
75+
"Get-SSResource" = "Get-AzureStorSimpleResource" ;
76+
"Get-SSResourceContext" = "Get-AzureStorSimpleResourceContext" ;
77+
"Get-SSStorageAccountCredential" = "Get-AzureStorSimpleStorageAccountCredential" ;
78+
"Get-SSTask" = "Get-AzureStorSimpleTask" ;
79+
"New-SSAccessControlRecord" = "New-AzureStorSimpleAccessControlRecord" ;
80+
"New-SSDeviceBackupPolicy" = "New-AzureStorSimpleDeviceBackupPolicy" ;
81+
"New-SSDeviceBackupScheduleAddConfig" = "New-AzureStorSimpleDeviceBackupScheduleAddConfig" ;
82+
"New-SSDeviceBackupScheduleUpdateConfig" = "New-AzureStorSimpleDeviceBackupScheduleUpdateConfig" ;
83+
"New-SSDeviceVolume" = "New-AzureStorSimpleDeviceVolume";
84+
"New-SSDeviceVolumeContainer" = "New-AzureStorSimpleDeviceVolumeContainer" ;
85+
"New-SSInlineStorageAccountCredential" = "New-AzureStorSimpleInlineStorageAccountCredential" ;
86+
"New-SSNetworkConfig" = "New-AzureStorSimpleNetworkConfig";
87+
"New-SSStorageAccountCredential" = "New-AzureStorSimpleStorageAccountCredential";
88+
"New-SSVirtualDevice" = "New-AzureStorSimpleVirtualDevice";
89+
"Remove-SSAccessControlRecord" = "Remove-AzureStorSimpleAccessControlRecord";
90+
"Remove-SSDeviceBackup" = "Remove-AzureStorSimpleDeviceBackup";
91+
"Remove-SSDeviceBackupPolicy" = "Remove-AzureStorSimpleDeviceBackupPolicy";
92+
"Remove-SSDeviceVolume" = "Remove-AzureStorSimpleDeviceVolume";
93+
"Remove-SSDeviceVolumeContainer" = "Remove-AzureStorSimpleDeviceVolumeContainer";
94+
"Remove-SSStorageAccountCredential" = "Remove-AzureStorSimpleStorageAccountCredential";
95+
"Select-SSResource" = "Select-AzureStorSimpleResource";
96+
"Set-SSAccessControlRecord" = "Set-AzureStorSimpleAccessControlRecord";
97+
"Set-SSDevice" = "Set-AzureStorSimpleDevice";
98+
"Set-SSDeviceBackupPolicy" = "Set-AzureStorSimpleDeviceBackupPolicy";
99+
"Set-SSDeviceVolume" = "Set-AzureStorSimpleDeviceVolume";
100+
"Set-SSStorageAccountCredential" = "Set-AzureStorSimpleStorageAccountCredential";
101+
"Set-SSVirtualDevice" = "Set-AzureStorSimpleVirtualDevice";
102+
"Start-SSBackupCloneJob" = "Start-AzureStorSimpleBackupCloneJob";
103+
"Start-SSDeviceBackupJob" = "Start-AzureStorSimpleDeviceBackupJob";
104+
"Start-SSDeviceBackupRestoreJob" = "Start-AzureStorSimpleDeviceBackupRestoreJob";
105+
"Start-SSDeviceFailoverJob" = "Start-AzureStorSimpleDeviceFailoverJob";
106+
"Stop-SSJob" = "Stop-AzureStorSimpleJob";
64107
}
65108

66109
$aliases.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias"

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/BackupSet/GetAzureStorSimpleDeviceBackup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets
2525
{
26-
[Cmdlet(VerbsCommon.Get, "AzureStorSimpleDeviceBackup", DefaultParameterSetName = StorSimpleCmdletParameterSet.Empty),OutputType(typeof(GetBackupResponse))]
26+
[Cmdlet(VerbsCommon.Get, "AzureStorSimpleDeviceBackup", DefaultParameterSetName = StorSimpleCmdletParameterSet.Empty),OutputType(typeof(IList<Backup>))]
2727
public class GetAzureStorSimpleDeviceBackup: StorSimpleCmdletBase
2828
{
2929
[Parameter(Position = 0, Mandatory = true, HelpMessage = StorSimpleCmdletHelpMessage.DeviceName, ParameterSetName = StorSimpleCmdletParameterSet.Empty)]

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DataContainer/NewAzureStorSimpleDeviceVolumeContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public override void ExecuteCmdlet()
6767

6868
if(EncryptionEnabled == true && (string.IsNullOrEmpty(EncryptionKey) || !IsValidAsciiString(EncryptionKey)))
6969
{
70-
throw new ArgumentNullException("EncryptionKey");
70+
throw new ArgumentException(Resources.EncryptionKeyNotAcceptableMessage);
7171
}
7272

7373
string encryptedKey = null;

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceJobs/GetAzureStorSimpleJob.cs

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -28,67 +28,61 @@ namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets
2828
/// <summary>
2929
/// Stop the specified device job if its in progress and is cancellable.
3030
/// </summary>
31-
[Cmdlet(VerbsCommon.Get, "AzureStorSimpleJob", DefaultParameterSetName=StorSimpleCmdletParameterSet.IdentifyByDeviceName),
32-
OutputType(typeof(IList<DeviceJobDetails>), typeof(DeviceJobDetails))]
31+
[Cmdlet(VerbsCommon.Get, "AzureStorSimpleJob"), OutputType(typeof(IList<DeviceJobDetails>), typeof(DeviceJobDetails))]
3332
public class GetAzureStorSimpleJob : StorSimpleCmdletBase
3433
{
3534
#region params
3635
/// <summary>
3736
/// Name of StorSimple device for which to fetch jobs
3837
/// </summary>
39-
[Parameter(Mandatory = true, Position = 0, ParameterSetName = StorSimpleCmdletParameterSet.IdentifyByDeviceName,
40-
HelpMessage=StorSimpleCmdletHelpMessage.DeviceName)]
38+
[Parameter(Mandatory = false, Position = 0, HelpMessage=StorSimpleCmdletHelpMessage.DeviceName)]
4139
[ValidateNotNullOrEmpty]
4240
public string DeviceName { get; set; }
4341

44-
4542
/// <summary>
4643
/// InstanceId/JobId of the job to retrieve
4744
/// </summary>
48-
[Parameter(Mandatory=true, Position = 0, ParameterSetName = StorSimpleCmdletParameterSet.IdentifyById,
49-
HelpMessage = StorSimpleCmdletHelpMessage.DeviceJobId)]
45+
[Parameter(Mandatory = false, Position = 1, HelpMessage = StorSimpleCmdletHelpMessage.DeviceJobId)]
5046
[ValidateNotNullOrEmpty]
5147
public string InstanceId { get; set; }
5248

5349
/// <summary>
5450
/// Filter jobs by their status.
5551
/// </summary>
56-
[Parameter(Mandatory = true, Position = 0, ParameterSetName = StorSimpleCmdletParameterSet.IdentifyByStatus,
57-
HelpMessage=StorSimpleCmdletHelpMessage.DeviceJobStatus)]
52+
[Parameter(Mandatory = false, Position = 2, HelpMessage=StorSimpleCmdletHelpMessage.DeviceJobStatus)]
5853
[ValidateSetAttribute(new string[] { "Running", "Completed", "Cancelled", "Failed", "Cancelling", "CompletedWithErrors" })]
5954
public string Status { get; set; }
6055

6156
/// <summary>
6257
/// Filter jobs by their status.
6358
/// </summary>
64-
[Parameter(Mandatory = true, Position = 0, ParameterSetName = StorSimpleCmdletParameterSet.IdentifyByType,
65-
HelpMessage=StorSimpleCmdletHelpMessage.DeviceJobType)]
59+
[Parameter(Mandatory = false, Position = 3, HelpMessage=StorSimpleCmdletHelpMessage.DeviceJobType)]
6660
[ValidateSetAttribute(new string[] { "Backup", "ManualBackup", "Restore", "CloneWorkflow", "DeviceRestore", "Update", "SupportPackage", "VirtualApplianceProvisioning" })]
6761
public string Type { get; set; }
6862

6963
/// <summary>
7064
/// Filter jobs that were created after specified time
7165
/// </summary>
72-
[Parameter(Position = 1, Mandatory=false, HelpMessage = StorSimpleCmdletHelpMessage.FromTime)]
66+
[Parameter(Mandatory = false, Position = 4, HelpMessage = StorSimpleCmdletHelpMessage.FromTime)]
7367
public DateTime? From { get; set; }
7468

7569
/// <summary>
7670
/// Filter jobs that were created till specified time
7771
/// </summary
78-
[Parameter(Position = 2, Mandatory=false, HelpMessage = StorSimpleCmdletHelpMessage.ToTime)]
72+
[Parameter(Mandatory = false, Position = 5, HelpMessage = StorSimpleCmdletHelpMessage.ToTime)]
7973
public DateTime? To { get; set; }
8074

8175
/// <summary>
8276
/// Number of results to skip
8377
/// </summary>
84-
[Parameter(Position = 3, Mandatory=false, HelpMessage = StorSimpleCmdletHelpMessage.SkipDesc)]
78+
[Parameter(Mandatory = false, Position = 6, HelpMessage = StorSimpleCmdletHelpMessage.SkipDesc)]
8579
[ValidateRange(0, Int32.MaxValue)]
8680
public int? Skip { get; set; }
8781

8882
/// <summary>
8983
/// Number of results to include.
9084
/// </summary>
91-
[Parameter(Position = 4, Mandatory=false, HelpMessage = StorSimpleCmdletHelpMessage.FirstDesc)]
85+
[Parameter(Mandatory = false, Position = 7, HelpMessage = StorSimpleCmdletHelpMessage.FirstDesc)]
9286
[ValidateRange(0, Int32.MaxValue)]
9387
public int? First { get; set; }
9488
#endregion params
@@ -108,41 +102,29 @@ public override void ExecuteCmdlet()
108102
// Make call to get device jobs.
109103
var response = StorSimpleClient.GetDeviceJobs(deviceId, Type, Status, InstanceId, fromDateTimeIsoString, toDateTimeIsoString, (int)Skip, (int)First);
110104

111-
if (ParameterSetName == StorSimpleCmdletParameterSet.IdentifyById)
105+
WriteObject(response.DeviceJobList, true);
106+
WriteVerbose(string.Format(Resources.DeviceJobsReturnedCount, response.DeviceJobList.Count,
107+
response.DeviceJobList.Count > 1 ? "s" : string.Empty));
108+
if (response.NextPageUri != null
109+
&& response.NextPageStartIdentifier != "-1")
112110
{
113-
if (response == null || response.DeviceJobList.Count < 1)
111+
if (First != null)
114112
{
115-
throw new ArgumentException(string.Format(Resources.NoDeviceJobFoundWithGivenIdMessage, InstanceId));
116-
}
117-
WriteObject(response.DeviceJobList.First());
118-
return;
119-
}
120-
else
121-
{
122-
WriteObject(response.DeviceJobList, true);
123-
WriteVerbose(string.Format(Resources.DeviceJobsReturnedCount, response.DeviceJobList.Count,
124-
response.DeviceJobList.Count > 1 ? "s" : string.Empty));
125-
if (response.NextPageUri != null
126-
&& response.NextPageStartIdentifier != "-1")
127-
{
128-
if (First != null)
129-
{
130-
//user has provided First(Top) parameter while calling the commandlet
131-
//so we need to provide it to him for calling the next page
132-
WriteVerbose(string.Format(Resources.DeviceJobsNextPageFormatMessage, First, response.NextPageStartIdentifier));
133-
}
134-
else
135-
{
136-
//user has NOT provided First(Top) parameter while calling the commandlet
137-
//so we DONT need to provide it to him for calling the next page
138-
WriteVerbose(string.Format(Resources.DeviceJobsNextPagewithNoFirstMessage, response.NextPageStartIdentifier));
139-
}
113+
//user has provided First(Top) parameter while calling the commandlet
114+
//so we need to provide it to him for calling the next page
115+
WriteVerbose(string.Format(Resources.DeviceJobsNextPageFormatMessage, First, response.NextPageStartIdentifier));
140116
}
141117
else
142118
{
143-
WriteVerbose(Resources.DeviceJobsNoMorePagesMessage);
119+
//user has NOT provided First(Top) parameter while calling the commandlet
120+
//so we DONT need to provide it to him for calling the next page
121+
WriteVerbose(string.Format(Resources.DeviceJobsNextPagewithNoFirstMessage, response.NextPageStartIdentifier));
144122
}
145123
}
124+
else
125+
{
126+
WriteVerbose(Resources.DeviceJobsNoMorePagesMessage);
127+
}
146128
}
147129
catch (Exception exception)
148130
{
@@ -164,7 +146,7 @@ private void ProcessParameters()
164146

165147
deviceId = null;
166148

167-
if (ParameterSetName == StorSimpleCmdletParameterSet.IdentifyByDeviceName)
149+
if (DeviceName != null)
168150
{
169151
deviceId = StorSimpleClient.GetDeviceId(DeviceName);
170152
if (deviceId == null)

src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/VirtualDevice/NewAzureStorSimpleVirtualDeviceCommand.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
using System.Management.Automation;
1717
using Microsoft.WindowsAzure.Management.StorSimple.Models;
1818

19-
namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets.VirtualDevice
19+
namespace Microsoft.WindowsAzure.Commands.StorSimple.Cmdlets
2020
{
2121
[Cmdlet(VerbsCommon.New, "AzureStorSimpleVirtualDevice"), OutputType(typeof(string))]
2222
public class NewAzureStorSimpleVirtualDeviceCommand : StorSimpleCmdletBase
@@ -41,6 +41,9 @@ public class NewAzureStorSimpleVirtualDeviceCommand : StorSimpleCmdletBase
4141

4242
[Parameter(Position = 3, Mandatory = true, HelpMessage = StorSimpleCmdletHelpMessage.CreateNewStorageAccount, ParameterSetName = StorSimpleCmdletParameterSet.CreateNewStorageAccount)]
4343
public SwitchParameter CreateNewStorageAccount { get; set; }
44+
45+
[Parameter(DontShow = true, Mandatory = false, HelpMessage = StorSimpleCmdletHelpMessage.PersistAzureVMOnFailrue)]
46+
public SwitchParameter PersistAzureVMOnFailrue { get; set; }
4447

4548
public override void ExecuteCmdlet()
4649
{
@@ -57,6 +60,11 @@ public override void ExecuteCmdlet()
5760
StorageAccountName = StorageAccountName
5861
};
5962

63+
if (PersistAzureVMOnFailrue.IsPresent)
64+
{
65+
applianceProvisiongInfo.DeleteAzureCisVMOnFailure = false;
66+
}
67+
6068
var deviceJobResponse = StorSimpleClient.CreateVirtualDevice(applianceProvisiongInfo);
6169

6270
HandleDeviceJobResponse(deviceJobResponse, "create");

src/ServiceManagement/StorSimple/Commands.StorSimple/Commands.StorSimple.csproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@
8282
<Reference Include="Microsoft.WindowsAzure.Management.Scheduler">
8383
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Scheduler.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Scheduler.dll</HintPath>
8484
</Reference>
85-
<Reference Include="Microsoft.WindowsAzure.Management.StorSimple">
86-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.StorSimple.1.0.0-preview\lib\net40\Microsoft.WindowsAzure.Management.StorSimple.dll</HintPath>
85+
<Reference Include="Microsoft.WindowsAzure.Management.StorSimple, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
86+
<SpecificVersion>False</SpecificVersion>
87+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.StorSimple.1.0.1-preview\lib\net40\Microsoft.WindowsAzure.Management.StorSimple.dll</HintPath>
8788
</Reference>
8889
<Reference Include="Newtonsoft.Json">
8990
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -193,6 +194,12 @@
193194
</ProjectReference>
194195
</ItemGroup>
195196
<ItemGroup>
197+
<None Include="Microsoft.WindowsAzure.Commands.StorSimple.format.ps1xml">
198+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
199+
</None>
200+
<None Include="Microsoft.WindowsAzure.Commands.StorSimple.types.ps1xml">
201+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
202+
</None>
196203
<None Include="MSSharedLibKey.snk" />
197204
<None Include="packages.config">
198205
<SubType>Designer</SubType>

0 commit comments

Comments
 (0)