Skip to content

Commit 9fbfcd4

Browse files
committed
Merge branch 'dev' of github.com:Azure/azure-powershell into parameterAndBugFixes
2 parents 05be958 + b994e6b commit 9fbfcd4

File tree

82 files changed

+8089
-291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+8089
-291
lines changed

src/Common/Storage/Azure.Storage.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ VariablesToExport = '*'
7979

8080
# Aliases to export from this module
8181
AliasesToExport = @(
82-
'Get-AzureRMStorageContainerAcl',
82+
'Get-AzureStorageContainerAcl',
8383
'Start-CopyAzureStorageBlob',
8484
'Stop-CopyAzureStorageBlob'
8585
)

src/Common/Storage/Commands.Storage/Common/StorageNouns.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ public static class StorageNouns
2222
/// <summary>
2323
/// Blob cmdlet name
2424
/// </summary>
25-
public const string Blob = "AzureRMStorageBlob";
25+
public const string Blob = "AzureStorageBlob";
2626

2727
/// <summary>
2828
/// Blobcontent cmdlet name
2929
/// </summary>
30-
public const string BlobContent = "AzureRMStorageBlobContent";
30+
public const string BlobContent = "AzureStorageBlobContent";
3131

3232
/// <summary>
3333
/// blob snapshot cmdlet name
3434
/// </summary>
35-
public const string BlobSnapshot = "AzureRMStorageBlobSnapshot";
35+
public const string BlobSnapshot = "AzureStorageBlobSnapshot";
3636

3737
/// <summary>
3838
/// Container cmdlet name
3939
/// </summary>
40-
public const string Container = "AzureRMStorageContainer";
40+
public const string Container = "AzureStorageContainer";
4141

4242
/// <summary>
4343
/// Container acl cmdlet name
4444
/// </summary>
45-
public const string ContainerAcl = "AzureRMStorageContainerAcl";
45+
public const string ContainerAcl = "AzureStorageContainerAcl";
4646

4747
/// <summary>
4848
/// Http protocol
@@ -57,12 +57,12 @@ public static class StorageNouns
5757
/// <summary>
5858
/// Queue cmdlet name
5959
/// </summary>
60-
public const string Queue = "AzureRMStorageQueue";
60+
public const string Queue = "AzureStorageQueue";
6161

6262
/// <summary>
6363
/// Storage context cmdlet name
6464
/// </summary>
65-
public const string StorageContext = "AzureRMStorageContext";
65+
public const string StorageContext = "AzureStorageContext";
6666

6767
/// <summary>
6868
/// Storage account name
@@ -72,12 +72,12 @@ public static class StorageNouns
7272
/// <summary>
7373
/// Table cmdlet name
7474
/// </summary>
75-
public const string Table = "AzureRMStorageTable";
75+
public const string Table = "AzureStorageTable";
7676

7777
/// <summary>
7878
/// Copy azure storage blob
7979
/// </summary>
80-
public const string CopyBlob = "AzureRMStorageBlobCopy";
80+
public const string CopyBlob = "AzureStorageBlobCopy";
8181

8282
/// <summary>
8383
/// Copy azure storage blob deprecated name
@@ -87,78 +87,78 @@ public static class StorageNouns
8787
/// <summary>
8888
/// Copy status for azure storage blob
8989
/// </summary>
90-
public const string CopyBlobStatus = "AzureRMStorageBlobCopyState";
90+
public const string CopyBlobStatus = "AzureStorageBlobCopyState";
9191

9292
/// <summary>
9393
/// Azure storage service hour metrics
9494
/// </summary>
95-
public const string StorageServiceMetrics = "AzureRMStorageServiceMetricsProperty";
95+
public const string StorageServiceMetrics = "AzureStorageServiceMetricsProperty";
9696

9797
/// <summary>
9898
/// Azure storage service logging
9999
/// </summary>
100-
public const string StorageServiceLogging = "AzureRMStorageServiceLoggingProperty";
100+
public const string StorageServiceLogging = "AzureStorageServiceLoggingProperty";
101101

102102
/// <summary>
103103
/// Azure storage CORS rule
104104
/// </summary>
105-
public const string StorageCORSRule = "AzureRMStorageCORSRule";
105+
public const string StorageCORSRule = "AzureStorageCORSRule";
106106

107107
/// <summary>
108108
/// Azure storage container sas
109109
/// </summary>
110-
public const string ContainerSas = "AzureRMStorageContainerSASToken";
110+
public const string ContainerSas = "AzureStorageContainerSASToken";
111111

112112
/// <summary>
113113
/// Azure storage blob sas
114114
/// </summary>
115-
public const string BlobSas = "AzureRMStorageBlobSASToken";
115+
public const string BlobSas = "AzureStorageBlobSASToken";
116116

