Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merge container branch

  • Loading branch information...
commit 054f0d6abeb30643510ac04718d0edff25ec3d8d 2 parents 59ba56b + c22c12c
@xmbms xmbms authored
Showing with 195 additions and 252 deletions.
  1. +0 −115 WindowsAzurePowershell/src/Management.Storage.Test/Blob/Cmdlet/GetAzureStorageContainerAclTest.cs
  2. +11 −7 WindowsAzurePowershell/src/Management.Storage.Test/Blob/Cmdlet/NewAzureStorageContainerTest.cs
  3. +1 −1  WindowsAzurePowershell/src/Management.Storage.Test/Blob/Cmdlet/SetAzureStorageContainerAclTest.cs
  4. +0 −1  WindowsAzurePowershell/src/Management.Storage.Test/Management.Storage.Test.csproj
  5. +12 −0 WindowsAzurePowershell/src/Management.Storage.Test/Service/MockStorageBlobManagement.cs
  6. +15 −1 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/GetAzureStorageContainer.cs
  7. +0 −96 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/GetAzureStorageContainerAcl.cs
  8. +46 −9 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/NewAzureStorageContainer.cs
  9. +3 −3 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/RemoveAzureStorageContainer.cs
  10. +6 −4 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/SetAzureStorageContainerAcl.cs
  11. +1 −1  WindowsAzurePowershell/src/Management.Storage/Common/Cmdlet/NewAzureStorageContext.cs
  12. +10 −5 WindowsAzurePowershell/src/Management.Storage/Common/StorageNouns.cs
  13. +1 −1  WindowsAzurePowershell/src/Management.Storage/Management.Storage.csproj
  14. +8 −8 WindowsAzurePowershell/src/Management.Storage/Microsoft.WindowsAzure.Management.Storage.format.ps1xml
  15. +45 −0 WindowsAzurePowershell/src/Management.Storage/Resources.Designer.cs
  16. +15 −0 WindowsAzurePowershell/src/Management.Storage/Resources.resx
  17. +9 −0 WindowsAzurePowershell/src/ServiceManagement/Storage/Blob/Contract/IStorageBlobManagement.cs
  18. +12 −0 WindowsAzurePowershell/src/ServiceManagement/Storage/Blob/Contract/StorageBlobManagement.cs
