Skip to content

Commit

Permalink
Merge pull request Azure#44 from huangpf/crp2
Browse files Browse the repository at this point in the history
Crp2
  • Loading branch information
AzureRT committed Apr 12, 2015
2 parents 83714a0 + 8bbfdbe commit b9f22dc
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 214 deletions.
1 change: 1 addition & 0 deletions src/AzurePowershell.sln
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.NetworkResourcePro
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Compute", "ResourceManager\Compute\Commands.Compute\Commands.Compute.csproj", "{52643BD5-6378-49BD-9F6E-DAC9DD8A867B}"
ProjectSection(ProjectDependencies) = postProject
{E1F5201D-6067-430E-B303-4E367652991B} = {E1F5201D-6067-430E-B303-4E367652991B}
{98CFD96B-A6BC-4F15-AE2C-603FC2B58981} = {98CFD96B-A6BC-4F15-AE2C-603FC2B58981}
{E1CA72BA-8374-45F6-904D-FD34ECDF5B6F} = {E1CA72BA-8374-45F6-904D-FD34ECDF5B6F}
EndProjectSection
Expand Down
1 change: 1 addition & 0 deletions src/Common/Commands.Common/Commands.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<ItemGroup>
<Compile Include="AzurePowerShell.cs" />
<Compile Include="Constants.cs" />
<Compile Include="SecureStringExtensions.cs" />
<Compile Include="ConversionUtilities.cs" />
<Compile Include="DebugStreamTraceListener.cs" />
<Compile Include="GeneralUtilities.cs" />
Expand Down
20 changes: 1 addition & 19 deletions src/Common/Commands.Common/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions src/Common/Commands.Common/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1358,10 +1358,4 @@ use and privacy statement at &lt;url&gt; and (c) agree to sharing my contact inf
<data name="AzureProfileMustNotBeNull" xml:space="preserve">
<value>Selected profile must not be null.</value>
</data>
<data name="InvalidTagFormat" xml:space="preserve">
<value>Invalid tag format. Expect @{Name = "tagName"} or @{Name = "tagName"; Value = "tagValue"}</value>
</data>
<data name="InvalidTagFormatNotUniqueName" xml:space="preserve">
<value>Invalid tag format. Ensure that each tag has a unique name. Example: @{Name = "tagName1"; Value = "tagValue1"}, @{Name = "tagName2"; Value = "tagValue2"}</value>
</data>
</root>
74 changes: 74 additions & 0 deletions src/Common/Commands.Common/SecureStringExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// ----------------------------------------------------------------------------------
//
// 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 System;
using System.Runtime.InteropServices;
using System.Security;

namespace Microsoft.WindowsAzure.Commands.Common
{
/// <summary>
/// Extends SecureString and string to convert from one to the other
/// </summary>
public static class SecureStringExtensions
{

/// <summary>
/// Converts a string into a secure string.
/// </summary>
/// <param name="value">the string to be converted.</param>
/// <returns>The secure string converted from the input string </returns>
public static SecureString ConvertToSecureString(this string value)
{
if (value == null)
{
throw new ArgumentNullException("value");
}

unsafe
{
fixed (char* chars = value)
{
SecureString secureString = new SecureString(chars, value.Length);
secureString.MakeReadOnly();
return secureString;
}
}
}

/// <summary>
/// Converts the secure string to a string.
/// </summary>
/// <param name="secureString">the secure string to be converted.</param>
/// <returns>The string converted from a secure string </returns>
public static string ConvertToString(this SecureString secureString)
{
if (secureString == null)
{
throw new ArgumentNullException("secureString");
}

IntPtr stringPointer = IntPtr.Zero;
try
{
stringPointer = Marshal.SecureStringToBSTR(secureString);
return Marshal.PtrToStringBSTR(stringPointer);
}
finally
{
Marshal.ZeroFreeBSTR(stringPointer);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll</HintPath>
</Reference>
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.28.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
<Compile Include="AvailabilitySets\NewAzureAvailabilitySetCommand.cs" />
<Compile Include="AvailabilitySets\AvailabilitySetBaseCmdlet.cs" />
<Compile Include="Common\ExtensionSettingBuilder.cs" />
<Compile Include="Common\TagsConversionHelper.cs" />
<Compile Include="Common\ComputeClient.cs" />
<Compile Include="Extension\SetAzureVMExtensionCommand.cs" />
<Compile Include="Extension\RemoveAzureVMExtensionCommand.cs" />
Expand All @@ -141,7 +140,6 @@
<Compile Include="Models\PSAvailabilitySet.cs" />
<Compile Include="Models\PSVirtualMachineInstanceView.cs" />
<Compile Include="StorageAccount\StorageManagementClient.cs" />
<Compile Include="Common\SecureStringExtension.cs" />
<Compile Include="Models\SourceImageReferenceExtension.cs" />
<Compile Include="StorageAccount\GetAzureStorageAccount.cs" />
<Compile Include="StorageAccount\GetAzureStorageAccountKey.cs" />
Expand Down Expand Up @@ -192,6 +190,10 @@
<Project>{c60342b1-47d3-4a0e-8081-9b97ce60b7af}</Project>
<Name>Commands.Profile</Name>
</ProjectReference>
<ProjectReference Include="..\..\Resources\Commands.Resources\Commands.Resources.csproj">
<Project>{e1f5201d-6067-430e-b303-4e367652991b}</Project>
<Name>Commands.Resources</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Microsoft.Azure.Commands.Compute.dll-Help.psd1">
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Compute.Common;
using Microsoft.Azure.Commands.Compute.Properties;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.Compute
{
[Cmdlet(VerbsCommon.Remove, ProfileNouns.VirtualMachineExtension)]
[OutputType(typeof(object))]
[OutputType(typeof(ComputeLongRunningOperationResponse))]
public class RemoveAzureVMExtensionCommand : VirtualMachineExtensionBaseCmdlet
{
[Parameter(HelpMessage = "To force the removal.")]
Expand All @@ -32,7 +32,7 @@ public override void ExecuteCmdlet()
base.ExecuteCmdlet();

if (this.Force.IsPresent
|| this.ShouldContinue(Resources.VirtualMachineExtensionRemovalConfirmation, Resources.VirtualMachineExtensionRemovalCaption))
|| this.ShouldContinue(Properties.Resources.VirtualMachineExtensionRemovalConfirmation, Properties.Resources.VirtualMachineExtensionRemovalCaption))
{
var op = this.VirtualMachineExtensionClient.Delete(this.ResourceGroupName, this.VMName, this.Name);
WriteObject(op);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Compute.Common;
using Microsoft.Azure.Commands.Compute.Models;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System.Collections;
Expand All @@ -25,7 +24,7 @@ namespace Microsoft.Azure.Commands.Compute
VerbsCommon.Set,
ProfileNouns.VirtualMachineExtension,
DefaultParameterSetName = SettingsParamSet)]
[OutputType(typeof(object))]
[OutputType(typeof(ComputeLongRunningOperationResponse))]
public class SetAzureVMExtensionCommand : VirtualMachineExtensionBaseCmdlet
{
protected const string SettingStringParamSet = "SettingString";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.Storage;
using Microsoft.Azure.Management.Storage.Models;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.Compute
{
using System.Management.Automation;
using Azure.Management.Storage;
using Azure.Management.Storage.Models;

/// <summary>
/// Lists all storage services underneath the subscription.
/// </summary>
Expand Down
Loading

0 comments on commit b9f22dc

Please sign in to comment.