117117
/// <summary>
118118
/// Azure storage file share sas
119119
/// </summary>
120-
public const string ShareSas = "AzureRMStorageShareSASToken";
120+
public const string ShareSas = "AzureStorageShareSASToken";
121121

122122
/// <summary>
123123
/// Azure storage file sas
124124
/// </summary>
125-
public const string FileSas = "AzureRMStorageFileSASToken";
125+
public const string FileSas = "AzureStorageFileSASToken";
126126

127127
/// <summary>
128128
/// Azure storage table sas
129129
/// </summary>
130-
public const string TableSas = "AzureRMStorageTableSASToken";
130+
public const string TableSas = "AzureStorageTableSASToken";
131131

132132
/// <summary>
133133
/// Azure storage queue sas
134134
/// </summary>
135-
public const string QueueSas = "AzureRMStorageQueueSASToken";
135+
public const string QueueSas = "AzureStorageQueueSASToken";
136136

137137
/// <summary>
138138
/// Azure storage table stored access policy
139139
/// </summary>
140-
public const string TableStoredAccessPolicy = "AzureRMStorageTableStoredAccessPolicy";
140+
public const string TableStoredAccessPolicy = "AzureStorageTableStoredAccessPolicy";
141141

142142
/// <summary>
143143
/// Azure storage share stored access policy
144144
/// </summary>
145-
public const string ShareStoredAccessPolicy = "AzureRMStorageShareStoredAccessPolicy";
145+
public const string ShareStoredAccessPolicy = "AzureStorageShareStoredAccessPolicy";
146146

147147
/// <summary>
148148
/// Azure storage container stored access policy
149149
/// </summary>
150-
public const string ContainerStoredAccessPolicy = "AzureRMStorageContainerStoredAccessPolicy";
150+
public const string ContainerStoredAccessPolicy = "AzureStorageContainerStoredAccessPolicy";
151151

152152

153153
/// <summary>
154154
/// Azure storage container stored access policy
155155
/// </summary>
156-
public const string QueueStoredAccessPolicy = "AzureRMStorageQueueStoredAccessPolicy";
156+
public const string QueueStoredAccessPolicy = "AzureStorageQueueStoredAccessPolicy";
157157

158158
/// <summary>
159159
/// Azure storage share quota
160160
/// </summary>
161-
public const string ShareQuota = "AzureRMStorageShareQuota";
161+
public const string ShareQuota = "AzureStorageShareQuota";
162162

163163
/// <summary>
164164
/// Default service metrics version

src/Common/Storage/Commands.Storage/File/Constants.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,37 +34,37 @@ internal static class Constants
3434
/// <summary>
3535
/// Cmdlet name for storage context.
3636
/// </summary>
37-
public const string StorageContextCmdletName = "AzureRMStorageContext";
37+
public const string StorageContextCmdletName = "AzureStorageContext";
3838

3939
/// <summary>
4040
/// Cmdlet name for file share.
4141
/// </summary>
42-
public const string ShareCmdletName = "AzureRMStorageShare";
42+
public const string ShareCmdletName = "AzureStorageShare";
4343

4444
/// <summary>
4545
/// Cmdlet name for file directory.
4646
/// </summary>
47-
public const string FileDirectoryCmdletName = "AzureRMStorageDirectory";
47+
public const string FileDirectoryCmdletName = "AzureStorageDirectory";
4848

4949
/// <summary>
5050
/// Cmdlet name for file.
5151
/// </summary>
52-
public const string FileCmdletName = "AzureRMStorageFile";
52+
public const string FileCmdletName = "AzureStorageFile";
5353

5454
/// <summary>
5555
/// Cmdlet name for file content.
5656
/// </summary>
57-
public const string FileContentCmdletName = "AzureRMStorageFileContent";
57+
public const string FileContentCmdletName = "AzureStorageFileContent";
5858

5959
/// <summary>
6060
/// Cmdlet name for file copy.
6161
/// </summary>
62-
public const string FileCopyCmdletName = "AzureRMStorageFileCopy";
62+
public const string FileCopyCmdletName = "AzureStorageFileCopy";
6363

6464
/// <summary>
6565
/// Cmdlet name for file copy state.
6666
/// </summary>
67-
public const string FileCopyCmdletStateName = "AzureRMStorageFileCopyState";
67+
public const string FileCopyCmdletStateName = "AzureStorageFileCopyState";
6868

6969
/// <summary>
7070
/// Stores the default endpoint suffix for storage accounts.

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/ScenarioTests/ApiManagementTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function Test-BackupRestoreApiManagement
129129
New-AzureRmStorageAccount -StorageAccountName $storageAccountName -Location $storageLocation -ResourceGroupName $resourceGroupName -Type Standard_LRS
130130

131131
$storageKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $resourceGroupName -StorageAccountName $storageAccountName).Key1
132-
$storageContext = New-AzureRmStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageKey
132+
$storageContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageKey
133133