View
115 WindowsAzurePowershell/src/Management.Storage.Test/Blob/Cmdlet/GetAzureStorageContainerAclTest.cs
@@ -1,115 +0,0 @@
-// ----------------------------------------------------------------------------------
-//
-// 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.
-// ----------------------------------------------------------------------------------
-
-namespace Microsoft.WindowsAzure.Management.Storage.Test.Blob
-{
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Microsoft.WindowsAzure.Management.Storage.Blob;
- using Microsoft.WindowsAzure.Management.Storage.Blob.Cmdlet;
- using Microsoft.WindowsAzure.Management.Storage.Common;
- using Microsoft.WindowsAzure.Management.Test.Tests.Utilities;
- using Microsoft.WindowsAzure.ServiceManagement.Storage.Blob.ResourceModel;
- using Microsoft.WindowsAzure.Storage.Blob;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
-
- /// <summary>
- /// unit test for Get-AzureStorageContainerAcl
- /// </summary>
- [TestClass]
- public class GetAzureStorageContainerAclTest : StorageBlobTestBase
- {
- /// <summary>
- /// get azure storage container acl command
- /// </summary>
- public GetAzureStorageContainerAclCommand command = null;
-
- [TestInitialize]
- public void InitCommand()
- {
- command = new GetAzureStorageContainerAclCommand(BlobMock)
- {
- CommandRuntime = new MockCommandRuntime()
- };
- }
-
- [TestCleanup]
- public void CleanCommand()
- {
- command = null;
- }
-
- [TestMethod]
- public void GetContainerAclWithInvalidContainerNameTest()
- {
- string name = "a";
- AssertThrows<ArgumentException>(() => command.GetContainerAcl(name), String.Format(Resources.InvalidContainerName, name));
- }
-
- [TestMethod]
- public void GetContainerAclForNotExistsContainerTest()
- {
- string name = "test";
- AssertThrows<ResourceNotFoundException>(() => command.GetContainerAcl(name), String.Format(Resources.ContainerNotFound, name));
- }
-
- [TestMethod]
- public void GetContainerAclSuccessfullyTest()
- {
- AddTestContainers();
- string name = string.Empty;
-
- ((MockCommandRuntime)command.CommandRuntime).ResetPipelines();
- name = "test";
- command.GetContainerAcl(name);
- AzureStorageContainer container = (AzureStorageContainer)((MockCommandRuntime)command.CommandRuntime).OutputPipeline.FirstOrDefault();
- Assert.AreEqual(BlobContainerPublicAccessType.Off, container.PublicAccess);
-
- ((MockCommandRuntime)command.CommandRuntime).ResetPipelines();
- name = "publicoff";
- command.GetContainerAcl(name);
- container = (AzureStorageContainer)((MockCommandRuntime)command.CommandRuntime).OutputPipeline.FirstOrDefault();
- Assert.AreEqual(BlobContainerPublicAccessType.Off, container.PublicAccess);
-
- ((MockCommandRuntime)command.CommandRuntime).ResetPipelines();
- name = "publicblob";
- command.GetContainerAcl(name);
- container = (AzureStorageContainer)((MockCommandRuntime)command.CommandRuntime).OutputPipeline.FirstOrDefault();
- Assert.AreEqual(BlobContainerPublicAccessType.Blob, container.PublicAccess);
-
- ((MockCommandRuntime)command.CommandRuntime).ResetPipelines();
- name = "publiccontainer";
- command.GetContainerAcl(name);
- container = (AzureStorageContainer)((MockCommandRuntime)command.CommandRuntime).OutputPipeline.FirstOrDefault();
- Assert.AreEqual(BlobContainerPublicAccessType.Container, container.PublicAccess);
- }
-
- [TestMethod]
- public void ExecuteCommandGetContainerAclTest()
- {
- string name = "test";
- command.Name = name;
- AssertThrows<ResourceNotFoundException>(() => command.ExecuteCmdlet(), String.Format(Resources.ContainerNotFound, name));
-
- AddTestContainers();
-
- ((MockCommandRuntime)command.CommandRuntime).ResetPipelines();
- command.ExecuteCmdlet();
- AzureStorageContainer container = (AzureStorageContainer)((MockCommandRuntime)command.CommandRuntime).OutputPipeline.FirstOrDefault();
- Assert.AreEqual(BlobContainerPublicAccessType.Off, container.PublicAccess);
- }
- }
-}
View
18 WindowsAzurePowershell/src/Management.Storage.Test/Blob/Cmdlet/NewAzureStorageContainerTest.cs
@@ -49,15 +49,17 @@ public void CleanCommand()
public void CreateContainerWithInvalidContainerNameTest()
{
string name = String.Empty;
- AssertThrows<ArgumentException>(() => command.CreateAzureContainer(name),
+ string accesslevel = StorageNouns.ContainerAclOff;
+
+ AssertThrows<ArgumentException>(() => command.CreateAzureContainer(name, accesslevel),
String.Format(Resources.InvalidContainerName, name));
name = "a";
- AssertThrows<ArgumentException>(() => command.CreateAzureContainer(name),
+ AssertThrows<ArgumentException>(() => command.CreateAzureContainer(name, accesslevel),
String.Format(Resources.InvalidContainerName, name));
name = "&*(";
- AssertThrows<ArgumentException>(() => command.CreateAzureContainer(name),
+ AssertThrows<ArgumentException>(() => command.CreateAzureContainer(name, accesslevel),
String.Format(Resources.InvalidContainerName, name));
}
@@ -66,7 +68,9 @@ public void CreateContainerForAlreadyExistsContainerTest()
{
AddTestContainers();
string name = "text";
- AssertThrows<ResourceAlreadyExistException>(() => command.CreateAzureContainer(name),
+ string accesslevel = StorageNouns.ContainerAclOff;
+
+ AssertThrows<ResourceAlreadyExistException>(() => command.CreateAzureContainer(name, accesslevel),
String.Format(Resources.ContainerAlreadyExists, name));
}
@@ -74,15 +78,15 @@ public void CreateContainerForAlreadyExistsContainerTest()
public void CreateContainerSuccessfullyTest()
{
string name = String.Empty;
+ string accesslevel = StorageNouns.ContainerAclOff;
((MockCommandRuntime)command.CommandRuntime).ResetPipelines();
name = "test";
- command.CreateAzureContainer(name);
- AzureStorageContainer container = (AzureStorageContainer)((MockCommandRuntime)command.CommandRuntime).OutputPipeline.FirstOrDefault();
+ AzureStorageContainer container = command.CreateAzureContainer(name, accesslevel);
Assert.AreEqual("test", container.Name);
((MockCommandRuntime)command.CommandRuntime).ResetPipelines();
- AssertThrows<ResourceAlreadyExistException>(() => command.CreateAzureContainer(name),
+ AssertThrows<ResourceAlreadyExistException>(() => command.CreateAzureContainer(name, accesslevel),
String.Format(Resources.ContainerAlreadyExists, name));
}
View
2  WindowsAzurePowershell/src/Management.Storage.Test/Blob/Cmdlet/SetAzureStorageContainerAclTest.cs
@@ -112,7 +112,7 @@ public void ExecuteCommandSetContainerAclTest()
{
AddTestContainers();
command.Name = "publicblob";
- command.PublicAccess = "container";
+ command.Permission = "container";
command.ExecuteCmdlet();
AzureStorageContainer container = (AzureStorageContainer)((MockCommandRuntime)command.CommandRuntime).OutputPipeline.FirstOrDefault();
Assert.AreEqual(BlobContainerPublicAccessType.Container, container.PublicAccess);
View
1  WindowsAzurePowershell/src/Management.Storage.Test/Management.Storage.Test.csproj
@@ -85,7 +85,6 @@
</Choose>
<ItemGroup>
<Compile Include="Blob\Cmdlet\GetAzureStorageBlobTest.cs" />
- <Compile Include="Blob\Cmdlet\GetAzureStorageContainerAclTest.cs" />
<Compile Include="Blob\Cmdlet\GetAzureStorageContainerTest.cs" />
<Compile Include="Blob\Cmdlet\NewAzureStorageContainerTest.cs" />
<Compile Include="Blob\Cmdlet\RemoveAzureStorageBlobTest.cs" />
View
12 WindowsAzurePowershell/src/Management.Storage.Test/Service/MockStorageBlobManagement.cs
@@ -358,5 +358,17 @@ public void DeleteICloudBlob(ICloudBlob blob, DeleteSnapshotsOption deleteSnapsh
}
}
}
+
+ /// <summary>
+ /// fetch container attributes
+ /// </summary>
+ /// <param name="container">CloudBlobContainer object</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">blob request options</param>
+ /// <param name="operationContext">An object that represents the context for the current operation.</param>
+ public void FetchContainerAttributes(CloudBlobContainer container, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ {
+ return;
+ }
}
}
View
16 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/GetAzureStorageContainer.cs
@@ -31,7 +31,7 @@ namespace Microsoft.WindowsAzure.Management.Storage.Blob.Cmdlet
/// </summary>
[Cmdlet(VerbsCommon.Get, StorageNouns.Container, DefaultParameterSetName = NameParameterSet),
OutputType(typeof(AzureStorageContainer))]
- public class GetAzureStorageContainerCommand : StorageCloudBlobCmdletBase
+ public class GetAzureStorageContainerCommand : StorageCloudBlobCmdletBase, IModuleAssemblyInitializer
{
/// <summary>
/// default parameter set name
@@ -83,6 +83,7 @@ internal IEnumerable<CloudBlobContainer> ListContainersByName(string name)
ContainerListingDetails details = ContainerListingDetails.Metadata;
string prefix = string.Empty;
BlobRequestOptions requestOptions = null;
+ AccessCondition accessCondition = null;
if (String.IsNullOrEmpty(name) || WildcardPattern.ContainsWildcardCharacters(name))
{
@@ -114,6 +115,8 @@ internal IEnumerable<CloudBlobContainer> ListContainersByName(string name)
if (Channel.IsContainerExists(container, requestOptions, OperationContext))
{
+ //fetch container attributes
+ Channel.FetchContainerAttributes(container, accessCondition, requestOptions, OperationContext);
yield return container;
}
else
@@ -187,5 +190,16 @@ public override void ExecuteCmdlet()
IEnumerable<AzureStorageContainer> azureContainers = PackCloudBlobContainerWithAcl(containerList);
WriteObjectWithStorageContext(azureContainers);
}
+
+ /// <summary>
+ /// add alias "Get-AzureStorageContainerAcl" for this cmdlet
+ /// </summary>
+ public void OnImport()
+ {
+ System.Management.Automation.PowerShell invoker = null;
+ invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);
+ invoker.AddCommand(Resources.NewAlias).AddParameter(Resources.NewAliasName, Resources.GetAzureStorageContainerAclCmdletName).AddParameter(Resources.NewAliasValue, Resources.GetAzureStorageContainerCmdletName);
+ System.Collections.ObjectModel.Collection<PSObject> psObjects = invoker.Invoke();
+ }
}
}
View
96 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/GetAzureStorageContainerAcl.cs
@@ -1,96 +0,0 @@
-// ----------------------------------------------------------------------------------
-//
-// 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.
-// ----------------------------------------------------------------------------------
-
-namespace Microsoft.WindowsAzure.Management.Storage.Blob.Cmdlet
-{
- using Microsoft.WindowsAzure.Management.Storage.Common;
- using Microsoft.WindowsAzure.ServiceManagement.Storage.Blob.Contract;
- using Microsoft.WindowsAzure.ServiceManagement.Storage.Blob.ResourceModel;
- using Microsoft.WindowsAzure.Storage;
- using Microsoft.WindowsAzure.Storage.Blob;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Management.Automation;
- using System.Security.Permissions;
- using System.Text;
-
- /// <summary>
- /// get access level for specified container
- /// </summary>
- [Cmdlet(VerbsCommon.Get, StorageNouns.ContainerAcl),
- OutputType(typeof(AzureStorageContainer))]
- public class GetAzureStorageContainerAclCommand : StorageCloudBlobCmdletBase
- {
- [Alias("N", "Container")]
- [Parameter(Position = 0, Mandatory = true, HelpMessage = "Container Name",
- ValueFromPipeline = true,
- ValueFromPipelineByPropertyName = true)]
- public string Name { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the GetAzureStorageContainerAclCommand class.
- /// </summary>
- public GetAzureStorageContainerAclCommand()
- : this(null)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the GetAzureStorageContainerCommand class.
- /// </summary>
- /// <param name="channel">IStorageBlobManagement channel</param>
- public GetAzureStorageContainerAclCommand(IStorageBlobManagement channel)
- {
- Channel = channel;
- }
-
- /// <summary>
- /// get container and it's acl info by container name
- /// </summary>
- /// <param name="name">container name</param>
- [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
- internal void GetContainerAcl(String name)
- {
- if (!NameUtil.IsValidContainerName(name))
- {
- throw new ArgumentException(String.Format(Resources.InvalidContainerName, name));
- }
-
- BlobRequestOptions reqesutOptions = null;
- AccessCondition accessCondition = null;
-
- CloudBlobContainer container = Channel.GetContainerReference(name);
-
- if (!Channel.IsContainerExists(container, reqesutOptions, OperationContext))
- {
- throw new ResourceNotFoundException(String.Format(Resources.ContainerNotFound, name));
- }
-
- BlobContainerPermissions permissions = Channel.GetContainerPermissions(container, accessCondition, reqesutOptions, OperationContext);
- AzureStorageContainer azureContainer = new AzureStorageContainer(container, permissions);
-
- WriteObjectWithStorageContext(azureContainer);
- }
-
- /// <summary>
- /// execute command
- /// </summary>
- [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
- public override void ExecuteCmdlet()
- {
- GetContainerAcl(Name);
- }
- }
-}
View
55 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/NewAzureStorageContainer.cs
@@ -20,11 +20,9 @@ namespace Microsoft.WindowsAzure.Management.Storage.Blob.Cmdlet
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
- using System.Collections.Generic;
- using System.Linq;
+ using System.Globalization;
using System.Management.Automation;
using System.Security.Permissions;
- using System.Text;
/// <summary>
/// create a new azure container
@@ -40,6 +38,18 @@ public class NewAzureStorageContainerCommand : StorageCloudBlobCmdletBase
[ValidateNotNullOrEmpty]
public string Name { get; set; }
+ [Alias("PublicAccess")]
+ [Parameter(Position = 1, Mandatory = false,
+ HelpMessage = "Permission string Off/Blob/Container")]
+ [ValidateSet(StorageNouns.ContainerAclOff, StorageNouns.ContainerAclBlob, StorageNouns.ContainerAclContainer, IgnoreCase = true)]
+ [ValidateNotNullOrEmpty]
+ public string Permission
+ {
+ get { return accessLevel; }
+ set { accessLevel = value; }
+ }
+ private string accessLevel = StorageNouns.ContainerAclOff;
+
/// <summary>
/// Initializes a new instance of the NewAzureStorageContainerCommand class.
/// </summary>
@@ -62,28 +72,54 @@ public NewAzureStorageContainerCommand(IStorageBlobManagement channel)
/// </summary>
/// <param name="name">container name</param>
[PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
- internal void CreateAzureContainer(string name)
+ internal AzureStorageContainer CreateAzureContainer(string name, string accesslevel)
{
if (!NameUtil.IsValidContainerName(name))
{
throw new ArgumentException(String.Format(Resources.InvalidContainerName, name));
}
- BlobRequestOptions reqesutOptions = null;
+ BlobRequestOptions requestOptions = null;
AccessCondition accessCondition = null;
CloudBlobContainer container = Channel.GetContainerReference(name);
- bool created = Channel.CreateContainerIfNotExists(container, reqesutOptions, OperationContext);
+ bool created = Channel.CreateContainerIfNotExists(container, requestOptions, OperationContext);
if (!created)
{
throw new ResourceAlreadyExistException(String.Format(Resources.ContainerAlreadyExists, name));
}
- BlobContainerPermissions permissions = Channel.GetContainerPermissions(container, accessCondition, reqesutOptions, OperationContext);
+ BlobContainerPermissions permissions = new BlobContainerPermissions();
+ accessLevel = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(accessLevel);
+
+ switch (CultureInfo.CurrentCulture.TextInfo.ToTitleCase(accessLevel))
+ {
+ case StorageNouns.ContainerAclOff:
+ permissions.PublicAccess = BlobContainerPublicAccessType.Off;
+ break;
+ case StorageNouns.ContainerAclBlob:
+ permissions.PublicAccess = BlobContainerPublicAccessType.Blob;
+ break;
+ case StorageNouns.ContainerAclContainer:
+ permissions.PublicAccess = BlobContainerPublicAccessType.Container;
+ break;
+ default:
+ throw new ArgumentException(Resources.OnlyOnePermissionForContainer);
+ }
+
+ if(accessLevel == StorageNouns.ContainerAclContainer || accessLevel == StorageNouns.ContainerAclBlob)
+ {
+ Channel.SetContainerPermissions(container, permissions, accessCondition, requestOptions, OperationContext);
+ }
+ else
+ {
+ permissions = Channel.GetContainerPermissions(container, accessCondition, requestOptions, OperationContext);
+ }
+
AzureStorageContainer azureContainer = new AzureStorageContainer(container, permissions);
- WriteObjectWithStorageContext(azureContainer);
+ return azureContainer;
}
/// <summary>
@@ -92,7 +128,8 @@ internal void CreateAzureContainer(string name)
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
public override void ExecuteCmdlet()
{
- CreateAzureContainer(Name);
+ AzureStorageContainer azureContainer = CreateAzureContainer(Name, accessLevel);
+ WriteObjectWithStorageContext(azureContainer);
}
}
}
View
6 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/RemoveAzureStorageContainer.cs
@@ -88,12 +88,12 @@ internal void RemoveAzureContainer(string name)
throw new ArgumentException(String.Format(Resources.InvalidContainerName, name));
}
- BlobRequestOptions reqesutOptions = null;
+ BlobRequestOptions requestOptions = null;
AccessCondition accessCondition = null;
CloudBlobContainer container = Channel.GetContainerReference(name);
- if (!Channel.IsContainerExists(container, reqesutOptions, OperationContext))
+ if (!Channel.IsContainerExists(container, requestOptions, OperationContext))
{
throw new ResourceNotFoundException(String.Format(Resources.ContainerNotFound, name));
}
@@ -102,7 +102,7 @@ internal void RemoveAzureContainer(string name)
if (force || ConfirmRemove(name))
{
- Channel.DeleteContainer(container, accessCondition, reqesutOptions, OperationContext);
+ Channel.DeleteContainer(container, accessCondition, requestOptions, OperationContext);
result = String.Format(Resources.RemoveContainerSuccessfully, name);
}
else
View
10 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/SetAzureStorageContainerAcl.cs
@@ -21,6 +21,7 @@ namespace Microsoft.WindowsAzure.Management.Storage.Cmdlet
using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Collections.Generic;
+ using System.Globalization;
using System.Linq;
using System.Management.Automation;
using System.Security.Permissions;
@@ -39,11 +40,12 @@ public class SetAzureStorageContainerAclCommand : StorageCloudBlobCmdletBase
ValueFromPipelineByPropertyName = true)]
public string Name { get; set; }
+ [Alias("PublicAccess")]
[Parameter(Position = 1, Mandatory = true,
- HelpMessage = "Permission string off/blob/container")]
- [ValidateSet(StorageNouns.ContainerAclOff, StorageNouns.ContainerAclBlob, StorageNouns.ContainerAclContainer)]
+ HelpMessage = "Permission string Off/Blob/Container")]
+ [ValidateSet(StorageNouns.ContainerAclOff, StorageNouns.ContainerAclBlob, StorageNouns.ContainerAclContainer, IgnoreCase = true)]
[ValidateNotNullOrEmpty]
- public string PublicAccess
+ public string Permission
{
get { return accessLevel; }
set { accessLevel = value; }
@@ -82,7 +84,7 @@ internal void SetContainerAcl(string name, string accessLevel)
BlobContainerPermissions permissions = new BlobContainerPermissions();
- switch (accessLevel.ToLower())
+ switch (CultureInfo.CurrentCulture.TextInfo.ToTitleCase(accessLevel))
{
case StorageNouns.ContainerAclOff:
permissions.PublicAccess = BlobContainerPublicAccessType.Off;
View
2  WindowsAzurePowershell/src/Management.Storage/Common/Cmdlet/NewAzureStorageContext.cs
@@ -28,7 +28,7 @@ namespace Microsoft.WindowsAzure.Management.Storage.Common.Cmdlet
/// <summary>
/// new storage context
/// </summary>
- [Cmdlet(VerbsCommon.New, StorageNouns.StorageContext, DefaultParameterSetName = AccountNameKeyParameterSet, SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High),
+ [Cmdlet(VerbsCommon.New, StorageNouns.StorageContext, DefaultParameterSetName = AccountNameKeyParameterSet),
OutputType(typeof(AzureStorageContext))]
public class NewAzureStorageContext : CmdletBase
{
View
15 WindowsAzurePowershell/src/Management.Storage/Common/StorageNouns.cs
@@ -35,6 +35,11 @@ public static class StorageNouns
public const string BlobContent = "AzureStorageBlobContent";
/// <summary>
+ /// blob snapshot cmdlet name
+ /// </summary>
+ public const string BlobSnapshot = "AzureStorageBlobSnapshot";
+
+ /// <summary>
/// container cmdlet name
/// </summary>
public const string Container = "AzureStorageContainer";
@@ -47,27 +52,27 @@ public static class StorageNouns
/// <summary>
/// BlobContainerPublicAccessType is off
/// </summary>
- public const string ContainerAclOff = "off";
+ public const string ContainerAclOff = "Off";
/// <summary>
/// BlobContainerPublicAccessType is blob
/// </summary>
- public const string ContainerAclBlob = "blob";
+ public const string ContainerAclBlob = "Blob";
/// <summary>
/// BlobContainerPublicAccessType is container
/// </summary>
- public const string ContainerAclContainer = "container";
+ public const string ContainerAclContainer = "Container";
/// <summary>
/// http protocol
/// </summary>
- public const string HTTP = "http";
+ public const string HTTP = "Http";
/// <summary>
/// https protocol
/// </summary>
- public const string HTTPS = "https";
+ public const string HTTPS = "Https";
/// <summary>
/// queue cmdlet name
View
2  WindowsAzurePowershell/src/Management.Storage/Management.Storage.csproj
@@ -99,7 +99,6 @@
<ItemGroup>
<Compile Include="Blob\Cmdlet\GetAzureStorageBlob.cs" />
<Compile Include="Blob\Cmdlet\GetAzureStorageContainer.cs" />
- <Compile Include="Blob\Cmdlet\GetAzureStorageContainerAcl.cs" />
<Compile Include="Blob\Cmdlet\NewAzureStorageContainer.cs" />
<Compile Include="Blob\Cmdlet\RemoveAzureStorageBlob.cs" />
<Compile Include="Blob\Cmdlet\RemoveAzureStorageContainer.cs" />
@@ -146,6 +145,7 @@
<EmbeddedResource Include="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
View
16 WindowsAzurePowershell/src/Management.Storage/Microsoft.WindowsAzure.Management.Storage.format.ps1xml
@@ -188,9 +188,9 @@
</TableControl>
</View>
<View>
- <Name>Microsoft.WindowsAzure.Management.Storage.Model.AzureStorageContainer</Name>
+ <Name>Microsoft.WindowsAzure.ServiceManagement.Storage.Blob.ResourceModel.AzureStorageContainer</Name>
<ViewSelectedBy>
- <TypeName>Microsoft.WindowsAzure.Management.Storage.Model.AzureStorageContainer</TypeName>
+ <TypeName>Microsoft.WindowsAzure.ServiceManagement.Storage.Blob.ResourceModel.AzureStorageContainer</TypeName>
</ViewSelectedBy>
<GroupBy>
<ScriptBlock>$_.CloudBlobContainer.ServiceClient.BaseUri</ScriptBlock>
@@ -229,9 +229,9 @@
</TableControl>
</View>
<View>
- <Name>Microsoft.WindowsAzure.Management.Storage.Model.AzureStorageBlob</Name>
+ <Name>Microsoft.WindowsAzure.ServiceManagement.Storage.Blob.ResourceModel.AzureStorageBlob</Name>
<ViewSelectedBy>
- <TypeName>Microsoft.WindowsAzure.Management.Storage.Model.AzureStorageBlob</TypeName>
+ <TypeName>Microsoft.WindowsAzure.ServiceManagement.Storage.Blob.ResourceModel.AzureStorageBlob</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
@@ -331,9 +331,9 @@
</TableControl>
</View>
<View>
- <Name>Microsoft.WindowsAzure.Management.Storage.Model.AzureStorageTable</Name>
+ <Name>Microsoft.WindowsAzure.ServiceManagement.Storage.Table.ResourceModel.AzureStorageTable</Name>
<ViewSelectedBy>
- <TypeName>Microsoft.WindowsAzure.Management.Storage.Model.AzureStorageTable</TypeName>
+ <TypeName>Microsoft.WindowsAzure.ServiceManagement.Storage.Table.ResourceModel.AzureStorageTable</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
@@ -361,9 +361,9 @@
</TableControl>
</View>
<View>
- <Name>Microsoft.WindowsAzure.Management.Storage.Model.StorageContext</Name>
+ <Name>Microsoft.WindowsAzure.ServiceManagement.Storage.Common.ResourceModel.AzureStorageContext</Name>
<ViewSelectedBy>
- <TypeName>Microsoft.WindowsAzure.Management.Storage.Model.StorageContext</TypeName>
+ <TypeName>Microsoft.WindowsAzure.ServiceManagement.Storage.Common.ResourceModel.AzureStorageContext</TypeName>
</ViewSelectedBy>
<ListControl>
<ListEntries>
View
45 WindowsAzurePowershell/src/Management.Storage/Resources.Designer.cs
@@ -349,6 +349,24 @@ internal class Resources {
}
/// <summary>
+ /// Looks up a localized string similar to Get-AzureStorageContainerAcl.
+ /// </summary>
+ internal static string GetAzureStorageContainerAclCmdletName {
+ get {
+ return ResourceManager.GetString("GetAzureStorageContainerAclCmdletName", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Get-AzureStorageContainer.
+ /// </summary>
+ internal static string GetAzureStorageContainerCmdletName {
+ get {
+ return ResourceManager.GetString("GetAzureStorageContainerCmdletName", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Get storage account from environment variable &apos;AZURE_STORAGE_CONNECTION_STRING&apos;..
/// </summary>
internal static string GetStorageAccountFromEnvironmentVariable {
@@ -475,6 +493,33 @@ internal class Resources {
}
/// <summary>
+ /// Looks up a localized string similar to New-Alias.
+ /// </summary>
+ internal static string NewAlias {
+ get {
+ return ResourceManager.GetString("NewAlias", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Name.
+ /// </summary>
+ internal static string NewAliasName {
+ get {
+ return ResourceManager.GetString("NewAliasName", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Value.
+ /// </summary>
+ internal static string NewAliasValue {
+ get {
+ return ResourceManager.GetString("NewAliasValue", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Object &apos;{0}&apos; cannot be null..
/// </summary>
internal static string ObjectCannotBeNull {
View
15 WindowsAzurePowershell/src/Management.Storage/Resources.resx
@@ -360,4 +360,19 @@
<value>The remove operation of blob '{0}' in container '{1}' is cancelled.</value>
<comment>0 for blob name, 1 for container name</comment>
</data>
+ <data name="GetAzureStorageContainerAclCmdletName" xml:space="preserve">
+ <value>Get-AzureStorageContainerAcl</value>
+ </data>
+ <data name="GetAzureStorageContainerCmdletName" xml:space="preserve">
+ <value>Get-AzureStorageContainer</value>
+ </data>
+ <data name="NewAlias" xml:space="preserve">
+ <value>New-Alias</value>
+ </data>
+ <data name="NewAliasName" xml:space="preserve">
+ <value>Name</value>
+ </data>
+ <data name="NewAliasValue" xml:space="preserve">
+ <value>Value</value>
+ </data>
</root>
View
9 WindowsAzurePowershell/src/ServiceManagement/Storage/Blob/Contract/IStorageBlobManagement.cs
@@ -131,5 +131,14 @@ public interface IStorageBlobManagement
/// <param name="operationContext">operation context</param>
/// <returns>an enumerable collection of icloudblob</returns>
void DeleteICloudBlob(ICloudBlob blob, DeleteSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext);
+
+ /// <summary>
+ /// fetch container attributes
+ /// </summary>
+ /// <param name="container">CloudBlobContainer object</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">blob request options</param>
+ /// <param name="operationContext">An object that represents the context for the current operation.</param>
+ void FetchContainerAttributes(CloudBlobContainer container, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext);
}
}
View
12 WindowsAzurePowershell/src/ServiceManagement/Storage/Blob/Contract/StorageBlobManagement.cs
@@ -209,5 +209,17 @@ public void DeleteICloudBlob(ICloudBlob blob, DeleteSnapshotsOption deleteSnapsh
{
blob.Delete(deleteSnapshotsOption, accessCondition, options, operationContext);
}
+
+ /// <summary>
+ /// fetch container attributes
+ /// </summary>
+ /// <param name="container">CloudBlobContainer object</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">blob request options</param>
+ /// <param name="operationContext">An object that represents the context for the current operation.</param>
+ public void FetchContainerAttributes(CloudBlobContainer container, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ {
+ container.FetchAttributes(accessCondition, options, operationContext);
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.