Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merge devstorage branch and remove servicemanagement project

  • Loading branch information...
commit 6f3e54a1a6eced97089327fec8f9e9040d944417 2 parents f9f66a1 + 3c55864
@xmbms xmbms authored
Showing with 594 additions and 55 deletions.
  1. +1 −1  WindowsAzurePowershell/src/Management.Storage.Test/Blob/Cmdlet/GetAzureStorageContainerTest.cs
  2. +0 −4 WindowsAzurePowershell/src/Management.Storage.Test/Management.Storage.Test.csproj
  3. +1 −1  WindowsAzurePowershell/src/Management.Storage.Test/Service/MockStorageBlobManagement.cs
  4. +2 −2 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/GetAzureStorageContainer.cs
  5. +1 −1  WindowsAzurePowershell/src/Management.Storage/Blob/StorageCloudBlobCmdletBase.cs
  6. +2 −5 WindowsAzurePowershell/src/Management.Storage/Common/Cmdlet/NewAzureStorageContext.cs
  7. +1 −2  WindowsAzurePowershell/src/Management.Storage/Common/StorageCloudCmdletBase.cs
  8. +59 −0 WindowsAzurePowershell/src/Management.Storage/Common/StorageExceptionUtil.cs
  9. +6 −8 WindowsAzurePowershell/src/Management.Storage/Management.Storage.csproj
  10. +135 −0 WindowsAzurePowershell/src/Management.Storage/Model/Contract/IStorageBlobManagement.cs
  11. +209 −0 WindowsAzurePowershell/src/Management.Storage/Model/Contract/StorageBlobManagement.cs
  12. +37 −0 WindowsAzurePowershell/src/Management.Storage/Model/ResourceModel/AzureStorageBase.cs
  13. +62 −0 WindowsAzurePowershell/src/Management.Storage/Model/ResourceModel/AzureStorageContainer.cs
  14. +78 −0 WindowsAzurePowershell/src/Management.Storage/Model/ResourceModel/AzureStorageContext.cs
  15. +0 −1  WindowsAzurePowershell/src/Management/Model/SubscriptionData.cs
  16. +0 −30 WindowsAzurePowershell/src/WindowsAzurePowershell.sln
