From cd59093bceb0cb1cbe84711d358150e50df9475e Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 30 Jan 2025 10:43:25 +0000 Subject: [PATCH] Update SDK code ad_cl_0 --- .../src/Generated/Docs/BatchClient.xml | 2856 +---------------- .../Generated/Samples/Samples_BatchClient.cs | 2854 +--------------- 2 files changed, 275 insertions(+), 5435 deletions(-) diff --git a/sdk/batch/Azure.Compute.Batch/src/Generated/Docs/BatchClient.xml b/sdk/batch/Azure.Compute.Batch/src/Generated/Docs/BatchClient.xml index 105b119931537..2106f52e75e05 100644 --- a/sdk/batch/Azure.Compute.Batch/src/Generated/Docs/BatchClient.xml +++ b/sdk/batch/Azure.Compute.Batch/src/Generated/Docs/BatchClient.xml @@ -63,21 +63,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool01", "Standard_D1_v2") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TargetDedicatedNodes = 2, - NetworkConfiguration = new NetworkConfiguration - { - EnableAcceleratedNetworking = true, - }, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -86,46 +72,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04"), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - MountConfiguration = {new MountConfiguration - { - AzureBlobFileSystemConfiguration = new AzureBlobFileSystemConfiguration("accountName", "blobContainerName", "bfusepath") - { - AccountKey = "accountKey", - }, - }, new MountConfiguration - { - AzureFileShareConfiguration = new AzureFileShareConfiguration("accountName", "https://myaccount.file.core.windows.net/fileshare", "accountKey", "filesharepath") - { - MountOptions = "mount options ver=1.0", - }, - }, new MountConfiguration - { - NfsMountConfiguration = new NfsMountConfiguration("somesource nfs url", "mountpath") - { - MountOptions = "mount options ver=1.0", - }, - }, new MountConfiguration - { - CifsMountConfiguration = new CifsMountConfiguration("accountName", "//myaccount.file.core.windows.net/file", "mountpath", "password") - { - MountOptions = "mount options ver=1.0", - }, - }}, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -134,32 +81,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "standard_d2s_v3") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04") - { - OsDisk = new OSDisk - { - EphemeralOSDiskSettings = new DiffDiskSettings - { - Placement = DiffDiskPlacement.CacheDisk, - }, - Caching = CachingType.ReadWrite, - DiskSizeGB = 100, - ManagedDisk = new ManagedDisk(StorageAccountType.StandardSSDLRS), - }, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 1, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 1, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -168,22 +90,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "18_04-lts-gen2", - Version = "latest", - }, "batch.node.ubuntu 18.04"), - ResourceTags = - { - ["TagName1"] = "TagValue1", - ["TagName2"] = "TagValue2" - }, - TargetDedicatedNodes = 1, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -192,23 +99,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "18_04-lts-gen2", - Version = "latest", - }, "batch.node.ubuntu 18.04") - { - SecurityProfile = new SecurityProfile(true, SecurityTypes.TrustedLaunch, new UefiSettings - { - SecureBootEnabled = false, - }), - }, - TargetDedicatedNodes = 1, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -217,23 +108,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04"), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - Metadata = { new MetadataItem("myproperty", "myvalue") }, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -242,27 +117,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "120_04-lts", - }, "batch.node.ubuntu 20.04") - { - ContainerConfiguration = new ContainerConfiguration(ContainerType.DockerCompatible) - { - ContainerImageNames = { "busybox" }, - }, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -271,37 +126,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04") - { - Extensions = {new VMExtension("batchextension1", "Microsoft.Azure.KeyVault", "KeyVaultForLinux") - { - TypeHandlerVersion = "2.0", - AutoUpgradeMinorVersion = true, - EnableAutomaticUpgrade = true, - Settings = - { - ["secretsManagementSettingsKey"] = "secretsManagementSettingsValue", - ["authenticationSettingsKey"] = "authenticationSettingsValue" - }, - }}, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Simplified, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); ]]> This sample shows how to call CreatePoolAsync. @@ -310,24 +135,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool002", "Standard_A1_v2") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64") - { - WindowsConfiguration = new WindowsConfiguration - { - EnableAutomaticUpdates = false, - }, - ServiceArtifactReference = new ServiceArtifactReference("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"), - }, - TargetDedicatedNodes = 2, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); ]]> @@ -339,21 +147,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool01", "Standard_D1_v2") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TargetDedicatedNodes = 2, - NetworkConfiguration = new NetworkConfiguration - { - EnableAcceleratedNetworking = true, - }, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -362,46 +156,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04"), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - MountConfiguration = {new MountConfiguration - { - AzureBlobFileSystemConfiguration = new AzureBlobFileSystemConfiguration("accountName", "blobContainerName", "bfusepath") - { - AccountKey = "accountKey", - }, - }, new MountConfiguration - { - AzureFileShareConfiguration = new AzureFileShareConfiguration("accountName", "https://myaccount.file.core.windows.net/fileshare", "accountKey", "filesharepath") - { - MountOptions = "mount options ver=1.0", - }, - }, new MountConfiguration - { - NfsMountConfiguration = new NfsMountConfiguration("somesource nfs url", "mountpath") - { - MountOptions = "mount options ver=1.0", - }, - }, new MountConfiguration - { - CifsMountConfiguration = new CifsMountConfiguration("accountName", "//myaccount.file.core.windows.net/file", "mountpath", "password") - { - MountOptions = "mount options ver=1.0", - }, - }}, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -410,32 +165,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "standard_d2s_v3") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04") - { - OsDisk = new OSDisk - { - EphemeralOSDiskSettings = new DiffDiskSettings - { - Placement = DiffDiskPlacement.CacheDisk, - }, - Caching = CachingType.ReadWrite, - DiskSizeGB = 100, - ManagedDisk = new ManagedDisk(StorageAccountType.StandardSSDLRS), - }, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 1, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 1, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -444,22 +174,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "18_04-lts-gen2", - Version = "latest", - }, "batch.node.ubuntu 18.04"), - ResourceTags = - { - ["TagName1"] = "TagValue1", - ["TagName2"] = "TagValue2" - }, - TargetDedicatedNodes = 1, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -468,23 +183,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "18_04-lts-gen2", - Version = "latest", - }, "batch.node.ubuntu 18.04") - { - SecurityProfile = new SecurityProfile(true, SecurityTypes.TrustedLaunch, new UefiSettings - { - SecureBootEnabled = false, - }), - }, - TargetDedicatedNodes = 1, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -493,23 +192,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04"), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - Metadata = { new MetadataItem("myproperty", "myvalue") }, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -518,27 +201,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "120_04-lts", - }, "batch.node.ubuntu 20.04") - { - ContainerConfiguration = new ContainerConfiguration(ContainerType.DockerCompatible) - { - ContainerImageNames = { "busybox" }, - }, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -547,37 +210,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04") - { - Extensions = {new VMExtension("batchextension1", "Microsoft.Azure.KeyVault", "KeyVaultForLinux") - { - TypeHandlerVersion = "2.0", - AutoUpgradeMinorVersion = true, - EnableAutomaticUpgrade = true, - Settings = - { - ["secretsManagementSettingsKey"] = "secretsManagementSettingsValue", - ["authenticationSettingsKey"] = "authenticationSettingsValue" - }, - }}, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Simplified, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); ]]> This sample shows how to call CreatePool. @@ -586,24 +219,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool002", "Standard_A1_v2") -{ - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64") - { - WindowsConfiguration = new WindowsConfiguration - { - EnableAutomaticUpdates = false, - }, - ServiceArtifactReference = new ServiceArtifactReference("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"), - }, - TargetDedicatedNodes = 2, -}; +BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); ]]> @@ -615,27 +231,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "mypool01", - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - targetDedicatedNodes = 2, - networkConfiguration = new - { - enableAcceleratedNetworking = true, - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -646,74 +242,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - mountConfiguration = new object[] - { - new - { - azureBlobFileSystemConfiguration = new - { - accountName = "accountName", - containerName = "blobContainerName", - accountKey = "accountKey", - relativeMountPath = "bfusepath", - }, - }, - new - { - azureFileShareConfiguration = new - { - accountName = "accountName", - azureFileUrl = "https://myaccount.file.core.windows.net/fileshare", - accountKey = "accountKey", - relativeMountPath = "filesharepath", - mountOptions = "mount options ver=1.0", - }, - }, - new - { - nfsMountConfiguration = new - { - source = "somesource nfs url", - relativeMountPath = "mountpath", - mountOptions = "mount options ver=1.0", - }, - }, - new - { - cifsMountConfiguration = new - { - username = "accountName", - password = "password", - source = "//myaccount.file.core.windows.net/file", - relativeMountPath = "mountpath", - mountOptions = "mount options ver=1.0", - }, - } - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -724,39 +253,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "mypool001", - vmSize = "standard_d2s_v3", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - osDisk = new - { - diskSizeGB = 100, - managedDisk = new - { - storageAccountType = "standardssd_lrs", - }, - caching = "readwrite", - ephemeralOSDiskSettings = new - { - placement = "cachedisk", - }, - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 1, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 1, - enableAutoScale = false, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -767,28 +264,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "mypool001", - vmSize = "STANDARD_DC2s_V2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "18_04-lts-gen2", - version = "latest", - }, - nodeAgentSKUId = "batch.node.ubuntu 18.04", - }, - targetDedicatedNodes = 1, - resourceTags = new - { - TagName1 = "TagValue1", - TagName2 = "TagValue2", - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -799,32 +275,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "mypool001", - vmSize = "STANDARD_DC2s_V2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "18_04-lts-gen2", - version = "latest", - }, - nodeAgentSKUId = "batch.node.ubuntu 18.04", - securityProfile = new - { - securityType = "trustedLaunch", - encryptionAtHost = true, - uefiSettings = new - { - secureBootEnabled = false, - }, - }, - }, - targetDedicatedNodes = 1, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -835,39 +286,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -878,38 +297,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "120_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - containerConfiguration = new - { - type = "dockerCompatible", - containerImageNames = new object[] - { - "busybox" - }, - }, - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -920,57 +308,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - extensions = new object[] - { - new - { - name = "batchextension1", - type = "KeyVaultForLinux", - publisher = "Microsoft.Azure.KeyVault", - typeHandlerVersion = "2.0", - autoUpgradeMinorVersion = true, - enableAutomaticUpgrade = true, - settings = new - { - secretsManagementSettingsKey = "secretsManagementSettingsValue", - authenticationSettingsKey = "authenticationSettingsValue", - }, - } - }, - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, - targetNodeCommunicationMode = "simplified", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -981,31 +319,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "mypool002", - vmSize = "Standard_A1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - windowsConfiguration = new - { - enableAutomaticUpdates = false, - }, - serviceArtifactReference = new - { - id = "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - targetDedicatedNodes = 2, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -1019,27 +333,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "mypool01", - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - targetDedicatedNodes = 2, - networkConfiguration = new - { - enableAcceleratedNetworking = true, - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1050,74 +344,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - mountConfiguration = new object[] - { - new - { - azureBlobFileSystemConfiguration = new - { - accountName = "accountName", - containerName = "blobContainerName", - accountKey = "accountKey", - relativeMountPath = "bfusepath", - }, - }, - new - { - azureFileShareConfiguration = new - { - accountName = "accountName", - azureFileUrl = "https://myaccount.file.core.windows.net/fileshare", - accountKey = "accountKey", - relativeMountPath = "filesharepath", - mountOptions = "mount options ver=1.0", - }, - }, - new - { - nfsMountConfiguration = new - { - source = "somesource nfs url", - relativeMountPath = "mountpath", - mountOptions = "mount options ver=1.0", - }, - }, - new - { - cifsMountConfiguration = new - { - username = "accountName", - password = "password", - source = "//myaccount.file.core.windows.net/file", - relativeMountPath = "mountpath", - mountOptions = "mount options ver=1.0", - }, - } - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1128,39 +355,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "mypool001", - vmSize = "standard_d2s_v3", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - osDisk = new - { - diskSizeGB = 100, - managedDisk = new - { - storageAccountType = "standardssd_lrs", - }, - caching = "readwrite", - ephemeralOSDiskSettings = new - { - placement = "cachedisk", - }, - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 1, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 1, - enableAutoScale = false, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1171,28 +366,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "mypool001", - vmSize = "STANDARD_DC2s_V2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "18_04-lts-gen2", - version = "latest", - }, - nodeAgentSKUId = "batch.node.ubuntu 18.04", - }, - targetDedicatedNodes = 1, - resourceTags = new - { - TagName1 = "TagValue1", - TagName2 = "TagValue2", - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1203,32 +377,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "mypool001", - vmSize = "STANDARD_DC2s_V2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "18_04-lts-gen2", - version = "latest", - }, - nodeAgentSKUId = "batch.node.ubuntu 18.04", - securityProfile = new - { - securityType = "trustedLaunch", - encryptionAtHost = true, - uefiSettings = new - { - secureBootEnabled = false, - }, - }, - }, - targetDedicatedNodes = 1, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1239,39 +388,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1282,38 +399,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "120_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - containerConfiguration = new - { - type = "dockerCompatible", - containerImageNames = new object[] - { - "busybox" - }, - }, - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1324,57 +410,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - extensions = new object[] - { - new - { - name = "batchextension1", - type = "KeyVaultForLinux", - publisher = "Microsoft.Azure.KeyVault", - typeHandlerVersion = "2.0", - autoUpgradeMinorVersion = true, - enableAutomaticUpgrade = true, - settings = new - { - secretsManagementSettingsKey = "secretsManagementSettingsValue", - authenticationSettingsKey = "authenticationSettingsValue", - }, - } - }, - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, - targetNodeCommunicationMode = "simplified", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1385,31 +421,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "mypool002", - vmSize = "Standard_A1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - windowsConfiguration = new - { - enableAutomaticUpdates = false, - }, - serviceArtifactReference = new - { - id = "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - targetDedicatedNodes = 2, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1689,13 +701,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - startTask = new - { - commandLine = "/bin/bash -c 'echo start task'", - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.UpdatePoolAsync("poolId", content); Console.WriteLine(response.Status); @@ -1709,13 +715,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - startTask = new - { - commandLine = "/bin/bash -c 'echo start task'", - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.UpdatePool("poolId", content); Console.WriteLine(response.Status); @@ -1755,11 +755,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent -{ - AutoScaleFormula = "$TargetDedicated=0", - AutoScaleEvaluationInterval = XmlConvert.ToTimeSpan("PT8M"), -}; +BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent(); Response response = await client.EnablePoolAutoScaleAsync("poolId", content); ]]> @@ -1771,11 +767,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent -{ - AutoScaleFormula = "$TargetDedicated=0", - AutoScaleEvaluationInterval = XmlConvert.ToTimeSpan("PT8M"), -}; +BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent(); Response response = client.EnablePoolAutoScale("poolId", content); ]]> @@ -1787,11 +779,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - autoScaleFormula = "$TargetDedicated=0", - autoScaleEvaluationInterval = "PT8M", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.EnablePoolAutoScaleAsync("poolId", content); Console.WriteLine(response.Status); @@ -1805,11 +793,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - autoScaleFormula = "$TargetDedicated=0", - autoScaleEvaluationInterval = "PT8M", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.EnablePoolAutoScale("poolId", content); Console.WriteLine(response.Status); @@ -1823,7 +807,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent("$TargetDedicated=1"); +BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent(null); Response response = await client.EvaluatePoolAutoScaleAsync("poolId", content); ]]> @@ -1835,7 +819,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent("$TargetDedicated=1"); +BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent(null); Response response = client.EvaluatePoolAutoScale("poolId", content); ]]> @@ -1847,10 +831,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - autoScaleFormula = "$TargetDedicated=1", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.EvaluatePoolAutoScaleAsync("poolId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -1865,10 +846,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - autoScaleFormula = "$TargetDedicated=1", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.EvaluatePoolAutoScale("poolId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -1883,11 +861,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolResizeContent content = new BatchPoolResizeContent -{ - TargetDedicatedNodes = 1, - TargetLowPriorityNodes = 0, -}; +BatchPoolResizeContent content = new BatchPoolResizeContent(); Response response = await client.ResizePoolAsync("resizePool", content); ]]> @@ -1899,11 +873,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolResizeContent content = new BatchPoolResizeContent -{ - TargetDedicatedNodes = 1, - TargetLowPriorityNodes = 0, -}; +BatchPoolResizeContent content = new BatchPoolResizeContent(); Response response = client.ResizePool("resizePool", content); ]]> @@ -1915,11 +885,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - targetDedicatedNodes = 1, - targetLowPriorityNodes = 0, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.ResizePoolAsync("resizePool", content); Console.WriteLine(response.Status); @@ -1933,11 +899,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - targetDedicatedNodes = 1, - targetLowPriorityNodes = 0, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.ResizePool("resizePool", content); Console.WriteLine(response.Status); @@ -1977,10 +939,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolReplaceContent pool = new BatchPoolReplaceContent(Array.Empty(), Array.Empty()) -{ - StartTask = new BatchStartTask("/bin/bash -c 'echo start task'"), -}; +BatchPoolReplaceContent pool = new BatchPoolReplaceContent(null, null); Response response = await client.ReplacePoolPropertiesAsync("poolId", pool); ]]> @@ -1992,10 +951,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchPoolReplaceContent pool = new BatchPoolReplaceContent(Array.Empty(), Array.Empty()) -{ - StartTask = new BatchStartTask("/bin/bash -c 'echo start task'"), -}; +BatchPoolReplaceContent pool = new BatchPoolReplaceContent(null, null); Response response = client.ReplacePoolProperties("poolId", pool); ]]> @@ -2007,15 +963,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - startTask = new - { - commandLine = "/bin/bash -c 'echo start task'", - }, - applicationPackageReferences = Array.Empty(), - metadata = Array.Empty(), -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.ReplacePoolPropertiesAsync("poolId", content); Console.WriteLine(response.Status); @@ -2029,15 +977,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - startTask = new - { - commandLine = "/bin/bash -c 'echo start task'", - }, - applicationPackageReferences = Array.Empty(), - metadata = Array.Empty(), -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.ReplacePoolProperties("poolId", content); Console.WriteLine(response.Status); @@ -2051,7 +991,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeRemoveContent content = new BatchNodeRemoveContent(new string[] { "tvm-1695681911_1-20161122t224741z", "tvm-1695681911_2-20161122t224741z" }); +BatchNodeRemoveContent content = new BatchNodeRemoveContent(null); Response response = await client.RemoveNodesAsync("poolId", content); ]]> @@ -2063,7 +1003,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeRemoveContent content = new BatchNodeRemoveContent(new string[] { "tvm-1695681911_1-20161122t224741z", "tvm-1695681911_2-20161122t224741z" }); +BatchNodeRemoveContent content = new BatchNodeRemoveContent(null); Response response = client.RemoveNodes("poolId", content); ]]> @@ -2075,14 +1015,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - nodeList = new object[] - { - "tvm-1695681911_1-20161122t224741z", - "tvm-1695681911_2-20161122t224741z" - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.RemoveNodesAsync("poolId", content); Console.WriteLine(response.Status); @@ -2096,14 +1029,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - nodeList = new object[] - { - "tvm-1695681911_1-20161122t224741z", - "tvm-1695681911_2-20161122t224741z" - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.RemoveNodes("poolId", content); Console.WriteLine(response.Status); @@ -2193,19 +1119,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - poolInfo = new - { - poolId = "poolId", - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.UpdateJobAsync("jobId", content); Console.WriteLine(response.Status); @@ -2215,23 +1129,11 @@ Console.WriteLine(response.Status); This sample shows how to call UpdateJob. "); -TokenCredential credential = new DefaultAzureCredential(); -BatchClient client = new BatchClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - poolInfo = new - { - poolId = "poolId", - }, -}); +Uri endpoint = new Uri(""); +TokenCredential credential = new DefaultAzureCredential(); +BatchClient client = new BatchClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); Response response = client.UpdateJob("jobId", content); Console.WriteLine(response.Status); @@ -2343,7 +1245,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobDisableContent content = new BatchJobDisableContent(DisableBatchJobOption.Terminate); +BatchJobDisableContent content = new BatchJobDisableContent(default); Response response = await client.DisableJobAsync("jobId", content); ]]> @@ -2355,7 +1257,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobDisableContent content = new BatchJobDisableContent(DisableBatchJobOption.Terminate); +BatchJobDisableContent content = new BatchJobDisableContent(default); Response response = client.DisableJob("jobId", content); ]]> @@ -2367,10 +1269,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - disableTasks = "terminate", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.DisableJobAsync("jobId", content); Console.WriteLine(response.Status); @@ -2384,10 +1283,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - disableTasks = "terminate", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.DisableJob("jobId", content); Console.WriteLine(response.Status); @@ -2477,13 +1373,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo -{ - PoolId = "poolId", -}) -{ - Priority = 0, -}; +BatchJobCreateContent job = new BatchJobCreateContent(null, null); Response response = await client.CreateJobAsync(job); ]]> This sample shows how to call CreateJobAsync. @@ -2492,96 +1382,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo -{ - AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.Job) - { - AutoPoolIdPrefix = "mypool", - Pool = new BatchPoolSpecification("Standard_D1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TaskSlotsPerNode = 2, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 3, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - StartTask = new BatchStartTask("myprogram2.exe") - { - ResourceFiles = {new ResourceFile - { - HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", - FilePath = "myprogram2.exe", - }}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") - { - Value = "myvalue", - }}, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - MaxTaskRetryCount = 2, - WaitForSuccess = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, - }, - }, -}) -{ - Priority = 100, - Constraints = new BatchJobConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = -1, - }, - JobManagerTask = new BatchJobManagerTask("taskId", "myprogram.exe") - { - ResourceFiles = {new ResourceFile - { - HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", - FilePath = "myprogram.exe", - }, new ResourceFile - { - StorageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", - FilePath = "datafolder", - }}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") - { - Value = "myvalue", - }}, - Constraints = new BatchTaskConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - RetentionTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = 0, - }, - RequiredSlots = 2, - KillJobOnCompletion = false, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - RunExclusive = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, -}; +BatchJobCreateContent job = new BatchJobCreateContent(null, null); Response response = await client.CreateJobAsync(job); ]]> @@ -2593,13 +1394,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo -{ - PoolId = "poolId", -}) -{ - Priority = 0, -}; +BatchJobCreateContent job = new BatchJobCreateContent(null, null); Response response = client.CreateJob(job); ]]> This sample shows how to call CreateJob. @@ -2608,96 +1403,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo -{ - AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.Job) - { - AutoPoolIdPrefix = "mypool", - Pool = new BatchPoolSpecification("Standard_D1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TaskSlotsPerNode = 2, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 3, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - StartTask = new BatchStartTask("myprogram2.exe") - { - ResourceFiles = {new ResourceFile - { - HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", - FilePath = "myprogram2.exe", - }}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") - { - Value = "myvalue", - }}, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - MaxTaskRetryCount = 2, - WaitForSuccess = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, - }, - }, -}) -{ - Priority = 100, - Constraints = new BatchJobConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = -1, - }, - JobManagerTask = new BatchJobManagerTask("taskId", "myprogram.exe") - { - ResourceFiles = {new ResourceFile - { - HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", - FilePath = "myprogram.exe", - }, new ResourceFile - { - StorageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", - FilePath = "datafolder", - }}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") - { - Value = "myvalue", - }}, - Constraints = new BatchTaskConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - RetentionTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = 0, - }, - RequiredSlots = 2, - KillJobOnCompletion = false, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - RunExclusive = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, -}; +BatchJobCreateContent job = new BatchJobCreateContent(null, null); Response response = client.CreateJob(job); ]]> @@ -2709,15 +1415,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "jobId", - priority = 0, - poolInfo = new - { - poolId = "poolId", - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateJobAsync(content); Console.WriteLine(response.Status); @@ -2728,139 +1426,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "jobId", - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - jobManagerTask = new - { - id = "taskId", - commandLine = "myprogram.exe", - resourceFiles = new object[] - { - new - { - httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", - filePath = "myprogram.exe", - }, - new - { - storageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", - filePath = "datafolder", - } - }, - environmentSettings = new object[] - { - new - { - name = "myvariable", - value = "myvalue", - } - }, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = 0, - retentionTime = "PT1H", - }, - requiredSlots = 2, - killJobOnCompletion = false, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - runExclusive = true, - }, - poolInfo = new - { - autoPoolSpecification = new - { - autoPoolIdPrefix = "mypool", - poolLifetimeOption = "job", - pool = new - { - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 3, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 2, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - startTask = new - { - commandLine = "myprogram2.exe", - resourceFiles = new object[] - { - new - { - httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", - filePath = "myprogram2.exe", - } - }, - environmentSettings = new object[] - { - new - { - name = "myvariable", - value = "myvalue", - } - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - maxTaskRetryCount = 2, - waitForSuccess = true, - }, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, - targetNodeCommunicationMode = "default", - }, - }, - }, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateJobAsync(content); Console.WriteLine(response.Status); @@ -2874,15 +1440,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "jobId", - priority = 0, - poolInfo = new - { - poolId = "poolId", - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateJob(content); Console.WriteLine(response.Status); @@ -2893,139 +1451,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "jobId", - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - jobManagerTask = new - { - id = "taskId", - commandLine = "myprogram.exe", - resourceFiles = new object[] - { - new - { - httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", - filePath = "myprogram.exe", - }, - new - { - storageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", - filePath = "datafolder", - } - }, - environmentSettings = new object[] - { - new - { - name = "myvariable", - value = "myvalue", - } - }, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = 0, - retentionTime = "PT1H", - }, - requiredSlots = 2, - killJobOnCompletion = false, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - runExclusive = true, - }, - poolInfo = new - { - autoPoolSpecification = new - { - autoPoolIdPrefix = "mypool", - poolLifetimeOption = "job", - pool = new - { - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 3, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 2, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - startTask = new - { - commandLine = "myprogram2.exe", - resourceFiles = new object[] - { - new - { - httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", - filePath = "myprogram2.exe", - } - }, - environmentSettings = new object[] - { - new - { - name = "myvariable", - value = "myvalue", - } - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - maxTaskRetryCount = 2, - waitForSuccess = true, - }, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, - targetNodeCommunicationMode = "default", - }, - }, - }, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateJob(content); Console.WriteLine(response.Status); @@ -3183,27 +1609,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - schedule = new - { - doNotRunUntil = "2025-01-01T12:30:00Z", - }, - jobSpecification = new - { - priority = 0, - usesTaskDependencies = false, - constraints = new - { - maxWallClockTime = "P10675199DT2H48M5.4775807S", - maxTaskRetryCount = 0, - }, - poolInfo = new - { - poolId = "poolId", - }, - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.UpdateJobScheduleAsync("jobScheduleId", content); Console.WriteLine(response.Status); @@ -3217,27 +1623,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - schedule = new - { - doNotRunUntil = "2025-01-01T12:30:00Z", - }, - jobSpecification = new - { - priority = 0, - usesTaskDependencies = false, - constraints = new - { - maxWallClockTime = "P10675199DT2H48M5.4775807S", - maxTaskRetryCount = 0, - }, - poolInfo = new - { - poolId = "poolId", - }, - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.UpdateJobSchedule("jobScheduleId", content); Console.WriteLine(response.Status); @@ -3457,13 +1843,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration -{ - RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), -}, new BatchJobSpecification(new BatchPoolInfo -{ - PoolId = "poolId", -})); +BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); Response response = await client.CreateJobScheduleAsync(jobSchedule); ]]> This sample shows how to call CreateJobScheduleAsync. @@ -3472,228 +1852,28 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration -{ - DoNotRunUntil = DateTimeOffset.Parse("2014-09-10T02:30:00.000Z"), - DoNotRunAfter = DateTimeOffset.Parse("2014-09-10T06:30:00.000Z"), - StartWindow = XmlConvert.ToTimeSpan("PT1M"), - RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), -}, new BatchJobSpecification(new BatchPoolInfo -{ - AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.JobSchedule) - { - AutoPoolIdPrefix = "mypool", - Pool = new BatchPoolSpecification("Standard_D1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TaskSlotsPerNode = 2, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 3, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - StartTask = new BatchStartTask("myprogram2.exe") - { - ResourceFiles = {new ResourceFile - { - HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", - FilePath = "myprogram2.exe", - }}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") - { - Value = "myvalue", - }}, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - MaxTaskRetryCount = 2, - WaitForSuccess = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, - }, - }, -}) -{ - Priority = 100, - Constraints = new BatchJobConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = -1, - }, - JobManagerTask = new BatchJobManagerTask("mytask1", "myprogram.exe") - { - ResourceFiles = {new ResourceFile - { - HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", - FilePath = "myprogram.exe", - }, new ResourceFile - { - HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", - FilePath = "test.txt", - }}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") - { - Value = "myvalue", - }}, - Constraints = new BatchTaskConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - RetentionTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = 0, - }, - RequiredSlots = 2, - KillJobOnCompletion = true, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, - RunExclusive = true, - }, -}) -{ - Metadata = { new MetadataItem("myproperty", "myvalue") }, -}; +BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); Response response = await client.CreateJobScheduleAsync(jobSchedule); ]]> - - -This sample shows how to call CreateJobSchedule. -"); -TokenCredential credential = new DefaultAzureCredential(); -BatchClient client = new BatchClient(endpoint, credential); - -BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration -{ - RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), -}, new BatchJobSpecification(new BatchPoolInfo -{ - PoolId = "poolId", -})); -Response response = client.CreateJobSchedule(jobSchedule); -]]> -This sample shows how to call CreateJobSchedule. -"); -TokenCredential credential = new DefaultAzureCredential(); -BatchClient client = new BatchClient(endpoint, credential); - -BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration -{ - DoNotRunUntil = DateTimeOffset.Parse("2014-09-10T02:30:00.000Z"), - DoNotRunAfter = DateTimeOffset.Parse("2014-09-10T06:30:00.000Z"), - StartWindow = XmlConvert.ToTimeSpan("PT1M"), - RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), -}, new BatchJobSpecification(new BatchPoolInfo -{ - AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.JobSchedule) - { - AutoPoolIdPrefix = "mypool", - Pool = new BatchPoolSpecification("Standard_D1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TaskSlotsPerNode = 2, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 3, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - StartTask = new BatchStartTask("myprogram2.exe") - { - ResourceFiles = {new ResourceFile - { - HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", - FilePath = "myprogram2.exe", - }}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") - { - Value = "myvalue", - }}, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - MaxTaskRetryCount = 2, - WaitForSuccess = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, - }, - }, -}) -{ - Priority = 100, - Constraints = new BatchJobConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = -1, - }, - JobManagerTask = new BatchJobManagerTask("mytask1", "myprogram.exe") - { - ResourceFiles = {new ResourceFile - { - HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", - FilePath = "myprogram.exe", - }, new ResourceFile - { - HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", - FilePath = "test.txt", - }}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") - { - Value = "myvalue", - }}, - Constraints = new BatchTaskConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - RetentionTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = 0, - }, - RequiredSlots = 2, - KillJobOnCompletion = true, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, - RunExclusive = true, - }, -}) -{ - Metadata = { new MetadataItem("myproperty", "myvalue") }, -}; + + +This sample shows how to call CreateJobSchedule. +"); +TokenCredential credential = new DefaultAzureCredential(); +BatchClient client = new BatchClient(endpoint, credential); + +BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); +Response response = client.CreateJobSchedule(jobSchedule); +]]> +This sample shows how to call CreateJobSchedule. +"); +TokenCredential credential = new DefaultAzureCredential(); +BatchClient client = new BatchClient(endpoint, credential); + +BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); Response response = client.CreateJobSchedule(jobSchedule); ]]> @@ -3705,21 +1885,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "jobScheduleId", - schedule = new - { - recurrenceInterval = "PT5M", - }, - jobSpecification = new - { - poolInfo = new - { - poolId = "poolId", - }, - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateJobScheduleAsync(content); Console.WriteLine(response.Status); @@ -3730,149 +1896,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "jobScheduleId", - schedule = new - { - doNotRunUntil = "2014-09-10T02:30:00.000Z", - doNotRunAfter = "2014-09-10T06:30:00.000Z", - startWindow = "PT1M", - recurrenceInterval = "PT5M", - }, - jobSpecification = new - { - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - jobManagerTask = new - { - id = "mytask1", - commandLine = "myprogram.exe", - resourceFiles = new object[] - { - new - { - httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", - filePath = "myprogram.exe", - }, - new - { - httpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", - filePath = "test.txt", - } - }, - environmentSettings = new object[] - { - new - { - name = "myvariable", - value = "myvalue", - } - }, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = 0, - retentionTime = "PT1H", - }, - requiredSlots = 2, - killJobOnCompletion = true, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, - runExclusive = true, - }, - poolInfo = new - { - autoPoolSpecification = new - { - autoPoolIdPrefix = "mypool", - poolLifetimeOption = "jobschedule", - pool = new - { - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 3, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 2, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - startTask = new - { - commandLine = "myprogram2.exe", - resourceFiles = new object[] - { - new - { - httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", - filePath = "myprogram2.exe", - } - }, - environmentSettings = new object[] - { - new - { - name = "myvariable", - value = "myvalue", - } - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - maxTaskRetryCount = 2, - waitForSuccess = true, - }, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, - targetNodeCommunicationMode = "default", - }, - }, - }, - }, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateJobScheduleAsync(content); Console.WriteLine(response.Status); @@ -3886,21 +1910,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "jobScheduleId", - schedule = new - { - recurrenceInterval = "PT5M", - }, - jobSpecification = new - { - poolInfo = new - { - poolId = "poolId", - }, - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateJobSchedule(content); Console.WriteLine(response.Status); @@ -3911,149 +1921,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "jobScheduleId", - schedule = new - { - doNotRunUntil = "2014-09-10T02:30:00.000Z", - doNotRunAfter = "2014-09-10T06:30:00.000Z", - startWindow = "PT1M", - recurrenceInterval = "PT5M", - }, - jobSpecification = new - { - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - jobManagerTask = new - { - id = "mytask1", - commandLine = "myprogram.exe", - resourceFiles = new object[] - { - new - { - httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", - filePath = "myprogram.exe", - }, - new - { - httpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", - filePath = "test.txt", - } - }, - environmentSettings = new object[] - { - new - { - name = "myvariable", - value = "myvalue", - } - }, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = 0, - retentionTime = "PT1H", - }, - requiredSlots = 2, - killJobOnCompletion = true, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, - runExclusive = true, - }, - poolInfo = new - { - autoPoolSpecification = new - { - autoPoolIdPrefix = "mypool", - poolLifetimeOption = "jobschedule", - pool = new - { - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 3, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 2, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - startTask = new - { - commandLine = "myprogram2.exe", - resourceFiles = new object[] - { - new - { - httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", - filePath = "myprogram2.exe", - } - }, - environmentSettings = new object[] - { - new - { - name = "myvariable", - value = "myvalue", - } - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - maxTaskRetryCount = 2, - waitForSuccess = true, - }, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, - targetNodeCommunicationMode = "default", - }, - }, - }, - }, - metadata = new object[] - { - new - { - name = "myproperty", - value = "myvalue", - } - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateJobSchedule(content); Console.WriteLine(response.Status); @@ -4067,7 +1935,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1"); +BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = await client.CreateTaskAsync("jobId", task); ]]> This sample shows how to call CreateTaskAsync. @@ -4076,21 +1944,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "bash -c 'echo hello'") -{ - ContainerSettings = new BatchTaskContainerSettings("ubuntu") - { - ContainerRunOptions = "--rm", - }, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, -}; +BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = await client.CreateTaskAsync("jobId", task); ]]> This sample shows how to call CreateTaskAsync. @@ -4099,24 +1953,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "cmd /c exit 3") -{ - ExitConditions = new ExitConditions - { - ExitCodeRanges = {new ExitCodeRangeMapping(2, 4, new ExitOptions - { - JobAction = BatchJobAction.Terminate, - })}, - }, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, -}; +BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = await client.CreateTaskAsync("jobId", task); ]]> This sample shows how to call CreateTaskAsync. @@ -4125,10 +1962,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1") -{ - RequiredSlots = 2, -}; +BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = await client.CreateTaskAsync("jobId", task); ]]> @@ -4140,7 +1974,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1"); +BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = client.CreateTask("jobId", task); ]]> This sample shows how to call CreateTask. @@ -4149,21 +1983,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "bash -c 'echo hello'") -{ - ContainerSettings = new BatchTaskContainerSettings("ubuntu") - { - ContainerRunOptions = "--rm", - }, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, -}; +BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = client.CreateTask("jobId", task); ]]> This sample shows how to call CreateTask. @@ -4172,24 +1992,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "cmd /c exit 3") -{ - ExitConditions = new ExitConditions - { - ExitCodeRanges = {new ExitCodeRangeMapping(2, 4, new ExitOptions - { - JobAction = BatchJobAction.Terminate, - })}, - }, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, -}; +BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = client.CreateTask("jobId", task); ]]> This sample shows how to call CreateTask. @@ -4198,10 +2001,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1") -{ - RequiredSlots = 2, -}; +BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = client.CreateTask("jobId", task); ]]> @@ -4213,11 +2013,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "task1", - commandLine = "cmd /c echo task1", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -4228,24 +2024,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "taskId", - commandLine = "bash -c 'echo hello'", - containerSettings = new - { - imageName = "ubuntu", - containerRunOptions = "--rm", - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -4256,34 +2035,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "taskId", - commandLine = "cmd /c exit 3", - exitConditions = new - { - exitCodeRanges = new object[] - { - new - { - start = 2, - end = 4, - exitOptions = new - { - jobAction = "terminate", - }, - } - }, - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -4294,12 +2046,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "task1", - requiredSlots = 2, - commandLine = "cmd /c echo task1", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -4313,11 +2060,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "task1", - commandLine = "cmd /c echo task1", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -4328,24 +2071,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "taskId", - commandLine = "bash -c 'echo hello'", - containerSettings = new - { - imageName = "ubuntu", - containerRunOptions = "--rm", - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -4356,34 +2082,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "taskId", - commandLine = "cmd /c exit 3", - exitConditions = new - { - exitCodeRanges = new object[] - { - new - { - start = 2, - end = 4, - exitOptions = new - { - jobAction = "terminate", - }, - } - }, - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -4394,12 +2093,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - id = "task1", - requiredSlots = 2, - commandLine = "cmd /c echo task1", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -4413,11 +2107,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] -{ - new BatchTaskCreateContent("simple1", "cmd /c dir /s"), - new BatchTaskCreateContent("simple2", "cmd /c dir /s") -}); +BatchTaskGroup taskCollection = new BatchTaskGroup(null); Response response = await client.CreateTaskCollectionAsync("jobId", taskCollection); ]]> This sample shows how to call CreateTaskCollectionAsync. @@ -4426,42 +2116,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] -{ - new BatchTaskCreateContent("complex1", "cmd /c dir /s") - { - ResourceFiles = {new ResourceFile - { - AutoStorageContainerName = "containerName", - FilePath = "data", - }}, - EnvironmentSettings = {new EnvironmentSetting("env1") - { - Value = "value1", - }, new EnvironmentSetting("env2") - { - Value = "value2", - }}, - AffinityInfo = new AffinityInfo("affinityId"), - Constraints = new BatchTaskConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("P1D"), - RetentionTime = XmlConvert.ToTimeSpan("P2D"), - MaxTaskRetryCount = 5, - }, - RequiredSlots = 2, - MultiInstanceSettings = new MultiInstanceSettings("cmd /c echo coordinating") - { - NumberOfInstances = 3, - CommonResourceFiles = {new ResourceFile - { - HttpUrl = "https://common.blob.core.windows.net/", - FilePath = "common.exe", - }}, - }, - }, - new BatchTaskCreateContent("simple3", "cmd /c dir /s") -}); +BatchTaskGroup taskCollection = new BatchTaskGroup(null); Response response = await client.CreateTaskCollectionAsync("jobId", taskCollection); ]]> @@ -4473,11 +2128,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] -{ - new BatchTaskCreateContent("simple1", "cmd /c dir /s"), - new BatchTaskCreateContent("simple2", "cmd /c dir /s") -}); +BatchTaskGroup taskCollection = new BatchTaskGroup(null); Response response = client.CreateTaskCollection("jobId", taskCollection); ]]> This sample shows how to call CreateTaskCollection. @@ -4486,42 +2137,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] -{ - new BatchTaskCreateContent("complex1", "cmd /c dir /s") - { - ResourceFiles = {new ResourceFile - { - AutoStorageContainerName = "containerName", - FilePath = "data", - }}, - EnvironmentSettings = {new EnvironmentSetting("env1") - { - Value = "value1", - }, new EnvironmentSetting("env2") - { - Value = "value2", - }}, - AffinityInfo = new AffinityInfo("affinityId"), - Constraints = new BatchTaskConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("P1D"), - RetentionTime = XmlConvert.ToTimeSpan("P2D"), - MaxTaskRetryCount = 5, - }, - RequiredSlots = 2, - MultiInstanceSettings = new MultiInstanceSettings("cmd /c echo coordinating") - { - NumberOfInstances = 3, - CommonResourceFiles = {new ResourceFile - { - HttpUrl = "https://common.blob.core.windows.net/", - FilePath = "common.exe", - }}, - }, - }, - new BatchTaskCreateContent("simple3", "cmd /c dir /s") -}); +BatchTaskGroup taskCollection = new BatchTaskGroup(null); Response response = client.CreateTaskCollection("jobId", taskCollection); ]]> @@ -4533,22 +2149,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - value = new object[] - { - new - { - id = "simple1", - commandLine = "cmd /c dir /s", - }, - new - { - id = "simple2", - commandLine = "cmd /c dir /s", - } - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskCollectionAsync("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -4560,67 +2161,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - value = new object[] - { - new - { - id = "complex1", - commandLine = "cmd /c dir /s", - resourceFiles = new object[] - { - new - { - autoStorageContainerName = "containerName", - filePath = "data", - } - }, - environmentSettings = new object[] - { - new - { - name = "env1", - value = "value1", - }, - new - { - name = "env2", - value = "value2", - } - }, - affinityInfo = new - { - affinityId = "affinityId", - }, - constraints = new - { - maxWallClockTime = "P1D", - retentionTime = "P2D", - maxTaskRetryCount = 5, - }, - requiredSlots = 2, - multiInstanceSettings = new - { - numberOfInstances = 3, - coordinationCommandLine = "cmd /c echo coordinating", - commonResourceFiles = new object[] - { - new - { - httpUrl = "https://common.blob.core.windows.net/", - filePath = "common.exe", - } - }, - }, - }, - new - { - id = "simple3", - commandLine = "cmd /c dir /s", - } - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskCollectionAsync("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -4635,22 +2176,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - value = new object[] - { - new - { - id = "simple1", - commandLine = "cmd /c dir /s", - }, - new - { - id = "simple2", - commandLine = "cmd /c dir /s", - } - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTaskCollection("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -4662,67 +2188,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - value = new object[] - { - new - { - id = "complex1", - commandLine = "cmd /c dir /s", - resourceFiles = new object[] - { - new - { - autoStorageContainerName = "containerName", - filePath = "data", - } - }, - environmentSettings = new object[] - { - new - { - name = "env1", - value = "value1", - }, - new - { - name = "env2", - value = "value2", - } - }, - affinityInfo = new - { - affinityId = "affinityId", - }, - constraints = new - { - maxWallClockTime = "P1D", - retentionTime = "P2D", - maxTaskRetryCount = 5, - }, - requiredSlots = 2, - multiInstanceSettings = new - { - numberOfInstances = 3, - coordinationCommandLine = "cmd /c echo coordinating", - commonResourceFiles = new object[] - { - new - { - httpUrl = "https://common.blob.core.windows.net/", - filePath = "common.exe", - } - }, - }, - }, - new - { - id = "simple3", - commandLine = "cmd /c dir /s", - } - }, -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTaskCollection("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -5025,12 +2491,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeUserCreateContent user = new BatchNodeUserCreateContent("userName") -{ - IsAdmin = false, - ExpiryTime = DateTimeOffset.Parse("2017-08-01T00:00:00Z"), - Password = "Password", -}; +BatchNodeUserCreateContent user = new BatchNodeUserCreateContent(null); Response response = await client.CreateNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", user); ]]> @@ -5042,12 +2503,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeUserCreateContent user = new BatchNodeUserCreateContent("userName") -{ - IsAdmin = false, - ExpiryTime = DateTimeOffset.Parse("2017-08-01T00:00:00Z"), - Password = "Password", -}; +BatchNodeUserCreateContent user = new BatchNodeUserCreateContent(null); Response response = client.CreateNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", user); ]]> @@ -5059,13 +2515,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - name = "userName", - isAdmin = false, - expiryTime = "2017-08-01T00:00:00Z", - password = "Password", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); Console.WriteLine(response.Status); @@ -5079,13 +2529,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - name = "userName", - isAdmin = false, - expiryTime = "2017-08-01T00:00:00Z", - password = "Password", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", content); Console.WriteLine(response.Status); @@ -5125,11 +2569,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent -{ - Password = "12345", - ExpiryTime = DateTimeOffset.Parse("2016-11-27T00:45:48.7320857Z"), -}; +BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent(); Response response = await client.ReplaceNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); ]]> @@ -5141,11 +2581,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent -{ - Password = "12345", - ExpiryTime = DateTimeOffset.Parse("2016-11-27T00:45:48.7320857Z"), -}; +BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent(); Response response = client.ReplaceNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); ]]> @@ -5157,11 +2593,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - password = "12345", - expiryTime = "2016-11-27T00:45:48.7320857Z", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.ReplaceNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); Console.WriteLine(response.Status); @@ -5175,11 +2607,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - password = "12345", - expiryTime = "2016-11-27T00:45:48.7320857Z", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.ReplaceNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); Console.WriteLine(response.Status); @@ -5421,7 +2849,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent("https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", DateTimeOffset.Parse("2017-11-27T00:00:00Z")); +UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent(null, default); Response response = await client.UploadNodeLogsAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); ]]> @@ -5433,7 +2861,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent("https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", DateTimeOffset.Parse("2017-11-27T00:00:00Z")); +UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent(null, default); Response response = client.UploadNodeLogs("poolId", "tvm-1695681911_1-20161121t182739z", content); ]]> @@ -5445,11 +2873,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - containerUrl = "https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", - startTime = "2017-11-27T00:00:00Z", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = await client.UploadNodeLogsAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -5465,11 +2889,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - containerUrl = "https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", - startTime = "2017-11-27T00:00:00Z", -}); +using RequestContent content = RequestContent.Create(new object()); Response response = client.UploadNodeLogs("poolId", "tvm-1695681911_1-20161121t182739z", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; diff --git a/sdk/batch/Azure.Compute.Batch/tests/Generated/Samples/Samples_BatchClient.cs b/sdk/batch/Azure.Compute.Batch/tests/Generated/Samples/Samples_BatchClient.cs index 274be47c20ed9..30ce0376ee756 100644 --- a/sdk/batch/Azure.Compute.Batch/tests/Generated/Samples/Samples_BatchClient.cs +++ b/sdk/batch/Azure.Compute.Batch/tests/Generated/Samples/Samples_BatchClient.cs @@ -80,27 +80,7 @@ public void Example_Batch_CreatePool_CreatesAPoolWithAcceleratedNetworking() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "mypool01", - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - targetDedicatedNodes = 2, - networkConfiguration = new - { - enableAcceleratedNetworking = true, - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -114,27 +94,7 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithAcceleratedNetworking TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "mypool01", - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - targetDedicatedNodes = 2, - networkConfiguration = new - { - enableAcceleratedNetworking = true, - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -148,21 +108,7 @@ public void Example_Batch_CreatePool_CreatesAPoolWithAcceleratedNetworking_Conve TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool01", "Standard_D1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TargetDedicatedNodes = 2, - NetworkConfiguration = new NetworkConfiguration - { - EnableAcceleratedNetworking = true, - }, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); } @@ -174,21 +120,7 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithAcceleratedNetworking TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool01", "Standard_D1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TargetDedicatedNodes = 2, - NetworkConfiguration = new NetworkConfiguration - { - EnableAcceleratedNetworking = true, - }, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); } @@ -200,74 +132,7 @@ public void Example_Batch_CreatePool_CreatesAPoolWithMountDriveSpecified() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - mountConfiguration = new object[] - { -new -{ -azureBlobFileSystemConfiguration = new -{ -accountName = "accountName", -containerName = "blobContainerName", -accountKey = "accountKey", -relativeMountPath = "bfusepath", -}, -}, -new -{ -azureFileShareConfiguration = new -{ -accountName = "accountName", -azureFileUrl = "https://myaccount.file.core.windows.net/fileshare", -accountKey = "accountKey", -relativeMountPath = "filesharepath", -mountOptions = "mount options ver=1.0", -}, -}, -new -{ -nfsMountConfiguration = new -{ -source = "somesource nfs url", -relativeMountPath = "mountpath", -mountOptions = "mount options ver=1.0", -}, -}, -new -{ -cifsMountConfiguration = new -{ -username = "accountName", -password = "password", -source = "//myaccount.file.core.windows.net/file", -relativeMountPath = "mountpath", -mountOptions = "mount options ver=1.0", -}, -} - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -281,74 +146,7 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithMountDriveSpecified_A TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - mountConfiguration = new object[] - { -new -{ -azureBlobFileSystemConfiguration = new -{ -accountName = "accountName", -containerName = "blobContainerName", -accountKey = "accountKey", -relativeMountPath = "bfusepath", -}, -}, -new -{ -azureFileShareConfiguration = new -{ -accountName = "accountName", -azureFileUrl = "https://myaccount.file.core.windows.net/fileshare", -accountKey = "accountKey", -relativeMountPath = "filesharepath", -mountOptions = "mount options ver=1.0", -}, -}, -new -{ -nfsMountConfiguration = new -{ -source = "somesource nfs url", -relativeMountPath = "mountpath", -mountOptions = "mount options ver=1.0", -}, -}, -new -{ -cifsMountConfiguration = new -{ -username = "accountName", -password = "password", -source = "//myaccount.file.core.windows.net/file", -relativeMountPath = "mountpath", -mountOptions = "mount options ver=1.0", -}, -} - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -362,46 +160,7 @@ public void Example_Batch_CreatePool_CreatesAPoolWithMountDriveSpecified_Conveni TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04"), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - MountConfiguration = {new MountConfiguration -{ -AzureBlobFileSystemConfiguration = new AzureBlobFileSystemConfiguration("accountName", "blobContainerName", "bfusepath") -{ -AccountKey = "accountKey", -}, -}, new MountConfiguration -{ -AzureFileShareConfiguration = new AzureFileShareConfiguration("accountName", "https://myaccount.file.core.windows.net/fileshare", "accountKey", "filesharepath") -{ -MountOptions = "mount options ver=1.0", -}, -}, new MountConfiguration -{ -NfsMountConfiguration = new NfsMountConfiguration("somesource nfs url", "mountpath") -{ -MountOptions = "mount options ver=1.0", -}, -}, new MountConfiguration -{ -CifsMountConfiguration = new CifsMountConfiguration("accountName", "//myaccount.file.core.windows.net/file", "mountpath", "password") -{ -MountOptions = "mount options ver=1.0", -}, -}}, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); } @@ -413,46 +172,7 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithMountDriveSpecified_C TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04"), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - MountConfiguration = {new MountConfiguration -{ -AzureBlobFileSystemConfiguration = new AzureBlobFileSystemConfiguration("accountName", "blobContainerName", "bfusepath") -{ -AccountKey = "accountKey", -}, -}, new MountConfiguration -{ -AzureFileShareConfiguration = new AzureFileShareConfiguration("accountName", "https://myaccount.file.core.windows.net/fileshare", "accountKey", "filesharepath") -{ -MountOptions = "mount options ver=1.0", -}, -}, new MountConfiguration -{ -NfsMountConfiguration = new NfsMountConfiguration("somesource nfs url", "mountpath") -{ -MountOptions = "mount options ver=1.0", -}, -}, new MountConfiguration -{ -CifsMountConfiguration = new CifsMountConfiguration("accountName", "//myaccount.file.core.windows.net/file", "mountpath", "password") -{ -MountOptions = "mount options ver=1.0", -}, -}}, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); } @@ -464,39 +184,7 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "mypool001", - vmSize = "standard_d2s_v3", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - osDisk = new - { - diskSizeGB = 100, - managedDisk = new - { - storageAccountType = "standardssd_lrs", - }, - caching = "readwrite", - ephemeralOSDiskSettings = new - { - placement = "cachedisk", - }, - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 1, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 1, - enableAutoScale = false, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -510,39 +198,7 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "mypool001", - vmSize = "standard_d2s_v3", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - osDisk = new - { - diskSizeGB = 100, - managedDisk = new - { - storageAccountType = "standardssd_lrs", - }, - caching = "readwrite", - ephemeralOSDiskSettings = new - { - placement = "cachedisk", - }, - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 1, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 1, - enableAutoScale = false, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -556,32 +212,7 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "standard_d2s_v3") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04") - { - OsDisk = new OSDisk - { - EphemeralOSDiskSettings = new DiffDiskSettings - { - Placement = DiffDiskPlacement.CacheDisk, - }, - Caching = CachingType.ReadWrite, - DiskSizeGB = 100, - ManagedDisk = new ManagedDisk(StorageAccountType.StandardSSDLRS), - }, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 1, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 1, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); } @@ -593,32 +224,7 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "standard_d2s_v3") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04") - { - OsDisk = new OSDisk - { - EphemeralOSDiskSettings = new DiffDiskSettings - { - Placement = DiffDiskPlacement.CacheDisk, - }, - Caching = CachingType.ReadWrite, - DiskSizeGB = 100, - ManagedDisk = new ManagedDisk(StorageAccountType.StandardSSDLRS), - }, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 1, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 1, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); } @@ -630,28 +236,7 @@ public void Example_Batch_CreatePool_CreatesASimplePoolWithResourceTags() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "mypool001", - vmSize = "STANDARD_DC2s_V2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "18_04-lts-gen2", - version = "latest", - }, - nodeAgentSKUId = "batch.node.ubuntu 18.04", - }, - targetDedicatedNodes = 1, - resourceTags = new - { - TagName1 = "TagValue1", - TagName2 = "TagValue2", - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -665,28 +250,7 @@ public async Task Example_Batch_CreatePool_CreatesASimplePoolWithResourceTags_As TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "mypool001", - vmSize = "STANDARD_DC2s_V2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "18_04-lts-gen2", - version = "latest", - }, - nodeAgentSKUId = "batch.node.ubuntu 18.04", - }, - targetDedicatedNodes = 1, - resourceTags = new - { - TagName1 = "TagValue1", - TagName2 = "TagValue2", - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -700,22 +264,7 @@ public void Example_Batch_CreatePool_CreatesASimplePoolWithResourceTags_Convenie TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "18_04-lts-gen2", - Version = "latest", - }, "batch.node.ubuntu 18.04"), - ResourceTags = -{ -["TagName1"] = "TagValue1", -["TagName2"] = "TagValue2" -}, - TargetDedicatedNodes = 1, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); } @@ -727,22 +276,7 @@ public async Task Example_Batch_CreatePool_CreatesASimplePoolWithResourceTags_Co TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "18_04-lts-gen2", - Version = "latest", - }, "batch.node.ubuntu 18.04"), - ResourceTags = -{ -["TagName1"] = "TagValue1", -["TagName2"] = "TagValue2" -}, - TargetDedicatedNodes = 1, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); } @@ -754,32 +288,7 @@ public void Example_Batch_CreatePool_CreatesAPoolWithSecurityProfile() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "mypool001", - vmSize = "STANDARD_DC2s_V2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "18_04-lts-gen2", - version = "latest", - }, - nodeAgentSKUId = "batch.node.ubuntu 18.04", - securityProfile = new - { - securityType = "trustedLaunch", - encryptionAtHost = true, - uefiSettings = new - { - secureBootEnabled = false, - }, - }, - }, - targetDedicatedNodes = 1, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -793,32 +302,7 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithSecurityProfile_Async TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "mypool001", - vmSize = "STANDARD_DC2s_V2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "UbuntuServer", - sku = "18_04-lts-gen2", - version = "latest", - }, - nodeAgentSKUId = "batch.node.ubuntu 18.04", - securityProfile = new - { - securityType = "trustedLaunch", - encryptionAtHost = true, - uefiSettings = new - { - secureBootEnabled = false, - }, - }, - }, - targetDedicatedNodes = 1, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -832,23 +316,7 @@ public void Example_Batch_CreatePool_CreatesAPoolWithSecurityProfile_Convenience TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "18_04-lts-gen2", - Version = "latest", - }, "batch.node.ubuntu 18.04") - { - SecurityProfile = new SecurityProfile(true, SecurityTypes.TrustedLaunch, new UefiSettings - { - SecureBootEnabled = false, - }), - }, - TargetDedicatedNodes = 1, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); } @@ -860,23 +328,7 @@ public async Task Example_Batch_CreatePool_CreatesAPoolWithSecurityProfile_Conve TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool001", "STANDARD_DC2s_V2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "UbuntuServer", - Sku = "18_04-lts-gen2", - Version = "latest", - }, "batch.node.ubuntu 18.04") - { - SecurityProfile = new SecurityProfile(true, SecurityTypes.TrustedLaunch, new UefiSettings - { - SecureBootEnabled = false, - }), - }, - TargetDedicatedNodes = 1, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); } @@ -888,39 +340,7 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPool() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -934,39 +354,7 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -980,23 +368,7 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPool_Con TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04"), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - Metadata = { new MetadataItem("myproperty", "myvalue") }, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); } @@ -1008,23 +380,7 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04"), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - Metadata = { new MetadataItem("myproperty", "myvalue") }, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); } @@ -1036,38 +392,7 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "120_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - containerConfiguration = new - { - type = "dockerCompatible", - containerImageNames = new object[] - { -"busybox" - }, - }, - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1081,38 +406,7 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "120_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - containerConfiguration = new - { - type = "dockerCompatible", - containerImageNames = new object[] - { -"busybox" - }, - }, - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -1126,27 +420,7 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "120_04-lts", - }, "batch.node.ubuntu 20.04") - { - ContainerConfiguration = new ContainerConfiguration(ContainerType.DockerCompatible) - { - ContainerImageNames = { "busybox" }, - }, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); } @@ -1158,27 +432,7 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "120_04-lts", - }, "batch.node.ubuntu 20.04") - { - ContainerConfiguration = new ContainerConfiguration(ContainerType.DockerCompatible) - { - ContainerImageNames = { "busybox" }, - }, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); } @@ -1190,57 +444,7 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - extensions = new object[] - { -new -{ -name = "batchextension1", -type = "KeyVaultForLinux", -publisher = "Microsoft.Azure.KeyVault", -typeHandlerVersion = "2.0", -autoUpgradeMinorVersion = true, -enableAutomaticUpgrade = true, -settings = new -{ -secretsManagementSettingsKey = "secretsManagementSettingsValue", -authenticationSettingsKey = "authenticationSettingsValue", -}, -} - }, - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - targetNodeCommunicationMode = "simplified", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1254,57 +458,7 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "pool2", - vmSize = "standard_a1", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "Canonical", - offer = "0001-com-ubuntu-server-focal", - sku = "20_04-lts", - }, - nodeAgentSKUId = "batch.node.ubuntu 20.04", - extensions = new object[] - { -new -{ -name = "batchextension1", -type = "KeyVaultForLinux", -publisher = "Microsoft.Azure.KeyVault", -typeHandlerVersion = "2.0", -autoUpgradeMinorVersion = true, -enableAutomaticUpgrade = true, -settings = new -{ -secretsManagementSettingsKey = "secretsManagementSettingsValue", -authenticationSettingsKey = "authenticationSettingsValue", -}, -} - }, - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 5, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 3, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - targetNodeCommunicationMode = "simplified", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -1318,37 +472,7 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04") - { - Extensions = {new VMExtension("batchextension1", "Microsoft.Azure.KeyVault", "KeyVaultForLinux") -{ -TypeHandlerVersion = "2.0", -AutoUpgradeMinorVersion = true, -EnableAutomaticUpgrade = true, -Settings = -{ -["secretsManagementSettingsKey"] = "secretsManagementSettingsValue", -["authenticationSettingsKey"] = "authenticationSettingsValue" -}, -}}, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Simplified, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); } @@ -1360,37 +484,7 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("pool2", "standard_a1") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "Canonical", - Offer = "0001-com-ubuntu-server-focal", - Sku = "20_04-lts", - }, "batch.node.ubuntu 20.04") - { - Extensions = {new VMExtension("batchextension1", "Microsoft.Azure.KeyVault", "KeyVaultForLinux") -{ -TypeHandlerVersion = "2.0", -AutoUpgradeMinorVersion = true, -EnableAutomaticUpgrade = true, -Settings = -{ -["secretsManagementSettingsKey"] = "secretsManagementSettingsValue", -["authenticationSettingsKey"] = "authenticationSettingsValue" -}, -}}, - }, - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 5, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - TaskSlotsPerNode = 3, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Simplified, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); } @@ -1402,31 +496,7 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "mypool002", - vmSize = "Standard_A1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - windowsConfiguration = new - { - enableAutomaticUpdates = false, - }, - serviceArtifactReference = new - { - id = "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - targetDedicatedNodes = 2, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreatePool(content); Console.WriteLine(response.Status); @@ -1440,31 +510,7 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "mypool002", - vmSize = "Standard_A1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - windowsConfiguration = new - { - enableAutomaticUpdates = false, - }, - serviceArtifactReference = new - { - id = "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - targetDedicatedNodes = 2, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreatePoolAsync(content); Console.WriteLine(response.Status); @@ -1478,24 +524,7 @@ public void Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPoolWith TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool002", "Standard_A1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64") - { - WindowsConfiguration = new WindowsConfiguration - { - EnableAutomaticUpdates = false, - }, - ServiceArtifactReference = new ServiceArtifactReference("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"), - }, - TargetDedicatedNodes = 2, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = client.CreatePool(pool); } @@ -1507,24 +536,7 @@ public async Task Example_Batch_CreatePool_CreatesAVirtualMachineConfigurationPo TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolCreateContent pool = new BatchPoolCreateContent("mypool002", "Standard_A1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64") - { - WindowsConfiguration = new WindowsConfiguration - { - EnableAutomaticUpdates = false, - }, - ServiceArtifactReference = new ServiceArtifactReference("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"), - }, - TargetDedicatedNodes = 2, - }; + BatchPoolCreateContent pool = new BatchPoolCreateContent(null, null); Response response = await client.CreatePoolAsync(pool); } @@ -1862,13 +874,7 @@ public void Example_Batch_UpdatePool_PatchThePool() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - startTask = new - { - commandLine = "/bin/bash -c 'echo start task'", - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.UpdatePool("poolId", content); Console.WriteLine(response.Status); @@ -1882,13 +888,7 @@ public async Task Example_Batch_UpdatePool_PatchThePool_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - startTask = new - { - commandLine = "/bin/bash -c 'echo start task'", - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.UpdatePoolAsync("poolId", content); Console.WriteLine(response.Status); @@ -1928,11 +928,7 @@ public void Example_Batch_EnablePoolAutoScale_PoolEnableAutoscale() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - autoScaleFormula = "$TargetDedicated=0", - autoScaleEvaluationInterval = "PT8M", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.EnablePoolAutoScale("poolId", content); Console.WriteLine(response.Status); @@ -1946,11 +942,7 @@ public async Task Example_Batch_EnablePoolAutoScale_PoolEnableAutoscale_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - autoScaleFormula = "$TargetDedicated=0", - autoScaleEvaluationInterval = "PT8M", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.EnablePoolAutoScaleAsync("poolId", content); Console.WriteLine(response.Status); @@ -1964,11 +956,7 @@ public void Example_Batch_EnablePoolAutoScale_PoolEnableAutoscale_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent - { - AutoScaleFormula = "$TargetDedicated=0", - AutoScaleEvaluationInterval = XmlConvert.ToTimeSpan("PT8M"), - }; + BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent(); Response response = client.EnablePoolAutoScale("poolId", content); } @@ -1980,11 +968,7 @@ public async Task Example_Batch_EnablePoolAutoScale_PoolEnableAutoscale_Convenie TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent - { - AutoScaleFormula = "$TargetDedicated=0", - AutoScaleEvaluationInterval = XmlConvert.ToTimeSpan("PT8M"), - }; + BatchPoolEnableAutoScaleContent content = new BatchPoolEnableAutoScaleContent(); Response response = await client.EnablePoolAutoScaleAsync("poolId", content); } @@ -1996,10 +980,7 @@ public void Example_Batch_EvaluatePoolAutoScale_PoolEvaluateAutoscale() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - autoScaleFormula = "$TargetDedicated=1", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.EvaluatePoolAutoScale("poolId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2014,10 +995,7 @@ public async Task Example_Batch_EvaluatePoolAutoScale_PoolEvaluateAutoscale_Asyn TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - autoScaleFormula = "$TargetDedicated=1", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.EvaluatePoolAutoScaleAsync("poolId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -2032,7 +1010,7 @@ public void Example_Batch_EvaluatePoolAutoScale_PoolEvaluateAutoscale_Convenienc TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent("$TargetDedicated=1"); + BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent(null); Response response = client.EvaluatePoolAutoScale("poolId", content); } @@ -2044,7 +1022,7 @@ public async Task Example_Batch_EvaluatePoolAutoScale_PoolEvaluateAutoscale_Conv TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent("$TargetDedicated=1"); + BatchPoolEvaluateAutoScaleContent content = new BatchPoolEvaluateAutoScaleContent(null); Response response = await client.EvaluatePoolAutoScaleAsync("poolId", content); } @@ -2056,11 +1034,7 @@ public void Example_Batch_ResizePool_PoolResize() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - targetDedicatedNodes = 1, - targetLowPriorityNodes = 0, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.ResizePool("resizePool", content); Console.WriteLine(response.Status); @@ -2074,11 +1048,7 @@ public async Task Example_Batch_ResizePool_PoolResize_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - targetDedicatedNodes = 1, - targetLowPriorityNodes = 0, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.ResizePoolAsync("resizePool", content); Console.WriteLine(response.Status); @@ -2092,11 +1062,7 @@ public void Example_Batch_ResizePool_PoolResize_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolResizeContent content = new BatchPoolResizeContent - { - TargetDedicatedNodes = 1, - TargetLowPriorityNodes = 0, - }; + BatchPoolResizeContent content = new BatchPoolResizeContent(); Response response = client.ResizePool("resizePool", content); } @@ -2108,11 +1074,7 @@ public async Task Example_Batch_ResizePool_PoolResize_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolResizeContent content = new BatchPoolResizeContent - { - TargetDedicatedNodes = 1, - TargetLowPriorityNodes = 0, - }; + BatchPoolResizeContent content = new BatchPoolResizeContent(); Response response = await client.ResizePoolAsync("resizePool", content); } @@ -2150,15 +1112,7 @@ public void Example_Batch_ReplacePoolProperties_PoolUpdate() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - startTask = new - { - commandLine = "/bin/bash -c 'echo start task'", - }, - applicationPackageReferences = Array.Empty(), - metadata = Array.Empty(), - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.ReplacePoolProperties("poolId", content); Console.WriteLine(response.Status); @@ -2172,15 +1126,7 @@ public async Task Example_Batch_ReplacePoolProperties_PoolUpdate_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - startTask = new - { - commandLine = "/bin/bash -c 'echo start task'", - }, - applicationPackageReferences = Array.Empty(), - metadata = Array.Empty(), - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.ReplacePoolPropertiesAsync("poolId", content); Console.WriteLine(response.Status); @@ -2194,10 +1140,7 @@ public void Example_Batch_ReplacePoolProperties_PoolUpdate_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolReplaceContent pool = new BatchPoolReplaceContent(Array.Empty(), Array.Empty()) - { - StartTask = new BatchStartTask("/bin/bash -c 'echo start task'"), - }; + BatchPoolReplaceContent pool = new BatchPoolReplaceContent(null, null); Response response = client.ReplacePoolProperties("poolId", pool); } @@ -2209,10 +1152,7 @@ public async Task Example_Batch_ReplacePoolProperties_PoolUpdate_Convenience_Asy TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchPoolReplaceContent pool = new BatchPoolReplaceContent(Array.Empty(), Array.Empty()) - { - StartTask = new BatchStartTask("/bin/bash -c 'echo start task'"), - }; + BatchPoolReplaceContent pool = new BatchPoolReplaceContent(null, null); Response response = await client.ReplacePoolPropertiesAsync("poolId", pool); } @@ -2224,14 +1164,7 @@ public void Example_Batch_RemoveNodes_PoolRemoveNodes() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - nodeList = new object[] - { -"tvm-1695681911_1-20161122t224741z", -"tvm-1695681911_2-20161122t224741z" - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.RemoveNodes("poolId", content); Console.WriteLine(response.Status); @@ -2245,14 +1178,7 @@ public async Task Example_Batch_RemoveNodes_PoolRemoveNodes_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - nodeList = new object[] - { -"tvm-1695681911_1-20161122t224741z", -"tvm-1695681911_2-20161122t224741z" - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.RemoveNodesAsync("poolId", content); Console.WriteLine(response.Status); @@ -2266,7 +1192,7 @@ public void Example_Batch_RemoveNodes_PoolRemoveNodes_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeRemoveContent content = new BatchNodeRemoveContent(new string[] { "tvm-1695681911_1-20161122t224741z", "tvm-1695681911_2-20161122t224741z" }); + BatchNodeRemoveContent content = new BatchNodeRemoveContent(null); Response response = client.RemoveNodes("poolId", content); } @@ -2278,7 +1204,7 @@ public async Task Example_Batch_RemoveNodes_PoolRemoveNodes_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeRemoveContent content = new BatchNodeRemoveContent(new string[] { "tvm-1695681911_1-20161122t224741z", "tvm-1695681911_2-20161122t224741z" }); + BatchNodeRemoveContent content = new BatchNodeRemoveContent(null); Response response = await client.RemoveNodesAsync("poolId", content); } @@ -2366,19 +1292,7 @@ public void Example_Batch_UpdateJob_JobPatch() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - poolInfo = new - { - poolId = "poolId", - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.UpdateJob("jobId", content); Console.WriteLine(response.Status); @@ -2392,19 +1306,7 @@ public async Task Example_Batch_UpdateJob_JobPatch_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - poolInfo = new - { - poolId = "poolId", - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.UpdateJobAsync("jobId", content); Console.WriteLine(response.Status); @@ -2516,10 +1418,7 @@ public void Example_Batch_DisableJob_JobDisable() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - disableTasks = "terminate", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.DisableJob("jobId", content); Console.WriteLine(response.Status); @@ -2533,10 +1432,7 @@ public async Task Example_Batch_DisableJob_JobDisable_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - disableTasks = "terminate", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.DisableJobAsync("jobId", content); Console.WriteLine(response.Status); @@ -2550,7 +1446,7 @@ public void Example_Batch_DisableJob_JobDisable_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobDisableContent content = new BatchJobDisableContent(DisableBatchJobOption.Terminate); + BatchJobDisableContent content = new BatchJobDisableContent(default); Response response = client.DisableJob("jobId", content); } @@ -2562,7 +1458,7 @@ public async Task Example_Batch_DisableJob_JobDisable_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobDisableContent content = new BatchJobDisableContent(DisableBatchJobOption.Terminate); + BatchJobDisableContent content = new BatchJobDisableContent(default); Response response = await client.DisableJobAsync("jobId", content); } @@ -2650,15 +1546,7 @@ public void Example_Batch_CreateJob_CreatesABasicJob() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "jobId", - priority = 0, - poolInfo = new - { - poolId = "poolId", - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateJob(content); Console.WriteLine(response.Status); @@ -2672,15 +1560,7 @@ public async Task Example_Batch_CreateJob_CreatesABasicJob_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "jobId", - priority = 0, - poolInfo = new - { - poolId = "poolId", - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateJobAsync(content); Console.WriteLine(response.Status); @@ -2694,13 +1574,7 @@ public void Example_Batch_CreateJob_CreatesABasicJob_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo - { - PoolId = "poolId", - }) - { - Priority = 0, - }; + BatchJobCreateContent job = new BatchJobCreateContent(null, null); Response response = client.CreateJob(job); } @@ -2708,161 +1582,23 @@ public void Example_Batch_CreateJob_CreatesABasicJob_Convenience() [Ignore("Only validating compilation of examples")] public async Task Example_Batch_CreateJob_CreatesABasicJob_Convenience_Async() { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - BatchClient client = new BatchClient(endpoint, credential); - - BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo - { - PoolId = "poolId", - }) - { - Priority = 0, - }; - Response response = await client.CreateJobAsync(job); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_Batch_CreateJob_CreatesAComplexJob() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - BatchClient client = new BatchClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - id = "jobId", - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - jobManagerTask = new - { - id = "taskId", - commandLine = "myprogram.exe", - resourceFiles = new object[] - { -new -{ -httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", -filePath = "myprogram.exe", -}, -new -{ -storageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", -filePath = "datafolder", -} - }, - environmentSettings = new object[] - { -new -{ -name = "myvariable", -value = "myvalue", -} - }, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = 0, - retentionTime = "PT1H", - }, - requiredSlots = 2, - killJobOnCompletion = false, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - runExclusive = true, - }, - poolInfo = new - { - autoPoolSpecification = new - { - autoPoolIdPrefix = "mypool", - poolLifetimeOption = "job", - pool = new - { - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 3, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 2, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - startTask = new - { - commandLine = "myprogram2.exe", - resourceFiles = new object[] - { -new -{ -httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", -filePath = "myprogram2.exe", -} - }, - environmentSettings = new object[] - { -new -{ -name = "myvariable", -value = "myvalue", -} - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - maxTaskRetryCount = 2, - waitForSuccess = true, - }, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - targetNodeCommunicationMode = "default", - }, - }, - }, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - }); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + BatchClient client = new BatchClient(endpoint, credential); + + BatchJobCreateContent job = new BatchJobCreateContent(null, null); + Response response = await client.CreateJobAsync(job); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Batch_CreateJob_CreatesAComplexJob() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + BatchClient client = new BatchClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateJob(content); Console.WriteLine(response.Status); @@ -2876,139 +1612,7 @@ public async Task Example_Batch_CreateJob_CreatesAComplexJob_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "jobId", - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - jobManagerTask = new - { - id = "taskId", - commandLine = "myprogram.exe", - resourceFiles = new object[] - { -new -{ -httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", -filePath = "myprogram.exe", -}, -new -{ -storageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", -filePath = "datafolder", -} - }, - environmentSettings = new object[] - { -new -{ -name = "myvariable", -value = "myvalue", -} - }, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = 0, - retentionTime = "PT1H", - }, - requiredSlots = 2, - killJobOnCompletion = false, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - runExclusive = true, - }, - poolInfo = new - { - autoPoolSpecification = new - { - autoPoolIdPrefix = "mypool", - poolLifetimeOption = "job", - pool = new - { - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 3, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 2, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - startTask = new - { - commandLine = "myprogram2.exe", - resourceFiles = new object[] - { -new -{ -httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", -filePath = "myprogram2.exe", -} - }, - environmentSettings = new object[] - { -new -{ -name = "myvariable", -value = "myvalue", -} - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - maxTaskRetryCount = 2, - waitForSuccess = true, - }, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - targetNodeCommunicationMode = "default", - }, - }, - }, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateJobAsync(content); Console.WriteLine(response.Status); @@ -3022,96 +1626,7 @@ public void Example_Batch_CreateJob_CreatesAComplexJob_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo - { - AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.Job) - { - AutoPoolIdPrefix = "mypool", - Pool = new BatchPoolSpecification("Standard_D1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TaskSlotsPerNode = 2, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 3, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - StartTask = new BatchStartTask("myprogram2.exe") - { - ResourceFiles = {new ResourceFile -{ -HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", -FilePath = "myprogram2.exe", -}}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") -{ -Value = "myvalue", -}}, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - MaxTaskRetryCount = 2, - WaitForSuccess = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, - }, - }, - }) - { - Priority = 100, - Constraints = new BatchJobConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = -1, - }, - JobManagerTask = new BatchJobManagerTask("taskId", "myprogram.exe") - { - ResourceFiles = {new ResourceFile -{ -HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", -FilePath = "myprogram.exe", -}, new ResourceFile -{ -StorageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", -FilePath = "datafolder", -}}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") -{ -Value = "myvalue", -}}, - Constraints = new BatchTaskConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - RetentionTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = 0, - }, - RequiredSlots = 2, - KillJobOnCompletion = false, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - RunExclusive = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, - }; + BatchJobCreateContent job = new BatchJobCreateContent(null, null); Response response = client.CreateJob(job); } @@ -3123,96 +1638,7 @@ public async Task Example_Batch_CreateJob_CreatesAComplexJob_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobCreateContent job = new BatchJobCreateContent("jobId", new BatchPoolInfo - { - AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.Job) - { - AutoPoolIdPrefix = "mypool", - Pool = new BatchPoolSpecification("Standard_D1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TaskSlotsPerNode = 2, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 3, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - StartTask = new BatchStartTask("myprogram2.exe") - { - ResourceFiles = {new ResourceFile -{ -HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", -FilePath = "myprogram2.exe", -}}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") -{ -Value = "myvalue", -}}, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - MaxTaskRetryCount = 2, - WaitForSuccess = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, - }, - }, - }) - { - Priority = 100, - Constraints = new BatchJobConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = -1, - }, - JobManagerTask = new BatchJobManagerTask("taskId", "myprogram.exe") - { - ResourceFiles = {new ResourceFile -{ -HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", -FilePath = "myprogram.exe", -}, new ResourceFile -{ -StorageContainerUrl = "http://mystorage1.blob.core.windows.net/data?sas", -FilePath = "datafolder", -}}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") -{ -Value = "myvalue", -}}, - Constraints = new BatchTaskConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - RetentionTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = 0, - }, - RequiredSlots = 2, - KillJobOnCompletion = false, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - RunExclusive = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, - }; + BatchJobCreateContent job = new BatchJobCreateContent(null, null); Response response = await client.CreateJobAsync(job); } @@ -3368,27 +1794,7 @@ public void Example_Batch_UpdateJobSchedule_JobSchedulePatch() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - schedule = new - { - doNotRunUntil = "2025-01-01T12:30:00Z", - }, - jobSpecification = new - { - priority = 0, - usesTaskDependencies = false, - constraints = new - { - maxWallClockTime = "P10675199DT2H48M5.4775807S", - maxTaskRetryCount = 0, - }, - poolInfo = new - { - poolId = "poolId", - }, - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.UpdateJobSchedule("jobScheduleId", content); Console.WriteLine(response.Status); @@ -3402,27 +1808,7 @@ public async Task Example_Batch_UpdateJobSchedule_JobSchedulePatch_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - schedule = new - { - doNotRunUntil = "2025-01-01T12:30:00Z", - }, - jobSpecification = new - { - priority = 0, - usesTaskDependencies = false, - constraints = new - { - maxWallClockTime = "P10675199DT2H48M5.4775807S", - maxTaskRetryCount = 0, - }, - poolInfo = new - { - poolId = "poolId", - }, - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.UpdateJobScheduleAsync("jobScheduleId", content); Console.WriteLine(response.Status); @@ -3642,21 +2028,7 @@ public void Example_Batch_CreateJobSchedule_CreatesABasicJobSchedule() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "jobScheduleId", - schedule = new - { - recurrenceInterval = "PT5M", - }, - jobSpecification = new - { - poolInfo = new - { - poolId = "poolId", - }, - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateJobSchedule(content); Console.WriteLine(response.Status); @@ -3670,21 +2042,7 @@ public async Task Example_Batch_CreateJobSchedule_CreatesABasicJobSchedule_Async TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "jobScheduleId", - schedule = new - { - recurrenceInterval = "PT5M", - }, - jobSpecification = new - { - poolInfo = new - { - poolId = "poolId", - }, - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateJobScheduleAsync(content); Console.WriteLine(response.Status); @@ -3698,13 +2056,7 @@ public void Example_Batch_CreateJobSchedule_CreatesABasicJobSchedule_Convenience TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration - { - RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), - }, new BatchJobSpecification(new BatchPoolInfo - { - PoolId = "poolId", - })); + BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); Response response = client.CreateJobSchedule(jobSchedule); } @@ -3716,13 +2068,7 @@ public async Task Example_Batch_CreateJobSchedule_CreatesABasicJobSchedule_Conve TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration - { - RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), - }, new BatchJobSpecification(new BatchPoolInfo - { - PoolId = "poolId", - })); + BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); Response response = await client.CreateJobScheduleAsync(jobSchedule); } @@ -3734,149 +2080,7 @@ public void Example_Batch_CreateJobSchedule_CreatesAComplexJobScheduleAdd() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "jobScheduleId", - schedule = new - { - doNotRunUntil = "2014-09-10T02:30:00.000Z", - doNotRunAfter = "2014-09-10T06:30:00.000Z", - startWindow = "PT1M", - recurrenceInterval = "PT5M", - }, - jobSpecification = new - { - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - jobManagerTask = new - { - id = "mytask1", - commandLine = "myprogram.exe", - resourceFiles = new object[] - { -new -{ -httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", -filePath = "myprogram.exe", -}, -new -{ -httpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", -filePath = "test.txt", -} - }, - environmentSettings = new object[] - { -new -{ -name = "myvariable", -value = "myvalue", -} - }, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = 0, - retentionTime = "PT1H", - }, - requiredSlots = 2, - killJobOnCompletion = true, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, - runExclusive = true, - }, - poolInfo = new - { - autoPoolSpecification = new - { - autoPoolIdPrefix = "mypool", - poolLifetimeOption = "jobschedule", - pool = new - { - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 3, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 2, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - startTask = new - { - commandLine = "myprogram2.exe", - resourceFiles = new object[] - { -new -{ -httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", -filePath = "myprogram2.exe", -} - }, - environmentSettings = new object[] - { -new -{ -name = "myvariable", -value = "myvalue", -} - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - maxTaskRetryCount = 2, - waitForSuccess = true, - }, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - targetNodeCommunicationMode = "default", - }, - }, - }, - }, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateJobSchedule(content); Console.WriteLine(response.Status); @@ -3886,153 +2090,11 @@ public void Example_Batch_CreateJobSchedule_CreatesAComplexJobScheduleAdd() [Ignore("Only validating compilation of examples")] public async Task Example_Batch_CreateJobSchedule_CreatesAComplexJobScheduleAdd_Async() { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - BatchClient client = new BatchClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - id = "jobScheduleId", - schedule = new - { - doNotRunUntil = "2014-09-10T02:30:00.000Z", - doNotRunAfter = "2014-09-10T06:30:00.000Z", - startWindow = "PT1M", - recurrenceInterval = "PT5M", - }, - jobSpecification = new - { - priority = 100, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = -1, - }, - jobManagerTask = new - { - id = "mytask1", - commandLine = "myprogram.exe", - resourceFiles = new object[] - { -new -{ -httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", -filePath = "myprogram.exe", -}, -new -{ -httpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", -filePath = "test.txt", -} - }, - environmentSettings = new object[] - { -new -{ -name = "myvariable", -value = "myvalue", -} - }, - constraints = new - { - maxWallClockTime = "PT1H", - maxTaskRetryCount = 0, - retentionTime = "PT1H", - }, - requiredSlots = 2, - killJobOnCompletion = true, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, - runExclusive = true, - }, - poolInfo = new - { - autoPoolSpecification = new - { - autoPoolIdPrefix = "mypool", - poolLifetimeOption = "jobschedule", - pool = new - { - vmSize = "Standard_D1_v2", - virtualMachineConfiguration = new - { - imageReference = new - { - publisher = "MicrosoftWindowsServer", - offer = "WindowsServer", - sku = "2016-datacenter-smalldisk", - version = "latest", - }, - nodeAgentSKUId = "batch.node.windows amd64", - }, - resizeTimeout = "PT15M", - targetDedicatedNodes = 3, - targetLowPriorityNodes = 0, - taskSlotsPerNode = 2, - taskSchedulingPolicy = new - { - nodeFillType = "spread", - }, - enableAutoScale = false, - enableInterNodeCommunication = true, - startTask = new - { - commandLine = "myprogram2.exe", - resourceFiles = new object[] - { -new -{ -httpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", -filePath = "myprogram2.exe", -} - }, - environmentSettings = new object[] - { -new -{ -name = "myvariable", -value = "myvalue", -} - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "admin", - }, - }, - maxTaskRetryCount = 2, - waitForSuccess = true, - }, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - targetNodeCommunicationMode = "default", - }, - }, - }, - }, - metadata = new object[] - { -new -{ -name = "myproperty", -value = "myvalue", -} - }, - }); + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + BatchClient client = new BatchClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateJobScheduleAsync(content); Console.WriteLine(response.Status); @@ -4046,104 +2108,7 @@ public void Example_Batch_CreateJobSchedule_CreatesAComplexJobScheduleAdd_Conven TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration - { - DoNotRunUntil = DateTimeOffset.Parse("2014-09-10T02:30:00.000Z"), - DoNotRunAfter = DateTimeOffset.Parse("2014-09-10T06:30:00.000Z"), - StartWindow = XmlConvert.ToTimeSpan("PT1M"), - RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), - }, new BatchJobSpecification(new BatchPoolInfo - { - AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.JobSchedule) - { - AutoPoolIdPrefix = "mypool", - Pool = new BatchPoolSpecification("Standard_D1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TaskSlotsPerNode = 2, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 3, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - StartTask = new BatchStartTask("myprogram2.exe") - { - ResourceFiles = {new ResourceFile -{ -HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", -FilePath = "myprogram2.exe", -}}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") -{ -Value = "myvalue", -}}, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - MaxTaskRetryCount = 2, - WaitForSuccess = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, - }, - }, - }) - { - Priority = 100, - Constraints = new BatchJobConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = -1, - }, - JobManagerTask = new BatchJobManagerTask("mytask1", "myprogram.exe") - { - ResourceFiles = {new ResourceFile -{ -HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", -FilePath = "myprogram.exe", -}, new ResourceFile -{ -HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", -FilePath = "test.txt", -}}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") -{ -Value = "myvalue", -}}, - Constraints = new BatchTaskConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - RetentionTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = 0, - }, - RequiredSlots = 2, - KillJobOnCompletion = true, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, - RunExclusive = true, - }, - }) - { - Metadata = { new MetadataItem("myproperty", "myvalue") }, - }; + BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); Response response = client.CreateJobSchedule(jobSchedule); } @@ -4155,104 +2120,7 @@ public async Task Example_Batch_CreateJobSchedule_CreatesAComplexJobScheduleAdd_ TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent("jobScheduleId", new BatchJobScheduleConfiguration - { - DoNotRunUntil = DateTimeOffset.Parse("2014-09-10T02:30:00.000Z"), - DoNotRunAfter = DateTimeOffset.Parse("2014-09-10T06:30:00.000Z"), - StartWindow = XmlConvert.ToTimeSpan("PT1M"), - RecurrenceInterval = XmlConvert.ToTimeSpan("PT5M"), - }, new BatchJobSpecification(new BatchPoolInfo - { - AutoPoolSpecification = new BatchAutoPoolSpecification(BatchPoolLifetimeOption.JobSchedule) - { - AutoPoolIdPrefix = "mypool", - Pool = new BatchPoolSpecification("Standard_D1_v2") - { - VirtualMachineConfiguration = new VirtualMachineConfiguration(new ImageReference - { - Publisher = "MicrosoftWindowsServer", - Offer = "WindowsServer", - Sku = "2016-datacenter-smalldisk", - Version = "latest", - }, "batch.node.windows amd64"), - TaskSlotsPerNode = 2, - TaskSchedulingPolicy = new BatchTaskSchedulingPolicy(BatchNodeFillType.Spread), - ResizeTimeout = XmlConvert.ToTimeSpan("PT15M"), - TargetDedicatedNodes = 3, - TargetLowPriorityNodes = 0, - EnableAutoScale = false, - EnableInterNodeCommunication = true, - StartTask = new BatchStartTask("myprogram2.exe") - { - ResourceFiles = {new ResourceFile -{ -HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram2.exe?sas", -FilePath = "myprogram2.exe", -}}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") -{ -Value = "myvalue", -}}, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.Admin, - }, - }, - MaxTaskRetryCount = 2, - WaitForSuccess = true, - }, - Metadata = { new MetadataItem("myproperty", "myvalue") }, - TargetNodeCommunicationMode = BatchNodeCommunicationMode.Default, - }, - }, - }) - { - Priority = 100, - Constraints = new BatchJobConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = -1, - }, - JobManagerTask = new BatchJobManagerTask("mytask1", "myprogram.exe") - { - ResourceFiles = {new ResourceFile -{ -HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/myprogram.exe?sas", -FilePath = "myprogram.exe", -}, new ResourceFile -{ -HttpUrl = "http://mystorage1.blob.core.windows.net/scripts/test.txt?sas", -FilePath = "test.txt", -}}, - EnvironmentSettings = {new EnvironmentSetting("myvariable") -{ -Value = "myvalue", -}}, - Constraints = new BatchTaskConstraints - { - MaxWallClockTime = XmlConvert.ToTimeSpan("PT1H"), - RetentionTime = XmlConvert.ToTimeSpan("PT1H"), - MaxTaskRetryCount = 0, - }, - RequiredSlots = 2, - KillJobOnCompletion = true, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, - RunExclusive = true, - }, - }) - { - Metadata = { new MetadataItem("myproperty", "myvalue") }, - }; + BatchJobScheduleCreateContent jobSchedule = new BatchJobScheduleCreateContent(null, null, null); Response response = await client.CreateJobScheduleAsync(jobSchedule); } @@ -4264,11 +2132,7 @@ public void Example_Batch_CreateTask_CreatesABasicTask() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "task1", - commandLine = "cmd /c echo task1", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -4282,11 +2146,7 @@ public async Task Example_Batch_CreateTask_CreatesABasicTask_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "task1", - commandLine = "cmd /c echo task1", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -4300,7 +2160,7 @@ public void Example_Batch_CreateTask_CreatesABasicTask_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1"); + BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = client.CreateTask("jobId", task); } @@ -4312,7 +2172,7 @@ public async Task Example_Batch_CreateTask_CreatesABasicTask_Convenience_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1"); + BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = await client.CreateTaskAsync("jobId", task); } @@ -4324,24 +2184,7 @@ public void Example_Batch_CreateTask_CreatesATaskWithContainerSettings() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "taskId", - commandLine = "bash -c 'echo hello'", - containerSettings = new - { - imageName = "ubuntu", - containerRunOptions = "--rm", - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -4355,24 +2198,7 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithContainerSettings_Asy TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "taskId", - commandLine = "bash -c 'echo hello'", - containerSettings = new - { - imageName = "ubuntu", - containerRunOptions = "--rm", - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -4386,21 +2212,7 @@ public void Example_Batch_CreateTask_CreatesATaskWithContainerSettings_Convenien TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "bash -c 'echo hello'") - { - ContainerSettings = new BatchTaskContainerSettings("ubuntu") - { - ContainerRunOptions = "--rm", - }, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, - }; + BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = client.CreateTask("jobId", task); } @@ -4412,21 +2224,7 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithContainerSettings_Con TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "bash -c 'echo hello'") - { - ContainerSettings = new BatchTaskContainerSettings("ubuntu") - { - ContainerRunOptions = "--rm", - }, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, - }; + BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = await client.CreateTaskAsync("jobId", task); } @@ -4438,34 +2236,7 @@ public void Example_Batch_CreateTask_CreatesATaskWithExitConditions() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "taskId", - commandLine = "cmd /c exit 3", - exitConditions = new - { - exitCodeRanges = new object[] - { -new -{ -start = 2, -end = 4, -exitOptions = new -{ -jobAction = "terminate", -}, -} - }, - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -4479,34 +2250,7 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithExitConditions_Async( TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "taskId", - commandLine = "cmd /c exit 3", - exitConditions = new - { - exitCodeRanges = new object[] - { -new -{ -start = 2, -end = 4, -exitOptions = new -{ -jobAction = "terminate", -}, -} - }, - }, - userIdentity = new - { - autoUser = new - { - scope = "task", - elevationLevel = "nonadmin", - }, - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -4520,24 +2264,7 @@ public void Example_Batch_CreateTask_CreatesATaskWithExitConditions_Convenience( TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "cmd /c exit 3") - { - ExitConditions = new ExitConditions - { - ExitCodeRanges = {new ExitCodeRangeMapping(2, 4, new ExitOptions -{ -JobAction = BatchJobAction.Terminate, -})}, - }, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, - }; + BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = client.CreateTask("jobId", task); } @@ -4549,24 +2276,7 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithExitConditions_Conven TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent("taskId", "cmd /c exit 3") - { - ExitConditions = new ExitConditions - { - ExitCodeRanges = {new ExitCodeRangeMapping(2, 4, new ExitOptions -{ -JobAction = BatchJobAction.Terminate, -})}, - }, - UserIdentity = new UserIdentity - { - AutoUser = new AutoUserSpecification - { - Scope = AutoUserScope.Task, - ElevationLevel = ElevationLevel.NonAdmin, - }, - }, - }; + BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = await client.CreateTaskAsync("jobId", task); } @@ -4578,12 +2288,7 @@ public void Example_Batch_CreateTask_CreatesATaskWithExtraSlotRequirement() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "task1", - requiredSlots = 2, - commandLine = "cmd /c echo task1", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTask("jobId", content); Console.WriteLine(response.Status); @@ -4597,12 +2302,7 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithExtraSlotRequirement_ TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - id = "task1", - requiredSlots = 2, - commandLine = "cmd /c echo task1", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskAsync("jobId", content); Console.WriteLine(response.Status); @@ -4616,10 +2316,7 @@ public void Example_Batch_CreateTask_CreatesATaskWithExtraSlotRequirement_Conven TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1") - { - RequiredSlots = 2, - }; + BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = client.CreateTask("jobId", task); } @@ -4631,10 +2328,7 @@ public async Task Example_Batch_CreateTask_CreatesATaskWithExtraSlotRequirement_ TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskCreateContent task = new BatchTaskCreateContent("task1", "cmd /c echo task1") - { - RequiredSlots = 2, - }; + BatchTaskCreateContent task = new BatchTaskCreateContent(null, null); Response response = await client.CreateTaskAsync("jobId", task); } @@ -4646,22 +2340,7 @@ public void Example_Batch_CreateTaskCollection_CreatesABasicCollectionOfTasks() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - value = new object[] - { -new -{ -id = "simple1", -commandLine = "cmd /c dir /s", -}, -new -{ -id = "simple2", -commandLine = "cmd /c dir /s", -} - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTaskCollection("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -4676,22 +2355,7 @@ public async Task Example_Batch_CreateTaskCollection_CreatesABasicCollectionOfTa TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - value = new object[] - { -new -{ -id = "simple1", -commandLine = "cmd /c dir /s", -}, -new -{ -id = "simple2", -commandLine = "cmd /c dir /s", -} - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskCollectionAsync("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -4706,11 +2370,7 @@ public void Example_Batch_CreateTaskCollection_CreatesABasicCollectionOfTasks_Co TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] - { -new BatchTaskCreateContent("simple1", "cmd /c dir /s"), -new BatchTaskCreateContent("simple2", "cmd /c dir /s") - }); + BatchTaskGroup taskCollection = new BatchTaskGroup(null); Response response = client.CreateTaskCollection("jobId", taskCollection); } @@ -4722,11 +2382,7 @@ public async Task Example_Batch_CreateTaskCollection_CreatesABasicCollectionOfTa TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] - { -new BatchTaskCreateContent("simple1", "cmd /c dir /s"), -new BatchTaskCreateContent("simple2", "cmd /c dir /s") - }); + BatchTaskGroup taskCollection = new BatchTaskGroup(null); Response response = await client.CreateTaskCollectionAsync("jobId", taskCollection); } @@ -4738,67 +2394,7 @@ public void Example_Batch_CreateTaskCollection_CreatesAComplexCollectionOfTasks( TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - value = new object[] - { -new -{ -id = "complex1", -commandLine = "cmd /c dir /s", -resourceFiles = new object[] -{ -new -{ -autoStorageContainerName = "containerName", -filePath = "data", -} -}, -environmentSettings = new object[] -{ -new -{ -name = "env1", -value = "value1", -}, -new -{ -name = "env2", -value = "value2", -} -}, -affinityInfo = new -{ -affinityId = "affinityId", -}, -constraints = new -{ -maxWallClockTime = "P1D", -retentionTime = "P2D", -maxTaskRetryCount = 5, -}, -requiredSlots = 2, -multiInstanceSettings = new -{ -numberOfInstances = 3, -coordinationCommandLine = "cmd /c echo coordinating", -commonResourceFiles = new object[] -{ -new -{ -httpUrl = "https://common.blob.core.windows.net/", -filePath = "common.exe", -} -}, -}, -}, -new -{ -id = "simple3", -commandLine = "cmd /c dir /s", -} - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateTaskCollection("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -4813,67 +2409,7 @@ public async Task Example_Batch_CreateTaskCollection_CreatesAComplexCollectionOf TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - value = new object[] - { -new -{ -id = "complex1", -commandLine = "cmd /c dir /s", -resourceFiles = new object[] -{ -new -{ -autoStorageContainerName = "containerName", -filePath = "data", -} -}, -environmentSettings = new object[] -{ -new -{ -name = "env1", -value = "value1", -}, -new -{ -name = "env2", -value = "value2", -} -}, -affinityInfo = new -{ -affinityId = "affinityId", -}, -constraints = new -{ -maxWallClockTime = "P1D", -retentionTime = "P2D", -maxTaskRetryCount = 5, -}, -requiredSlots = 2, -multiInstanceSettings = new -{ -numberOfInstances = 3, -coordinationCommandLine = "cmd /c echo coordinating", -commonResourceFiles = new object[] -{ -new -{ -httpUrl = "https://common.blob.core.windows.net/", -filePath = "common.exe", -} -}, -}, -}, -new -{ -id = "simple3", -commandLine = "cmd /c dir /s", -} - }, - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateTaskCollectionAsync("jobId", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -4888,42 +2424,7 @@ public void Example_Batch_CreateTaskCollection_CreatesAComplexCollectionOfTasks_ TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] - { -new BatchTaskCreateContent("complex1", "cmd /c dir /s") -{ -ResourceFiles = {new ResourceFile -{ -AutoStorageContainerName = "containerName", -FilePath = "data", -}}, -EnvironmentSettings = {new EnvironmentSetting("env1") -{ -Value = "value1", -}, new EnvironmentSetting("env2") -{ -Value = "value2", -}}, -AffinityInfo = new AffinityInfo("affinityId"), -Constraints = new BatchTaskConstraints -{ -MaxWallClockTime = XmlConvert.ToTimeSpan("P1D"), -RetentionTime = XmlConvert.ToTimeSpan("P2D"), -MaxTaskRetryCount = 5, -}, -RequiredSlots = 2, -MultiInstanceSettings = new MultiInstanceSettings("cmd /c echo coordinating") -{ -NumberOfInstances = 3, -CommonResourceFiles = {new ResourceFile -{ -HttpUrl = "https://common.blob.core.windows.net/", -FilePath = "common.exe", -}}, -}, -}, -new BatchTaskCreateContent("simple3", "cmd /c dir /s") - }); + BatchTaskGroup taskCollection = new BatchTaskGroup(null); Response response = client.CreateTaskCollection("jobId", taskCollection); } @@ -4935,42 +2436,7 @@ public async Task Example_Batch_CreateTaskCollection_CreatesAComplexCollectionOf TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchTaskGroup taskCollection = new BatchTaskGroup(new BatchTaskCreateContent[] - { -new BatchTaskCreateContent("complex1", "cmd /c dir /s") -{ -ResourceFiles = {new ResourceFile -{ -AutoStorageContainerName = "containerName", -FilePath = "data", -}}, -EnvironmentSettings = {new EnvironmentSetting("env1") -{ -Value = "value1", -}, new EnvironmentSetting("env2") -{ -Value = "value2", -}}, -AffinityInfo = new AffinityInfo("affinityId"), -Constraints = new BatchTaskConstraints -{ -MaxWallClockTime = XmlConvert.ToTimeSpan("P1D"), -RetentionTime = XmlConvert.ToTimeSpan("P2D"), -MaxTaskRetryCount = 5, -}, -RequiredSlots = 2, -MultiInstanceSettings = new MultiInstanceSettings("cmd /c echo coordinating") -{ -NumberOfInstances = 3, -CommonResourceFiles = {new ResourceFile -{ -HttpUrl = "https://common.blob.core.windows.net/", -FilePath = "common.exe", -}}, -}, -}, -new BatchTaskCreateContent("simple3", "cmd /c dir /s") - }); + BatchTaskGroup taskCollection = new BatchTaskGroup(null); Response response = await client.CreateTaskCollectionAsync("jobId", taskCollection); } @@ -5270,13 +2736,7 @@ public void Example_Batch_CreateNodeUser_NodeCreateUser() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - name = "userName", - isAdmin = false, - expiryTime = "2017-08-01T00:00:00Z", - password = "Password", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.CreateNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", content); Console.WriteLine(response.Status); @@ -5290,13 +2750,7 @@ public async Task Example_Batch_CreateNodeUser_NodeCreateUser_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - name = "userName", - isAdmin = false, - expiryTime = "2017-08-01T00:00:00Z", - password = "Password", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.CreateNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); Console.WriteLine(response.Status); @@ -5310,12 +2764,7 @@ public void Example_Batch_CreateNodeUser_NodeCreateUser_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeUserCreateContent user = new BatchNodeUserCreateContent("userName") - { - IsAdmin = false, - ExpiryTime = DateTimeOffset.Parse("2017-08-01T00:00:00Z"), - Password = "Password", - }; + BatchNodeUserCreateContent user = new BatchNodeUserCreateContent(null); Response response = client.CreateNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", user); } @@ -5327,12 +2776,7 @@ public async Task Example_Batch_CreateNodeUser_NodeCreateUser_Convenience_Async( TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeUserCreateContent user = new BatchNodeUserCreateContent("userName") - { - IsAdmin = false, - ExpiryTime = DateTimeOffset.Parse("2017-08-01T00:00:00Z"), - Password = "Password", - }; + BatchNodeUserCreateContent user = new BatchNodeUserCreateContent(null); Response response = await client.CreateNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", user); } @@ -5370,11 +2814,7 @@ public void Example_Batch_ReplaceNodeUser_NodeUpdateUser() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - password = "12345", - expiryTime = "2016-11-27T00:45:48.7320857Z", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.ReplaceNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); Console.WriteLine(response.Status); @@ -5388,11 +2828,7 @@ public async Task Example_Batch_ReplaceNodeUser_NodeUpdateUser_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - password = "12345", - expiryTime = "2016-11-27T00:45:48.7320857Z", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.ReplaceNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); Console.WriteLine(response.Status); @@ -5406,11 +2842,7 @@ public void Example_Batch_ReplaceNodeUser_NodeUpdateUser_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent - { - Password = "12345", - ExpiryTime = DateTimeOffset.Parse("2016-11-27T00:45:48.7320857Z"), - }; + BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent(); Response response = client.ReplaceNodeUser("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); } @@ -5422,11 +2854,7 @@ public async Task Example_Batch_ReplaceNodeUser_NodeUpdateUser_Convenience_Async TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent - { - Password = "12345", - ExpiryTime = DateTimeOffset.Parse("2016-11-27T00:45:48.7320857Z"), - }; + BatchNodeUserUpdateContent content = new BatchNodeUserUpdateContent(); Response response = await client.ReplaceNodeUserAsync("poolId", "tvm-1695681911_1-20161121t182739z", "userName", content); } @@ -5666,11 +3094,7 @@ public void Example_Batch_UploadNodeLogs_UploadBatchServiceLogs() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - containerUrl = "https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", - startTime = "2017-11-27T00:00:00Z", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = client.UploadNodeLogs("poolId", "tvm-1695681911_1-20161121t182739z", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -5686,11 +3110,7 @@ public async Task Example_Batch_UploadNodeLogs_UploadBatchServiceLogs_Async() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - containerUrl = "https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", - startTime = "2017-11-27T00:00:00Z", - }); + using RequestContent content = RequestContent.Create(new object()); Response response = await client.UploadNodeLogsAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; @@ -5706,7 +3126,7 @@ public void Example_Batch_UploadNodeLogs_UploadBatchServiceLogs_Convenience() TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent("https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", DateTimeOffset.Parse("2017-11-27T00:00:00Z")); + UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent(null, default); Response response = client.UploadNodeLogs("poolId", "tvm-1695681911_1-20161121t182739z", content); } @@ -5718,7 +3138,7 @@ public async Task Example_Batch_UploadNodeLogs_UploadBatchServiceLogs_Convenienc TokenCredential credential = new DefaultAzureCredential(); BatchClient client = new BatchClient(endpoint, credential); - UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent("https://somestorageacct.blob.core.windows.net/batch-compute-node-logs?se=2017-12-09T18%3A51%3A00Z&sp=w&sv=2016-05-31&sr=c&sig", DateTimeOffset.Parse("2017-11-27T00:00:00Z")); + UploadBatchServiceLogsContent content = new UploadBatchServiceLogsContent(null, default); Response response = await client.UploadNodeLogsAsync("poolId", "tvm-1695681911_1-20161121t182739z", content); }