-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate rest of the cmdletd under StorageAccount to Track2 SDK #20
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,13 +12,17 @@ | |
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Track2 = Azure.ResourceManager.Storage; | ||
using Track2Models = Azure.ResourceManager.Storage.Models; | ||
|
||
using Microsoft.Azure.Commands.Management.Storage.Models; | ||
using Microsoft.Azure.Management.Storage; | ||
using Microsoft.Azure.Management.Storage.Models; | ||
using Microsoft.Rest.Azure; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
using Azure; | ||
|
||
namespace Microsoft.Azure.Commands.Management.Storage | ||
{ | ||
|
@@ -92,24 +96,46 @@ public override void ExecuteCmdlet() | |
{ | ||
WriteWarning("Can't get single deleted container, so -IncludeDeleted will be omit when get single container with -Name."); | ||
} | ||
var container = this.StorageClient.BlobContainers.Get( | ||
this.ResourceGroupName, | ||
this.StorageAccountName, | ||
this.Name); | ||
WriteObject(new PSContainer(container)); | ||
|
||
Track2.BlobContainerResource blobContainerResource = this.StorageClientTrack2 | ||
.GetBlobContainerResource(this.ResourceGroupName, this.StorageAccountName, this.Name).Get().Value; | ||
|
||
//var container = this.StorageClient.BlobContainers.Get( | ||
// this.ResourceGroupName, | ||
// this.StorageAccountName, | ||
// this.Name); | ||
//WriteObject(new PSContainer(container)); | ||
WriteObject(new PSContainer(blobContainerResource)); | ||
} | ||
else | ||
{ | ||
IPage<ListContainerItem> containerlistResult = this.StorageClient.BlobContainers.List( | ||
this.ResourceGroupName, | ||
this.StorageAccountName, | ||
include: IncludeDeleted.IsPresent ? ListContainersInclude.Deleted : null); | ||
WriteContainerList(containerlistResult); | ||
while (containerlistResult.NextPageLink != null) | ||
|
||
Pageable<Track2.BlobContainerResource> containerList = this.StorageClientTrack2.GetBlobServiceResource(this.ResourceGroupName, this.StorageAccountName) | ||
.GetBlobContainers() | ||
.GetAll(include: IncludeDeleted.IsPresent ? ListContainersInclude.Deleted : null); | ||
|
||
if (containerList != null) | ||
{ | ||
containerlistResult = this.StorageClient.BlobContainers.ListNext(containerlistResult.NextPageLink); | ||
WriteContainerList(containerlistResult); | ||
List<PSContainer> output = new List<PSContainer>(); | ||
foreach (Track2.BlobContainerResource container in containerList) | ||
{ | ||
output.Add(new PSContainer(container)); | ||
} | ||
WriteObject(output, true); | ||
} | ||
|
||
|
||
|
||
//IPage<ListContainerItem> containerlistResult = this.StorageClient.BlobContainers.List( | ||
// this.ResourceGroupName, | ||
// this.StorageAccountName, | ||
// include: IncludeDeleted.IsPresent ? ListContainersInclude.Deleted : null); | ||
//WriteContainerList(containerlistResult); | ||
//while (containerlistResult.NextPageLink != null) | ||
//{ | ||
// containerlistResult = this.StorageClient.BlobContainers.ListNext(containerlistResult.NextPageLink); | ||
// WriteContainerList(containerlistResult); | ||
//} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the commented part |
||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ | |
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
using Azure.ResourceManager.Storage; | ||
using Azure.ResourceManager.Storage.Models; | ||
|
||
namespace Microsoft.Azure.Commands.Management.Storage | ||
{ | ||
|
@@ -111,12 +113,22 @@ public override void ExecuteCmdlet() | |
break; | ||
} | ||
|
||
ImmutabilityPolicy policy= | ||
this.StorageClient.BlobContainers.GetImmutabilityPolicy( | ||
this.ResourceGroupName, | ||
this.StorageAccountName, | ||
this.ContainerName, | ||
Etag); | ||
//ImmutabilityPolicy policy= | ||
//this.StorageClient.BlobContainers.GetImmutabilityPolicy( | ||
// this.ResourceGroupName, | ||
// this.StorageAccountName, | ||
// this.ContainerName, | ||
// Etag); | ||
|
||
//ImmutabilityPolicyResource policy = this.StorageClientTrack2.GetImmutabilityPolicy( | ||
// this.ResourceGroupName, | ||
// this.StorageAccountName, | ||
// this.ContainerName, | ||
// this.Etag); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the commented part |
||
|
||
ImmutabilityPolicyResource policy = this.StorageClientTrack2.GetImmutabilityPolicyResource( | ||
this.ResourceGroupName, this.StorageAccountName, this.ContainerName).Get(new global::Azure.ETag(this.Etag)).Value; | ||
|
||
|
||
WriteObject(new PSImmutabilityPolicy(policy)); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,14 +112,20 @@ public override void ExecuteCmdlet() | |
default: | ||
break; | ||
} | ||
this.StorageClient.BlobContainers.ObjectLevelWorm( | ||
this.ResourceGroupName, | ||
this.StorageAccountName, | ||
this.Name); | ||
var container = this.StorageClient.BlobContainers.Get( | ||
this.ResourceGroupName, | ||
this.StorageAccountName, | ||
this.Name); | ||
//this.StorageClient.BlobContainers.ObjectLevelWorm( | ||
// this.ResourceGroupName, | ||
// this.StorageAccountName, | ||
// this.Name); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the commented part |
||
|
||
this.StorageClientTrack2.GetBlobContainerResource(this.ResourceGroupName, this.StorageAccountName, this.Name) | ||
.EnableObjectLevelWorm(global::Azure.WaitUntil.Completed); | ||
|
||
var container = this.StorageClientTrack2.GetBlobContainerResource(this.ResourceGroupName, this.StorageAccountName, this.Name).Get(); | ||
|
||
//var container = this.StorageClient.BlobContainers.Get( | ||
// this.ResourceGroupName, | ||
// this.StorageAccountName, | ||
// this.Name); | ||
WriteObject(new PSContainer(container)); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the commented part