diff --git a/ChangeLog.txt b/ChangeLog.txt
index 26909e9e6e9b..4a1635684bc6 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,14 @@
+2015.08.07 version 0.9.6
+* Azure Batch cmdlets
+ * Cmdlets updated to use the general availability API. See http://blogs.technet.com/b/windowshpc/archive/2015/07/10/what-39-s-new-in-azure-batch-july-release-general-availability.aspx
+ * Breaking changes to cmdlets resulting from API update:
+ * Workitems have been removed.
+ * If you were adding all tasks to a single job, use the New-AzureBatchJob cmdlet to directly create your job.
+ * If you were managing workitems with a recurring schedule defined, use the AzureBatchJobSchedule cmdlets instead.
+ * If you were using the AzureBatchVM cmdlets, use the AzureBatchComputeNode cmdlets instead.
+ * The AzureBatchTaskFile and AzureBatchVMFile cmdlets have been consolidated into the AzureBatchNodeFile cmdlets.
+ * The Name property on most entities has been replaced by an Id property.
+
2015.07.17 version 0.9.5
* Azure SQL cmdlets
* Allowing to use of Storage V2 accounts in Auditing policies
diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi
index 52ed86acd314..a8a2cfbf001c 100644
--- a/setup/azurecmdfiles.wxi
+++ b/setup/azurecmdfiles.wxi
@@ -733,6 +733,15 @@
+
+
+
+
+
+
+
+
+
@@ -820,6 +829,9 @@
+
+
+
@@ -1062,6 +1074,15 @@
+
+
+
+
+
+
+
+
+
@@ -1219,6 +1240,15 @@
+
+
+
+
+
+
+
+
+
@@ -1240,6 +1270,9 @@
+
+
+
@@ -1362,6 +1395,9 @@
+
+
+
@@ -1860,6 +1896,15 @@
+
+
+
+
+
+
+
+
+
@@ -1875,6 +1920,9 @@
+
+
+
@@ -1890,6 +1938,9 @@
+
+
+
@@ -2210,6 +2261,15 @@
+
+
+
+
+
+
+
+
+
@@ -2255,6 +2315,9 @@
+
+
+
@@ -4824,6 +4887,9 @@
+
+
+
@@ -4853,6 +4919,7 @@
+
@@ -4923,6 +4990,9 @@
+
+
+
@@ -4974,6 +5044,9 @@
+
+
+
@@ -4981,6 +5054,7 @@
+
@@ -5021,6 +5095,7 @@
+
@@ -5183,16 +5258,21 @@
+
+
+
+
+
@@ -5297,6 +5377,9 @@
+
+
+
@@ -5312,6 +5395,7 @@
+
diff --git a/src/Common/Commands.Common/Commands.Common.csproj b/src/Common/Commands.Common/Commands.Common.csproj
index 10af73bb0fbb..3327be6458bd 100644
--- a/src/Common/Commands.Common/Commands.Common.csproj
+++ b/src/Common/Commands.Common/Commands.Common.csproj
@@ -171,6 +171,7 @@
+
diff --git a/src/Common/Commands.Common/DiagnosticsHelper.cs b/src/Common/Commands.Common/DiagnosticsHelper.cs
new file mode 100644
index 000000000000..3b5a5007969c
--- /dev/null
+++ b/src/Common/Commands.Common/DiagnosticsHelper.cs
@@ -0,0 +1,127 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using Microsoft.WindowsAzure.Commands.Common.Properties;
+using System;
+using System.Collections;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using Newtonsoft.Json;
+
+namespace Microsoft.WindowsAzure.Commands.Utilities.Common
+{
+ public static class DiagnosticsHelper
+ {
+ private static string XmlNamespace = "http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration";
+ private static string EncodedXmlCfg = "xmlCfg";
+ private static string StorageAccount = "storageAccount";
+ private static string Path = "path";
+ private static string ExpandResourceDirectory = "expandResourceDirectory";
+ private static string LocalResourceDirectory = "localResourceDirectory";
+ private static string StorageAccountNameTag = "storageAccountName";
+ private static string StorageAccountKeyTag = "storageAccountKey";
+ private static string StorageAccountEndPointTag = "storageAccountEndPoint";
+
+ public static string GetJsonSerializedPublicDiagnosticsConfigurationFromFile(string configurationPath,
+ string storageAccountName)
+ {
+ return
+ JsonConvert.SerializeObject(
+ DiagnosticsHelper.GetPublicDiagnosticsConfigurationFromFile(configurationPath, storageAccountName));
+ }
+
+ public static Hashtable GetPublicDiagnosticsConfigurationFromFile(string configurationPath, string storageAccountName)
+ {
+ using (StreamReader reader = new StreamReader(configurationPath))
+ {
+ return GetPublicDiagnosticsConfiguration(reader.ReadToEnd(), storageAccountName);
+ }
+ }
+
+ public static Hashtable GetPublicDiagnosticsConfiguration(string config, string storageAccountName)
+ {
+ // find the element and extract it
+ int wadCfgBeginIndex = config.IndexOf("");
+ if (wadCfgBeginIndex == -1)
+ {
+ throw new ArgumentException(Resources.IaasDiagnosticsBadConfigNoWadCfg);
+ }
+
+ int wadCfgEndIndex = config.IndexOf("");
+ if (wadCfgEndIndex == -1)
+ {
+ throw new ArgumentException(Resources.IaasDiagnosticsBadConfigNoEndWadCfg);
+ }
+
+ if (wadCfgEndIndex <= wadCfgBeginIndex)
+ {
+ throw new ArgumentException(Resources.IaasDiagnosticsBadConfigNoMatchingWadCfg);
+ }
+
+ string encodedConfiguration = Convert.ToBase64String(
+ Encoding.UTF8.GetBytes(
+ config.Substring(
+ wadCfgBeginIndex, wadCfgEndIndex + "".Length - wadCfgBeginIndex).ToCharArray()));
+
+ // Now extract the local resource directory element
+ XmlDocument doc = new XmlDocument();
+ XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);
+ ns.AddNamespace("ns", XmlNamespace);
+ doc.LoadXml(config);
+ var node = doc.SelectSingleNode("//ns:LocalResourceDirectory", ns);
+ string localDirectory = (node != null && node.Attributes != null) ? node.Attributes[Path].Value : null;
+ string localDirectoryExpand = (node != null && node.Attributes != null)
+ ? node.Attributes["expandEnvironment"].Value
+ : null;
+ if (localDirectoryExpand == "0")
+ {
+ localDirectoryExpand = "false";
+ }
+ if (localDirectoryExpand == "1")
+ {
+ localDirectoryExpand = "true";
+ }
+
+ var hashTable = new Hashtable();
+ hashTable.Add(EncodedXmlCfg, encodedConfiguration);
+ hashTable.Add(StorageAccount, storageAccountName);
+ if (!string.IsNullOrEmpty(localDirectory))
+ {
+ var localDirectoryHashTable = new Hashtable();
+ localDirectoryHashTable.Add(Path, localDirectory);
+ localDirectoryHashTable.Add(ExpandResourceDirectory, localDirectoryExpand);
+ hashTable.Add(LocalResourceDirectory, localDirectoryHashTable);
+ }
+
+ return hashTable;
+ }
+
+ public static string GetJsonSerializedPrivateDiagnosticsConfiguration(string storageAccountName,
+ string storageKey, string endpoint)
+ {
+ return JsonConvert.SerializeObject(GetPrivateDiagnosticsConfiguration( storageAccountName, storageKey, endpoint));
+ }
+
+ public static Hashtable GetPrivateDiagnosticsConfiguration(string storageAccountName, string storageKey, string endpoint)
+ {
+ var hashTable = new Hashtable();
+ hashTable.Add(StorageAccountNameTag, storageAccountName);
+ hashTable.Add(StorageAccountKeyTag, storageKey);
+ hashTable.Add(StorageAccountEndPointTag, endpoint);
+ return hashTable;
+ }
+ }
+}
diff --git a/src/Common/Commands.Common/Properties/Resources.Designer.cs b/src/Common/Commands.Common/Properties/Resources.Designer.cs
index 1b2caf4f5f8e..a10815c4434d 100644
--- a/src/Common/Commands.Common/Properties/Resources.Designer.cs
+++ b/src/Common/Commands.Common/Properties/Resources.Designer.cs
@@ -978,6 +978,33 @@ public static string GlobalSettingsManager_Load_PublishSettingsNotFound {
}
}
+ ///
+ /// Looks up a localized string similar to Cannot find the WadCfg end element in the config..
+ ///
+ public static string IaasDiagnosticsBadConfigNoEndWadCfg {
+ get {
+ return ResourceManager.GetString("IaasDiagnosticsBadConfigNoEndWadCfg", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to WadCfg start element in the config is not matching the end element..
+ ///
+ public static string IaasDiagnosticsBadConfigNoMatchingWadCfg {
+ get {
+ return ResourceManager.GetString("IaasDiagnosticsBadConfigNoMatchingWadCfg", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Cannot find the WadCfg element in the config..
+ ///
+ public static string IaasDiagnosticsBadConfigNoWadCfg {
+ get {
+ return ResourceManager.GetString("IaasDiagnosticsBadConfigNoWadCfg", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to iisnode.dll.
///
diff --git a/src/Common/Commands.Common/Properties/Resources.resx b/src/Common/Commands.Common/Properties/Resources.resx
index 7616e8b49007..c3e3784a3713 100644
--- a/src/Common/Commands.Common/Properties/Resources.resx
+++ b/src/Common/Commands.Common/Properties/Resources.resx
@@ -1443,4 +1443,13 @@ The file needs to be a PowerShell script (.ps1 or .psm1).
Cannot delete '{0}': {1}
{0} is the path of a file, {1} is an error message
+
+ Cannot find the WadCfg end element in the config.
+
+
+ WadCfg start element in the config is not matching the end element.
+
+
+ Cannot find the WadCfg element in the config.
+
\ No newline at end of file
diff --git a/src/ResourceManager.sln b/src/ResourceManager.sln
index 64379a37db40..53241051824d 100644
--- a/src/ResourceManager.sln
+++ b/src/ResourceManager.sln
@@ -149,10 +149,10 @@ Global
{DEA446A1-84E2-46CC-B780-EB4AFDE2460E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEA446A1-84E2-46CC-B780-EB4AFDE2460E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEA446A1-84E2-46CC-B780-EB4AFDE2460E}.Release|Any CPU.Build.0 = Release|Any CPU
- {127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {59D1B5DC-9175-43EC-90C6-CBA601B3565F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {59D1B5DC-9175-43EC-90C6-CBA601B3565F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {59D1B5DC-9175-43EC-90C6-CBA601B3565F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {59D1B5DC-9175-43EC-90C6-CBA601B3565F}.Release|Any CPU.Build.0 = Release|Any CPU
{80A92297-7C92-456B-8EE7-9FB6CE30149D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80A92297-7C92-456B-8EE7-9FB6CE30149D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80A92297-7C92-456B-8EE7-9FB6CE30149D}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -198,7 +198,6 @@ Global
{080B0477-7E52-4455-90AB-23BD13D1B1CE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{56ED8C97-53B9-4DF6-ACB5-7E6800105BF8} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{7E6683BE-ECFF-4709-89EB-1325E9E70512} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
- {127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{13E031E4-8A43-4B87-9D72-D70180C31C11} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{469F20E0-9D40-41AD-94C3-B47AD15A4C00} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
{133561EC-99AF-4ADC-AF41-39C4D3AD323B} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
diff --git a/src/ResourceManager/Batch/Commands.Batch.Test/BatchTestHelpers.cs b/src/ResourceManager/Batch/Commands.Batch.Test/BatchTestHelpers.cs
index 6e84172febed..6a6eb70b1b9d 100644
--- a/src/ResourceManager/Batch/Commands.Batch.Test/BatchTestHelpers.cs
+++ b/src/ResourceManager/Batch/Commands.Batch.Test/BatchTestHelpers.cs
@@ -20,7 +20,6 @@
using Microsoft.Azure.Batch;
using Microsoft.Azure.Batch.Common;
using Microsoft.Azure.Batch.Protocol;
-using Microsoft.Azure.Batch.Protocol.Entities;
using Microsoft.Azure.Commands.Batch.Models;
using Microsoft.Azure.Commands.Batch.Test.ScenarioTests;
using Microsoft.Azure.Management.Batch;
@@ -35,7 +34,7 @@
using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;
using Microsoft.WindowsAzure.Storage.Shared.Protocol;
using Xunit;
-using JobExecutionEnvironment = Microsoft.Azure.Batch.Protocol.Entities.JobExecutionEnvironment;
+using ProxyModels = Microsoft.Azure.Batch.Protocol.Models;
namespace Microsoft.Azure.Commands.Batch.Test
{
@@ -113,291 +112,229 @@ public static void AssertBatchAccountContextsAreEqual(BatchAccountContext contex
}
///
- /// Builds a PSCloudWorkItem for testing
+ /// Builds a CloudPoolGetResponse object
///
- public static PSCloudWorkItem CreatePSCloudWorkItem()
+ public static ProxyModels.CloudPoolGetResponse CreateCloudPoolGetResponse(string poolId)
{
- BatchAccountContext context = CreateBatchContextWithKeys();
- using (IWorkItemManager wiManager = context.BatchOMClient.OpenWorkItemManager())
- {
- ICloudWorkItem workItem = wiManager.CreateWorkItem("testWorkItem");
- return new PSCloudWorkItem(workItem);
- }
- }
+ ProxyModels.CloudPoolGetResponse response = new ProxyModels.CloudPoolGetResponse();
+ response.StatusCode = HttpStatusCode.OK;
- ///
- /// Builds a PSCloudPool for testing
- ///
- public static PSCloudPool CreatePSCloudPool()
- {
- BatchAccountContext context = CreateBatchContextWithKeys();
- using (IPoolManager poolManager = context.BatchOMClient.OpenPoolManager())
- {
- ICloudPool pool = poolManager.CreatePool("testPool");
- return new PSCloudPool(pool);
- }
- }
+ ProxyModels.CloudPool pool = new ProxyModels.CloudPool();
+ pool.Id = poolId;
- ///
- /// Builds a GetPoolResponse object
- ///
- public static GetPoolResponse CreateGetPoolResponse(string poolName)
- {
- GetPoolResponse response = new GetPoolResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
-
- Pool pool = new Pool();
- SetProperty(pool, "Name", poolName);
-
- SetProperty(response, "Pool", pool);
+ response.Pool = pool;
return response;
}
///
- /// Builds a ListPoolsResponse object
+ /// Builds a CloudPoolListResponse object
///
- public static ListPoolsResponse CreateListPoolsResponse(IEnumerable poolNames)
+ public static ProxyModels.CloudPoolListResponse CreateCloudPoolListResponse(IEnumerable poolIds)
{
- ListPoolsResponse response = new ListPoolsResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.CloudPoolListResponse response = new ProxyModels.CloudPoolListResponse();
+ response.StatusCode = HttpStatusCode.OK;
- List pools = new List();
+ List pools = new List();
- foreach (string name in poolNames)
+ foreach (string id in poolIds)
{
- Pool pool = new Pool();
- SetProperty(pool, "Name", name);
+ ProxyModels.CloudPool pool = new ProxyModels.CloudPool();
+ pool.Id = id;
pools.Add(pool);
}
- SetProperty(response, "Pools", pools);
+ response.Pools = pools;
return response;
}
///
- /// Builds a GetTVMResponse object
+ /// Builds a ComputeNodeGetResponse object
///
- public static GetTVMResponse CreateGetTVMResponse(string vmName)
+ public static ProxyModels.ComputeNodeGetResponse CreateComputeNodeGetResponse(string computeNodeId)
{
- GetTVMResponse response = new GetTVMResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.ComputeNodeGetResponse response = new ProxyModels.ComputeNodeGetResponse();
+ response.StatusCode = HttpStatusCode.OK;
- TVM vm = new TVM();
- SetProperty(vm, "Name", vmName);
- SetProperty(response, "TVM", vm);
+ ProxyModels.ComputeNode computeNode = new ProxyModels.ComputeNode();
+ computeNode.Id = computeNodeId;
+ response.ComputeNode = computeNode;
return response;
}
///
- /// Builds a ListTVMsResponse object
+ /// Builds a ComputeNodeListResponse object
///
- public static ListTVMsResponse CreateListTVMsResponse(IEnumerable vmNames)
+ public static ProxyModels.ComputeNodeListResponse CreateComputeNodeListResponse(IEnumerable computeNodeIds)
{
- ListTVMsResponse response = new ListTVMsResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.ComputeNodeListResponse response = new ProxyModels.ComputeNodeListResponse();
+ response.StatusCode = HttpStatusCode.OK;
- List vms = new List();
+ List computeNodes = new List();
- foreach (string name in vmNames)
+ foreach (string id in computeNodeIds)
{
- TVM vm = new TVM();
- SetProperty(vm, "Name", name);
- vms.Add(vm);
+ ProxyModels.ComputeNode computeNode = new ProxyModels.ComputeNode();
+ computeNode.Id = id;
+ computeNodes.Add(computeNode);
}
- SetProperty(response, "TVMs", vms);
+ response.ComputeNodes = computeNodes;
return response;
}
///
- /// Builds a GetWorkItemResponse object
+ /// Builds a CloudJobScheduleGetResponse object
///
- public static GetWorkItemResponse CreateGetWorkItemResponse(string workItemName)
+ public static ProxyModels.CloudJobScheduleGetResponse CreateCloudJobScheduleGetResponse(string jobScheduleId)
{
- GetWorkItemResponse response = new GetWorkItemResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.CloudJobScheduleGetResponse response = new ProxyModels.CloudJobScheduleGetResponse();
+ response.StatusCode = HttpStatusCode.OK;
- JobExecutionEnvironment jee = new JobExecutionEnvironment();
+ ProxyModels.JobSpecification jobSpec = new ProxyModels.JobSpecification();
+ ProxyModels.Schedule schedule = new ProxyModels.Schedule();
- WorkItem workItem = new WorkItem(workItemName, jee);
- SetProperty(response, "WorkItem", workItem);
+ ProxyModels.CloudJobSchedule jobSchedule = new ProxyModels.CloudJobSchedule(jobScheduleId, schedule, jobSpec);
+ response.JobSchedule = jobSchedule;
return response;
}
///
- /// Builds a ListWorkItemsResponse object
+ /// Builds a CloudJobScheduleListResponse object
///
- public static ListWorkItemsResponse CreateListWorkItemsResponse(IEnumerable workItemNames)
+ public static ProxyModels.CloudJobScheduleListResponse CreateCloudJobScheduleListResponse(IEnumerable jobScheduleIds)
{
- ListWorkItemsResponse response = new ListWorkItemsResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.CloudJobScheduleListResponse response = new ProxyModels.CloudJobScheduleListResponse();
+ response.StatusCode = HttpStatusCode.OK;;
- List workItems = new List();
- JobExecutionEnvironment jee = new JobExecutionEnvironment();
+ List jobSchedules = new List();
+ ProxyModels.JobSpecification jobSpec = new ProxyModels.JobSpecification();
+ ProxyModels.Schedule schedule = new ProxyModels.Schedule();
- foreach (string name in workItemNames)
+ foreach (string id in jobScheduleIds)
{
- workItems.Add(new WorkItem(name, jee));
+ jobSchedules.Add(new ProxyModels.CloudJobSchedule(id, schedule, jobSpec));
}
- SetProperty(response, "WorkItems", workItems);
+ response.JobSchedules = jobSchedules;
return response;
}
///
- /// Builds a GetJobResponse object
+ /// Builds a CloudJobGetResponse object
///
- public static GetJobResponse CreateGetJobResponse(string jobName)
+ public static ProxyModels.CloudJobGetResponse CreateCloudJobGetResponse(string jobId)
{
- GetJobResponse response = new GetJobResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.CloudJobGetResponse response = new ProxyModels.CloudJobGetResponse();
+ response.StatusCode = HttpStatusCode.OK;
- Job job = new Job();
- SetProperty(job, "Name", jobName);
+ ProxyModels.CloudJob job = new ProxyModels.CloudJob();
+ job.Id = jobId;
- SetProperty(response, "Job", job);
+ response.Job = job;
return response;
}
///
- /// Builds a ListJobsResponse object
+ /// Builds a CloudJobListResponse object
///
- public static ListJobsResponse CreateListJobsResponse(IEnumerable jobNames)
+ public static ProxyModels.CloudJobListResponse CreateCloudJobListResponse(IEnumerable jobIds)
{
- ListJobsResponse response = new ListJobsResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.CloudJobListResponse response = new ProxyModels.CloudJobListResponse();
+ response.StatusCode = HttpStatusCode.OK;
- List jobs = new List();
+ List jobs = new List();
- foreach (string name in jobNames)
+ foreach (string id in jobIds)
{
- Job job = new Job();
- SetProperty(job, "Name", name);
+ ProxyModels.CloudJob job = new ProxyModels.CloudJob();
+ job.Id = id;
jobs.Add(job);
}
- SetProperty(response, "Jobs", jobs);
+ response.Jobs = jobs;
return response;
}
///
- /// Builds a GetTaskResponse object
+ /// Builds a CloudTaskGetResponse object
///
- public static GetTaskResponse CreateGetTaskResponse(string taskName)
+ public static ProxyModels.CloudTaskGetResponse CreateCloudTaskGetResponse(string taskId)
{
- GetTaskResponse response = new GetTaskResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.CloudTaskGetResponse response = new ProxyModels.CloudTaskGetResponse();
+ response.StatusCode = HttpStatusCode.OK;
- Azure.Batch.Protocol.Entities.Task task = new Azure.Batch.Protocol.Entities.Task();
- SetProperty(task, "Name", taskName);
+ ProxyModels.CloudTask task = new ProxyModels.CloudTask();
+ task.Id = taskId;
- SetProperty(response, "Task", task);
+ response.Task = task;
return response;
}
///
- /// Builds a ListTasksResponse object
+ /// Builds a CloudTaskListResponse object
///
- public static ListTasksResponse CreateListTasksResponse(IEnumerable taskNames)
+ public static ProxyModels.CloudTaskListResponse CreateCloudTaskListResponse(IEnumerable taskIds)
{
- ListTasksResponse response = new ListTasksResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.CloudTaskListResponse response = new ProxyModels.CloudTaskListResponse();
+ response.StatusCode = HttpStatusCode.OK;
- List tasks = new List();
+ List tasks = new List();
- foreach (string name in taskNames)
+ foreach (string id in taskIds)
{
- Azure.Batch.Protocol.Entities.Task task = new Azure.Batch.Protocol.Entities.Task();
- SetProperty(task, "Name", name);
+ ProxyModels.CloudTask task = new ProxyModels.CloudTask();
+ task.Id = id;
tasks.Add(task);
}
- SetProperty(response, "Tasks", tasks);
-
- return response;
- }
-
- ///
- /// Builds a GetTaskFilePropertiesResponse object
- ///
- public static GetTaskFilePropertiesResponse CreateGetTaskFilePropertiesResponse(string fileName)
- {
- GetTaskFilePropertiesResponse response = new GetTaskFilePropertiesResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
-
- Azure.Batch.Protocol.Entities.File file = new Azure.Batch.Protocol.Entities.File();
- SetProperty(file, "Name", fileName);
-
- SetProperty(response, "File", file);
-
- return response;
- }
-
- ///
- /// Builds a ListTaskFilesResponse object
- ///
- public static ListTaskFilesResponse CreateListTaskFilesResponse(IEnumerable fileNames)
- {
- ListTaskFilesResponse response = new ListTaskFilesResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
-
- List files = new List();
-
- foreach (string name in fileNames)
- {
- Azure.Batch.Protocol.Entities.File file = new Azure.Batch.Protocol.Entities.File();
- SetProperty(file, "Name", name);
- files.Add(file);
- }
-
- SetProperty(response, "Files", files);
+ response.Tasks = tasks;
return response;
}
///
- /// Builds a GetTVMFilePropertiesResponse object
+ /// Builds a NodeFileGetPropertiesResponse object
///
- public static GetTVMFilePropertiesResponse CreateGetTVMFilePropertiesResponse(string fileName)
+ public static ProxyModels.NodeFileGetPropertiesResponse CreateNodeFileGetPropertiesResponse(string fileName)
{
- GetTVMFilePropertiesResponse response = new GetTVMFilePropertiesResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.NodeFileGetPropertiesResponse response = new ProxyModels.NodeFileGetPropertiesResponse();
+ response.StatusCode = HttpStatusCode.OK;
- Azure.Batch.Protocol.Entities.File file = new Azure.Batch.Protocol.Entities.File();
- SetProperty(file, "Name", fileName);
+ ProxyModels.NodeFile file = new ProxyModels.NodeFile();
+ file.Name = fileName;
- SetProperty(response, "File", file);
+ response.File = file;
return response;
}
///
- /// Builds a ListTVMFilesResponse object
+ /// Builds a NodeFileListResponse object
///
- public static ListTVMFilesResponse CreateListTVMFilesResponse(IEnumerable fileNames)
+ public static ProxyModels.NodeFileListResponse CreateNodeFileListResponse(IEnumerable fileNames)
{
- ListTVMFilesResponse response = new ListTVMFilesResponse();
- SetProperty(response, "StatusCode", HttpStatusCode.OK);
+ ProxyModels.NodeFileListResponse response = new ProxyModels.NodeFileListResponse();
+ response.StatusCode = HttpStatusCode.OK;
- List files = new List();
+ List files = new List();
foreach (string name in fileNames)
{
- Azure.Batch.Protocol.Entities.File file = new Azure.Batch.Protocol.Entities.File();
- SetProperty(file, "Name", name);
+ ProxyModels.NodeFile file = new ProxyModels.NodeFile();
+ file.Name = name;
files.Add(file);
}
- SetProperty(response, "Files", files);
+ response.Files = files;
return response;
}
diff --git a/src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj b/src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj
index b966dae3685f..3211f67a4d9f 100644
--- a/src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj
+++ b/src/ResourceManager/Batch/Commands.Batch.Test/Commands.Batch.Test.csproj
@@ -43,9 +43,9 @@
..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll
-
+
False
- ..\..\..\packages\Azure.Batch.1.2.0\lib\net45\Microsoft.Azure.Batch.dll
+ ..\..\..\packages\Azure.Batch.2.0.1\lib\net45\Microsoft.Azure.Batch.dll
..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll
@@ -78,14 +78,17 @@
False
..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5571.32271-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll
-
- ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll
+
+ False
+ ..\..\..\packages\Microsoft.Data.Edm.5.6.2\lib\net40\Microsoft.Data.Edm.dll
-
- ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll
+
+ False
+ ..\..\..\packages\Microsoft.Data.OData.5.6.2\lib\net40\Microsoft.Data.OData.dll
-
- ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll
+
+ False
+ ..\..\..\packages\Microsoft.Data.Services.Client.5.6.2\lib\net40\Microsoft.Data.Services.Client.dll
False
@@ -101,9 +104,9 @@
..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll
-
+
False
- ..\..\..\packages\WindowsAzure.Storage.4.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll
+ ..\..\..\packages\WindowsAzure.Storage.4.3.0\lib\net40\Microsoft.WindowsAzure.Storage.dll
False
@@ -112,6 +115,10 @@
..\..\..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll
+
+ False
+ ..\..\..\packages\System.Spatial.5.6.2\lib\net40\System.Spatial.dll
+
False
..\..\..\packages\xunit.1.9.2\lib\net20\xunit.dll
@@ -136,9 +143,6 @@
..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll
-
- ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll
-
@@ -154,12 +158,11 @@
-
-
-
-
-
+
+
+
+
@@ -175,18 +178,18 @@
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -211,13 +214,13 @@
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
@@ -241,187 +244,184 @@
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
+
+ Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
+ PreserveNewest
+
+
Always
-
+
+ PreserveNewest
+
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
-
+
Always
diff --git a/src/ResourceManager/Batch/Commands.Batch.Test/ComputeNodeUsers/NewBatchComputeNodeUserCommandTests.cs b/src/ResourceManager/Batch/Commands.Batch.Test/ComputeNodeUsers/NewBatchComputeNodeUserCommandTests.cs
new file mode 100644
index 000000000000..abc958d33cd1
--- /dev/null
+++ b/src/ResourceManager/Batch/Commands.Batch.Test/ComputeNodeUsers/NewBatchComputeNodeUserCommandTests.cs
@@ -0,0 +1,85 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Batch;
+using Microsoft.Azure.Batch.Protocol;
+using Microsoft.Azure.Batch.Protocol.Models;
+using Microsoft.Azure.Commands.Batch.Models;
+using Microsoft.WindowsAzure.Commands.ScenarioTest;
+using Moq;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Threading.Tasks;
+using Xunit;
+using BatchClient = Microsoft.Azure.Commands.Batch.Models.BatchClient;
+
+namespace Microsoft.Azure.Commands.Batch.Test.ComputeNodeUsers
+{
+ public class NewBatchComputeNodeUserCommandTests
+ {
+ private NewBatchComputeNodeUserCommand cmdlet;
+ private Mock batchClientMock;
+ private Mock commandRuntimeMock;
+
+ public NewBatchComputeNodeUserCommandTests()
+ {
+ batchClientMock = new Mock();
+ commandRuntimeMock = new Mock();
+ cmdlet = new NewBatchComputeNodeUserCommand()
+ {
+ CommandRuntime = commandRuntimeMock.Object,
+ BatchClient = batchClientMock.Object,
+ };
+ }
+
+ [Fact]
+ [Trait(Category.AcceptanceType, Category.CheckIn)]
+ public void NewBatchComputeNodeUserParametersTest()
+ {
+ // Setup cmdlet without the required parameters
+ BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();
+ cmdlet.BatchContext = context;
+
+ Assert.Throws(() => cmdlet.ExecuteCmdlet());
+
+ cmdlet.PoolId = "testPool";
+ cmdlet.ComputeNodeId = "computeNode1";
+
+ Assert.Throws(() => cmdlet.ExecuteCmdlet());
+ cmdlet.Name = "testUser";
+
+ Assert.Throws(() => cmdlet.ExecuteCmdlet());
+ cmdlet.Password = "Password1234";
+
+ // Don't go to the service on an Add ComputeNodeUser call
+ RequestInterceptor interceptor = new RequestInterceptor((baseRequest) =>
+ {
+ BatchRequest request =
+ (BatchRequest)baseRequest;
+
+ request.ServiceRequestFunc = (cancellationToken) =>
+ {
+ ComputeNodeAddUserResponse response = new ComputeNodeAddUserResponse();
+ Task task = Task.FromResult(response);
+ return task;
+ };
+ });
+ cmdlet.AdditionalBehaviors = new List() { interceptor };
+
+ // Verify no exceptions when required parameters are set
+ cmdlet.ExecuteCmdlet();
+ }
+ }
+}
diff --git a/src/ResourceManager/Batch/Commands.Batch.Test/VMUsers/RemoveBatchVMUserCommandTests.cs b/src/ResourceManager/Batch/Commands.Batch.Test/ComputeNodeUsers/RemoveBatchComputeNodeUserCommandTests.cs
similarity index 69%
rename from src/ResourceManager/Batch/Commands.Batch.Test/VMUsers/RemoveBatchVMUserCommandTests.cs
rename to src/ResourceManager/Batch/Commands.Batch.Test/ComputeNodeUsers/RemoveBatchComputeNodeUserCommandTests.cs
index 4cd2d65778bd..1dcc66234ee6 100644
--- a/src/ResourceManager/Batch/Commands.Batch.Test/VMUsers/RemoveBatchVMUserCommandTests.cs
+++ b/src/ResourceManager/Batch/Commands.Batch.Test/ComputeNodeUsers/RemoveBatchComputeNodeUserCommandTests.cs
@@ -15,7 +15,7 @@
using System;
using Microsoft.Azure.Batch;
using Microsoft.Azure.Batch.Protocol;
-using Microsoft.Azure.Batch.Protocol.Entities;
+using Microsoft.Azure.Batch.Protocol.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Moq;
using System.Collections.Generic;
@@ -24,19 +24,19 @@
using Xunit;
using BatchClient = Microsoft.Azure.Commands.Batch.Models.BatchClient;
-namespace Microsoft.Azure.Commands.Batch.Test.Users
+namespace Microsoft.Azure.Commands.Batch.Test.ComputeNodeUsers
{
- public class RemoveBatchVMUserCommandTests
+ public class RemoveBatchComputeNodeUserCommandTests
{
- private RemoveBatchVMUserCommand cmdlet;
+ private RemoveBatchComputeNodeUserCommand cmdlet;
private Mock batchClientMock;
private Mock commandRuntimeMock;
- public RemoveBatchVMUserCommandTests()
+ public RemoveBatchComputeNodeUserCommandTests()
{
batchClientMock = new Mock();
commandRuntimeMock = new Mock();
- cmdlet = new RemoveBatchVMUserCommand()
+ cmdlet = new RemoveBatchComputeNodeUserCommand()
{
CommandRuntime = commandRuntimeMock.Object,
BatchClient = batchClientMock.Object,
@@ -45,7 +45,7 @@ public RemoveBatchVMUserCommandTests()
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
- public void RemoveBatchUserParametersTest()
+ public void RemoveBatchComputeNodeUserParametersTest()
{
// Setup cmdlet without the required parameters
BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();
@@ -57,20 +57,22 @@ public void RemoveBatchUserParametersTest()
Assert.Throws(() => cmdlet.ExecuteCmdlet());
- cmdlet.PoolName = "testPool";
- cmdlet.VMName = "vm1";
+ cmdlet.PoolId = "testPool";
+ cmdlet.ComputeNodeId = "computeNode1";
cmdlet.Name = "testUser";
// Don't go to the service on a DeleteTVMUser call
- YieldInjectionInterceptor interceptor = new YieldInjectionInterceptor((opContext, request) =>
+ RequestInterceptor interceptor = new RequestInterceptor((baseRequest) =>
{
- if (request is DeleteTVMUserRequest)
+ BatchRequest request =
+ (BatchRequest)baseRequest;
+
+ request.ServiceRequestFunc = (cancellationToken) =>
{
- DeleteTVMUserResponse response = new DeleteTVMUserResponse();
- Task