134134
$apiManagementName = Get-ApiManagementServiceName
135135
$organization = "apimpowershellorg"

src/ResourceManager/AzureBatch/Commands.Batch.Test/BatchTestHelpers.cs

Lines changed: 111 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,16 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System.IO;
1615
using System.Linq;
1716
using System.Net;
18-
using System.Net.Http;
1917
using System.Threading.Tasks;
2018
using Microsoft.Azure.Batch;
21-
using Microsoft.Azure.Batch.Common;
2219
using Microsoft.Azure.Batch.Protocol;
23-
using Microsoft.Azure.Commands.Batch.Models;
24-
using Microsoft.Azure.Commands.Batch.Test.ScenarioTests;
25-
using Microsoft.Azure.Management.Batch;
2620
using Microsoft.Azure.Management.Batch.Models;
2721
using System;
2822
using System.Collections;
2923
using System.Collections.Generic;
3024
using System.Reflection;
31-
using Microsoft.Azure.Management.Resources;
32-
using Microsoft.Azure.Management.Resources.Models;
33-
using Microsoft.Azure.Test.HttpRecorder;
34-
using Microsoft.WindowsAzure.Storage.Shared.Protocol;
3525
using Xunit;
3626
using ProxyModels = Microsoft.Azure.Batch.Protocol.Models;
3727