View
2  WindowsAzurePowershell/src/Management.Storage.Test/Blob/Cmdlet/GetAzureStorageContainerTest.cs
@@ -18,9 +18,9 @@ namespace Microsoft.WindowsAzure.Management.Storage.Test.Blob.Cmdlet
using Microsoft.WindowsAzure.Management.Storage.Blob;
using Microsoft.WindowsAzure.Management.Storage.Blob.Cmdlet;
using Microsoft.WindowsAzure.Management.Storage.Common;
+ using Microsoft.WindowsAzure.Management.Storage.Model.ResourceModel;
using Microsoft.WindowsAzure.Management.Storage.Test.Service;
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;
View
4 WindowsAzurePowershell/src/Management.Storage.Test/Management.Storage.Test.csproj
@@ -116,10 +116,6 @@
<Project>{cd5aa507-f5ef-473d-855b-84b91a1abe54}</Project>
<Name>Management</Name>
</ProjectReference>
- <ProjectReference Include="..\ServiceManagement\ServiceManagement.csproj">
- <Project>{559a16c7-b11c-4aa6-8c16-8adeca6abed7}</Project>
- <Name>ServiceManagement</Name>
- </ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="MSSharedLibKey.snk" />
View
2  WindowsAzurePowershell/src/Management.Storage.Test/Service/MockStorageBlobManagement.cs
@@ -15,7 +15,7 @@
namespace Microsoft.WindowsAzure.Management.Storage.Test.Service
{
using Microsoft.WindowsAzure.Management.Storage.Common;
- using Microsoft.WindowsAzure.ServiceManagement.Storage.Blob.Contract;
+ using Microsoft.WindowsAzure.Management.Storage.Model.Contract;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
View
4 WindowsAzurePowershell/src/Management.Storage/Blob/Cmdlet/GetAzureStorageContainer.cs
@@ -15,8 +15,8 @@
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.Management.Storage.Model.Contract;
+ using Microsoft.WindowsAzure.Management.Storage.Model.ResourceModel;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
View
2  WindowsAzurePowershell/src/Management.Storage/Blob/StorageCloudBlobCmdletBase.cs
@@ -14,7 +14,7 @@
namespace Microsoft.WindowsAzure.Management.Storage.Common
{
- using Microsoft.WindowsAzure.ServiceManagement.Storage.Blob.Contract;
+ using Microsoft.WindowsAzure.Management.Storage.Model.Contract;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
View
7 WindowsAzurePowershell/src/Management.Storage/Common/Cmdlet/NewAzureStorageContext.cs
@@ -15,16 +15,13 @@
namespace Microsoft.WindowsAzure.Management.Storage.Common.Cmdlet
{
using Microsoft.WindowsAzure.Management.Cmdlets.Common;
- using Microsoft.WindowsAzure.ServiceManagement.Storage.Common.ResourceModel;
+ using Microsoft.WindowsAzure.Management.Storage.Model.ResourceModel;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using System;
- using System.Collections.Generic;
- using System.Linq;
using System.Management.Automation;
using System.Security.Permissions;
- using System.Text;
-
+
/// <summary>
/// New storage context
/// </summary>
View
3  WindowsAzurePowershell/src/Management.Storage/Common/StorageCloudCmdletBase.cs
@@ -15,8 +15,7 @@
namespace Microsoft.WindowsAzure.Management.Storage.Common
{
using Microsoft.WindowsAzure.Management.Cmdlets.Common;
- using Microsoft.WindowsAzure.ServiceManagement.Storage.Common.ResourceModel;
- using Microsoft.WindowsAzure.ServiceManagement.Storage.Util;
+ using Microsoft.WindowsAzure.Management.Storage.Model.ResourceModel;
using Microsoft.WindowsAzure.Storage;
using System;
using System.Collections.Generic;
View
59 WindowsAzurePowershell/src/Management.Storage/Common/StorageExceptionUtil.cs
@@ -0,0 +1,59 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Common
+{
+ using Microsoft.WindowsAzure.Storage;
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+ /// <summary>
+ /// Storage exception utility
+ /// </summary>
+ public static class StorageExceptionUtil
+ {
+ /// <summary>
+ /// Whether the storage exception is resource not found exception or not.
+ /// </summary>
+ /// <param name="e">StorageException from storage client</param>
+ /// <returns>Whether the storageexception is caused by resource not found</returns>
+ public static bool IsNotFoundException(this StorageException e)
+ {
+ return e.RequestInformation != null && e.RequestInformation.HttpStatusCode == 404;
+ }
+
+ /// <summary>
+ /// Replace storage exception to expose more information in Message.
+ /// </summary>
+ /// <param name="e">StorageException from storage client</param>
+ /// <returns>A new storage exception with detailed error message</returns>
+ public static StorageException RepackStorageException(this StorageException e)
+ {
+ if (null != e.RequestInformation &&
+ null != e.RequestInformation.HttpStatusMessage)
+ {
+ String msg = string.Format(
+ "Error Message {0}. HTTP Status Code: {1} - HTTP Error Message: {2}",
+ e.Message,
+ e.RequestInformation.HttpStatusCode,
+ e.RequestInformation.HttpStatusMessage);
+ e = new StorageException(e.RequestInformation, msg, e);
+ }
+
+ return e;
+ }
+ }
+}
View
14 WindowsAzurePowershell/src/Management.Storage/Management.Storage.csproj
@@ -97,8 +97,14 @@
<Compile Include="Common\ResourceNotFoundException.cs" />
<Compile Include="Common\StorageCloudCmdletBase.cs" />
<Compile Include="Blob\StorageCloudBlobCmdletBase.cs" />
+ <Compile Include="Common\StorageExceptionUtil.cs" />
<Compile Include="Common\StorageNouns.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Model\Contract\IStorageBlobManagement.cs" />
+ <Compile Include="Model\Contract\StorageBlobManagement.cs" />
+ <Compile Include="Model\ResourceModel\AzureStorageBase.cs" />
+ <Compile Include="Model\ResourceModel\AzureStorageContainer.cs" />
+ <Compile Include="Model\ResourceModel\AzureStorageContext.cs" />
<Compile Include="Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -110,14 +116,6 @@
<Project>{cd5aa507-f5ef-473d-855b-84b91a1abe54}</Project>
<Name>Management</Name>
</ProjectReference>
- <ProjectReference Include="..\ServiceManagement.Additions\ServiceManagement.Additions.csproj">
- <Project>{da1432af-d6b5-47a1-8b74-ccd740683e0f}</Project>
- <Name>ServiceManagement.Additions</Name>
- </ProjectReference>
- <ProjectReference Include="..\ServiceManagement\ServiceManagement.csproj">
- <Project>{559a16c7-b11c-4aa6-8c16-8adeca6abed7}</Project>
- <Name>ServiceManagement</Name>
- </ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
View
135 WindowsAzurePowershell/src/Management.Storage/Model/Contract/IStorageBlobManagement.cs
@@ -0,0 +1,135 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Model.Contract
+{
+ using Microsoft.WindowsAzure.Storage;
+ using Microsoft.WindowsAzure.Storage.Blob;
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+ /// <summary>
+ /// Blob management interface
+ /// </summary>
+ public interface IStorageBlobManagement
+ {
+ /// <summary>
+ /// Get a list of cloudblobcontainer in azure
+ /// </summary>
+ /// <param name="prefix">Container prefix</param>
+ /// <param name="detailsIncluded">Container listing details</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>An enumerable collection of cloudblobcontainer</returns>
+ IEnumerable<CloudBlobContainer> ListContainers(string prefix, ContainerListingDetails detailsIncluded, BlobRequestOptions options, OperationContext operationContext);
+
+ /// <summary>
+ /// Get container presssions
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>The container's permission</returns>
+ BlobContainerPermissions GetContainerPermissions(CloudBlobContainer container, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext);
+
+ /// <summary>
+ /// Set container permissions
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="permissions">The container's permission</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ void SetContainerPermissions(CloudBlobContainer container, BlobContainerPermissions permissions, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext);
+
+ /// <summary>
+ /// Get an CloudBlobContainer instance in local
+ /// </summary>
+ /// <param name="name">Container name</param>
+ /// <returns>A CloudBlobContainer in local memory</returns>
+ CloudBlobContainer GetContainerReference(String name);
+
+ /// <summary>
+ /// Get blob reference with properties and meta data from server
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="blobName">Blob name</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">Blob request options</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>Return an ICloudBlob if the specific blob exists on azure, otherwise return null</returns>
+ ICloudBlob GetBlobReferenceFromServer(CloudBlobContainer container, string blobName, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext);
+
+ /// <summary>
+ /// Whether the container is exists or not
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>True if the specific container exists, otherwise return false</returns>
+ bool IsContainerExists(CloudBlobContainer container, BlobRequestOptions options, OperationContext operationContext);
+
+ /// <summary>
+ /// Whether the blob is exists or not
+ /// </summary>
+ /// <param name="blob">A icloudblob object</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>True if the specific blob exists, otherwise return false</returns>
+ bool IsBlobExists(ICloudBlob blob, BlobRequestOptions options, OperationContext operationContext);
+
+ /// <summary>
+ /// Create the container if not exists
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>True if the container did not already exist and was created; otherwise false.</returns>
+ bool CreateContainerIfNotExists(CloudBlobContainer container, BlobRequestOptions requestOptions, OperationContext operationContext);
+
+ /// <summary>
+ /// Delete container
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ void DeleteContainer(CloudBlobContainer container, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext);
+
+ /// <summary>
+ /// List all blobs in specified containers
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="prefix">Blob prefix</param>
+ /// <param name="useFlatBlobListing">Use flat blob listing(whether treat "container/" as directory)</param>
+ /// <param name="blobListingDetails">Blob listing details</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>An enumerable collection of icloudblob</returns>
+ IEnumerable<IListBlobItem> ListBlobs(CloudBlobContainer container, string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, BlobRequestOptions options, OperationContext operationContext);
+
+ /// <summary>
+ /// Delete azure blob
+ /// </summary>
+ /// <param name="blob">ICloudblob object</param>
+ /// <param name="deleteSnapshotsOption">Delete snapshots option</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <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);
+ }
+}
View
209 WindowsAzurePowershell/src/Management.Storage/Model/Contract/StorageBlobManagement.cs
@@ -0,0 +1,209 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Model.Contract
+{
+ using Microsoft.WindowsAzure.Management.Storage.Common;
+ using Microsoft.WindowsAzure.Storage;
+ using Microsoft.WindowsAzure.Storage.Blob;
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// Blob management
+ /// </summary>
+ public class StorageBlobManagement : IStorageBlobManagement
+ {
+ /// <summary>
+ /// Azure storage blob client
+ /// </summary>
+ private CloudBlobClient blobClient;
+
+ /// <summary>
+ /// Init blob management
+ /// </summary>
+ /// <param name="client">a cloud blob object</param>
+ public StorageBlobManagement(CloudBlobClient client)
+ {
+ blobClient = client;
+ }
+
+ /// <summary>
+ /// Get a list of cloudblobcontainer in azure
+ /// </summary>
+ /// <param name="prefix">Container prefix</param>
+ /// <param name="detailsIncluded">Container listing details</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>An enumerable collection of cloudblobcontainer</returns>
+ public IEnumerable<CloudBlobContainer> ListContainers(string prefix, ContainerListingDetails detailsIncluded, BlobRequestOptions options, OperationContext operationContext)
+ {
+ return blobClient.ListContainers(prefix, detailsIncluded, options, operationContext);
+ }
+
+ /// <summary>
+ /// Get container presssions
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>The container's permission</returns>
+ public BlobContainerPermissions GetContainerPermissions(CloudBlobContainer container, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ {
+ return container.GetPermissions(accessCondition, options, operationContext);
+ }
+
+ /// <summary>
+ /// Get an CloudBlobContainer instance in local
+ /// </summary>
+ /// <param name="name">Container name</param>
+ /// <returns>A CloudBlobContainer in local memory</returns>
+ public CloudBlobContainer GetContainerReference(string name)
+ {
+ return blobClient.GetContainerReference(name);
+ }
+
+ /// <summary>
+ /// Create the container if not exists
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>True if the container did not already exist and was created; otherwise false.</returns>
+ public bool CreateContainerIfNotExists(CloudBlobContainer container, BlobRequestOptions requestOptions, OperationContext operationContext)
+ {
+ return container.CreateIfNotExists(requestOptions, operationContext);
+ }
+
+ /// <summary>
+ /// Delete container
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ public void DeleteContainer(CloudBlobContainer container, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ {
+ container.Delete(accessCondition, options, operationContext);
+ }
+
+ /// <summary>
+ /// Set container permissions
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="permissions">The container's permission</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ public void SetContainerPermissions(CloudBlobContainer container, BlobContainerPermissions permissions, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ {
+ container.SetPermissions(permissions, accessCondition, options, operationContext);
+ }
+
+ /// <summary>
+ /// Get blob reference with properties and meta data from server
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="blobName">Blob name</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="options">Blob request options</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>Return an ICloudBlob if the specific blob exists on azure, otherwise return null</returns>
+ public ICloudBlob GetBlobReferenceFromServer(CloudBlobContainer container, string blobName, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ {
+ try
+ {
+ ICloudBlob blob = container.GetBlobReferenceFromServer(blobName, accessCondition, options, operationContext);
+ return blob;
+ }
+ catch(StorageException e)
+ {
+ if (e.IsNotFoundException())
+ {
+ return null;
+ }
+ else
+ {
+ throw;
+ }
+ }
+ }
+
+ /// <summary>
+ /// List all blobs in specified containers
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="prefix">Blob prefix</param>
+ /// <param name="useFlatBlobListing">Use flat blob listing(whether treat "container/" as directory)</param>
+ /// <param name="blobListingDetails">Blob listing details</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>An enumerable collection of icloudblob</returns>
+ public IEnumerable<IListBlobItem> ListBlobs(CloudBlobContainer container, string prefix, bool useFlatBlobListing, BlobListingDetails blobListingDetails, BlobRequestOptions options, OperationContext operationContext)
+ {
+ return container.ListBlobs(prefix, useFlatBlobListing, blobListingDetails, options, operationContext);
+ }
+
+ /// <summary>
+ /// Whether the container is exists or not
+ /// </summary>
+ /// <param name="container">A cloudblobcontainer object</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>True if the specific container exists, otherwise return false</returns>
+ public bool IsContainerExists(CloudBlobContainer container, BlobRequestOptions options, OperationContext operationContext)
+ {
+ if (null == container)
+ {
+ return false;
+ }
+ else
+ {
+ return container.Exists(options, operationContext);
+ }
+ }
+
+ /// <summary>
+ /// Whether the blob is exists or not
+ /// </summary>
+ /// <param name="blob">A icloudblob object</param>
+ /// <param name="options">Blob request option</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>True if the specific blob exists, otherwise return false</returns>
+ public bool IsBlobExists(ICloudBlob blob, BlobRequestOptions options, OperationContext operationContext)
+ {
+ if (null == blob)
+ {
+ return false;
+ }
+ else
+ {
+ return blob.Exists(options, operationContext);
+ }
+ }
+
+ /// <summary>
+ /// Delete azure blob
+ /// </summary>
+ /// <param name="blob">ICloudblob object</param>
+ /// <param name="deleteSnapshotsOption">Delete snapshots option</param>
+ /// <param name="accessCondition">Access condition</param>
+ /// <param name="operationContext">Operation context</param>
+ /// <returns>An enumerable collection of icloudblob</returns>
+ public void DeleteICloudBlob(ICloudBlob blob, DeleteSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
+ {
+ blob.Delete(deleteSnapshotsOption, accessCondition, options, operationContext);
+ }
+ }
+}
View
37 WindowsAzurePowershell/src/Management.Storage/Model/ResourceModel/AzureStorageBase.cs
@@ -0,0 +1,37 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Model.ResourceModel
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+ /// <summary>
+ /// Base class for all azure storage object
+ /// </summary>
+ public class AzureStorageBase
+ {
+ /// <summary>
+ /// Storage context
+ /// </summary>
+ public AzureStorageContext Context { get; set; }
+
+ /// <summary>
+ /// Azure storage object name
+ /// </summary>
+ public String Name { get; set; }
+ }
+}
View
62 WindowsAzurePowershell/src/Management.Storage/Model/ResourceModel/AzureStorageContainer.cs
@@ -0,0 +1,62 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Model.ResourceModel
+{
+ using Microsoft.WindowsAzure.Storage.Blob;
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+ /// <summary>
+ /// azure storage container
+ /// </summary>
+ public class AzureStorageContainer : AzureStorageBase
+ {
+ /// <summary>
+ /// CloudBlobContainer object
+ /// </summary>
+ public CloudBlobContainer CloudBlobContainer { get; private set; }
+
+ /// <summary>
+ /// the permission of CloudBlobContainer
+ /// </summary>
+ public BlobContainerPermissions Permissions { get; private set; }
+
+ /// <summary>
+ /// the public accesss level of CloudBlobContainer
+ /// </summary>
+ public BlobContainerPublicAccessType PublicAccess { get; private set; }
+
+ /// <summary>
+ /// last modified of CloudBlobContainer
+ /// </summary>
+ public DateTimeOffset? LastModified { get; private set; }
+
+ /// <summary>
+ /// init azure storage container using CloudBlobContainer and BlobContainerPermissions
+ /// </summary>
+ /// <param name="container">CloudBlobContainer object</param>
+ /// <param name="permissions">permissions of container</param>
+ public AzureStorageContainer(CloudBlobContainer container, BlobContainerPermissions permissions)
+ {
+ CloudBlobContainer = container;
+ Permissions = permissions;
+ Name = container.Name;
+ PublicAccess = permissions.PublicAccess;
+ LastModified = container.Properties.LastModified;
+ }
+ }
+}
View
78 WindowsAzurePowershell/src/Management.Storage/Model/ResourceModel/AzureStorageContext.cs
@@ -0,0 +1,78 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Model.ResourceModel
+{
+ using Microsoft.WindowsAzure.Storage;
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+ /// <summary>
+ /// Storage context
+ /// </summary>
+ public class AzureStorageContext
+ {
+ /// <summary>
+ /// Storage account name used in this context
+ /// </summary>
+ public string StorageAccountName { get; private set; }
+
+ /// <summary>
+ /// Blob end point of the storage context
+ /// </summary>
+ public string BlobEndPoint { get; private set; }
+
+ /// <summary>
+ /// Table end point of the storage context
+ /// </summary>
+ public string TableEndPoint { get; private set; }
+
+ /// <summary>
+ /// Queue end point of the storage context
+ /// </summary>
+ public string QueueEndPoint { get; private set; }
+
+ /// <summary>
+ /// Self reference, it could enable New-AzureStorageContext can be used in pipeline
+ /// </summary>
+ public AzureStorageContext Context { get; private set; }
+
+ /// <summary>
+ /// Name place holder, and force pipeline to ignore this property
+ /// </summary>
+ public string Name { get; private set; }
+
+ /// <summary>
+ /// Storage account in context
+ /// </summary>
+ public CloudStorageAccount StorageAccount { get; private set; }
+
+ /// <summary>
+ /// Create a storage context usign cloud storage account
+ /// </summary>
+ /// <param name="account">cloud storage account</param>
+ public AzureStorageContext(CloudStorageAccount account)
+ {
+ StorageAccount = account;
+ BlobEndPoint = account.BlobEndpoint.ToString();
+ TableEndPoint = account.TableEndpoint.ToString();
+ QueueEndPoint = account.QueueEndpoint.ToString();
+ StorageAccountName = account.Credentials.AccountName;
+ Context = this;
+ Name = String.Empty;
+ }
+ }
+}
View
1  WindowsAzurePowershell/src/Management/Model/SubscriptionData.cs
@@ -55,7 +55,6 @@ public CloudStorageAccount GetCurrentStorageAccount()
return GetCurrentStorageAccount(channel);
}
-
public CloudStorageAccount GetCurrentStorageAccount(IServiceManagement channel)
{
if (String.IsNullOrEmpty(CurrentStorageAccount))
View
30 WindowsAzurePowershell/src/WindowsAzurePowershell.sln
@@ -59,8 +59,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Management.Store", "Managem
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Management.Store.Test", "Management.Store.Test\Management.Store.Test.csproj", "{3958B2D7-74CF-44D5-99BA-CF280782F380}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceManagement", "ServiceManagement\ServiceManagement.csproj", "{559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -646,34 +644,6 @@ Global
{3958B2D7-74CF-44D5-99BA-CF280782F380}.ReleaseSigned|x64.ActiveCfg = ReleaseSigned|x64
{3958B2D7-74CF-44D5-99BA-CF280782F380}.ReleaseSigned|x64.Build.0 = ReleaseSigned|x64
{3958B2D7-74CF-44D5-99BA-CF280782F380}.ReleaseSigned|x86.ActiveCfg = ReleaseSigned|x64
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Debug|x64.ActiveCfg = Debug|x64
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Debug|x64.Build.0 = Debug|x64
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Debug|x86.ActiveCfg = Debug|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.DebugVS|Any CPU.ActiveCfg = Debug|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.DebugVS|Any CPU.Build.0 = Debug|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.DebugVS|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.DebugVS|Mixed Platforms.Build.0 = Debug|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.DebugVS|x64.ActiveCfg = Debug|x64
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.DebugVS|x64.Build.0 = Debug|x64
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.DebugVS|x86.ActiveCfg = Debug|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Release|Any CPU.Build.0 = Release|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Release|x64.ActiveCfg = Release|x64
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Release|x64.Build.0 = Release|x64
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.Release|x86.ActiveCfg = Release|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.ReleaseSigned|Any CPU.ActiveCfg = ReleaseSigned|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.ReleaseSigned|Any CPU.Build.0 = ReleaseSigned|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.ReleaseSigned|Mixed Platforms.ActiveCfg = ReleaseSigned|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.ReleaseSigned|Mixed Platforms.Build.0 = ReleaseSigned|Any CPU
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.ReleaseSigned|x64.ActiveCfg = ReleaseSigned|x64
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.ReleaseSigned|x64.Build.0 = ReleaseSigned|x64
- {559A16C7-B11C-4AA6-8C16-8ADECA6ABED7}.ReleaseSigned|x86.ActiveCfg = ReleaseSigned|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Please sign in to comment.
Something went wrong with that request. Please try again.