@@ -114,16 +104,22 @@ public static void AssertBatchAccountContextsAreEqual(BatchAccountContext contex
114104
/// Creates a RequestInterceptor that does not contact the Batch Service but instead uses the supplied response body.
115105
/// </summary>
116106
/// <param name="responseToUse">The response the interceptor should return. If none is specified, then a new instance of the response type is instantiated.</param>
107+
/// <param name="requestAction">An action to perform on the request.</param>
117108
/// <typeparam name="TParameters">The type of the request parameters.</typeparam>
118109
/// <typeparam name="TResponse">The type of the expected response.</typeparam>
119-
public static RequestInterceptor CreateNoOpInterceptor<TParameters, TResponse>(TResponse responseToUse = null)
110+
public static RequestInterceptor CreateFakeServiceResponseInterceptor<TParameters, TResponse>(TResponse responseToUse = null,
111+
Action<BatchRequest<TParameters, TResponse>> requestAction = null)
120112
where TParameters : ProxyModels.BatchParameters
121113
where TResponse : ProxyModels.BatchOperationResponse, new()
122114
{
123115
RequestInterceptor interceptor = new RequestInterceptor((baseRequest) =>
124116
{
125-
BatchRequest<TParameters, TResponse> request =
126-
(BatchRequest<TParameters, TResponse>)baseRequest;
117+
BatchRequest<TParameters, TResponse> request = (BatchRequest<TParameters, TResponse>)baseRequest;
118+
119+
if (requestAction != null)
120+
{
121+
requestAction(request);
122+
}
127123

128124
request.ServiceRequestFunc = (cancellationToken) =>
129125
{
@@ -140,12 +136,12 @@ public static RequestInterceptor CreateNoOpInterceptor<TParameters, TResponse>(T
140136
/// The interceptor must handle both request types since it's possible for one OM node file method to perform both REST APIs.
141137
/// </summary>
142138
/// <param name="fileName">The name of the file to put in the response body.</param>
143-
public static RequestInterceptor CreateNoOpGetFileAndPropertiesInterceptor(string fileName)
139+
public static RequestInterceptor CreateFakGetFileAndPropertiesResponseInterceptor(string fileName)
144140
{
145141
RequestInterceptor interceptor = new RequestInterceptor((baseRequest) =>
146142
{
147143
BatchRequest<ProxyModels.NodeFileGetParameters, ProxyModels.NodeFileGetResponse> fileRequest = baseRequest as
148-
BatchRequest<ProxyModels.NodeFileGetParameters, ProxyModels.NodeFileGetResponse>;
144+
BatchRequest<ProxyModels.NodeFileGetParameters, ProxyModels.NodeFileGetResponse>;
149145

150146
if (fileRequest != null)
151147
{
@@ -401,6 +397,106 @@ public static ProxyModels.NodeFileListResponse CreateNodeFileListResponse(IEnume
401397
return response;
402398
}
403399

400+
/// <summary>
401+
/// Fabricates a CloudJob that's in the bound state
402+
/// </summary>
403+
public static CloudJob CreateFakeBoundJob(BatchAccountContext context)
404+
{
405+
string jobId = "testJob";
406+
407+
RequestInterceptor interceptor = new RequestInterceptor((baseRequest) =>
408+
{
409+
BatchRequest<ProxyModels.CloudJobGetParameters, ProxyModels.CloudJobGetResponse> request =
410+
(BatchRequest<ProxyModels.CloudJobGetParameters, ProxyModels.CloudJobGetResponse>)baseRequest;
411+
412+
request.ServiceRequestFunc = (cancellationToken) =>
413+
{
414+
ProxyModels.CloudJobGetResponse response = new ProxyModels.CloudJobGetResponse();
415+
response.Job = new ProxyModels.CloudJob(jobId, new ProxyModels.PoolInformation());
416+
417+
Task<ProxyModels.CloudJobGetResponse> task = Task.FromResult(response);
418+
return task;
419+
};
420+
});
421+
422+
return context.BatchOMClient.JobOperations.GetJob(jobId, additionalBehaviors: new BatchClientBehavior[] { interceptor });
423+
}
424+
425+
/// <summary>
426+
/// Fabricates a CloudJobSchedule that's in the bound state
427+
/// </summary>
428+
public static CloudJobSchedule CreateFakeBoundJobSchedule(BatchAccountContext context)
429+
{
430+
string jobScheduleId = "testJobSchedule";
431+
432+
RequestInterceptor interceptor = new RequestInterceptor((baseRequest) =>
433+
{
434+
BatchRequest<ProxyModels.CloudJobScheduleGetParameters, ProxyModels.CloudJobScheduleGetResponse> request =
435+
(BatchRequest<ProxyModels.CloudJobScheduleGetParameters, ProxyModels.CloudJobScheduleGetResponse>)baseRequest;
436+
437+
request.ServiceRequestFunc = (cancellationToken) =>
438+
{
439+
ProxyModels.CloudJobScheduleGetResponse response = new ProxyModels.CloudJobScheduleGetResponse();
440+
response.JobSchedule = new ProxyModels.CloudJobSchedule(jobScheduleId, new ProxyModels.Schedule(), new ProxyModels.JobSpecification());
441+
442+
Task<ProxyModels.CloudJobScheduleGetResponse> task = Task.FromResult(response);
443+
return task;
444+
};
445+
});
446+
447+
return context.BatchOMClient.JobScheduleOperations.GetJobSchedule(jobScheduleId, additionalBehaviors: new BatchClientBehavior[] { interceptor });
448+
}
449+
450+
/// <summary>
451+
/// Fabricates a CloudPool that's in the bound state
452+
/// </summary>
453+
public static CloudPool CreateFakeBoundPool(BatchAccountContext context)
454+
{
455+
string poolId = "testPool";
456+
457+
RequestInterceptor interceptor = new RequestInterceptor((baseRequest) =>
458+
{
459+
BatchRequest<ProxyModels.CloudPoolGetParameters, ProxyModels.CloudPoolGetResponse> request =
460+
(BatchRequest<ProxyModels.CloudPoolGetParameters, ProxyModels.CloudPoolGetResponse>)baseRequest;
461+
462+
request.ServiceRequestFunc = (cancellationToken) =>
463+
{
464+
ProxyModels.CloudPoolGetResponse response = new ProxyModels.CloudPoolGetResponse();
465+
response.Pool = new ProxyModels.CloudPool(poolId, "small", "4");
466+
467+
Task<ProxyModels.CloudPoolGetResponse> task = Task.FromResult(response);
468+
return task;
469+
};
470+
});
471+
472+
return context.BatchOMClient.PoolOperations.GetPool(poolId, additionalBehaviors: new BatchClientBehavior[] { interceptor });
473+
}
474+
475+
/// <summary>
476+
/// Fabricates a CloudTask that's in the bound state
477+
/// </summary>
478+
public static CloudTask CreateFakeBoundTask(BatchAccountContext context)
479+
{
480+
string taskId = "testTask";
481+
482+
RequestInterceptor interceptor = new RequestInterceptor((baseRequest) =>
483+
{
484+
BatchRequest<ProxyModels.CloudTaskGetParameters, ProxyModels.CloudTaskGetResponse> request =
485+
(BatchRequest<ProxyModels.CloudTaskGetParameters, ProxyModels.CloudTaskGetResponse>)baseRequest;
486+
487+
request.ServiceRequestFunc = (cancellationToken) =>
488+
{
489+
ProxyModels.CloudTaskGetResponse response = new ProxyModels.CloudTaskGetResponse();
490+
response.Task = new ProxyModels.CloudTask(taskId, "cmd /c dir /s");
491+
492+
Task<ProxyModels.CloudTaskGetResponse> task = Task.FromResult(response);
493+
return task;
494+
};
495+
});
496+
497+
return context.BatchOMClient.JobOperations.GetTask("jobId", taskId, additionalBehaviors: new BatchClientBehavior[] { interceptor });
498+
}
499+
404500
/// <summary>
405501
/// Uses Reflection to set a property value on an object. Can be used to bypass restricted set accessors.
406502
/// </summary>

0 commit comments

Comments
 (0)