From 9df67d97908e6c1d7ca0124744fb7b772df98eb7 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Sat, 12 Oct 2024 16:21:48 +0800 Subject: [PATCH] [Batch] Remove "Microsoft.Azure.Management.Batch" Version="15.0.0" and add Batch.Management.Sdk (#26199) * Batch SDK generated by auto rest powershell * Update ChangeLog.md * Update ChangeLog.md --- .../Batch.Management.Sdk.csproj | 13 + .../Generated/ApplicationOperations.cs | 1468 +++++++ .../ApplicationOperationsExtensions.cs | 271 ++ .../Generated/ApplicationPackageOperations.cs | 1592 ++++++++ .../ApplicationPackageOperationsExtensions.cs | 313 ++ .../Generated/BatchAccountOperations.cs | 3560 +++++++++++++++++ .../BatchAccountOperationsExtensions.cs | 757 ++++ .../Generated/BatchManagementClient.cs | 380 ++ .../Generated/CertificateOperations.cs | 1921 +++++++++ .../CertificateOperationsExtensions.cs | 496 +++ .../Generated/IApplicationOperations.cs | 188 + .../IApplicationPackageOperations.cs | 212 + .../Generated/IBatchAccountOperations.cs | 538 +++ .../Generated/IBatchManagementClient.cs | 118 + .../Generated/ICertificateOperations.cs | 340 ++ .../Generated/ILocationOperations.cs | 180 + .../Generated/IOperations.cs | 60 + .../Generated/IPoolOperations.cs | 319 ++ .../IPrivateEndpointConnectionOperations.cs | 229 ++ .../IPrivateLinkResourceOperations.cs | 98 + .../Generated/LocationOperations.cs | 1274 ++++++ .../Generated/LocationOperationsExtensions.cs | 248 ++ .../Generated/Models/AccountKeyType.cs | 57 + .../ActivateApplicationPackageParameters.cs | 62 + .../Generated/Models/AllocationState.cs | 71 + .../Generated/Models/Application.cs | 88 + .../Generated/Models/ApplicationPackage.cs | 104 + .../Models/ApplicationPackageProperties.cs | 89 + .../Models/ApplicationPackageReference.cs | 86 + .../Generated/Models/ApplicationProperties.cs | 74 + .../Generated/Models/AuthenticationMode.cs | 66 + .../Generated/Models/AutoScaleRun.cs | 87 + .../Generated/Models/AutoScaleRunError.cs | 104 + .../Generated/Models/AutoScaleSettings.cs | 75 + .../Models/AutoStorageAuthenticationMode.cs | 59 + .../Models/AutoStorageBaseProperties.cs | 89 + .../Generated/Models/AutoStorageProperties.cs | 73 + .../Generated/Models/AutoUserScope.cs | 58 + .../Generated/Models/AutoUserSpecification.cs | 72 + .../AzureBlobFileSystemConfiguration.cs | 149 + .../Models/AzureFileShareConfiguration.cs | 126 + .../Generated/Models/BatchAccount.cs | 309 ++ .../Models/BatchAccountCreateHeaders.cs | 55 + .../Models/BatchAccountCreateParameters.cs | 192 + .../Models/BatchAccountCreateProperties.cs | 151 + .../Models/BatchAccountDeleteHeaders.cs | 55 + .../Generated/Models/BatchAccountIdentity.cs | 98 + .../Generated/Models/BatchAccountKeys.cs | 68 + .../Models/BatchAccountProperties.cs | 278 ++ .../BatchAccountRegenerateKeyParameters.cs | 58 + .../Models/BatchAccountUpdateParameters.cs | 143 + .../Models/BatchAccountUpdateProperties.cs | 117 + .../Generated/Models/BatchLocationQuota.cs | 50 + .../Generated/Models/BatchPoolIdentity.cs | 71 + .../Models/CIFSMountConfiguration.cs | 127 + .../Generated/Models/CachingType.cs | 66 + .../Generated/Models/Certificate.cs | 166 + .../Models/CertificateBaseProperties.cs | 72 + .../CertificateCancelDeletionHeaders.cs | 45 + .../Models/CertificateCreateHeaders.cs | 45 + .../CertificateCreateOrUpdateParameters.cs | 106 + .../CertificateCreateOrUpdateProperties.cs | 85 + .../Models/CertificateDeleteHeaders.cs | 55 + .../Generated/Models/CertificateFormat.cs | 58 + .../Generated/Models/CertificateGetHeaders.cs | 45 + .../Generated/Models/CertificateProperties.cs | 127 + .../Models/CertificateProvisioningState.cs | 74 + .../Generated/Models/CertificateReference.cs | 134 + .../Models/CertificateStoreLocation.cs | 57 + .../Models/CertificateUpdateHeaders.cs | 45 + .../Generated/Models/CertificateVisibility.cs | 70 + .../Models/CheckNameAvailabilityParameters.cs | 75 + .../Models/CheckNameAvailabilityResult.cs | 74 + .../Models/CloudServiceConfiguration.cs | 90 + .../Models/ComputeNodeDeallocationOption.cs | 82 + .../Generated/Models/ComputeNodeFillType.cs | 59 + .../Models/ComputeNodeIdentityReference.cs | 49 + .../Models/ContainerConfiguration.cs | 79 + .../Generated/Models/ContainerRegistry.cs | 83 + .../Generated/Models/ContainerType.cs | 49 + .../Models/ContainerWorkingDirectory.cs | 59 + .../Generated/Models/DataDisk.cs | 111 + .../Models/DeleteCertificateError.cs | 114 + .../Models/DeploymentConfiguration.cs | 86 + .../Generated/Models/DetectorResponse.cs | 63 + .../Models/DetectorResponseProperties.cs | 49 + .../Generated/Models/DiffDiskPlacement.cs | 48 + .../Generated/Models/DiffDiskSettings.cs | 67 + .../Models/DiskEncryptionConfiguration.cs | 52 + .../Generated/Models/DiskEncryptionTarget.cs | 59 + .../Models/DynamicVNetAssignmentScope.cs | 59 + .../Generated/Models/ElevationLevel.cs | 58 + .../Generated/Models/EncryptionProperties.cs | 60 + .../Models/EndpointAccessDefaultAction.cs | 57 + .../Generated/Models/EndpointAccessProfile.cs | 80 + .../Generated/Models/EndpointDependency.cs | 72 + .../Generated/Models/EndpointDetail.cs | 48 + .../Generated/Models/EnvironmentSetting.cs | 76 + .../Generated/Models/FixedScaleSettings.cs | 92 + .../Models/IPAddressProvisioningType.cs | 68 + .../Generated/Models/IPRule.cs | 75 + .../Generated/Models/IPRuleAction.cs | 48 + .../Generated/Models/ImageReference.cs | 107 + .../Models/InboundEndpointProtocol.cs | 57 + .../Generated/Models/InboundNatPool.cs | 162 + .../Models/InterNodeCommunicationState.cs | 57 + .../Generated/Models/KeySource.cs | 61 + .../Generated/Models/KeyVaultProperties.cs | 61 + .../Generated/Models/KeyVaultReference.cs | 79 + .../Models/LinuxUserConfiguration.cs | 88 + .../Generated/Models/LoginMode.cs | 61 + .../Generated/Models/MetadataItem.cs | 82 + .../Generated/Models/MountConfiguration.cs | 106 + .../Generated/Models/NFSMountConfiguration.cs | 95 + .../Models/NameAvailabilityReason.cs | 57 + .../Generated/Models/NetworkConfiguration.cs | 138 + .../Generated/Models/NetworkProfile.cs | 80 + .../Models/NetworkSecurityGroupRule.cs | 120 + .../Models/NetworkSecurityGroupRuleAccess.cs | 57 + .../Generated/Models/NodeCommunicationMode.cs | 72 + .../Models/NodePlacementConfiguration.cs | 53 + .../Models/NodePlacementPolicyType.cs | 58 + .../Generated/Models/OSDisk.cs | 53 + .../Generated/Models/Operation.cs | 91 + .../Generated/Models/OperationDisplay.cs | 81 + .../Models/OutboundEnvironmentEndpoint.cs | 61 + .../Generated/Models/PackageState.cs | 57 + .../Generated/Models/Page.cs | 43 + .../Generated/Models/Pool.cs | 521 +++ .../Generated/Models/PoolAllocationMode.cs | 57 + .../Generated/Models/PoolCreateHeaders.cs | 45 + .../Generated/Models/PoolDeleteHeaders.cs | 55 + .../Models/PoolDisableAutoScaleHeaders.cs | 45 + .../Models/PoolEndpointConfiguration.cs | 80 + .../Generated/Models/PoolGetHeaders.cs | 45 + .../Generated/Models/PoolIdentityType.cs | 58 + .../Generated/Models/PoolProperties.cs | 493 +++ .../Generated/Models/PoolProvisioningState.cs | 59 + .../Generated/Models/PoolStopResizeHeaders.cs | 45 + .../Generated/Models/PoolUpdateHeaders.cs | 45 + .../Generated/Models/PrivateEndpoint.cs | 51 + .../Models/PrivateEndpointConnection.cs | 111 + .../PrivateEndpointConnectionDeleteHeaders.cs | 55 + .../PrivateEndpointConnectionProperties.cs | 97 + ...vateEndpointConnectionProvisioningState.cs | 96 + .../PrivateEndpointConnectionUpdateHeaders.cs | 55 + .../Generated/Models/PrivateLinkResource.cs | 84 + .../Models/PrivateLinkResourceProperties.cs | 70 + .../PrivateLinkServiceConnectionState.cs | 81 + .../PrivateLinkServiceConnectionStatus.cs | 79 + .../Generated/Models/ProvisioningState.cs | 93 + .../Generated/Models/ProxyResource.cs | 78 + .../Models/PublicIPAddressConfiguration.cs | 70 + .../Models/PublicNetworkAccessType.cs | 58 + .../Generated/Models/ResizeError.cs | 104 + .../Generated/Models/ResizeOperationStatus.cs | 115 + .../Generated/Models/Resource.cs | 88 + .../Generated/Models/ResourceFile.cs | 168 + .../Generated/Models/ResourceIdentityType.cs | 67 + .../Generated/Models/ResourceType.cs | 48 + .../Generated/Models/ScaleSettings.cs | 87 + .../Generated/Models/SkuCapability.cs | 58 + .../Generated/Models/StartTask.cs | 196 + .../Generated/Models/StorageAccountType.cs | 57 + .../Generated/Models/SupportedSku.cs | 68 + .../Generated/Models/TaskContainerSettings.cs | 108 + .../Generated/Models/TaskSchedulingPolicy.cs | 61 + .../Generated/Models/UserAccount.cs | 125 + .../Models/UserAssignedIdentities.cs | 58 + .../Generated/Models/UserIdentity.cs | 65 + .../Generated/Models/VMExtension.cs | 159 + .../Models/VirtualMachineConfiguration.cs | 232 ++ .../Models/VirtualMachineFamilyCoreQuota.cs | 58 + .../Generated/Models/WindowsConfiguration.cs | 51 + .../Models/WindowsUserConfiguration.cs | 55 + .../Generated/Operations.cs | 411 ++ .../Generated/OperationsExtensions.cs | 76 + .../Generated/PoolOperations.cs | 2162 ++++++++++ .../Generated/PoolOperationsExtensions.cs | 487 +++ .../PrivateEndpointConnectionOperations.cs | 1311 ++++++ ...eEndpointConnectionOperationsExtensions.cs | 345 ++ .../PrivateLinkResourceOperations.cs | 711 ++++ ...PrivateLinkResourceOperationsExtensions.cs | 139 + .../Properties/AssemblyInfo.cs | 29 + src/Batch/Batch.Management.Sdk/README.md | 96 + src/Batch/Batch.Test/Batch.Test.csproj | 2 +- src/Batch/Batch.sln | 34 +- src/Batch/Batch/Az.Batch.psd1 | 2 +- src/Batch/Batch/Batch.csproj | 5 +- src/Batch/Batch/ChangeLog.md | 3 + .../BatchClient.PrivateEndpointConnection.cs | 2 +- 191 files changed, 33815 insertions(+), 18 deletions(-) create mode 100644 src/Batch/Batch.Management.Sdk/Batch.Management.Sdk.csproj create mode 100644 src/Batch/Batch.Management.Sdk/Generated/ApplicationOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/ApplicationOperationsExtensions.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/ApplicationPackageOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/ApplicationPackageOperationsExtensions.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/BatchAccountOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/BatchAccountOperationsExtensions.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/BatchManagementClient.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/CertificateOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/CertificateOperationsExtensions.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/IApplicationOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/IApplicationPackageOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/IBatchAccountOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/IBatchManagementClient.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/ICertificateOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/ILocationOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/IOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/IPoolOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/IPrivateEndpointConnectionOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/IPrivateLinkResourceOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/LocationOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/LocationOperationsExtensions.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AccountKeyType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ActivateApplicationPackageParameters.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AllocationState.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/Application.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackage.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackageProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackageReference.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AuthenticationMode.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleRun.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleRunError.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleSettings.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageAuthenticationMode.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageBaseProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AutoUserScope.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AutoUserSpecification.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AzureBlobFileSystemConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/AzureFileShareConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccount.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateParameters.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountDeleteHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountIdentity.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountKeys.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountRegenerateKeyParameters.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountUpdateParameters.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountUpdateProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchLocationQuota.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/BatchPoolIdentity.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CIFSMountConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CachingType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/Certificate.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateBaseProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCancelDeletionHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateOrUpdateParameters.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateOrUpdateProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateDeleteHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateFormat.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateGetHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateProvisioningState.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateReference.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateStoreLocation.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateUpdateHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CertificateVisibility.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CheckNameAvailabilityParameters.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CheckNameAvailabilityResult.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/CloudServiceConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeDeallocationOption.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeFillType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeIdentityReference.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ContainerConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ContainerRegistry.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ContainerType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ContainerWorkingDirectory.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/DataDisk.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/DeleteCertificateError.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/DeploymentConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/DetectorResponse.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/DetectorResponseProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/DiffDiskPlacement.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/DiffDiskSettings.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/DiskEncryptionConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/DiskEncryptionTarget.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/DynamicVNetAssignmentScope.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ElevationLevel.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/EncryptionProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/EndpointAccessDefaultAction.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/EndpointAccessProfile.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/EndpointDependency.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/EndpointDetail.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/EnvironmentSetting.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/FixedScaleSettings.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/IPAddressProvisioningType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/IPRule.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/IPRuleAction.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ImageReference.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/InboundEndpointProtocol.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/InboundNatPool.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/InterNodeCommunicationState.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/KeySource.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/KeyVaultProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/KeyVaultReference.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/LinuxUserConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/LoginMode.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/MetadataItem.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/MountConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/NFSMountConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/NameAvailabilityReason.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/NetworkConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/NetworkProfile.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/NetworkSecurityGroupRule.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/NetworkSecurityGroupRuleAccess.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/NodeCommunicationMode.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/NodePlacementConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/NodePlacementPolicyType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/OSDisk.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/Operation.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/OperationDisplay.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/OutboundEnvironmentEndpoint.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PackageState.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/Page.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/Pool.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolAllocationMode.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolCreateHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolDeleteHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolDisableAutoScaleHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolEndpointConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolGetHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolIdentityType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolProvisioningState.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolStopResizeHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PoolUpdateHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpoint.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionDeleteHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionProvisioningState.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionUpdateHeaders.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkResource.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkResourceProperties.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionState.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStatus.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ProvisioningState.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ProxyResource.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PublicIPAddressConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/PublicNetworkAccessType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ResizeError.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ResizeOperationStatus.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/Resource.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ResourceFile.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ResourceIdentityType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ResourceType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/ScaleSettings.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/SkuCapability.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/StartTask.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/StorageAccountType.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/SupportedSku.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/TaskContainerSettings.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/TaskSchedulingPolicy.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/UserAccount.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/UserAssignedIdentities.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/UserIdentity.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/VMExtension.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/VirtualMachineConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/VirtualMachineFamilyCoreQuota.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/WindowsConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Models/WindowsUserConfiguration.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/Operations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/OperationsExtensions.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/PoolOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/PoolOperationsExtensions.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/PrivateEndpointConnectionOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/PrivateEndpointConnectionOperationsExtensions.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/PrivateLinkResourceOperations.cs create mode 100644 src/Batch/Batch.Management.Sdk/Generated/PrivateLinkResourceOperationsExtensions.cs create mode 100644 src/Batch/Batch.Management.Sdk/Properties/AssemblyInfo.cs create mode 100644 src/Batch/Batch.Management.Sdk/README.md diff --git a/src/Batch/Batch.Management.Sdk/Batch.Management.Sdk.csproj b/src/Batch/Batch.Management.Sdk/Batch.Management.Sdk.csproj new file mode 100644 index 000000000000..469bb6e556b1 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Batch.Management.Sdk.csproj @@ -0,0 +1,13 @@ + + + Batch + + + + netstandard2.0 + Microsoft.Azure.PowerShell.Batch.Management.Sdk + Microsoft.Azure.Management.Batch + $(NoWarn);CS0108;CS1573 + + + \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/ApplicationOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/ApplicationOperations.cs new file mode 100644 index 000000000000..111077bc7d1c --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/ApplicationOperations.cs @@ -0,0 +1,1468 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// ApplicationOperations operations. + /// + internal partial class ApplicationOperations : Microsoft.Rest.IServiceOperations, IApplicationOperations + { + /// + /// Initializes a new instance of the ApplicationOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ApplicationOperations (BatchManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BatchManagementClient + /// + public BatchManagementClient Client { get; private set; } + + /// + /// Adds an application to the specified Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The parameters for the request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, Application parameters = default(Application), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (applicationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applicationName"); + } + if (applicationName != null) + { + if (applicationName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "applicationName", 64); + } + if (applicationName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "applicationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "applicationName", "^[a-zA-Z0-9_-]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("applicationName", applicationName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes an application. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (applicationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applicationName"); + } + if (applicationName != null) + { + if (applicationName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "applicationName", 64); + } + if (applicationName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "applicationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "applicationName", "^[a-zA-Z0-9_-]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("applicationName", applicationName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the specified application. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (applicationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applicationName"); + } + if (applicationName != null) + { + if (applicationName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "applicationName", 64); + } + if (applicationName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "applicationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "applicationName", "^[a-zA-Z0-9_-]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("applicationName", applicationName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates settings for the specified application. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The parameters for the request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, Application parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (applicationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applicationName"); + } + if (applicationName != null) + { + if (applicationName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "applicationName", 64); + } + if (applicationName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "applicationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "applicationName", "^[a-zA-Z0-9_-]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("applicationName", applicationName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists all of the applications in the specified account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxresults = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("maxresults", maxresults); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (maxresults != null) + { + _queryParameters.Add(string.Format("maxresults={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(maxresults, this.Client.SerializationSettings).Trim('"')))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists all of the applications in the specified account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/ApplicationOperationsExtensions.cs b/src/Batch/Batch.Management.Sdk/Generated/ApplicationOperationsExtensions.cs new file mode 100644 index 000000000000..13cc03bee151 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/ApplicationOperationsExtensions.cs @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for ApplicationOperations + /// + public static partial class ApplicationOperationsExtensions + { + /// + /// Adds an application to the specified Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + public static Application Create(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationName, Application parameters = default(Application)) + { + return ((IApplicationOperations)operations).CreateAsync(resourceGroupName, accountName, applicationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Adds an application to the specified Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationName, Application parameters = default(Application), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, accountName, applicationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes an application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + public static void Delete(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationName) + { + ((IApplicationOperations)operations).DeleteAsync(resourceGroupName, accountName, applicationName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, applicationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Gets information about the specified application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + public static Application Get(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationName) + { + return ((IApplicationOperations)operations).GetAsync(resourceGroupName, accountName, applicationName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the specified application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, applicationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates settings for the specified application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + public static Application Update(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationName, Application parameters) + { + return ((IApplicationOperations)operations).UpdateAsync(resourceGroupName, accountName, applicationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates settings for the specified application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IApplicationOperations operations, string resourceGroupName, string accountName, string applicationName, Application parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, applicationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists all of the applications in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + public static Microsoft.Rest.Azure.IPage List(this IApplicationOperations operations, string resourceGroupName, string accountName, int? maxresults = default(int?)) + { + return ((IApplicationOperations)operations).ListAsync(resourceGroupName, accountName, maxresults).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the applications in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IApplicationOperations operations, string resourceGroupName, string accountName, int? maxresults = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, maxresults, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists all of the applications in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IApplicationOperations operations, string nextPageLink) + { + return ((IApplicationOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the applications in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IApplicationOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Batch/Batch.Management.Sdk/Generated/ApplicationPackageOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/ApplicationPackageOperations.cs new file mode 100644 index 000000000000..709c9e26f6b6 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/ApplicationPackageOperations.cs @@ -0,0 +1,1592 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// ApplicationPackageOperations operations. + /// + internal partial class ApplicationPackageOperations : Microsoft.Rest.IServiceOperations, IApplicationPackageOperations + { + /// + /// Initializes a new instance of the ApplicationPackageOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ApplicationPackageOperations (BatchManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BatchManagementClient + /// + public BatchManagementClient Client { get; private set; } + + /// + /// Activates the specified application package. This should be done after the + /// `ApplicationPackage` was created and uploaded. This needs to be done before + /// an `ApplicationPackage` can be used on Pools or Tasks. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// The format of the application package binary file. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> ActivateWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, string versionName, string format, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (applicationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applicationName"); + } + if (applicationName != null) + { + if (applicationName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "applicationName", 64); + } + if (applicationName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "applicationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "applicationName", "^[a-zA-Z0-9_-]+$"); + } + } + if (versionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "versionName"); + } + if (versionName != null) + { + if (versionName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "versionName", 64); + } + if (versionName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "versionName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(versionName, "^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "versionName", "^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + ActivateApplicationPackageParameters parameters = new ActivateApplicationPackageParameters(); + if(format != null) + { + parameters.Format = format; + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("versionName", versionName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Activate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}/activate").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{versionName}", System.Uri.EscapeDataString(versionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Creates an application package record. The record contains a storageUrl + /// where the package should be uploaded to. Once it is uploaded the + /// `ApplicationPackage` needs to be activated using `ApplicationPackageActive` + /// before it can be used. If the auto storage account was configured to use + /// storage keys, the URL returned will contain a SAS. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, string versionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (applicationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applicationName"); + } + if (applicationName != null) + { + if (applicationName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "applicationName", 64); + } + if (applicationName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "applicationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "applicationName", "^[a-zA-Z0-9_-]+$"); + } + } + if (versionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "versionName"); + } + if (versionName != null) + { + if (versionName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "versionName", 64); + } + if (versionName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "versionName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(versionName, "^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "versionName", "^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + ApplicationPackage parameters = new ApplicationPackage(); + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("versionName", versionName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{versionName}", System.Uri.EscapeDataString(versionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes an application package record and its associated binary file. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, string versionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (applicationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applicationName"); + } + if (applicationName != null) + { + if (applicationName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "applicationName", 64); + } + if (applicationName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "applicationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "applicationName", "^[a-zA-Z0-9_-]+$"); + } + } + if (versionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "versionName"); + } + if (versionName != null) + { + if (versionName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "versionName", 64); + } + if (versionName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "versionName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(versionName, "^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "versionName", "^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("versionName", versionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{versionName}", System.Uri.EscapeDataString(versionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the specified application package. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, string versionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (applicationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applicationName"); + } + if (applicationName != null) + { + if (applicationName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "applicationName", 64); + } + if (applicationName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "applicationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "applicationName", "^[a-zA-Z0-9_-]+$"); + } + } + if (versionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "versionName"); + } + if (versionName != null) + { + if (versionName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "versionName", 64); + } + if (versionName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "versionName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(versionName, "^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "versionName", "^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("versionName", versionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{versionName}", System.Uri.EscapeDataString(versionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists all of the application packages in the specified application. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, int? maxresults = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (applicationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "applicationName"); + } + if (applicationName != null) + { + if (applicationName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "applicationName", 64); + } + if (applicationName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "applicationName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(applicationName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "applicationName", "^[a-zA-Z0-9_-]+$"); + } + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("maxresults", maxresults); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (maxresults != null) + { + _queryParameters.Add(string.Format("maxresults={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(maxresults, this.Client.SerializationSettings).Trim('"')))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists all of the application packages in the specified application. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/ApplicationPackageOperationsExtensions.cs b/src/Batch/Batch.Management.Sdk/Generated/ApplicationPackageOperationsExtensions.cs new file mode 100644 index 000000000000..34c9024b3036 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/ApplicationPackageOperationsExtensions.cs @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for ApplicationPackageOperations + /// + public static partial class ApplicationPackageOperationsExtensions + { + /// + /// Activates the specified application package. This should be done after the + /// `ApplicationPackage` was created and uploaded. This needs to be done before + /// an `ApplicationPackage` can be used on Pools or Tasks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + public static ApplicationPackage Activate(this IApplicationPackageOperations operations, string resourceGroupName, string accountName, string applicationName, string versionName, string format) + { + return ((IApplicationPackageOperations)operations).ActivateAsync(resourceGroupName, accountName, applicationName, versionName, format).GetAwaiter().GetResult(); + } + + /// + /// Activates the specified application package. This should be done after the + /// `ApplicationPackage` was created and uploaded. This needs to be done before + /// an `ApplicationPackage` can be used on Pools or Tasks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ActivateAsync(this IApplicationPackageOperations operations, string resourceGroupName, string accountName, string applicationName, string versionName, string format, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ActivateWithHttpMessagesAsync(resourceGroupName, accountName, applicationName, versionName, format, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates an application package record. The record contains a storageUrl + /// where the package should be uploaded to. Once it is uploaded the + /// `ApplicationPackage` needs to be activated using `ApplicationPackageActive` + /// before it can be used. If the auto storage account was configured to use + /// storage keys, the URL returned will contain a SAS. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + public static ApplicationPackage Create(this IApplicationPackageOperations operations, string resourceGroupName, string accountName, string applicationName, string versionName) + { + return ((IApplicationPackageOperations)operations).CreateAsync(resourceGroupName, accountName, applicationName, versionName).GetAwaiter().GetResult(); + } + + /// + /// Creates an application package record. The record contains a storageUrl + /// where the package should be uploaded to. Once it is uploaded the + /// `ApplicationPackage` needs to be activated using `ApplicationPackageActive` + /// before it can be used. If the auto storage account was configured to use + /// storage keys, the URL returned will contain a SAS. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this IApplicationPackageOperations operations, string resourceGroupName, string accountName, string applicationName, string versionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, accountName, applicationName, versionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes an application package record and its associated binary file. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + public static void Delete(this IApplicationPackageOperations operations, string resourceGroupName, string accountName, string applicationName, string versionName) + { + ((IApplicationPackageOperations)operations).DeleteAsync(resourceGroupName, accountName, applicationName, versionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an application package record and its associated binary file. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IApplicationPackageOperations operations, string resourceGroupName, string accountName, string applicationName, string versionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, applicationName, versionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Gets information about the specified application package. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + public static ApplicationPackage Get(this IApplicationPackageOperations operations, string resourceGroupName, string accountName, string applicationName, string versionName) + { + return ((IApplicationPackageOperations)operations).GetAsync(resourceGroupName, accountName, applicationName, versionName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the specified application package. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IApplicationPackageOperations operations, string resourceGroupName, string accountName, string applicationName, string versionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, applicationName, versionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists all of the application packages in the specified application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The maximum number of items to return in the response. + /// + public static Microsoft.Rest.Azure.IPage List(this IApplicationPackageOperations operations, string resourceGroupName, string accountName, string applicationName, int? maxresults = default(int?)) + { + return ((IApplicationPackageOperations)operations).ListAsync(resourceGroupName, accountName, applicationName, maxresults).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the application packages in the specified application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IApplicationPackageOperations operations, string resourceGroupName, string accountName, string applicationName, int? maxresults = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, applicationName, maxresults, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists all of the application packages in the specified application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IApplicationPackageOperations operations, string nextPageLink) + { + return ((IApplicationPackageOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the application packages in the specified application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IApplicationPackageOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Batch/Batch.Management.Sdk/Generated/BatchAccountOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/BatchAccountOperations.cs new file mode 100644 index 000000000000..b470cb9da37c --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/BatchAccountOperations.cs @@ -0,0 +1,3560 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BatchAccountOperations operations. + /// + internal partial class BatchAccountOperations : Microsoft.Rest.IServiceOperations, IBatchAccountOperations + { + /// + /// Initializes a new instance of the BatchAccountOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BatchAccountOperations (BatchManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BatchManagementClient + /// + public BatchManagementClient Client { get; private set; } + + /// + /// Creates a new Batch account with the specified parameters. Existing + /// accounts cannot be updated with this API and should instead be updated with + /// the Update Batch Account API. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// A name for the Batch account which must be unique within the region. Batch + /// account names must be between 3 and 24 characters in length and must use + /// only numbers and lowercase letters. This name is used as part of the DNS + /// name that is used to access the Batch service in the region in which the + /// account is created. For example: + /// http://accountname.region.batch.azure.com/. + /// + /// + /// Additional parameters for account creation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, BatchAccountCreateParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, accountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the properties of an existing Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// Additional parameters for account update. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, BatchAccountUpdateParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes the specified Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Batch/batchAccounts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the Batch accounts associated with the specified + /// resource group. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Synchronizes access keys for the auto-storage account configured for the + /// specified Batch account, only if storage key authentication is being used. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task SynchronizeAutoStorageKeysWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "SynchronizeAutoStorageKeys", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// This operation applies only to Batch accounts with + /// allowedAuthenticationModes containing 'SharedKey'. If the Batch account + /// doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients + /// cannot use shared keys to authenticate, and must use another + /// allowedAuthenticationModes instead. In this case, regenerating the keys + /// will fail. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The type of account key to regenerate. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> RegenerateKeyWithHttpMessagesAsync(string resourceGroupName, string accountName, AccountKeyType keyName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + BatchAccountRegenerateKeyParameters parameters = new BatchAccountRegenerateKeyParameters(); + parameters.KeyName = keyName; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "RegenerateKey", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// This operation applies only to Batch accounts with + /// allowedAuthenticationModes containing 'SharedKey'. If the Batch account + /// doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients + /// cannot use shared keys to authenticate, and must use another + /// allowedAuthenticationModes instead. In this case, getting the keys will + /// fail. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetKeysWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetKeys", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the detectors available for a given Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListDetectorsWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListDetectors", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the given detector for a given Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the detector. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetDetectorWithHttpMessagesAsync(string resourceGroupName, string accountName, string detectorId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (detectorId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "detectorId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("detectorId", detectorId); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetDetector", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{detectorId}", System.Uri.EscapeDataString(detectorId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the endpoints that a Batch Compute Node under this Batch Account may + /// call as part of Batch service administration. If you are deploying a Pool + /// inside of a virtual network that you specify, you must make sure your + /// network allows outbound access to these endpoints. Failure to allow access + /// to these endpoints may cause Batch to mark the affected nodes as unusable. + /// For more information about creating a pool inside of a virtual network, see + /// https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListOutboundNetworkDependenciesEndpointsWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListOutboundNetworkDependenciesEndpoints", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/outboundNetworkDependenciesEndpoints").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Creates a new Batch account with the specified parameters. Existing + /// accounts cannot be updated with this API and should instead be updated with + /// the Update Batch Account API. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// A name for the Batch account which must be unique within the region. Batch + /// account names must be between 3 and 24 characters in length and must use + /// only numbers and lowercase letters. This name is used as part of the DNS + /// name that is used to access the Batch service in the region in which the + /// account is created. For example: + /// http://accountname.region.batch.azure.com/. + /// + /// + /// Additional parameters for account creation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string accountName, BatchAccountCreateParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-z0-9]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes the specified Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the Batch accounts associated with the specified + /// resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the detectors available for a given Batch account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListDetectorsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListDetectorsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the endpoints that a Batch Compute Node under this Batch Account may + /// call as part of Batch service administration. If you are deploying a Pool + /// inside of a virtual network that you specify, you must make sure your + /// network allows outbound access to these endpoints. Failure to allow access + /// to these endpoints may cause Batch to mark the affected nodes as unusable. + /// For more information about creating a pool inside of a virtual network, see + /// https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListOutboundNetworkDependenciesEndpointsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListOutboundNetworkDependenciesEndpointsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/BatchAccountOperationsExtensions.cs b/src/Batch/Batch.Management.Sdk/Generated/BatchAccountOperationsExtensions.cs new file mode 100644 index 000000000000..1ceac9aca4ca --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/BatchAccountOperationsExtensions.cs @@ -0,0 +1,757 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for BatchAccountOperations + /// + public static partial class BatchAccountOperationsExtensions + { + /// + /// Creates a new Batch account with the specified parameters. Existing + /// accounts cannot be updated with this API and should instead be updated with + /// the Update Batch Account API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// A name for the Batch account which must be unique within the region. Batch + /// account names must be between 3 and 24 characters in length and must use + /// only numbers and lowercase letters. This name is used as part of the DNS + /// name that is used to access the Batch service in the region in which the + /// account is created. For example: + /// http://accountname.region.batch.azure.com/. + /// + public static BatchAccount Create(this IBatchAccountOperations operations, string resourceGroupName, string accountName, BatchAccountCreateParameters parameters) + { + return ((IBatchAccountOperations)operations).CreateAsync(resourceGroupName, accountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new Batch account with the specified parameters. Existing + /// accounts cannot be updated with this API and should instead be updated with + /// the Update Batch Account API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// A name for the Batch account which must be unique within the region. Batch + /// account names must be between 3 and 24 characters in length and must use + /// only numbers and lowercase letters. This name is used as part of the DNS + /// name that is used to access the Batch service in the region in which the + /// account is created. For example: + /// http://accountname.region.batch.azure.com/. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, BatchAccountCreateParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, accountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates the properties of an existing Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + public static BatchAccount Update(this IBatchAccountOperations operations, string resourceGroupName, string accountName, BatchAccountUpdateParameters parameters) + { + return ((IBatchAccountOperations)operations).UpdateAsync(resourceGroupName, accountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the properties of an existing Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, BatchAccountUpdateParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes the specified Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + public static BatchAccountDeleteHeaders Delete(this IBatchAccountOperations operations, string resourceGroupName, string accountName) + { + return ((IBatchAccountOperations)operations).DeleteAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + /// + /// Gets information about the specified Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + public static BatchAccount Get(this IBatchAccountOperations operations, string resourceGroupName, string accountName) + { + return ((IBatchAccountOperations)operations).GetAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the specified Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IBatchAccountOperations operations) + { + return ((IBatchAccountOperations)operations).ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IBatchAccountOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets information about the Batch accounts associated with the specified + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroup(this IBatchAccountOperations operations, string resourceGroupName) + { + return ((IBatchAccountOperations)operations).ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the Batch accounts associated with the specified + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupAsync(this IBatchAccountOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Synchronizes access keys for the auto-storage account configured for the + /// specified Batch account, only if storage key authentication is being used. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + public static void SynchronizeAutoStorageKeys(this IBatchAccountOperations operations, string resourceGroupName, string accountName) + { + ((IBatchAccountOperations)operations).SynchronizeAutoStorageKeysAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// Synchronizes access keys for the auto-storage account configured for the + /// specified Batch account, only if storage key authentication is being used. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task SynchronizeAutoStorageKeysAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.SynchronizeAutoStorageKeysWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// This operation applies only to Batch accounts with + /// allowedAuthenticationModes containing 'SharedKey'. If the Batch account + /// doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients + /// cannot use shared keys to authenticate, and must use another + /// allowedAuthenticationModes instead. In this case, regenerating the keys + /// will fail. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + public static BatchAccountKeys RegenerateKey(this IBatchAccountOperations operations, string resourceGroupName, string accountName, AccountKeyType keyName) + { + return ((IBatchAccountOperations)operations).RegenerateKeyAsync(resourceGroupName, accountName, keyName).GetAwaiter().GetResult(); + } + + /// + /// This operation applies only to Batch accounts with + /// allowedAuthenticationModes containing 'SharedKey'. If the Batch account + /// doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients + /// cannot use shared keys to authenticate, and must use another + /// allowedAuthenticationModes instead. In this case, regenerating the keys + /// will fail. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task RegenerateKeyAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, AccountKeyType keyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.RegenerateKeyWithHttpMessagesAsync(resourceGroupName, accountName, keyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// This operation applies only to Batch accounts with + /// allowedAuthenticationModes containing 'SharedKey'. If the Batch account + /// doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients + /// cannot use shared keys to authenticate, and must use another + /// allowedAuthenticationModes instead. In this case, getting the keys will + /// fail. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + public static BatchAccountKeys GetKeys(this IBatchAccountOperations operations, string resourceGroupName, string accountName) + { + return ((IBatchAccountOperations)operations).GetKeysAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// This operation applies only to Batch accounts with + /// allowedAuthenticationModes containing 'SharedKey'. If the Batch account + /// doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients + /// cannot use shared keys to authenticate, and must use another + /// allowedAuthenticationModes instead. In this case, getting the keys will + /// fail. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetKeysAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetKeysWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets information about the detectors available for a given Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + public static Microsoft.Rest.Azure.IPage ListDetectors(this IBatchAccountOperations operations, string resourceGroupName, string accountName) + { + return ((IBatchAccountOperations)operations).ListDetectorsAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the detectors available for a given Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListDetectorsAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListDetectorsWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets information about the given detector for a given Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the detector. + /// + public static DetectorResponse GetDetector(this IBatchAccountOperations operations, string resourceGroupName, string accountName, string detectorId) + { + return ((IBatchAccountOperations)operations).GetDetectorAsync(resourceGroupName, accountName, detectorId).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the given detector for a given Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the detector. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetDetectorAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, string detectorId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetDetectorWithHttpMessagesAsync(resourceGroupName, accountName, detectorId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the endpoints that a Batch Compute Node under this Batch Account may + /// call as part of Batch service administration. If you are deploying a Pool + /// inside of a virtual network that you specify, you must make sure your + /// network allows outbound access to these endpoints. Failure to allow access + /// to these endpoints may cause Batch to mark the affected nodes as unusable. + /// For more information about creating a pool inside of a virtual network, see + /// https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + public static Microsoft.Rest.Azure.IPage ListOutboundNetworkDependenciesEndpoints(this IBatchAccountOperations operations, string resourceGroupName, string accountName) + { + return ((IBatchAccountOperations)operations).ListOutboundNetworkDependenciesEndpointsAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// Lists the endpoints that a Batch Compute Node under this Batch Account may + /// call as part of Batch service administration. If you are deploying a Pool + /// inside of a virtual network that you specify, you must make sure your + /// network allows outbound access to these endpoints. Failure to allow access + /// to these endpoints may cause Batch to mark the affected nodes as unusable. + /// For more information about creating a pool inside of a virtual network, see + /// https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListOutboundNetworkDependenciesEndpointsAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListOutboundNetworkDependenciesEndpointsWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates a new Batch account with the specified parameters. Existing + /// accounts cannot be updated with this API and should instead be updated with + /// the Update Batch Account API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// A name for the Batch account which must be unique within the region. Batch + /// account names must be between 3 and 24 characters in length and must use + /// only numbers and lowercase letters. This name is used as part of the DNS + /// name that is used to access the Batch service in the region in which the + /// account is created. For example: + /// http://accountname.region.batch.azure.com/. + /// + public static BatchAccount BeginCreate(this IBatchAccountOperations operations, string resourceGroupName, string accountName, BatchAccountCreateParameters parameters) + { + return ((IBatchAccountOperations)operations).BeginCreateAsync(resourceGroupName, accountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new Batch account with the specified parameters. Existing + /// accounts cannot be updated with this API and should instead be updated with + /// the Update Batch Account API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// A name for the Batch account which must be unique within the region. Batch + /// account names must be between 3 and 24 characters in length and must use + /// only numbers and lowercase letters. This name is used as part of the DNS + /// name that is used to access the Batch service in the region in which the + /// account is created. For example: + /// http://accountname.region.batch.azure.com/. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, BatchAccountCreateParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, accountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes the specified Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + public static BatchAccountDeleteHeaders BeginDelete(this IBatchAccountOperations operations, string resourceGroupName, string accountName) + { + return ((IBatchAccountOperations)operations).BeginDeleteAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IBatchAccountOperations operations, string resourceGroupName, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IBatchAccountOperations operations, string nextPageLink) + { + return ((IBatchAccountOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IBatchAccountOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets information about the Batch accounts associated with the specified + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroupNext(this IBatchAccountOperations operations, string nextPageLink) + { + return ((IBatchAccountOperations)operations).ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the Batch accounts associated with the specified + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupNextAsync(this IBatchAccountOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets information about the detectors available for a given Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListDetectorsNext(this IBatchAccountOperations operations, string nextPageLink) + { + return ((IBatchAccountOperations)operations).ListDetectorsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the detectors available for a given Batch account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListDetectorsNextAsync(this IBatchAccountOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListDetectorsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the endpoints that a Batch Compute Node under this Batch Account may + /// call as part of Batch service administration. If you are deploying a Pool + /// inside of a virtual network that you specify, you must make sure your + /// network allows outbound access to these endpoints. Failure to allow access + /// to these endpoints may cause Batch to mark the affected nodes as unusable. + /// For more information about creating a pool inside of a virtual network, see + /// https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListOutboundNetworkDependenciesEndpointsNext(this IBatchAccountOperations operations, string nextPageLink) + { + return ((IBatchAccountOperations)operations).ListOutboundNetworkDependenciesEndpointsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the endpoints that a Batch Compute Node under this Batch Account may + /// call as part of Batch service administration. If you are deploying a Pool + /// inside of a virtual network that you specify, you must make sure your + /// network allows outbound access to these endpoints. Failure to allow access + /// to these endpoints may cause Batch to mark the affected nodes as unusable. + /// For more information about creating a pool inside of a virtual network, see + /// https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListOutboundNetworkDependenciesEndpointsNextAsync(this IBatchAccountOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListOutboundNetworkDependenciesEndpointsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Batch/Batch.Management.Sdk/Generated/BatchManagementClient.cs b/src/Batch/Batch.Management.Sdk/Generated/BatchManagementClient.cs new file mode 100644 index 000000000000..d0654bb16452 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/BatchManagementClient.cs @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// The Batch Management Client. + /// + public partial class BatchManagementClient : Microsoft.Rest.ServiceClient, IBatchManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + /// + /// Gets or sets json serialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } + /// + /// Gets or sets json deserialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } + /// + /// Credentials needed for the client to connect to Azure. + /// + public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + + /// + /// The Azure subscription ID. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000) + /// + public string SubscriptionId { get; set;} + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set;} + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + public int? LongRunningOperationRetryTimeout { get; set;} + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set;} + + /// + /// Gets the IBatchAccountOperations + /// + public virtual IBatchAccountOperations BatchAccount { get; private set; } + /// + /// Gets the IApplicationPackageOperations + /// + public virtual IApplicationPackageOperations ApplicationPackage { get; private set; } + /// + /// Gets the IApplicationOperations + /// + public virtual IApplicationOperations Application { get; private set; } + /// + /// Gets the ILocationOperations + /// + public virtual ILocationOperations Location { get; private set; } + /// + /// Gets the IOperations + /// + public virtual IOperations Operations { get; private set; } + /// + /// Gets the ICertificateOperations + /// + public virtual ICertificateOperations Certificate { get; private set; } + /// + /// Gets the IPrivateLinkResourceOperations + /// + public virtual IPrivateLinkResourceOperations PrivateLinkResource { get; private set; } + /// + /// Gets the IPrivateEndpointConnectionOperations + /// + public virtual IPrivateEndpointConnectionOperations PrivateEndpointConnection { get; private set; } + /// + /// Gets the IPoolOperations + /// + public virtual IPoolOperations Pool { get; private set; } + /// + /// Initializes a new instance of the BatchManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling BatchManagementClient.Dispose(). False: will not dispose provided httpClient + protected BatchManagementClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the BatchManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected BatchManagementClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the BatchManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected BatchManagementClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the BatchManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected BatchManagementClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the BatchManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected BatchManagementClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the BatchManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BatchManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BatchManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling BatchManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public BatchManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BatchManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BatchManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BatchManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BatchManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BatchManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Thrown when a required parameter is null + /// + public BatchManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + + /// + /// Initializes client properties. + /// + private void Initialize() + { + this.BatchAccount = new BatchAccountOperations(this); + this.ApplicationPackage = new ApplicationPackageOperations(this); + this.Application = new ApplicationOperations(this); + this.Location = new LocationOperations(this); + this.Operations = new Operations(this); + this.Certificate = new CertificateOperations(this); + this.PrivateLinkResource = new PrivateLinkResourceOperations(this); + this.PrivateEndpointConnection = new PrivateEndpointConnectionOperations(this); + this.Pool = new PoolOperations(this); + this.BaseUri = new System.Uri("https://management.azure.com"); + this.ApiVersion = "2022-10-01"; + this.AcceptLanguage = "en-US"; + this.LongRunningOperationRetryTimeout = 30; + this.GenerateClientRequestId = true; + SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/CertificateOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/CertificateOperations.cs new file mode 100644 index 000000000000..078a3e9e94c0 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/CertificateOperations.cs @@ -0,0 +1,1921 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// CertificateOperations operations. + /// + internal partial class CertificateOperations : Microsoft.Rest.IServiceOperations, ICertificateOperations + { + /// + /// Initializes a new instance of the CertificateOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CertificateOperations (BatchManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BatchManagementClient + /// + public BatchManagementClient Client { get; private set; } + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Comma separated list of properties that should be returned. e.g. + /// "properties/provisioningState". Only top level properties under properties/ + /// are valid for selection. + /// + /// + /// OData filter expression. Valid properties for filtering are + /// "properties/provisioningState", + /// "properties/provisioningStateTransitionTime", "name". + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBatchAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxresults = default(int?), string select = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("maxresults", maxresults); + tracingParameters.Add("select", select); + tracingParameters.Add("filter", filter); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBatchAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (maxresults != null) + { + _queryParameters.Add(string.Format("maxresults={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(maxresults, this.Client.SerializationSettings).Trim('"')))); + } + if (select != null) + { + _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The entity state (ETag) version of the certificate to update. A value of + /// "*" can be used to apply the operation only if the certificate already + /// exists. If omitted, this operation will always be applied. + /// + /// + /// Set to '*' to allow a new certificate to be created, but to prevent + /// updating an existing certificate. Other values will be ignored. + /// + /// + /// Additional parameters for certificate creation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), string ifNoneMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (certificateName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateName"); + } + if (certificateName != null) + { + if (certificateName.Length > 45) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "certificateName", 45); + } + if (certificateName.Length < 5) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "certificateName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(certificateName, "^[\\w]+-[\\w]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "certificateName", "^[\\w]+-[\\w]+$"); + } + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("ifNoneMatch", ifNoneMatch); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + if (_httpRequest.Headers.Contains("If-None-Match")) + { + _httpRequest.Headers.Remove("If-None-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The entity state (ETag) version of the certificate to update. This value + /// can be omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// Certificate entity to update. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (certificateName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateName"); + } + if (certificateName != null) + { + if (certificateName.Length > 45) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "certificateName", 45); + } + if (certificateName.Length < 5) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "certificateName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(certificateName, "^[\\w]+-[\\w]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "certificateName", "^[\\w]+-[\\w]+$"); + } + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("ifMatch", ifMatch); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (certificateName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateName"); + } + if (certificateName != null) + { + if (certificateName.Length > 45) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "certificateName", 45); + } + if (certificateName.Length < 5) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "certificateName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(certificateName, "^[\\w]+-[\\w]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "certificateName", "^[\\w]+-[\\w]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("certificateName", certificateName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// If you try to delete a certificate that is being used by a pool or compute + /// node, the status of the certificate changes to deleteFailed. If you decide + /// that you want to continue using the certificate, you can use this operation + /// to set the status of the certificate back to active. If you intend to + /// delete the certificate, you do not need to run this operation after the + /// deletion failed. You must make sure that the certificate is not being used + /// by any resources, and then you can try again to delete the certificate. + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CancelDeletionWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (certificateName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateName"); + } + if (certificateName != null) + { + if (certificateName.Length > 45) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "certificateName", 45); + } + if (certificateName.Length < 5) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "certificateName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(certificateName, "^[\\w]+-[\\w]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "certificateName", "^[\\w]+-[\\w]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("certificateName", certificateName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CancelDeletion", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (certificateName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateName"); + } + if (certificateName != null) + { + if (certificateName.Length > 45) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "certificateName", 45); + } + if (certificateName.Length < 5) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "certificateName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(certificateName, "^[\\w]+-[\\w]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "certificateName", "^[\\w]+-[\\w]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("certificateName", certificateName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBatchAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBatchAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/CertificateOperationsExtensions.cs b/src/Batch/Batch.Management.Sdk/Generated/CertificateOperationsExtensions.cs new file mode 100644 index 000000000000..20323be4899d --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/CertificateOperationsExtensions.cs @@ -0,0 +1,496 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for CertificateOperations + /// + public static partial class CertificateOperationsExtensions + { + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Comma separated list of properties that should be returned. e.g. + /// "properties/provisioningState". Only top level properties under properties/ + /// are valid for selection. + /// + /// + /// OData filter expression. Valid properties for filtering are + /// "properties/provisioningState", + /// "properties/provisioningStateTransitionTime", "name". + /// + public static Microsoft.Rest.Azure.IPage ListByBatchAccount(this ICertificateOperations operations, string resourceGroupName, string accountName, int? maxresults = default(int?), string select = default(string), string filter = default(string)) + { + return ((ICertificateOperations)operations).ListByBatchAccountAsync(resourceGroupName, accountName, maxresults, select, filter).GetAwaiter().GetResult(); + } + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Comma separated list of properties that should be returned. e.g. + /// "properties/provisioningState". Only top level properties under properties/ + /// are valid for selection. + /// + /// + /// OData filter expression. Valid properties for filtering are + /// "properties/provisioningState", + /// "properties/provisioningStateTransitionTime", "name". + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBatchAccountAsync(this ICertificateOperations operations, string resourceGroupName, string accountName, int? maxresults = default(int?), string select = default(string), string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBatchAccountWithHttpMessagesAsync(resourceGroupName, accountName, maxresults, select, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The entity state (ETag) version of the certificate to update. A value of + /// "*" can be used to apply the operation only if the certificate already + /// exists. If omitted, this operation will always be applied. + /// + /// + /// Set to '*' to allow a new certificate to be created, but to prevent + /// updating an existing certificate. Other values will be ignored. + /// + public static Certificate Create(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), string ifNoneMatch = default(string)) + { + return ((ICertificateOperations)operations).CreateAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch).GetAwaiter().GetResult(); + } + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The entity state (ETag) version of the certificate to update. A value of + /// "*" can be used to apply the operation only if the certificate already + /// exists. If omitted, this operation will always be applied. + /// + /// + /// Set to '*' to allow a new certificate to be created, but to prevent + /// updating an existing certificate. Other values will be ignored. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), string ifNoneMatch = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The entity state (ETag) version of the certificate to update. This value + /// can be omitted or set to "*" to apply the operation unconditionally. + /// + public static Certificate Update(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string)) + { + return ((ICertificateOperations)operations).UpdateAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The entity state (ETag) version of the certificate to update. This value + /// can be omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + public static CertificateDeleteHeaders Delete(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName) + { + return ((ICertificateOperations)operations).DeleteAsync(resourceGroupName, accountName, certificateName).GetAwaiter().GetResult(); + } + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + public static Certificate Get(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName) + { + return ((ICertificateOperations)operations).GetAsync(resourceGroupName, accountName, certificateName).GetAwaiter().GetResult(); + } + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// If you try to delete a certificate that is being used by a pool or compute + /// node, the status of the certificate changes to deleteFailed. If you decide + /// that you want to continue using the certificate, you can use this operation + /// to set the status of the certificate back to active. If you intend to + /// delete the certificate, you do not need to run this operation after the + /// deletion failed. You must make sure that the certificate is not being used + /// by any resources, and then you can try again to delete the certificate. + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + public static Certificate CancelDeletion(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName) + { + return ((ICertificateOperations)operations).CancelDeletionAsync(resourceGroupName, accountName, certificateName).GetAwaiter().GetResult(); + } + + /// + /// If you try to delete a certificate that is being used by a pool or compute + /// node, the status of the certificate changes to deleteFailed. If you decide + /// that you want to continue using the certificate, you can use this operation + /// to set the status of the certificate back to active. If you intend to + /// delete the certificate, you do not need to run this operation after the + /// deletion failed. You must make sure that the certificate is not being used + /// by any resources, and then you can try again to delete the certificate. + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CancelDeletionAsync(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CancelDeletionWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + public static CertificateDeleteHeaders BeginDelete(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName) + { + return ((ICertificateOperations)operations).BeginDeleteAsync(resourceGroupName, accountName, certificateName).GetAwaiter().GetResult(); + } + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this ICertificateOperations operations, string resourceGroupName, string accountName, string certificateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, certificateName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBatchAccountNext(this ICertificateOperations operations, string nextPageLink) + { + return ((ICertificateOperations)operations).ListByBatchAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBatchAccountNextAsync(this ICertificateOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBatchAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Batch/Batch.Management.Sdk/Generated/IApplicationOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/IApplicationOperations.cs new file mode 100644 index 000000000000..0424b90cdb5d --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/IApplicationOperations.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// ApplicationOperations operations. + /// + public partial interface IApplicationOperations + { + /// + /// Adds an application to the specified Batch account. + /// + /// + /// Adds an application to the specified Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The parameters for the request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, Application parameters = default(Application), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes an application. + /// + /// + /// Deletes an application. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the specified application. + /// + /// + /// Gets information about the specified application. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates settings for the specified application. + /// + /// + /// Updates settings for the specified application. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The parameters for the request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, Application parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all of the applications in the specified account. + /// + /// + /// Lists all of the applications in the specified account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxresults = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all of the applications in the specified account. + /// + /// + /// Lists all of the applications in the specified account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/IApplicationPackageOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/IApplicationPackageOperations.cs new file mode 100644 index 000000000000..85c81fa9f7ca --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/IApplicationPackageOperations.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// ApplicationPackageOperations operations. + /// + public partial interface IApplicationPackageOperations + { + /// + /// Activates the specified application package. This should be done after the + /// `ApplicationPackage` was created and uploaded. This needs to be done before + /// an `ApplicationPackage` can be used on Pools or Tasks. + /// + /// + /// Activates the specified application package. This should be done after the + /// `ApplicationPackage` was created and uploaded. This needs to be done before + /// an `ApplicationPackage` can be used on Pools or Tasks. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// The format of the application package binary file. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> ActivateWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, string versionName, string format, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates an application package record. The record contains a storageUrl + /// where the package should be uploaded to. Once it is uploaded the + /// `ApplicationPackage` needs to be activated using `ApplicationPackageActive` + /// before it can be used. If the auto storage account was configured to use + /// storage keys, the URL returned will contain a SAS. + /// + /// + /// Creates an application package record. The record contains a storageUrl + /// where the package should be uploaded to. Once it is uploaded the + /// `ApplicationPackage` needs to be activated using `ApplicationPackageActive` + /// before it can be used. If the auto storage account was configured to use + /// storage keys, the URL returned will contain a SAS. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, string versionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes an application package record and its associated binary file. + /// + /// + /// Deletes an application package record and its associated binary file. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, string versionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the specified application package. + /// + /// + /// Gets information about the specified application package. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The version of the application. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, string versionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all of the application packages in the specified application. + /// + /// + /// Lists all of the application packages in the specified application. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the application. This must be unique within the account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, string applicationName, int? maxresults = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all of the application packages in the specified application. + /// + /// + /// Lists all of the application packages in the specified application. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/IBatchAccountOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/IBatchAccountOperations.cs new file mode 100644 index 000000000000..7bbb53b99291 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/IBatchAccountOperations.cs @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// BatchAccountOperations operations. + /// + public partial interface IBatchAccountOperations + { + /// + /// Creates a new Batch account with the specified parameters. Existing + /// accounts cannot be updated with this API and should instead be updated with + /// the Update Batch Account API. + /// + /// + /// Creates a new Batch account with the specified parameters. Existing + /// accounts cannot be updated with this API and should instead be updated with + /// the Update Batch Account API. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// A name for the Batch account which must be unique within the region. Batch + /// account names must be between 3 and 24 characters in length and must use + /// only numbers and lowercase letters. This name is used as part of the DNS + /// name that is used to access the Batch service in the region in which the + /// account is created. For example: + /// http://accountname.region.batch.azure.com/. + /// + /// + /// Additional parameters for account creation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, BatchAccountCreateParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the properties of an existing Batch account. + /// + /// + /// Updates the properties of an existing Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// Additional parameters for account update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, BatchAccountUpdateParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes the specified Batch account. + /// + /// + /// Deletes the specified Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the specified Batch account. + /// + /// + /// Gets information about the specified Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the Batch accounts associated with the specified + /// resource group. + /// + /// + /// Gets information about the Batch accounts associated with the specified + /// resource group. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Synchronizes access keys for the auto-storage account configured for the + /// specified Batch account, only if storage key authentication is being used. + /// + /// + /// Synchronizes access keys for the auto-storage account configured for the + /// specified Batch account, only if storage key authentication is being used. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task SynchronizeAutoStorageKeysWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// This operation applies only to Batch accounts with + /// allowedAuthenticationModes containing 'SharedKey'. If the Batch account + /// doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients + /// cannot use shared keys to authenticate, and must use another + /// allowedAuthenticationModes instead. In this case, regenerating the keys + /// will fail. + /// + /// + /// This operation applies only to Batch accounts with + /// allowedAuthenticationModes containing 'SharedKey'. If the Batch account + /// doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients + /// cannot use shared keys to authenticate, and must use another + /// allowedAuthenticationModes instead. In this case, regenerating the keys + /// will fail. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The type of account key to regenerate. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> RegenerateKeyWithHttpMessagesAsync(string resourceGroupName, string accountName, AccountKeyType keyName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// This operation applies only to Batch accounts with + /// allowedAuthenticationModes containing 'SharedKey'. If the Batch account + /// doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients + /// cannot use shared keys to authenticate, and must use another + /// allowedAuthenticationModes instead. In this case, getting the keys will + /// fail. + /// + /// + /// This operation applies only to Batch accounts with + /// allowedAuthenticationModes containing 'SharedKey'. If the Batch account + /// doesn't contain 'SharedKey' in its allowedAuthenticationMode, clients + /// cannot use shared keys to authenticate, and must use another + /// allowedAuthenticationModes instead. In this case, getting the keys will + /// fail. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetKeysWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the detectors available for a given Batch account. + /// + /// + /// Gets information about the detectors available for a given Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListDetectorsWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the given detector for a given Batch account. + /// + /// + /// Gets information about the given detector for a given Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The name of the detector. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetDetectorWithHttpMessagesAsync(string resourceGroupName, string accountName, string detectorId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the endpoints that a Batch Compute Node under this Batch Account may + /// call as part of Batch service administration. If you are deploying a Pool + /// inside of a virtual network that you specify, you must make sure your + /// network allows outbound access to these endpoints. Failure to allow access + /// to these endpoints may cause Batch to mark the affected nodes as unusable. + /// For more information about creating a pool inside of a virtual network, see + /// https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + /// + /// + /// Lists the endpoints that a Batch Compute Node under this Batch Account may + /// call as part of Batch service administration. If you are deploying a Pool + /// inside of a virtual network that you specify, you must make sure your + /// network allows outbound access to these endpoints. Failure to allow access + /// to these endpoints may cause Batch to mark the affected nodes as unusable. + /// For more information about creating a pool inside of a virtual network, see + /// https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListOutboundNetworkDependenciesEndpointsWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates a new Batch account with the specified parameters. Existing + /// accounts cannot be updated with this API and should instead be updated with + /// the Update Batch Account API. + /// + /// + /// Creates a new Batch account with the specified parameters. Existing + /// accounts cannot be updated with this API and should instead be updated with + /// the Update Batch Account API. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// A name for the Batch account which must be unique within the region. Batch + /// account names must be between 3 and 24 characters in length and must use + /// only numbers and lowercase letters. This name is used as part of the DNS + /// name that is used to access the Batch service in the region in which the + /// account is created. For example: + /// http://accountname.region.batch.azure.com/. + /// + /// + /// Additional parameters for account creation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string accountName, BatchAccountCreateParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes the specified Batch account. + /// + /// + /// Deletes the specified Batch account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// Gets information about the Batch accounts associated with the subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the Batch accounts associated with the specified + /// resource group. + /// + /// + /// Gets information about the Batch accounts associated with the specified + /// resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the detectors available for a given Batch account. + /// + /// + /// Gets information about the detectors available for a given Batch account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListDetectorsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the endpoints that a Batch Compute Node under this Batch Account may + /// call as part of Batch service administration. If you are deploying a Pool + /// inside of a virtual network that you specify, you must make sure your + /// network allows outbound access to these endpoints. Failure to allow access + /// to these endpoints may cause Batch to mark the affected nodes as unusable. + /// For more information about creating a pool inside of a virtual network, see + /// https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + /// + /// + /// Lists the endpoints that a Batch Compute Node under this Batch Account may + /// call as part of Batch service administration. If you are deploying a Pool + /// inside of a virtual network that you specify, you must make sure your + /// network allows outbound access to these endpoints. Failure to allow access + /// to these endpoints may cause Batch to mark the affected nodes as unusable. + /// For more information about creating a pool inside of a virtual network, see + /// https://docs.microsoft.com/en-us/azure/batch/batch-virtual-network. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListOutboundNetworkDependenciesEndpointsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/IBatchManagementClient.cs b/src/Batch/Batch.Management.Sdk/Generated/IBatchManagementClient.cs new file mode 100644 index 000000000000..83562fff68f6 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/IBatchManagementClient.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// The Batch Management Client. + /// + public partial interface IBatchManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + Microsoft.Rest.ServiceClientCredentials Credentials { get;} + + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get;} + + + /// + /// The Azure subscription ID. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000) + /// + string SubscriptionId { get; set;} + + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set;} + + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set;} + + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set;} + + + /// + /// Gets the IBatchAccountOperations + /// + IBatchAccountOperations BatchAccount { get; } + + /// + /// Gets the IApplicationPackageOperations + /// + IApplicationPackageOperations ApplicationPackage { get; } + + /// + /// Gets the IApplicationOperations + /// + IApplicationOperations Application { get; } + + /// + /// Gets the ILocationOperations + /// + ILocationOperations Location { get; } + + /// + /// Gets the IOperations + /// + IOperations Operations { get; } + + /// + /// Gets the ICertificateOperations + /// + ICertificateOperations Certificate { get; } + + /// + /// Gets the IPrivateLinkResourceOperations + /// + IPrivateLinkResourceOperations PrivateLinkResource { get; } + + /// + /// Gets the IPrivateEndpointConnectionOperations + /// + IPrivateEndpointConnectionOperations PrivateEndpointConnection { get; } + + /// + /// Gets the IPoolOperations + /// + IPoolOperations Pool { get; } + + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/ICertificateOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/ICertificateOperations.cs new file mode 100644 index 000000000000..da9095bd7f45 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/ICertificateOperations.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// CertificateOperations operations. + /// + public partial interface ICertificateOperations + { + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Comma separated list of properties that should be returned. e.g. + /// "properties/provisioningState". Only top level properties under properties/ + /// are valid for selection. + /// + /// + /// OData filter expression. Valid properties for filtering are + /// "properties/provisioningState", + /// "properties/provisioningStateTransitionTime", "name". + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBatchAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxresults = default(int?), string select = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The entity state (ETag) version of the certificate to update. A value of + /// "*" can be used to apply the operation only if the certificate already + /// exists. If omitted, this operation will always be applied. + /// + /// + /// Set to '*' to allow a new certificate to be created, but to prevent + /// updating an existing certificate. Other values will be ignored. + /// + /// + /// Additional parameters for certificate creation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), string ifNoneMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The entity state (ETag) version of the certificate to update. This value + /// can be omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// Certificate entity to update. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, CertificateCreateOrUpdateParameters parameters, string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// If you try to delete a certificate that is being used by a pool or compute + /// node, the status of the certificate changes to deleteFailed. If you decide + /// that you want to continue using the certificate, you can use this operation + /// to set the status of the certificate back to active. If you intend to + /// delete the certificate, you do not need to run this operation after the + /// deletion failed. You must make sure that the certificate is not being used + /// by any resources, and then you can try again to delete the certificate. + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// If you try to delete a certificate that is being used by a pool or compute + /// node, the status of the certificate changes to deleteFailed. If you decide + /// that you want to continue using the certificate, you can use this operation + /// to set the status of the certificate back to active. If you intend to + /// delete the certificate, you do not need to run this operation after the + /// deletion failed. You must make sure that the certificate is not being used + /// by any resources, and then you can try again to delete the certificate. + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CancelDeletionWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The identifier for the certificate. This must be made up of algorithm and + /// thumbprint separated by a dash, and must match the certificate data in the + /// request. For example SHA1-a3d1c5. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string certificateName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// Warning: This operation is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBatchAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/ILocationOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/ILocationOperations.cs new file mode 100644 index 000000000000..d9c71c0a6ca9 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/ILocationOperations.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// LocationOperations operations. + /// + public partial interface ILocationOperations + { + /// + /// Gets the Batch service quotas for the specified subscription at the given + /// location. + /// + /// + /// Gets the Batch service quotas for the specified subscription at the given + /// location. + /// + /// + /// The region for which to retrieve Batch service quotas. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetQuotasWithHttpMessagesAsync(string locationName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the + /// given location. + /// + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the + /// given location. + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// OData filter expression. Valid properties for filtering are "familyName". + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListSupportedVirtualMachineSkusWithHttpMessagesAsync(string locationName, int? maxresults = default(int?), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the + /// given location. + /// + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the + /// given location. + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// OData filter expression. Valid properties for filtering are "familyName". + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListSupportedCloudServiceSkusWithHttpMessagesAsync(string locationName, int? maxresults = default(int?), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Checks whether the Batch account name is available in the specified region. + /// + /// + /// Checks whether the Batch account name is available in the specified region. + /// + /// + /// The desired region for the name check. + /// + /// + /// The name to check for availability + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CheckNameAvailabilityWithHttpMessagesAsync(string locationName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the + /// given location. + /// + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the + /// given location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListSupportedVirtualMachineSkusNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the + /// given location. + /// + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the + /// given location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListSupportedCloudServiceSkusNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/IOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/IOperations.cs new file mode 100644 index 000000000000..28bf42e11fed --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/IOperations.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists available operations for the Microsoft.Batch provider + /// + /// + /// Lists available operations for the Microsoft.Batch provider + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists available operations for the Microsoft.Batch provider + /// + /// + /// Lists available operations for the Microsoft.Batch provider + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/IPoolOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/IPoolOperations.cs new file mode 100644 index 000000000000..6b743822f97d --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/IPoolOperations.cs @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// PoolOperations operations. + /// + public partial interface IPoolOperations + { + /// + /// Lists all of the pools in the specified account. + /// + /// + /// Lists all of the pools in the specified account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Comma separated list of properties that should be returned. e.g. + /// "properties/provisioningState". Only top level properties under properties/ + /// are valid for selection. + /// + /// + /// OData filter expression. Valid properties for filtering are: + /// name + /// properties/allocationState + /// properties/allocationStateTransitionTime + /// properties/creationTime + /// properties/provisioningState + /// properties/provisioningStateTransitionTime + /// properties/lastModified + /// properties/vmSize + /// properties/interNodeCommunication + /// properties/scaleSettings/autoScale + /// properties/scaleSettings/fixedScale + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBatchAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxresults = default(int?), string select = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates a new pool inside the specified account. + /// + /// + /// Creates a new pool inside the specified account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The entity state (ETag) version of the pool to update. A value of "*" can + /// be used to apply the operation only if the pool already exists. If omitted, + /// this operation will always be applied. + /// + /// + /// Set to '*' to allow a new pool to be created, but to prevent updating an + /// existing pool. Other values will be ignored. + /// + /// + /// Additional parameters for pool creation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the properties of an existing pool. + /// + /// + /// Updates the properties of an existing pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The entity state (ETag) version of the pool to update. This value can be + /// omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// Pool properties that should be updated. Properties that are supplied will + /// be updated, any property not supplied will be unchanged. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes the specified pool. + /// + /// + /// Deletes the specified pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the specified pool. + /// + /// + /// Gets information about the specified pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Disables automatic scaling for a pool. + /// + /// + /// Disables automatic scaling for a pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> DisableAutoScaleWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// This does not restore the pool to its previous state before the resize + /// operation: it only stops any further changes being made, and the pool + /// maintains its current state. After stopping, the pool stabilizes at the + /// number of nodes it was at when the stop operation was done. During the stop + /// operation, the pool allocation state changes first to stopping and then to + /// steady. A resize operation need not be an explicit resize pool request; + /// this API can also be used to halt the initial sizing of the pool when it is + /// created. + /// + /// + /// This does not restore the pool to its previous state before the resize + /// operation: it only stops any further changes being made, and the pool + /// maintains its current state. After stopping, the pool stabilizes at the + /// number of nodes it was at when the stop operation was done. During the stop + /// operation, the pool allocation state changes first to stopping and then to + /// steady. A resize operation need not be an explicit resize pool request; + /// this API can also be used to halt the initial sizing of the pool when it is + /// created. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> StopResizeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes the specified pool. + /// + /// + /// Deletes the specified pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all of the pools in the specified account. + /// + /// + /// Lists all of the pools in the specified account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBatchAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/IPrivateEndpointConnectionOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/IPrivateEndpointConnectionOperations.cs new file mode 100644 index 000000000000..233a6afc572b --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/IPrivateEndpointConnectionOperations.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// PrivateEndpointConnectionOperations operations. + /// + public partial interface IPrivateEndpointConnectionOperations + { + /// + /// Lists all of the private endpoint connections in the specified account. + /// + /// + /// Lists all of the private endpoint connections in the specified account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBatchAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxresults = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the specified private endpoint connection. + /// + /// + /// Gets information about the specified private endpoint connection. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the properties of an existing private endpoint connection. + /// + /// + /// Updates the properties of an existing private endpoint connection. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The state (ETag) version of the private endpoint connection to update. This + /// value can be omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// The private link service connection state of the private endpoint + /// connection + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes the specified private endpoint connection. + /// + /// + /// Deletes the specified private endpoint connection. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the properties of an existing private endpoint connection. + /// + /// + /// Updates the properties of an existing private endpoint connection. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The state (ETag) version of the private endpoint connection to update. This + /// value can be omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// The private link service connection state of the private endpoint + /// connection + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes the specified private endpoint connection. + /// + /// + /// Deletes the specified private endpoint connection. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all of the private endpoint connections in the specified account. + /// + /// + /// Lists all of the private endpoint connections in the specified account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBatchAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/IPrivateLinkResourceOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/IPrivateLinkResourceOperations.cs new file mode 100644 index 000000000000..4e835ed36309 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/IPrivateLinkResourceOperations.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// PrivateLinkResourceOperations operations. + /// + public partial interface IPrivateLinkResourceOperations + { + /// + /// Lists all of the private link resources in the specified account. + /// + /// + /// Lists all of the private link resources in the specified account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBatchAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxresults = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets information about the specified private link resource. + /// + /// + /// Gets information about the specified private link resource. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private link resource name. This must be unique within the account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateLinkResourceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all of the private link resources in the specified account. + /// + /// + /// Lists all of the private link resources in the specified account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBatchAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/LocationOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/LocationOperations.cs new file mode 100644 index 000000000000..6ccb5b76ea2d --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/LocationOperations.cs @@ -0,0 +1,1274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// LocationOperations operations. + /// + internal partial class LocationOperations : Microsoft.Rest.IServiceOperations, ILocationOperations + { + /// + /// Initializes a new instance of the LocationOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LocationOperations (BatchManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BatchManagementClient + /// + public BatchManagementClient Client { get; private set; } + + /// + /// Gets the Batch service quotas for the specified subscription at the given + /// location. + /// + /// + /// The region for which to retrieve Batch service quotas. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetQuotasWithHttpMessagesAsync(string locationName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (locationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "locationName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("locationName", locationName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetQuotas", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the + /// given location. + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// OData filter expression. Valid properties for filtering are "familyName". + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListSupportedVirtualMachineSkusWithHttpMessagesAsync(string locationName, int? maxresults = default(int?), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (locationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "locationName"); + } + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("maxresults", maxresults); + tracingParameters.Add("filter", filter); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListSupportedVirtualMachineSkus", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/virtualMachineSkus").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (maxresults != null) + { + _queryParameters.Add(string.Format("maxresults={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(maxresults, this.Client.SerializationSettings).Trim('"')))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the + /// given location. + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// OData filter expression. Valid properties for filtering are "familyName". + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListSupportedCloudServiceSkusWithHttpMessagesAsync(string locationName, int? maxresults = default(int?), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (locationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "locationName"); + } + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("maxresults", maxresults); + tracingParameters.Add("filter", filter); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListSupportedCloudServiceSkus", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/cloudServiceSkus").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (maxresults != null) + { + _queryParameters.Add(string.Format("maxresults={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(maxresults, this.Client.SerializationSettings).Trim('"')))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Checks whether the Batch account name is available in the specified region. + /// + /// + /// The desired region for the name check. + /// + /// + /// The name to check for availability + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CheckNameAvailabilityWithHttpMessagesAsync(string locationName, string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (locationName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "locationName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + CheckNameAvailabilityParameters parameters = new CheckNameAvailabilityParameters(); + if(name != null) + { + parameters.Name = name; + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("locationName", locationName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability").ToString(); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the + /// given location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListSupportedVirtualMachineSkusNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListSupportedVirtualMachineSkusNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the + /// given location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListSupportedCloudServiceSkusNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListSupportedCloudServiceSkusNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/LocationOperationsExtensions.cs b/src/Batch/Batch.Management.Sdk/Generated/LocationOperationsExtensions.cs new file mode 100644 index 000000000000..0d664da956bc --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/LocationOperationsExtensions.cs @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for LocationOperations + /// + public static partial class LocationOperationsExtensions + { + /// + /// Gets the Batch service quotas for the specified subscription at the given + /// location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The region for which to retrieve Batch service quotas. + /// + public static BatchLocationQuota GetQuotas(this ILocationOperations operations, string locationName) + { + return ((ILocationOperations)operations).GetQuotasAsync(locationName).GetAwaiter().GetResult(); + } + + /// + /// Gets the Batch service quotas for the specified subscription at the given + /// location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The region for which to retrieve Batch service quotas. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetQuotasAsync(this ILocationOperations operations, string locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetQuotasWithHttpMessagesAsync(locationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the + /// given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// OData filter expression. Valid properties for filtering are "familyName". + /// + public static Microsoft.Rest.Azure.IPage ListSupportedVirtualMachineSkus(this ILocationOperations operations, string locationName, int? maxresults = default(int?), string filter = default(string)) + { + return ((ILocationOperations)operations).ListSupportedVirtualMachineSkusAsync(locationName, maxresults, filter).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the + /// given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// OData filter expression. Valid properties for filtering are "familyName". + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListSupportedVirtualMachineSkusAsync(this ILocationOperations operations, string locationName, int? maxresults = default(int?), string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListSupportedVirtualMachineSkusWithHttpMessagesAsync(locationName, maxresults, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the + /// given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// OData filter expression. Valid properties for filtering are "familyName". + /// + public static Microsoft.Rest.Azure.IPage ListSupportedCloudServiceSkus(this ILocationOperations operations, string locationName, int? maxresults = default(int?), string filter = default(string)) + { + return ((ILocationOperations)operations).ListSupportedCloudServiceSkusAsync(locationName, maxresults, filter).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the + /// given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The region for which to retrieve Batch service supported SKUs. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// OData filter expression. Valid properties for filtering are "familyName". + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListSupportedCloudServiceSkusAsync(this ILocationOperations operations, string locationName, int? maxresults = default(int?), string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListSupportedCloudServiceSkusWithHttpMessagesAsync(locationName, maxresults, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Checks whether the Batch account name is available in the specified region. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The desired region for the name check. + /// + public static CheckNameAvailabilityResult CheckNameAvailability(this ILocationOperations operations, string locationName, string name) + { + return ((ILocationOperations)operations).CheckNameAvailabilityAsync(locationName, name).GetAwaiter().GetResult(); + } + + /// + /// Checks whether the Batch account name is available in the specified region. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The desired region for the name check. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CheckNameAvailabilityAsync(this ILocationOperations operations, string locationName, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(locationName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the + /// given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListSupportedVirtualMachineSkusNext(this ILocationOperations operations, string nextPageLink) + { + return ((ILocationOperations)operations).ListSupportedVirtualMachineSkusNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Batch supported Virtual Machine VM sizes available at the + /// given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListSupportedVirtualMachineSkusNextAsync(this ILocationOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListSupportedVirtualMachineSkusNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the + /// given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListSupportedCloudServiceSkusNext(this ILocationOperations operations, string nextPageLink) + { + return ((ILocationOperations)operations).ListSupportedCloudServiceSkusNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Batch supported Cloud Service VM sizes available at the + /// given location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListSupportedCloudServiceSkusNextAsync(this ILocationOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListSupportedCloudServiceSkusNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AccountKeyType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AccountKeyType.cs new file mode 100644 index 000000000000..217707c3a06f --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AccountKeyType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for AccountKeyType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum AccountKeyType + { + /// + /// The primary account key. + /// + [System.Runtime.Serialization.EnumMember(Value = "Primary")] + Primary, + /// + /// The secondary account key. + /// + [System.Runtime.Serialization.EnumMember(Value = "Secondary")] + Secondary + } + internal static class AccountKeyTypeEnumExtension + { + internal static string ToSerializedValue(this AccountKeyType? value) + { + return value == null ? null : ((AccountKeyType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this AccountKeyType value) + { + switch( value ) + { + case AccountKeyType.Primary: + return "Primary"; + case AccountKeyType.Secondary: + return "Secondary"; + } + return null; + } + internal static AccountKeyType? ParseAccountKeyType(this string value) + { + switch( value ) + { + case "Primary": + return AccountKeyType.Primary; + case "Secondary": + return AccountKeyType.Secondary; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ActivateApplicationPackageParameters.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ActivateApplicationPackageParameters.cs new file mode 100644 index 000000000000..3a9926645f8d --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ActivateApplicationPackageParameters.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Parameters for an activating an application package. + /// + public partial class ActivateApplicationPackageParameters + { + /// + /// Initializes a new instance of the ActivateApplicationPackageParameters class. + /// + public ActivateApplicationPackageParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActivateApplicationPackageParameters class. + /// + + /// The format of the application package binary file. + /// + public ActivateApplicationPackageParameters(string format) + + { + this.Format = format; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the format of the application package binary file. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "format")] + public string Format {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Format == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Format"); + } + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AllocationState.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AllocationState.cs new file mode 100644 index 000000000000..9fb521ef833c --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AllocationState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for AllocationState. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum AllocationState + { + /// + /// The pool is not resizing. There are no changes to the number of nodes in + /// the pool in progress. A pool enters this state when it is created and when + /// no operations are being performed on the pool to change the number of + /// nodes. + /// + [System.Runtime.Serialization.EnumMember(Value = "Steady")] + Steady, + /// + /// The pool is resizing; that is, compute nodes are being added to or removed + /// from the pool. + /// + [System.Runtime.Serialization.EnumMember(Value = "Resizing")] + Resizing, + /// + /// The pool was resizing, but the user has requested that the resize be + /// stopped, but the stop request has not yet been completed. + /// + [System.Runtime.Serialization.EnumMember(Value = "Stopping")] + Stopping + } + internal static class AllocationStateEnumExtension + { + internal static string ToSerializedValue(this AllocationState? value) + { + return value == null ? null : ((AllocationState)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this AllocationState value) + { + switch( value ) + { + case AllocationState.Steady: + return "Steady"; + case AllocationState.Resizing: + return "Resizing"; + case AllocationState.Stopping: + return "Stopping"; + } + return null; + } + internal static AllocationState? ParseAllocationState(this string value) + { + switch( value ) + { + case "Steady": + return AllocationState.Steady; + case "Resizing": + return AllocationState.Resizing; + case "Stopping": + return AllocationState.Stopping; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/Application.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/Application.cs new file mode 100644 index 000000000000..0ce1fc8ab1e7 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/Application.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Contains information about an application in a Batch account. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Application : ProxyResource + { + /// + /// Initializes a new instance of the Application class. + /// + public Application() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Application class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The ETag of the resource, used for concurrency statements. + /// + + /// The display name for the application. + /// + + /// A value indicating whether packages within the application may be + /// overwritten using the same version string. + /// + + /// The package to use if a client requests the application but does not + /// specify a version. This property can only be set to the name of an existing + /// package. + /// + public Application(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string displayName = default(string), bool? allowUpdates = default(bool?), string defaultVersion = default(string)) + + : base(id, name, type, etag) + { + this.DisplayName = displayName; + this.AllowUpdates = allowUpdates; + this.DefaultVersion = defaultVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the display name for the application. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets a value indicating whether packages within the application may + /// be overwritten using the same version string. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowUpdates")] + public bool? AllowUpdates {get; set; } + + /// + /// Gets or sets the package to use if a client requests the application but + /// does not specify a version. This property can only be set to the name of an + /// existing package. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.defaultVersion")] + public string DefaultVersion {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackage.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackage.cs new file mode 100644 index 000000000000..4232032b173c --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackage.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// An application package which represents a particular version of an + /// application. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class ApplicationPackage : ProxyResource + { + /// + /// Initializes a new instance of the ApplicationPackage class. + /// + public ApplicationPackage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationPackage class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The ETag of the resource, used for concurrency statements. + /// + + /// The current state of the application package. + /// Possible values include: 'Pending', 'Active' + + /// The format of the application package, if the package is active. + /// + + /// The URL for the application package in Azure Storage. + /// + + /// The UTC time at which the Azure Storage URL will expire. + /// + + /// The time at which the package was last activated, if the package is active. + /// + public ApplicationPackage(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), PackageState? state = default(PackageState?), string format = default(string), string storageUrl = default(string), System.DateTime? storageUrlExpiry = default(System.DateTime?), System.DateTime? lastActivationTime = default(System.DateTime?)) + + : base(id, name, type, etag) + { + this.State = state; + this.Format = format; + this.StorageUrl = storageUrl; + this.StorageUrlExpiry = storageUrlExpiry; + this.LastActivationTime = lastActivationTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the current state of the application package. Possible values include: 'Pending', 'Active' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.state")] + public PackageState? State {get; private set; } + + /// + /// Gets the format of the application package, if the package is active. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.format")] + public string Format {get; private set; } + + /// + /// Gets the URL for the application package in Azure Storage. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageUrl")] + public string StorageUrl {get; private set; } + + /// + /// Gets the UTC time at which the Azure Storage URL will expire. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageUrlExpiry")] + public System.DateTime? StorageUrlExpiry {get; private set; } + + /// + /// Gets the time at which the package was last activated, if the package is + /// active. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lastActivationTime")] + public System.DateTime? LastActivationTime {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackageProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackageProperties.cs new file mode 100644 index 000000000000..e0505bf55050 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackageProperties.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Properties of an application package + /// + public partial class ApplicationPackageProperties + { + /// + /// Initializes a new instance of the ApplicationPackageProperties class. + /// + public ApplicationPackageProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationPackageProperties class. + /// + + /// The current state of the application package. + /// Possible values include: 'Pending', 'Active' + + /// The format of the application package, if the package is active. + /// + + /// The URL for the application package in Azure Storage. + /// + + /// The UTC time at which the Azure Storage URL will expire. + /// + + /// The time at which the package was last activated, if the package is active. + /// + public ApplicationPackageProperties(PackageState? state = default(PackageState?), string format = default(string), string storageUrl = default(string), System.DateTime? storageUrlExpiry = default(System.DateTime?), System.DateTime? lastActivationTime = default(System.DateTime?)) + + { + this.State = state; + this.Format = format; + this.StorageUrl = storageUrl; + this.StorageUrlExpiry = storageUrlExpiry; + this.LastActivationTime = lastActivationTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the current state of the application package. Possible values include: 'Pending', 'Active' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "state")] + public PackageState? State {get; private set; } + + /// + /// Gets the format of the application package, if the package is active. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "format")] + public string Format {get; private set; } + + /// + /// Gets the URL for the application package in Azure Storage. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageUrl")] + public string StorageUrl {get; private set; } + + /// + /// Gets the UTC time at which the Azure Storage URL will expire. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageUrlExpiry")] + public System.DateTime? StorageUrlExpiry {get; private set; } + + /// + /// Gets the time at which the package was last activated, if the package is + /// active. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastActivationTime")] + public System.DateTime? LastActivationTime {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackageReference.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackageReference.cs new file mode 100644 index 000000000000..31e304ad83d7 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationPackageReference.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Link to an application package inside the batch account + /// + /// + /// Link to an application package inside the batch account + /// + public partial class ApplicationPackageReference + { + /// + /// Initializes a new instance of the ApplicationPackageReference class. + /// + public ApplicationPackageReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationPackageReference class. + /// + + /// The ID of the application package to install. This must be inside the same + /// batch account as the pool. This can either be a reference to a specific + /// version or the default version if one exists. + /// + + /// If this is omitted, and no default version is specified for this + /// application, the request fails with the error code + /// InvalidApplicationPackageReferences. If you are calling the REST API + /// directly, the HTTP status code is 409. + /// + public ApplicationPackageReference(string id, string version = default(string)) + + { + this.Id = id; + this.Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the ID of the application package to install. This must be + /// inside the same batch account as the pool. This can either be a reference + /// to a specific version or the default version if one exists. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } + + /// + /// Gets or sets if this is omitted, and no default version is specified for + /// this application, the request fails with the error code + /// InvalidApplicationPackageReferences. If you are calling the REST API + /// directly, the HTTP status code is 409. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "version")] + public string Version {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Id == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Id"); + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationProperties.cs new file mode 100644 index 000000000000..a6cc04dd1bb3 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ApplicationProperties.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The properties associated with the Application. + /// + public partial class ApplicationProperties + { + /// + /// Initializes a new instance of the ApplicationProperties class. + /// + public ApplicationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationProperties class. + /// + + /// The display name for the application. + /// + + /// A value indicating whether packages within the application may be + /// overwritten using the same version string. + /// + + /// The package to use if a client requests the application but does not + /// specify a version. This property can only be set to the name of an existing + /// package. + /// + public ApplicationProperties(string displayName = default(string), bool? allowUpdates = default(bool?), string defaultVersion = default(string)) + + { + this.DisplayName = displayName; + this.AllowUpdates = allowUpdates; + this.DefaultVersion = defaultVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the display name for the application. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets a value indicating whether packages within the application may + /// be overwritten using the same version string. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowUpdates")] + public bool? AllowUpdates {get; set; } + + /// + /// Gets or sets the package to use if a client requests the application but + /// does not specify a version. This property can only be set to the name of an + /// existing package. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "defaultVersion")] + public string DefaultVersion {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AuthenticationMode.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AuthenticationMode.cs new file mode 100644 index 000000000000..558bda075764 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AuthenticationMode.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for AuthenticationMode. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum AuthenticationMode + { + /// + /// The authentication mode using shared keys. + /// + [System.Runtime.Serialization.EnumMember(Value = "SharedKey")] + SharedKey, + /// + /// The authentication mode using Azure Active Directory. + /// + [System.Runtime.Serialization.EnumMember(Value = "AAD")] + AAD, + /// + /// The authentication mode using task authentication tokens. + /// + [System.Runtime.Serialization.EnumMember(Value = "TaskAuthenticationToken")] + TaskAuthenticationToken + } + internal static class AuthenticationModeEnumExtension + { + internal static string ToSerializedValue(this AuthenticationMode? value) + { + return value == null ? null : ((AuthenticationMode)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this AuthenticationMode value) + { + switch( value ) + { + case AuthenticationMode.SharedKey: + return "SharedKey"; + case AuthenticationMode.AAD: + return "AAD"; + case AuthenticationMode.TaskAuthenticationToken: + return "TaskAuthenticationToken"; + } + return null; + } + internal static AuthenticationMode? ParseAuthenticationMode(this string value) + { + switch( value ) + { + case "SharedKey": + return AuthenticationMode.SharedKey; + case "AAD": + return AuthenticationMode.AAD; + case "TaskAuthenticationToken": + return AuthenticationMode.TaskAuthenticationToken; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleRun.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleRun.cs new file mode 100644 index 000000000000..b143b09b64c4 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleRun.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The results and errors from an execution of a pool autoscale formula. + /// + /// + /// The results and errors from an execution of a pool autoscale formula. + /// + public partial class AutoScaleRun + { + /// + /// Initializes a new instance of the AutoScaleRun class. + /// + public AutoScaleRun() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoScaleRun class. + /// + + /// The time at which the autoscale formula was last evaluated. + /// + + /// Each variable value is returned in the form $variable=value, and variables + /// are separated by semicolons. + /// + + /// An error that occurred when autoscaling a pool. + /// + public AutoScaleRun(System.DateTime evaluationTime, string results = default(string), AutoScaleRunError error = default(AutoScaleRunError)) + + { + this.EvaluationTime = evaluationTime; + this.Results = results; + this.Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the time at which the autoscale formula was last evaluated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "evaluationTime")] + public System.DateTime EvaluationTime {get; set; } + + /// + /// Gets or sets each variable value is returned in the form $variable=value, + /// and variables are separated by semicolons. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "results")] + public string Results {get; set; } + + /// + /// Gets or sets an error that occurred when autoscaling a pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public AutoScaleRunError Error {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.Error != null) + { + this.Error.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleRunError.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleRunError.cs new file mode 100644 index 000000000000..4239571d3b03 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleRunError.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// An error that occurred when autoscaling a pool. + /// + /// + /// An error that occurred when autoscaling a pool. + /// + public partial class AutoScaleRunError + { + /// + /// Initializes a new instance of the AutoScaleRunError class. + /// + public AutoScaleRunError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoScaleRunError class. + /// + + /// An identifier for the error. Codes are invariant and are intended to be + /// consumed programmatically. + /// + + /// A message describing the error, intended to be suitable for display in a + /// user interface. + /// + + /// Additional details about the error. + /// + public AutoScaleRunError(string code, string message, System.Collections.Generic.IList details = default(System.Collections.Generic.IList)) + + { + this.Code = code; + this.Message = message; + this.Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets an identifier for the error. Codes are invariant and are + /// intended to be consumed programmatically. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets a message describing the error, intended to be suitable for + /// display in a user interface. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + + /// + /// Gets or sets additional details about the error. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "details")] + public System.Collections.Generic.IList Details {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Code == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Code"); + } + if (this.Message == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Message"); + } + + + if (this.Details != null) + { + foreach (var element in this.Details) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleSettings.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleSettings.cs new file mode 100644 index 000000000000..6a71d8fa383e --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoScaleSettings.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// AutoScale settings for the pool. + /// + /// + /// AutoScale settings for the pool. + /// + public partial class AutoScaleSettings + { + /// + /// Initializes a new instance of the AutoScaleSettings class. + /// + public AutoScaleSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoScaleSettings class. + /// + + /// A formula for the desired number of compute nodes in the pool. + /// + + /// If omitted, the default value is 15 minutes (PT15M). + /// + public AutoScaleSettings(string formula, System.TimeSpan? evaluationInterval = default(System.TimeSpan?)) + + { + this.Formula = formula; + this.EvaluationInterval = evaluationInterval; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets a formula for the desired number of compute nodes in the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "formula")] + public string Formula {get; set; } + + /// + /// Gets or sets if omitted, the default value is 15 minutes (PT15M). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "evaluationInterval")] + public System.TimeSpan? EvaluationInterval {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Formula == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Formula"); + } + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageAuthenticationMode.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageAuthenticationMode.cs new file mode 100644 index 000000000000..48db09e1a308 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageAuthenticationMode.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for AutoStorageAuthenticationMode. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum AutoStorageAuthenticationMode + { + /// + /// The Batch service will authenticate requests to auto-storage using storage + /// account keys. + /// + [System.Runtime.Serialization.EnumMember(Value = "StorageKeys")] + StorageKeys, + /// + /// The Batch service will authenticate requests to auto-storage using the + /// managed identity assigned to the Batch account. + /// + [System.Runtime.Serialization.EnumMember(Value = "BatchAccountManagedIdentity")] + BatchAccountManagedIdentity + } + internal static class AutoStorageAuthenticationModeEnumExtension + { + internal static string ToSerializedValue(this AutoStorageAuthenticationMode? value) + { + return value == null ? null : ((AutoStorageAuthenticationMode)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this AutoStorageAuthenticationMode value) + { + switch( value ) + { + case AutoStorageAuthenticationMode.StorageKeys: + return "StorageKeys"; + case AutoStorageAuthenticationMode.BatchAccountManagedIdentity: + return "BatchAccountManagedIdentity"; + } + return null; + } + internal static AutoStorageAuthenticationMode? ParseAutoStorageAuthenticationMode(this string value) + { + switch( value ) + { + case "StorageKeys": + return AutoStorageAuthenticationMode.StorageKeys; + case "BatchAccountManagedIdentity": + return AutoStorageAuthenticationMode.BatchAccountManagedIdentity; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageBaseProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageBaseProperties.cs new file mode 100644 index 000000000000..2e474bb75909 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageBaseProperties.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The properties related to the auto-storage account. + /// + public partial class AutoStorageBaseProperties + { + /// + /// Initializes a new instance of the AutoStorageBaseProperties class. + /// + public AutoStorageBaseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoStorageBaseProperties class. + /// + + /// The resource ID of the storage account to be used for auto-storage account. + /// + + /// The authentication mode which the Batch service will use to manage the + /// auto-storage account. + /// Possible values include: 'StorageKeys', 'BatchAccountManagedIdentity' + + /// The identity referenced here must be assigned to pools which have compute + /// nodes that need access to auto-storage. + /// + public AutoStorageBaseProperties(string storageAccountId, AutoStorageAuthenticationMode? authenticationMode = default(AutoStorageAuthenticationMode?), ComputeNodeIdentityReference nodeIdentityReference = default(ComputeNodeIdentityReference)) + + { + this.StorageAccountId = storageAccountId; + this.AuthenticationMode = authenticationMode; + this.NodeIdentityReference = nodeIdentityReference; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the storage account to be used for + /// auto-storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageAccountId")] + public string StorageAccountId {get; set; } + + /// + /// Gets or sets the authentication mode which the Batch service will use to + /// manage the auto-storage account. Possible values include: 'StorageKeys', 'BatchAccountManagedIdentity' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "authenticationMode")] + public AutoStorageAuthenticationMode? AuthenticationMode {get; set; } + + /// + /// Gets or sets the identity referenced here must be assigned to pools which + /// have compute nodes that need access to auto-storage. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nodeIdentityReference")] + public ComputeNodeIdentityReference NodeIdentityReference {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.StorageAccountId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "StorageAccountId"); + } + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageProperties.cs new file mode 100644 index 000000000000..83e680eab9a9 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoStorageProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Contains information about the auto-storage account associated with a Batch + /// account. + /// + public partial class AutoStorageProperties : AutoStorageBaseProperties + { + /// + /// Initializes a new instance of the AutoStorageProperties class. + /// + public AutoStorageProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoStorageProperties class. + /// + + /// The resource ID of the storage account to be used for auto-storage account. + /// + + /// The authentication mode which the Batch service will use to manage the + /// auto-storage account. + /// Possible values include: 'StorageKeys', 'BatchAccountManagedIdentity' + + /// The identity referenced here must be assigned to pools which have compute + /// nodes that need access to auto-storage. + /// + + /// The UTC time at which storage keys were last synchronized with the Batch + /// account. + /// + public AutoStorageProperties(string storageAccountId, System.DateTime lastKeySync, AutoStorageAuthenticationMode? authenticationMode = default(AutoStorageAuthenticationMode?), ComputeNodeIdentityReference nodeIdentityReference = default(ComputeNodeIdentityReference)) + + : base(storageAccountId, authenticationMode, nodeIdentityReference) + { + this.LastKeySync = lastKeySync; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the UTC time at which storage keys were last synchronized with + /// the Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastKeySync")] + public System.DateTime LastKeySync {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AutoUserScope.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoUserScope.cs new file mode 100644 index 000000000000..f19cca1925a7 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoUserScope.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for AutoUserScope. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum AutoUserScope + { + /// + /// Specifies that the service should create a new user for the task. + /// + [System.Runtime.Serialization.EnumMember(Value = "Task")] + Task, + /// + /// Specifies that the task runs as the common auto user account which is + /// created on every node in a pool. + /// + [System.Runtime.Serialization.EnumMember(Value = "Pool")] + Pool + } + internal static class AutoUserScopeEnumExtension + { + internal static string ToSerializedValue(this AutoUserScope? value) + { + return value == null ? null : ((AutoUserScope)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this AutoUserScope value) + { + switch( value ) + { + case AutoUserScope.Task: + return "Task"; + case AutoUserScope.Pool: + return "Pool"; + } + return null; + } + internal static AutoUserScope? ParseAutoUserScope(this string value) + { + switch( value ) + { + case "Task": + return AutoUserScope.Task; + case "Pool": + return AutoUserScope.Pool; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AutoUserSpecification.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoUserSpecification.cs new file mode 100644 index 000000000000..824adc132877 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AutoUserSpecification.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Specifies the parameters for the auto user that runs a task on the Batch + /// service. + /// + /// + /// Specifies the parameters for the auto user that runs a task on the Batch + /// service. + /// + public partial class AutoUserSpecification + { + /// + /// Initializes a new instance of the AutoUserSpecification class. + /// + public AutoUserSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoUserSpecification class. + /// + + /// The default value is Pool. If the pool is running Windows a value of Task + /// should be specified if stricter isolation between tasks is required. For + /// example, if the task mutates the registry in a way which could impact other + /// tasks, or if certificates have been specified on the pool which should not + /// be accessible by normal tasks but should be accessible by start tasks. + /// Possible values include: 'Task', 'Pool' + + /// The default value is nonAdmin. + /// Possible values include: 'NonAdmin', 'Admin' + public AutoUserSpecification(AutoUserScope? scope = default(AutoUserScope?), ElevationLevel? elevationLevel = default(ElevationLevel?)) + + { + this.Scope = scope; + this.ElevationLevel = elevationLevel; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the default value is Pool. If the pool is running Windows a + /// value of Task should be specified if stricter isolation between tasks is + /// required. For example, if the task mutates the registry in a way which + /// could impact other tasks, or if certificates have been specified on the + /// pool which should not be accessible by normal tasks but should be + /// accessible by start tasks. Possible values include: 'Task', 'Pool' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "scope")] + public AutoUserScope? Scope {get; set; } + + /// + /// Gets or sets the default value is nonAdmin. Possible values include: 'NonAdmin', 'Admin' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "elevationLevel")] + public ElevationLevel? ElevationLevel {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AzureBlobFileSystemConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AzureBlobFileSystemConfiguration.cs new file mode 100644 index 000000000000..73a2c91a3358 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AzureBlobFileSystemConfiguration.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Information used to connect to an Azure Storage Container using Blobfuse. + /// + /// + /// Information used to connect to an Azure Storage Container using Blobfuse. + /// + public partial class AzureBlobFileSystemConfiguration + { + /// + /// Initializes a new instance of the AzureBlobFileSystemConfiguration class. + /// + public AzureBlobFileSystemConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBlobFileSystemConfiguration class. + /// + + /// The Azure Storage Account name. + /// + + /// The Azure Blob Storage Container name. + /// + + /// This property is mutually exclusive with both sasKey and identity; exactly + /// one must be specified. + /// + + /// This property is mutually exclusive with both accountKey and identity; + /// exactly one must be specified. + /// + + /// These are 'net use' options in Windows and 'mount' options in Linux. + /// + + /// All file systems are mounted relative to the Batch mounts directory, + /// accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + /// + + /// This property is mutually exclusive with both accountKey and sasKey; + /// exactly one must be specified. + /// + public AzureBlobFileSystemConfiguration(string accountName, string containerName, string relativeMountPath, string accountKey = default(string), string sasKey = default(string), string blobfuseOptions = default(string), ComputeNodeIdentityReference identityReference = default(ComputeNodeIdentityReference)) + + { + this.AccountName = accountName; + this.ContainerName = containerName; + this.AccountKey = accountKey; + this.SasKey = sasKey; + this.BlobfuseOptions = blobfuseOptions; + this.RelativeMountPath = relativeMountPath; + this.IdentityReference = identityReference; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the Azure Storage Account name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountName")] + public string AccountName {get; set; } + + /// + /// Gets or sets the Azure Blob Storage Container name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "containerName")] + public string ContainerName {get; set; } + + /// + /// Gets or sets this property is mutually exclusive with both sasKey and + /// identity; exactly one must be specified. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountKey")] + public string AccountKey {get; set; } + + /// + /// Gets or sets this property is mutually exclusive with both accountKey and + /// identity; exactly one must be specified. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sasKey")] + public string SasKey {get; set; } + + /// + /// Gets or sets these are 'net use' options in Windows and 'mount' options in + /// Linux. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "blobfuseOptions")] + public string BlobfuseOptions {get; set; } + + /// + /// Gets or sets all file systems are mounted relative to the Batch mounts + /// directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment + /// variable. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "relativeMountPath")] + public string RelativeMountPath {get; set; } + + /// + /// Gets or sets this property is mutually exclusive with both accountKey and + /// sasKey; exactly one must be specified. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identityReference")] + public ComputeNodeIdentityReference IdentityReference {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.AccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AccountName"); + } + if (this.ContainerName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ContainerName"); + } + if (this.RelativeMountPath == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "RelativeMountPath"); + } + + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/AzureFileShareConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/AzureFileShareConfiguration.cs new file mode 100644 index 000000000000..bdf27d96ae5a --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/AzureFileShareConfiguration.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Information used to connect to an Azure Fileshare. + /// + /// + /// Information used to connect to an Azure Fileshare. + /// + public partial class AzureFileShareConfiguration + { + /// + /// Initializes a new instance of the AzureFileShareConfiguration class. + /// + public AzureFileShareConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureFileShareConfiguration class. + /// + + /// The Azure Storage account name. + /// + + /// This is of the form 'https://{account}.file.core.windows.net/'. + /// + + /// The Azure Storage account key. + /// + + /// All file systems are mounted relative to the Batch mounts directory, + /// accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + /// + + /// These are 'net use' options in Windows and 'mount' options in Linux. + /// + public AzureFileShareConfiguration(string accountName, string azureFileUrl, string accountKey, string relativeMountPath, string mountOptions = default(string)) + + { + this.AccountName = accountName; + this.AzureFileUrl = azureFileUrl; + this.AccountKey = accountKey; + this.RelativeMountPath = relativeMountPath; + this.MountOptions = mountOptions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the Azure Storage account name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountName")] + public string AccountName {get; set; } + + /// + /// Gets or sets this is of the form + /// 'https://{account}.file.core.windows.net/'. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "azureFileUrl")] + public string AzureFileUrl {get; set; } + + /// + /// Gets or sets the Azure Storage account key. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountKey")] + public string AccountKey {get; set; } + + /// + /// Gets or sets all file systems are mounted relative to the Batch mounts + /// directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment + /// variable. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "relativeMountPath")] + public string RelativeMountPath {get; set; } + + /// + /// Gets or sets these are 'net use' options in Windows and 'mount' options in + /// Linux. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "mountOptions")] + public string MountOptions {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.AccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AccountName"); + } + if (this.AzureFileUrl == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AzureFileUrl"); + } + if (this.AccountKey == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AccountKey"); + } + if (this.RelativeMountPath == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "RelativeMountPath"); + } + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccount.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccount.cs new file mode 100644 index 000000000000..5b7157cd85c4 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccount.cs @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Contains information about an Azure Batch account. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BatchAccount : Resource + { + /// + /// Initializes a new instance of the BatchAccount class. + /// + public BatchAccount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccount class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + + /// The identity of the Batch account. + /// + + /// The provisioned state of the resource + /// Possible values include: 'Invalid', 'Creating', 'Deleting', 'Succeeded', + /// 'Failed', 'Cancelled' + + /// The network profile only takes effect when publicNetworkAccess is enabled. + /// + + /// The account endpoint used to interact with the Batch service. + /// + + /// The endpoint used by compute node to connect to the Batch node management + /// service. + /// + + /// The allocation mode for creating pools in the Batch account. + /// Possible values include: 'BatchService', 'UserSubscription' + + /// Identifies the Azure key vault associated with a Batch account. + /// + + /// If not specified, the default value is 'enabled'. + /// Possible values include: 'Enabled', 'Disabled' + + /// List of private endpoint connections associated with the Batch account + /// + + /// Contains information about the auto-storage account associated with a Batch + /// account. + /// + + /// Configures how customer data is encrypted inside the Batch account. By + /// default, accounts are encrypted using a Microsoft managed key. For + /// additional control, a customer-managed key can be used instead. + /// + + /// For accounts with PoolAllocationMode set to UserSubscription, quota is + /// managed on the subscription so this value is not returned. + /// + + /// For accounts with PoolAllocationMode set to UserSubscription, quota is + /// managed on the subscription so this value is not returned. + /// + + /// A list of the dedicated core quota per Virtual Machine family for the Batch + /// account. For accounts with PoolAllocationMode set to UserSubscription, + /// quota is managed on the subscription so this value is not returned. + /// + + /// If this flag is true, dedicated core quota is enforced via both the + /// dedicatedCoreQuotaPerVMFamily and dedicatedCoreQuota properties on the + /// account. If this flag is false, dedicated core quota is enforced only via + /// the dedicatedCoreQuota property on the account and does not consider + /// Virtual Machine family. + /// + + /// The pool quota for the Batch account. + /// + + /// The active job and job schedule quota for the Batch account. + /// + + /// List of allowed authentication modes for the Batch account that can be used + /// to authenticate with the data plane. This does not affect authentication + /// with the control plane. + /// + public BatchAccount(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), BatchAccountIdentity identity = default(BatchAccountIdentity), ProvisioningState provisioningState = default(ProvisioningState), NetworkProfile networkProfile = default(NetworkProfile), string accountEndpoint = default(string), string nodeManagementEndpoint = default(string), PoolAllocationMode? poolAllocationMode = default(PoolAllocationMode?), KeyVaultReference keyVaultReference = default(KeyVaultReference), PublicNetworkAccessType? publicNetworkAccess = default(PublicNetworkAccessType?), System.Collections.Generic.IList privateEndpointConnections = default(System.Collections.Generic.IList), AutoStorageProperties autoStorage = default(AutoStorageProperties), EncryptionProperties encryption = default(EncryptionProperties), int? dedicatedCoreQuota = default(int?), int? lowPriorityCoreQuota = default(int?), System.Collections.Generic.IList dedicatedCoreQuotaPerVMFamily = default(System.Collections.Generic.IList), bool dedicatedCoreQuotaPerVMFamilyEnforced = default(bool), int poolQuota = default(int), int activeJobAndJobScheduleQuota = default(int), System.Collections.Generic.IList allowedAuthenticationModes = default(System.Collections.Generic.IList)) + + : base(id, name, type, location, tags) + { + this.Identity = identity; + this.ProvisioningState = provisioningState; + this.NetworkProfile = networkProfile; + this.AccountEndpoint = accountEndpoint; + this.NodeManagementEndpoint = nodeManagementEndpoint; + this.PoolAllocationMode = poolAllocationMode; + this.KeyVaultReference = keyVaultReference; + this.PublicNetworkAccess = publicNetworkAccess; + this.PrivateEndpointConnections = privateEndpointConnections; + this.AutoStorage = autoStorage; + this.Encryption = encryption; + this.DedicatedCoreQuota = dedicatedCoreQuota; + this.LowPriorityCoreQuota = lowPriorityCoreQuota; + this.DedicatedCoreQuotaPerVMFamily = dedicatedCoreQuotaPerVMFamily; + this.DedicatedCoreQuotaPerVMFamilyEnforced = dedicatedCoreQuotaPerVMFamilyEnforced; + this.PoolQuota = poolQuota; + this.ActiveJobAndJobScheduleQuota = activeJobAndJobScheduleQuota; + this.AllowedAuthenticationModes = allowedAuthenticationModes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the identity of the Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public BatchAccountIdentity Identity {get; set; } + + /// + /// Gets the provisioned state of the resource Possible values include: 'Invalid', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Cancelled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public ProvisioningState ProvisioningState {get; private set; } + + /// + /// Gets or sets the network profile only takes effect when publicNetworkAccess + /// is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.networkProfile")] + public NetworkProfile NetworkProfile {get; set; } + + /// + /// Gets the account endpoint used to interact with the Batch service. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountEndpoint")] + public string AccountEndpoint {get; private set; } + + /// + /// Gets the endpoint used by compute node to connect to the Batch node + /// management service. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.nodeManagementEndpoint")] + public string NodeManagementEndpoint {get; private set; } + + /// + /// Gets the allocation mode for creating pools in the Batch account. Possible values include: 'BatchService', 'UserSubscription' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.poolAllocationMode")] + public PoolAllocationMode? PoolAllocationMode {get; private set; } + + /// + /// Gets identifies the Azure key vault associated with a Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.keyVaultReference")] + public KeyVaultReference KeyVaultReference {get; private set; } + + /// + /// Gets or sets if not specified, the default value is 'enabled'. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public PublicNetworkAccessType? PublicNetworkAccess {get; set; } + + /// + /// Gets list of private endpoint connections associated with the Batch account + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public System.Collections.Generic.IList PrivateEndpointConnections {get; private set; } + + /// + /// Gets contains information about the auto-storage account associated with a + /// Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.autoStorage")] + public AutoStorageProperties AutoStorage {get; private set; } + + /// + /// Gets configures how customer data is encrypted inside the Batch account. By + /// default, accounts are encrypted using a Microsoft managed key. For + /// additional control, a customer-managed key can be used instead. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.encryption")] + public EncryptionProperties Encryption {get; private set; } + + /// + /// Gets for accounts with PoolAllocationMode set to UserSubscription, quota is + /// managed on the subscription so this value is not returned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dedicatedCoreQuota")] + public int? DedicatedCoreQuota {get; private set; } + + /// + /// Gets for accounts with PoolAllocationMode set to UserSubscription, quota is + /// managed on the subscription so this value is not returned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lowPriorityCoreQuota")] + public int? LowPriorityCoreQuota {get; private set; } + + /// + /// Gets a list of the dedicated core quota per Virtual Machine family for the + /// Batch account. For accounts with PoolAllocationMode set to + /// UserSubscription, quota is managed on the subscription so this value is not + /// returned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dedicatedCoreQuotaPerVMFamily")] + public System.Collections.Generic.IList DedicatedCoreQuotaPerVMFamily {get; private set; } + + /// + /// Gets if this flag is true, dedicated core quota is enforced via both the + /// dedicatedCoreQuotaPerVMFamily and dedicatedCoreQuota properties on the + /// account. If this flag is false, dedicated core quota is enforced only via + /// the dedicatedCoreQuota property on the account and does not consider + /// Virtual Machine family. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dedicatedCoreQuotaPerVMFamilyEnforced")] + public bool DedicatedCoreQuotaPerVMFamilyEnforced {get; private set; } + + /// + /// Gets the pool quota for the Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.poolQuota")] + public int PoolQuota {get; private set; } + + /// + /// Gets the active job and job schedule quota for the Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.activeJobAndJobScheduleQuota")] + public int ActiveJobAndJobScheduleQuota {get; private set; } + + /// + /// Gets list of allowed authentication modes for the Batch account that can be + /// used to authenticate with the data plane. This does not affect + /// authentication with the control plane. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowedAuthenticationModes")] + public System.Collections.Generic.IList AllowedAuthenticationModes {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Identity != null) + { + this.Identity.Validate(); + } + + if (this.NetworkProfile != null) + { + this.NetworkProfile.Validate(); + } + + + + if (this.KeyVaultReference != null) + { + this.KeyVaultReference.Validate(); + } + + if (this.PrivateEndpointConnections != null) + { + foreach (var element in this.PrivateEndpointConnections) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.AutoStorage != null) + { + this.AutoStorage.Validate(); + } + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateHeaders.cs new file mode 100644 index 000000000000..7ee3a0e30903 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class BatchAccountCreateHeaders + { + /// + /// Initializes a new instance of the BatchAccountCreateHeaders class. + /// + public BatchAccountCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccountCreateHeaders class. + /// + + /// + /// + + /// + /// + public BatchAccountCreateHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateParameters.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateParameters.cs new file mode 100644 index 000000000000..783f56b8fd8d --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateParameters.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Parameters supplied to the Create operation. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BatchAccountCreateParameters + { + /// + /// Initializes a new instance of the BatchAccountCreateParameters class. + /// + public BatchAccountCreateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccountCreateParameters class. + /// + + /// The region in which to create the account. + /// + + /// The user-specified tags associated with the account. + /// + + /// The identity of the Batch account. + /// + + /// The network profile only takes effect when publicNetworkAccess is enabled. + /// + + /// The properties related to the auto-storage account. + /// + + /// The pool allocation mode also affects how clients may authenticate to the + /// Batch Service API. If the mode is BatchService, clients may authenticate + /// using access keys or Azure Active Directory. If the mode is + /// UserSubscription, clients must use Azure Active Directory. The default is + /// BatchService. + /// Possible values include: 'BatchService', 'UserSubscription' + + /// A reference to the Azure key vault associated with the Batch account. + /// + + /// If not specified, the default value is 'enabled'. + /// Possible values include: 'Enabled', 'Disabled' + + /// Configures how customer data is encrypted inside the Batch account. By + /// default, accounts are encrypted using a Microsoft managed key. For + /// additional control, a customer-managed key can be used instead. + /// + + /// List of allowed authentication modes for the Batch account that can be used + /// to authenticate with the data plane. This does not affect authentication + /// with the control plane. + /// + public BatchAccountCreateParameters(string location, System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), BatchAccountIdentity identity = default(BatchAccountIdentity), NetworkProfile networkProfile = default(NetworkProfile), AutoStorageBaseProperties autoStorage = default(AutoStorageBaseProperties), PoolAllocationMode? poolAllocationMode = default(PoolAllocationMode?), KeyVaultReference keyVaultReference = default(KeyVaultReference), PublicNetworkAccessType? publicNetworkAccess = default(PublicNetworkAccessType?), EncryptionProperties encryption = default(EncryptionProperties), System.Collections.Generic.IList allowedAuthenticationModes = default(System.Collections.Generic.IList)) + + { + this.Location = location; + this.Tags = tags; + this.Identity = identity; + this.NetworkProfile = networkProfile; + this.AutoStorage = autoStorage; + this.PoolAllocationMode = poolAllocationMode; + this.KeyVaultReference = keyVaultReference; + this.PublicNetworkAccess = publicNetworkAccess; + this.Encryption = encryption; + this.AllowedAuthenticationModes = allowedAuthenticationModes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the region in which to create the account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + + /// + /// Gets or sets the user-specified tags associated with the account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + + /// + /// Gets or sets the identity of the Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public BatchAccountIdentity Identity {get; set; } + + /// + /// Gets or sets the network profile only takes effect when publicNetworkAccess + /// is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.networkProfile")] + public NetworkProfile NetworkProfile {get; set; } + + /// + /// Gets or sets the properties related to the auto-storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.autoStorage")] + public AutoStorageBaseProperties AutoStorage {get; set; } + + /// + /// Gets or sets the pool allocation mode also affects how clients may + /// authenticate to the Batch Service API. If the mode is BatchService, clients + /// may authenticate using access keys or Azure Active Directory. If the mode + /// is UserSubscription, clients must use Azure Active Directory. The default + /// is BatchService. Possible values include: 'BatchService', 'UserSubscription' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.poolAllocationMode")] + public PoolAllocationMode? PoolAllocationMode {get; set; } + + /// + /// Gets or sets a reference to the Azure key vault associated with the Batch + /// account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.keyVaultReference")] + public KeyVaultReference KeyVaultReference {get; set; } + + /// + /// Gets or sets if not specified, the default value is 'enabled'. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public PublicNetworkAccessType? PublicNetworkAccess {get; set; } + + /// + /// Gets or sets configures how customer data is encrypted inside the Batch + /// account. By default, accounts are encrypted using a Microsoft managed key. + /// For additional control, a customer-managed key can be used instead. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.encryption")] + public EncryptionProperties Encryption {get; set; } + + /// + /// Gets or sets list of allowed authentication modes for the Batch account + /// that can be used to authenticate with the data plane. This does not affect + /// authentication with the control plane. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowedAuthenticationModes")] + public System.Collections.Generic.IList AllowedAuthenticationModes {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Location == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Location"); + } + + + if (this.Identity != null) + { + this.Identity.Validate(); + } + if (this.NetworkProfile != null) + { + this.NetworkProfile.Validate(); + } + if (this.AutoStorage != null) + { + this.AutoStorage.Validate(); + } + + if (this.KeyVaultReference != null) + { + this.KeyVaultReference.Validate(); + } + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateProperties.cs new file mode 100644 index 000000000000..df5d35605c39 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountCreateProperties.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The properties of a Batch account. + /// + public partial class BatchAccountCreateProperties + { + /// + /// Initializes a new instance of the BatchAccountCreateProperties class. + /// + public BatchAccountCreateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccountCreateProperties class. + /// + + /// The properties related to the auto-storage account. + /// + + /// The pool allocation mode also affects how clients may authenticate to the + /// Batch Service API. If the mode is BatchService, clients may authenticate + /// using access keys or Azure Active Directory. If the mode is + /// UserSubscription, clients must use Azure Active Directory. The default is + /// BatchService. + /// Possible values include: 'BatchService', 'UserSubscription' + + /// A reference to the Azure key vault associated with the Batch account. + /// + + /// If not specified, the default value is 'enabled'. + /// Possible values include: 'Enabled', 'Disabled' + + /// The network profile only takes effect when publicNetworkAccess is enabled. + /// + + /// Configures how customer data is encrypted inside the Batch account. By + /// default, accounts are encrypted using a Microsoft managed key. For + /// additional control, a customer-managed key can be used instead. + /// + + /// List of allowed authentication modes for the Batch account that can be used + /// to authenticate with the data plane. This does not affect authentication + /// with the control plane. + /// + public BatchAccountCreateProperties(AutoStorageBaseProperties autoStorage = default(AutoStorageBaseProperties), PoolAllocationMode? poolAllocationMode = default(PoolAllocationMode?), KeyVaultReference keyVaultReference = default(KeyVaultReference), PublicNetworkAccessType? publicNetworkAccess = default(PublicNetworkAccessType?), NetworkProfile networkProfile = default(NetworkProfile), EncryptionProperties encryption = default(EncryptionProperties), System.Collections.Generic.IList allowedAuthenticationModes = default(System.Collections.Generic.IList)) + + { + this.AutoStorage = autoStorage; + this.PoolAllocationMode = poolAllocationMode; + this.KeyVaultReference = keyVaultReference; + this.PublicNetworkAccess = publicNetworkAccess; + this.NetworkProfile = networkProfile; + this.Encryption = encryption; + this.AllowedAuthenticationModes = allowedAuthenticationModes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the properties related to the auto-storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoStorage")] + public AutoStorageBaseProperties AutoStorage {get; set; } + + /// + /// Gets or sets the pool allocation mode also affects how clients may + /// authenticate to the Batch Service API. If the mode is BatchService, clients + /// may authenticate using access keys or Azure Active Directory. If the mode + /// is UserSubscription, clients must use Azure Active Directory. The default + /// is BatchService. Possible values include: 'BatchService', 'UserSubscription' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "poolAllocationMode")] + public PoolAllocationMode? PoolAllocationMode {get; set; } + + /// + /// Gets or sets a reference to the Azure key vault associated with the Batch + /// account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultReference")] + public KeyVaultReference KeyVaultReference {get; set; } + + /// + /// Gets or sets if not specified, the default value is 'enabled'. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publicNetworkAccess")] + public PublicNetworkAccessType? PublicNetworkAccess {get; set; } + + /// + /// Gets or sets the network profile only takes effect when publicNetworkAccess + /// is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkProfile")] + public NetworkProfile NetworkProfile {get; set; } + + /// + /// Gets or sets configures how customer data is encrypted inside the Batch + /// account. By default, accounts are encrypted using a Microsoft managed key. + /// For additional control, a customer-managed key can be used instead. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "encryption")] + public EncryptionProperties Encryption {get; set; } + + /// + /// Gets or sets list of allowed authentication modes for the Batch account + /// that can be used to authenticate with the data plane. This does not affect + /// authentication with the control plane. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedAuthenticationModes")] + public System.Collections.Generic.IList AllowedAuthenticationModes {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.AutoStorage != null) + { + this.AutoStorage.Validate(); + } + + if (this.KeyVaultReference != null) + { + this.KeyVaultReference.Validate(); + } + + if (this.NetworkProfile != null) + { + this.NetworkProfile.Validate(); + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountDeleteHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountDeleteHeaders.cs new file mode 100644 index 000000000000..34b050ae04fb --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountDeleteHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class BatchAccountDeleteHeaders + { + /// + /// Initializes a new instance of the BatchAccountDeleteHeaders class. + /// + public BatchAccountDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccountDeleteHeaders class. + /// + + /// + /// + + /// + /// + public BatchAccountDeleteHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountIdentity.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountIdentity.cs new file mode 100644 index 000000000000..7c16a5867d12 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountIdentity.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The identity of the Batch account, if configured. This is used when the + /// user specifies 'Microsoft.KeyVault' as their Batch account encryption + /// configuration or when `ManagedIdentity` is selected as the auto-storage + /// authentication mode. + /// + public partial class BatchAccountIdentity + { + /// + /// Initializes a new instance of the BatchAccountIdentity class. + /// + public BatchAccountIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccountIdentity class. + /// + + /// The principal id of the Batch account. This property will only be provided + /// for a system assigned identity. + /// + + /// The tenant id associated with the Batch account. This property will only be + /// provided for a system assigned identity. + /// + + /// The type of identity used for the Batch account. + /// Possible values include: 'SystemAssigned', 'UserAssigned', 'None' + + /// The list of user identities associated with the Batch account. + /// + public BatchAccountIdentity(ResourceIdentityType type, string principalId = default(string), string tenantId = default(string), System.Collections.Generic.IDictionary userAssignedIdentities = default(System.Collections.Generic.IDictionary)) + + { + this.PrincipalId = principalId; + this.TenantId = tenantId; + this.Type = type; + this.UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the principal id of the Batch account. This property will only be + /// provided for a system assigned identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; private set; } + + /// + /// Gets the tenant id associated with the Batch account. This property will + /// only be provided for a system assigned identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; private set; } + + /// + /// Gets or sets the type of identity used for the Batch account. Possible values include: 'SystemAssigned', 'UserAssigned', 'None' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public ResourceIdentityType Type {get; set; } + + /// + /// Gets or sets the list of user identities associated with the Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userAssignedIdentities")] + public System.Collections.Generic.IDictionary UserAssignedIdentities {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountKeys.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountKeys.cs new file mode 100644 index 000000000000..5078cec26df1 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountKeys.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A set of Azure Batch account keys. + /// + public partial class BatchAccountKeys + { + /// + /// Initializes a new instance of the BatchAccountKeys class. + /// + public BatchAccountKeys() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccountKeys class. + /// + + /// The Batch account name. + /// + + /// The primary key associated with the account. + /// + + /// The secondary key associated with the account. + /// + public BatchAccountKeys(string accountName = default(string), string primary = default(string), string secondary = default(string)) + + { + this.AccountName = accountName; + this.Primary = primary; + this.Secondary = secondary; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the Batch account name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountName")] + public string AccountName {get; private set; } + + /// + /// Gets the primary key associated with the account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "primary")] + public string Primary {get; private set; } + + /// + /// Gets the secondary key associated with the account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "secondary")] + public string Secondary {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountProperties.cs new file mode 100644 index 000000000000..513e40d74b8b --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountProperties.cs @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Account specific properties. + /// + public partial class BatchAccountProperties + { + /// + /// Initializes a new instance of the BatchAccountProperties class. + /// + public BatchAccountProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccountProperties class. + /// + + /// The account endpoint used to interact with the Batch service. + /// + + /// The endpoint used by compute node to connect to the Batch node management + /// service. + /// + + /// The provisioned state of the resource + /// Possible values include: 'Invalid', 'Creating', 'Deleting', 'Succeeded', + /// 'Failed', 'Cancelled' + + /// The allocation mode for creating pools in the Batch account. + /// Possible values include: 'BatchService', 'UserSubscription' + + /// Identifies the Azure key vault associated with a Batch account. + /// + + /// If not specified, the default value is 'enabled'. + /// Possible values include: 'Enabled', 'Disabled' + + /// The network profile only takes effect when publicNetworkAccess is enabled. + /// + + /// List of private endpoint connections associated with the Batch account + /// + + /// Contains information about the auto-storage account associated with a Batch + /// account. + /// + + /// Configures how customer data is encrypted inside the Batch account. By + /// default, accounts are encrypted using a Microsoft managed key. For + /// additional control, a customer-managed key can be used instead. + /// + + /// For accounts with PoolAllocationMode set to UserSubscription, quota is + /// managed on the subscription so this value is not returned. + /// + + /// For accounts with PoolAllocationMode set to UserSubscription, quota is + /// managed on the subscription so this value is not returned. + /// + + /// A list of the dedicated core quota per Virtual Machine family for the Batch + /// account. For accounts with PoolAllocationMode set to UserSubscription, + /// quota is managed on the subscription so this value is not returned. + /// + + /// If this flag is true, dedicated core quota is enforced via both the + /// dedicatedCoreQuotaPerVMFamily and dedicatedCoreQuota properties on the + /// account. If this flag is false, dedicated core quota is enforced only via + /// the dedicatedCoreQuota property on the account and does not consider + /// Virtual Machine family. + /// + + /// The pool quota for the Batch account. + /// + + /// The active job and job schedule quota for the Batch account. + /// + + /// List of allowed authentication modes for the Batch account that can be used + /// to authenticate with the data plane. This does not affect authentication + /// with the control plane. + /// + public BatchAccountProperties(string accountEndpoint = default(string), string nodeManagementEndpoint = default(string), ProvisioningState provisioningState = default(ProvisioningState), PoolAllocationMode? poolAllocationMode = default(PoolAllocationMode?), KeyVaultReference keyVaultReference = default(KeyVaultReference), PublicNetworkAccessType? publicNetworkAccess = default(PublicNetworkAccessType?), NetworkProfile networkProfile = default(NetworkProfile), System.Collections.Generic.IList privateEndpointConnections = default(System.Collections.Generic.IList), AutoStorageProperties autoStorage = default(AutoStorageProperties), EncryptionProperties encryption = default(EncryptionProperties), int? dedicatedCoreQuota = default(int?), int? lowPriorityCoreQuota = default(int?), System.Collections.Generic.IList dedicatedCoreQuotaPerVMFamily = default(System.Collections.Generic.IList), bool dedicatedCoreQuotaPerVMFamilyEnforced = default(bool), int poolQuota = default(int), int activeJobAndJobScheduleQuota = default(int), System.Collections.Generic.IList allowedAuthenticationModes = default(System.Collections.Generic.IList)) + + { + this.AccountEndpoint = accountEndpoint; + this.NodeManagementEndpoint = nodeManagementEndpoint; + this.ProvisioningState = provisioningState; + this.PoolAllocationMode = poolAllocationMode; + this.KeyVaultReference = keyVaultReference; + this.PublicNetworkAccess = publicNetworkAccess; + this.NetworkProfile = networkProfile; + this.PrivateEndpointConnections = privateEndpointConnections; + this.AutoStorage = autoStorage; + this.Encryption = encryption; + this.DedicatedCoreQuota = dedicatedCoreQuota; + this.LowPriorityCoreQuota = lowPriorityCoreQuota; + this.DedicatedCoreQuotaPerVMFamily = dedicatedCoreQuotaPerVMFamily; + this.DedicatedCoreQuotaPerVMFamilyEnforced = dedicatedCoreQuotaPerVMFamilyEnforced; + this.PoolQuota = poolQuota; + this.ActiveJobAndJobScheduleQuota = activeJobAndJobScheduleQuota; + this.AllowedAuthenticationModes = allowedAuthenticationModes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the account endpoint used to interact with the Batch service. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountEndpoint")] + public string AccountEndpoint {get; private set; } + + /// + /// Gets the endpoint used by compute node to connect to the Batch node + /// management service. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nodeManagementEndpoint")] + public string NodeManagementEndpoint {get; private set; } + + /// + /// Gets the provisioned state of the resource Possible values include: 'Invalid', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Cancelled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public ProvisioningState ProvisioningState {get; private set; } + + /// + /// Gets the allocation mode for creating pools in the Batch account. Possible values include: 'BatchService', 'UserSubscription' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "poolAllocationMode")] + public PoolAllocationMode? PoolAllocationMode {get; private set; } + + /// + /// Gets identifies the Azure key vault associated with a Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultReference")] + public KeyVaultReference KeyVaultReference {get; private set; } + + /// + /// Gets or sets if not specified, the default value is 'enabled'. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publicNetworkAccess")] + public PublicNetworkAccessType? PublicNetworkAccess {get; set; } + + /// + /// Gets or sets the network profile only takes effect when publicNetworkAccess + /// is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkProfile")] + public NetworkProfile NetworkProfile {get; set; } + + /// + /// Gets list of private endpoint connections associated with the Batch account + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "privateEndpointConnections")] + public System.Collections.Generic.IList PrivateEndpointConnections {get; private set; } + + /// + /// Gets contains information about the auto-storage account associated with a + /// Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoStorage")] + public AutoStorageProperties AutoStorage {get; private set; } + + /// + /// Gets configures how customer data is encrypted inside the Batch account. By + /// default, accounts are encrypted using a Microsoft managed key. For + /// additional control, a customer-managed key can be used instead. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "encryption")] + public EncryptionProperties Encryption {get; private set; } + + /// + /// Gets for accounts with PoolAllocationMode set to UserSubscription, quota is + /// managed on the subscription so this value is not returned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dedicatedCoreQuota")] + public int? DedicatedCoreQuota {get; private set; } + + /// + /// Gets for accounts with PoolAllocationMode set to UserSubscription, quota is + /// managed on the subscription so this value is not returned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lowPriorityCoreQuota")] + public int? LowPriorityCoreQuota {get; private set; } + + /// + /// Gets a list of the dedicated core quota per Virtual Machine family for the + /// Batch account. For accounts with PoolAllocationMode set to + /// UserSubscription, quota is managed on the subscription so this value is not + /// returned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dedicatedCoreQuotaPerVMFamily")] + public System.Collections.Generic.IList DedicatedCoreQuotaPerVMFamily {get; private set; } + + /// + /// Gets if this flag is true, dedicated core quota is enforced via both the + /// dedicatedCoreQuotaPerVMFamily and dedicatedCoreQuota properties on the + /// account. If this flag is false, dedicated core quota is enforced only via + /// the dedicatedCoreQuota property on the account and does not consider + /// Virtual Machine family. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dedicatedCoreQuotaPerVMFamilyEnforced")] + public bool DedicatedCoreQuotaPerVMFamilyEnforced {get; private set; } + + /// + /// Gets the pool quota for the Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "poolQuota")] + public int PoolQuota {get; private set; } + + /// + /// Gets the active job and job schedule quota for the Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "activeJobAndJobScheduleQuota")] + public int ActiveJobAndJobScheduleQuota {get; private set; } + + /// + /// Gets list of allowed authentication modes for the Batch account that can be + /// used to authenticate with the data plane. This does not affect + /// authentication with the control plane. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedAuthenticationModes")] + public System.Collections.Generic.IList AllowedAuthenticationModes {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + + if (this.KeyVaultReference != null) + { + this.KeyVaultReference.Validate(); + } + + if (this.NetworkProfile != null) + { + this.NetworkProfile.Validate(); + } + if (this.PrivateEndpointConnections != null) + { + foreach (var element in this.PrivateEndpointConnections) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.AutoStorage != null) + { + this.AutoStorage.Validate(); + } + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountRegenerateKeyParameters.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountRegenerateKeyParameters.cs new file mode 100644 index 000000000000..00c2c014f2e7 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountRegenerateKeyParameters.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Parameters supplied to the RegenerateKey operation. + /// + public partial class BatchAccountRegenerateKeyParameters + { + /// + /// Initializes a new instance of the BatchAccountRegenerateKeyParameters class. + /// + public BatchAccountRegenerateKeyParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccountRegenerateKeyParameters class. + /// + + /// The type of account key to regenerate. + /// Possible values include: 'Primary', 'Secondary' + public BatchAccountRegenerateKeyParameters(AccountKeyType keyName) + + { + this.KeyName = keyName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the type of account key to regenerate. Possible values include: 'Primary', 'Secondary' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyName")] + public AccountKeyType KeyName {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountUpdateParameters.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountUpdateParameters.cs new file mode 100644 index 000000000000..9ee28dbdaa03 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountUpdateParameters.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Parameters for updating an Azure Batch account. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BatchAccountUpdateParameters + { + /// + /// Initializes a new instance of the BatchAccountUpdateParameters class. + /// + public BatchAccountUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccountUpdateParameters class. + /// + + /// The user-specified tags associated with the account. + /// + + /// The identity of the Batch account. + /// + + /// The network profile only takes effect when publicNetworkAccess is enabled. + /// + + /// The properties related to the auto-storage account. + /// + + /// Configures how customer data is encrypted inside the Batch account. By + /// default, accounts are encrypted using a Microsoft managed key. For + /// additional control, a customer-managed key can be used instead. + /// + + /// List of allowed authentication modes for the Batch account that can be used + /// to authenticate with the data plane. This does not affect authentication + /// with the control plane. + /// + + /// If not specified, the default value is 'enabled'. + /// Possible values include: 'Enabled', 'Disabled' + public BatchAccountUpdateParameters(System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), BatchAccountIdentity identity = default(BatchAccountIdentity), NetworkProfile networkProfile = default(NetworkProfile), AutoStorageBaseProperties autoStorage = default(AutoStorageBaseProperties), EncryptionProperties encryption = default(EncryptionProperties), System.Collections.Generic.IList allowedAuthenticationModes = default(System.Collections.Generic.IList), PublicNetworkAccessType? publicNetworkAccess = default(PublicNetworkAccessType?)) + + { + this.Tags = tags; + this.Identity = identity; + this.NetworkProfile = networkProfile; + this.AutoStorage = autoStorage; + this.Encryption = encryption; + this.AllowedAuthenticationModes = allowedAuthenticationModes; + this.PublicNetworkAccess = publicNetworkAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the user-specified tags associated with the account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + + /// + /// Gets or sets the identity of the Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public BatchAccountIdentity Identity {get; set; } + + /// + /// Gets or sets the network profile only takes effect when publicNetworkAccess + /// is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.networkProfile")] + public NetworkProfile NetworkProfile {get; set; } + + /// + /// Gets or sets the properties related to the auto-storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.autoStorage")] + public AutoStorageBaseProperties AutoStorage {get; set; } + + /// + /// Gets or sets configures how customer data is encrypted inside the Batch + /// account. By default, accounts are encrypted using a Microsoft managed key. + /// For additional control, a customer-managed key can be used instead. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.encryption")] + public EncryptionProperties Encryption {get; set; } + + /// + /// Gets or sets list of allowed authentication modes for the Batch account + /// that can be used to authenticate with the data plane. This does not affect + /// authentication with the control plane. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allowedAuthenticationModes")] + public System.Collections.Generic.IList AllowedAuthenticationModes {get; set; } + + /// + /// Gets or sets if not specified, the default value is 'enabled'. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public PublicNetworkAccessType? PublicNetworkAccess {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.Identity != null) + { + this.Identity.Validate(); + } + if (this.NetworkProfile != null) + { + this.NetworkProfile.Validate(); + } + if (this.AutoStorage != null) + { + this.AutoStorage.Validate(); + } + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountUpdateProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountUpdateProperties.cs new file mode 100644 index 000000000000..9e5f363926dc --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchAccountUpdateProperties.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The properties of a Batch account. + /// + public partial class BatchAccountUpdateProperties + { + /// + /// Initializes a new instance of the BatchAccountUpdateProperties class. + /// + public BatchAccountUpdateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchAccountUpdateProperties class. + /// + + /// The properties related to the auto-storage account. + /// + + /// Configures how customer data is encrypted inside the Batch account. By + /// default, accounts are encrypted using a Microsoft managed key. For + /// additional control, a customer-managed key can be used instead. + /// + + /// List of allowed authentication modes for the Batch account that can be used + /// to authenticate with the data plane. This does not affect authentication + /// with the control plane. + /// + + /// If not specified, the default value is 'enabled'. + /// Possible values include: 'Enabled', 'Disabled' + + /// The network profile only takes effect when publicNetworkAccess is enabled. + /// + public BatchAccountUpdateProperties(AutoStorageBaseProperties autoStorage = default(AutoStorageBaseProperties), EncryptionProperties encryption = default(EncryptionProperties), System.Collections.Generic.IList allowedAuthenticationModes = default(System.Collections.Generic.IList), PublicNetworkAccessType? publicNetworkAccess = default(PublicNetworkAccessType?), NetworkProfile networkProfile = default(NetworkProfile)) + + { + this.AutoStorage = autoStorage; + this.Encryption = encryption; + this.AllowedAuthenticationModes = allowedAuthenticationModes; + this.PublicNetworkAccess = publicNetworkAccess; + this.NetworkProfile = networkProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the properties related to the auto-storage account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoStorage")] + public AutoStorageBaseProperties AutoStorage {get; set; } + + /// + /// Gets or sets configures how customer data is encrypted inside the Batch + /// account. By default, accounts are encrypted using a Microsoft managed key. + /// For additional control, a customer-managed key can be used instead. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "encryption")] + public EncryptionProperties Encryption {get; set; } + + /// + /// Gets or sets list of allowed authentication modes for the Batch account + /// that can be used to authenticate with the data plane. This does not affect + /// authentication with the control plane. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allowedAuthenticationModes")] + public System.Collections.Generic.IList AllowedAuthenticationModes {get; set; } + + /// + /// Gets or sets if not specified, the default value is 'enabled'. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publicNetworkAccess")] + public PublicNetworkAccessType? PublicNetworkAccess {get; set; } + + /// + /// Gets or sets the network profile only takes effect when publicNetworkAccess + /// is enabled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkProfile")] + public NetworkProfile NetworkProfile {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.AutoStorage != null) + { + this.AutoStorage.Validate(); + } + + + + if (this.NetworkProfile != null) + { + this.NetworkProfile.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchLocationQuota.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchLocationQuota.cs new file mode 100644 index 000000000000..1e57b32d0647 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchLocationQuota.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Quotas associated with a Batch region for a particular subscription. + /// + public partial class BatchLocationQuota + { + /// + /// Initializes a new instance of the BatchLocationQuota class. + /// + public BatchLocationQuota() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchLocationQuota class. + /// + + /// The number of Batch accounts that may be created under the subscription in + /// the specified region. + /// + public BatchLocationQuota(int? accountQuota = default(int?)) + + { + this.AccountQuota = accountQuota; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the number of Batch accounts that may be created under the + /// subscription in the specified region. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountQuota")] + public int? AccountQuota {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/BatchPoolIdentity.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchPoolIdentity.cs new file mode 100644 index 000000000000..898b3b5cc304 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/BatchPoolIdentity.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The identity of the Batch pool, if configured. If the pool identity is + /// updated during update an existing pool, only the new vms which are created + /// after the pool shrinks to 0 will have the updated identities + /// + public partial class BatchPoolIdentity + { + /// + /// Initializes a new instance of the BatchPoolIdentity class. + /// + public BatchPoolIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BatchPoolIdentity class. + /// + + /// The type of identity used for the Batch Pool. + /// Possible values include: 'UserAssigned', 'None' + + /// The list of user identities associated with the Batch pool. + /// + public BatchPoolIdentity(PoolIdentityType type, System.Collections.Generic.IDictionary userAssignedIdentities = default(System.Collections.Generic.IDictionary)) + + { + this.Type = type; + this.UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the type of identity used for the Batch Pool. Possible values include: 'UserAssigned', 'None' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public PoolIdentityType Type {get; set; } + + /// + /// Gets or sets the list of user identities associated with the Batch pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userAssignedIdentities")] + public System.Collections.Generic.IDictionary UserAssignedIdentities {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CIFSMountConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CIFSMountConfiguration.cs new file mode 100644 index 000000000000..c8bb6200d4f0 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CIFSMountConfiguration.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Information used to connect to a CIFS file system. + /// + /// + /// Information used to connect to a CIFS file system. + /// + public partial class CifsMountConfiguration + { + /// + /// Initializes a new instance of the CifsMountConfiguration class. + /// + public CifsMountConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CifsMountConfiguration class. + /// + + /// The user to use for authentication against the CIFS file system. + /// + + /// The URI of the file system to mount. + /// + + /// All file systems are mounted relative to the Batch mounts directory, + /// accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + /// + + /// These are 'net use' options in Windows and 'mount' options in Linux. + /// + + /// The password to use for authentication against the CIFS file system. + /// + public CifsMountConfiguration(string userName, string source, string relativeMountPath, string password, string mountOptions = default(string)) + + { + this.UserName = userName; + this.Source = source; + this.RelativeMountPath = relativeMountPath; + this.MountOptions = mountOptions; + this.Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the user to use for authentication against the CIFS file + /// system. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the URI of the file system to mount. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "source")] + public string Source {get; set; } + + /// + /// Gets or sets all file systems are mounted relative to the Batch mounts + /// directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment + /// variable. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "relativeMountPath")] + public string RelativeMountPath {get; set; } + + /// + /// Gets or sets these are 'net use' options in Windows and 'mount' options in + /// Linux. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "mountOptions")] + public string MountOptions {get; set; } + + /// + /// Gets or sets the password to use for authentication against the CIFS file + /// system. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "password")] + public string Password {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.UserName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "UserName"); + } + if (this.Source == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Source"); + } + if (this.RelativeMountPath == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "RelativeMountPath"); + } + if (this.Password == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Password"); + } + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CachingType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CachingType.cs new file mode 100644 index 000000000000..b042110fc473 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CachingType.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for CachingType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum CachingType + { + /// + /// The caching mode for the disk is not enabled. + /// + [System.Runtime.Serialization.EnumMember(Value = "None")] + None, + /// + /// The caching mode for the disk is read only. + /// + [System.Runtime.Serialization.EnumMember(Value = "ReadOnly")] + ReadOnly, + /// + /// The caching mode for the disk is read and write. + /// + [System.Runtime.Serialization.EnumMember(Value = "ReadWrite")] + ReadWrite + } + internal static class CachingTypeEnumExtension + { + internal static string ToSerializedValue(this CachingType? value) + { + return value == null ? null : ((CachingType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this CachingType value) + { + switch( value ) + { + case CachingType.None: + return "None"; + case CachingType.ReadOnly: + return "ReadOnly"; + case CachingType.ReadWrite: + return "ReadWrite"; + } + return null; + } + internal static CachingType? ParseCachingType(this string value) + { + switch( value ) + { + case "None": + return CachingType.None; + case "ReadOnly": + return CachingType.ReadOnly; + case "ReadWrite": + return CachingType.ReadWrite; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/Certificate.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/Certificate.cs new file mode 100644 index 000000000000..8974dad97b76 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/Certificate.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Contains information about a certificate. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Certificate : ProxyResource + { + /// + /// Initializes a new instance of the Certificate class. + /// + public Certificate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Certificate class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The ETag of the resource, used for concurrency statements. + /// + + /// This must match the first portion of the certificate name. Currently + /// required to be 'SHA1'. + /// + + /// This must match the thumbprint from the name. + /// + + /// The format of the certificate - either Pfx or Cer. If omitted, the default + /// is Pfx. + /// Possible values include: 'Pfx', 'Cer' + + /// + /// Possible values include: 'Succeeded', 'Deleting', 'Failed' + + /// The time at which the certificate entered its current state. + /// + + /// The previous provisioned state of the resource + /// Possible values include: 'Succeeded', 'Deleting', 'Failed' + + /// The time at which the certificate entered its previous state. + /// + + /// The public key of the certificate. + /// + + /// This is only returned when the certificate provisioningState is 'Failed'. + /// + public Certificate(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string thumbprintAlgorithm = default(string), string thumbprint = default(string), CertificateFormat format = default(CertificateFormat), CertificateProvisioningState? provisioningState = default(CertificateProvisioningState?), System.DateTime? provisioningStateTransitionTime = default(System.DateTime?), CertificateProvisioningState? previousProvisioningState = default(CertificateProvisioningState?), System.DateTime? previousProvisioningStateTransitionTime = default(System.DateTime?), string publicData = default(string), DeleteCertificateError deleteCertificateError = default(DeleteCertificateError)) + + : base(id, name, type, etag) + { + this.ThumbprintAlgorithm = thumbprintAlgorithm; + this.Thumbprint = thumbprint; + this.Format = format; + this.ProvisioningState = provisioningState; + this.ProvisioningStateTransitionTime = provisioningStateTransitionTime; + this.PreviousProvisioningState = previousProvisioningState; + this.PreviousProvisioningStateTransitionTime = previousProvisioningStateTransitionTime; + this.PublicData = publicData; + this.DeleteCertificateError = deleteCertificateError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets this must match the first portion of the certificate name. + /// Currently required to be 'SHA1'. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.thumbprintAlgorithm")] + public string ThumbprintAlgorithm {get; set; } + + /// + /// Gets or sets this must match the thumbprint from the name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.thumbprint")] + public string Thumbprint {get; set; } + + /// + /// Gets or sets the format of the certificate - either Pfx or Cer. If omitted, + /// the default is Pfx. Possible values include: 'Pfx', 'Cer' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.format")] + public CertificateFormat Format {get; set; } + + /// + /// Gets Possible values include: 'Succeeded', 'Deleting', 'Failed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public CertificateProvisioningState? ProvisioningState {get; private set; } + + /// + /// Gets the time at which the certificate entered its current state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningStateTransitionTime")] + public System.DateTime? ProvisioningStateTransitionTime {get; private set; } + + /// + /// Gets the previous provisioned state of the resource Possible values include: 'Succeeded', 'Deleting', 'Failed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.previousProvisioningState")] + public CertificateProvisioningState? PreviousProvisioningState {get; private set; } + + /// + /// Gets the time at which the certificate entered its previous state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.previousProvisioningStateTransitionTime")] + public System.DateTime? PreviousProvisioningStateTransitionTime {get; private set; } + + /// + /// Gets the public key of the certificate. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.publicData")] + public string PublicData {get; private set; } + + /// + /// Gets this is only returned when the certificate provisioningState is + /// 'Failed'. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.deleteCertificateError")] + public DeleteCertificateError DeleteCertificateError {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + + + + if (this.DeleteCertificateError != null) + { + this.DeleteCertificateError.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateBaseProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateBaseProperties.cs new file mode 100644 index 000000000000..cd53636afbe0 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateBaseProperties.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Base certificate properties. + /// + public partial class CertificateBaseProperties + { + /// + /// Initializes a new instance of the CertificateBaseProperties class. + /// + public CertificateBaseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateBaseProperties class. + /// + + /// This must match the first portion of the certificate name. Currently + /// required to be 'SHA1'. + /// + + /// This must match the thumbprint from the name. + /// + + /// The format of the certificate - either Pfx or Cer. If omitted, the default + /// is Pfx. + /// Possible values include: 'Pfx', 'Cer' + public CertificateBaseProperties(string thumbprintAlgorithm = default(string), string thumbprint = default(string), CertificateFormat format = default(CertificateFormat)) + + { + this.ThumbprintAlgorithm = thumbprintAlgorithm; + this.Thumbprint = thumbprint; + this.Format = format; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets this must match the first portion of the certificate name. + /// Currently required to be 'SHA1'. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "thumbprintAlgorithm")] + public string ThumbprintAlgorithm {get; set; } + + /// + /// Gets or sets this must match the thumbprint from the name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "thumbprint")] + public string Thumbprint {get; set; } + + /// + /// Gets or sets the format of the certificate - either Pfx or Cer. If omitted, + /// the default is Pfx. Possible values include: 'Pfx', 'Cer' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "format")] + public CertificateFormat Format {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCancelDeletionHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCancelDeletionHeaders.cs new file mode 100644 index 000000000000..258b30f6c11e --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCancelDeletionHeaders.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class CertificateCancelDeletionHeaders + { + /// + /// Initializes a new instance of the CertificateCancelDeletionHeaders class. + /// + public CertificateCancelDeletionHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateCancelDeletionHeaders class. + /// + + /// + /// + public CertificateCancelDeletionHeaders(string eTag = default(string)) + + { + this.ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ETag")] + public string ETag {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateHeaders.cs new file mode 100644 index 000000000000..951641b4b562 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateHeaders.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class CertificateCreateHeaders + { + /// + /// Initializes a new instance of the CertificateCreateHeaders class. + /// + public CertificateCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateCreateHeaders class. + /// + + /// + /// + public CertificateCreateHeaders(string eTag = default(string)) + + { + this.ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ETag")] + public string ETag {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateOrUpdateParameters.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateOrUpdateParameters.cs new file mode 100644 index 000000000000..da14eb6115ed --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateOrUpdateParameters.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Contains information about a certificate. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class CertificateCreateOrUpdateParameters : ProxyResource + { + /// + /// Initializes a new instance of the CertificateCreateOrUpdateParameters class. + /// + public CertificateCreateOrUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateCreateOrUpdateParameters class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The ETag of the resource, used for concurrency statements. + /// + + /// This must match the first portion of the certificate name. Currently + /// required to be 'SHA1'. + /// + + /// This must match the thumbprint from the name. + /// + + /// The format of the certificate - either Pfx or Cer. If omitted, the default + /// is Pfx. + /// Possible values include: 'Pfx', 'Cer' + + /// The maximum size is 10KB. + /// + + /// This must not be specified if the certificate format is Cer. + /// + public CertificateCreateOrUpdateParameters(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string thumbprintAlgorithm = default(string), string thumbprint = default(string), CertificateFormat format = default(CertificateFormat), string data = default(string), string password = default(string)) + + : base(id, name, type, etag) + { + this.ThumbprintAlgorithm = thumbprintAlgorithm; + this.Thumbprint = thumbprint; + this.Format = format; + this.Data = data; + this.Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets this must match the first portion of the certificate name. + /// Currently required to be 'SHA1'. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.thumbprintAlgorithm")] + public string ThumbprintAlgorithm {get; set; } + + /// + /// Gets or sets this must match the thumbprint from the name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.thumbprint")] + public string Thumbprint {get; set; } + + /// + /// Gets or sets the format of the certificate - either Pfx or Cer. If omitted, + /// the default is Pfx. Possible values include: 'Pfx', 'Cer' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.format")] + public CertificateFormat Format {get; set; } + + /// + /// Gets or sets the maximum size is 10KB. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.data")] + public string Data {get; set; } + + /// + /// Gets or sets this must not be specified if the certificate format is Cer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.password")] + public string Password {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateOrUpdateProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateOrUpdateProperties.cs new file mode 100644 index 000000000000..d7f30b37fa42 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateCreateOrUpdateProperties.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Certificate properties for create operations + /// + public partial class CertificateCreateOrUpdateProperties : CertificateBaseProperties + { + /// + /// Initializes a new instance of the CertificateCreateOrUpdateProperties class. + /// + public CertificateCreateOrUpdateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateCreateOrUpdateProperties class. + /// + + /// This must match the first portion of the certificate name. Currently + /// required to be 'SHA1'. + /// + + /// This must match the thumbprint from the name. + /// + + /// The format of the certificate - either Pfx or Cer. If omitted, the default + /// is Pfx. + /// Possible values include: 'Pfx', 'Cer' + + /// The maximum size is 10KB. + /// + + /// This must not be specified if the certificate format is Cer. + /// + public CertificateCreateOrUpdateProperties(string data, string thumbprintAlgorithm = default(string), string thumbprint = default(string), CertificateFormat format = default(CertificateFormat), string password = default(string)) + + : base(thumbprintAlgorithm, thumbprint, format) + { + this.Data = data; + this.Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the maximum size is 10KB. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "data")] + public string Data {get; set; } + + /// + /// Gets or sets this must not be specified if the certificate format is Cer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "password")] + public string Password {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Data == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Data"); + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateDeleteHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateDeleteHeaders.cs new file mode 100644 index 000000000000..8be20b3bd5bd --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateDeleteHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class CertificateDeleteHeaders + { + /// + /// Initializes a new instance of the CertificateDeleteHeaders class. + /// + public CertificateDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateDeleteHeaders class. + /// + + /// + /// + + /// + /// + public CertificateDeleteHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateFormat.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateFormat.cs new file mode 100644 index 000000000000..a7b0ca4b8db3 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateFormat.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for CertificateFormat. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum CertificateFormat + { + /// + /// The certificate is a PFX (PKCS#12) formatted certificate or certificate + /// chain. + /// + [System.Runtime.Serialization.EnumMember(Value = "Pfx")] + Pfx, + /// + /// The certificate is a base64-encoded X.509 certificate. + /// + [System.Runtime.Serialization.EnumMember(Value = "Cer")] + Cer + } + internal static class CertificateFormatEnumExtension + { + internal static string ToSerializedValue(this CertificateFormat? value) + { + return value == null ? null : ((CertificateFormat)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this CertificateFormat value) + { + switch( value ) + { + case CertificateFormat.Pfx: + return "Pfx"; + case CertificateFormat.Cer: + return "Cer"; + } + return null; + } + internal static CertificateFormat? ParseCertificateFormat(this string value) + { + switch( value ) + { + case "Pfx": + return CertificateFormat.Pfx; + case "Cer": + return CertificateFormat.Cer; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateGetHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateGetHeaders.cs new file mode 100644 index 000000000000..64ac7c5596d3 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateGetHeaders.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class CertificateGetHeaders + { + /// + /// Initializes a new instance of the CertificateGetHeaders class. + /// + public CertificateGetHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateGetHeaders class. + /// + + /// + /// + public CertificateGetHeaders(string eTag = default(string)) + + { + this.ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ETag")] + public string ETag {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateProperties.cs new file mode 100644 index 000000000000..9982f1402c47 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateProperties.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Certificate properties. + /// + public partial class CertificateProperties : CertificateBaseProperties + { + /// + /// Initializes a new instance of the CertificateProperties class. + /// + public CertificateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateProperties class. + /// + + /// This must match the first portion of the certificate name. Currently + /// required to be 'SHA1'. + /// + + /// This must match the thumbprint from the name. + /// + + /// The format of the certificate - either Pfx or Cer. If omitted, the default + /// is Pfx. + /// Possible values include: 'Pfx', 'Cer' + + /// + /// Possible values include: 'Succeeded', 'Deleting', 'Failed' + + /// The time at which the certificate entered its current state. + /// + + /// The previous provisioned state of the resource + /// Possible values include: 'Succeeded', 'Deleting', 'Failed' + + /// The time at which the certificate entered its previous state. + /// + + /// The public key of the certificate. + /// + + /// This is only returned when the certificate provisioningState is 'Failed'. + /// + public CertificateProperties(string thumbprintAlgorithm = default(string), string thumbprint = default(string), CertificateFormat format = default(CertificateFormat), CertificateProvisioningState? provisioningState = default(CertificateProvisioningState?), System.DateTime? provisioningStateTransitionTime = default(System.DateTime?), CertificateProvisioningState? previousProvisioningState = default(CertificateProvisioningState?), System.DateTime? previousProvisioningStateTransitionTime = default(System.DateTime?), string publicData = default(string), DeleteCertificateError deleteCertificateError = default(DeleteCertificateError)) + + : base(thumbprintAlgorithm, thumbprint, format) + { + this.ProvisioningState = provisioningState; + this.ProvisioningStateTransitionTime = provisioningStateTransitionTime; + this.PreviousProvisioningState = previousProvisioningState; + this.PreviousProvisioningStateTransitionTime = previousProvisioningStateTransitionTime; + this.PublicData = publicData; + this.DeleteCertificateError = deleteCertificateError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets Possible values include: 'Succeeded', 'Deleting', 'Failed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public CertificateProvisioningState? ProvisioningState {get; private set; } + + /// + /// Gets the time at which the certificate entered its current state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningStateTransitionTime")] + public System.DateTime? ProvisioningStateTransitionTime {get; private set; } + + /// + /// Gets the previous provisioned state of the resource Possible values include: 'Succeeded', 'Deleting', 'Failed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "previousProvisioningState")] + public CertificateProvisioningState? PreviousProvisioningState {get; private set; } + + /// + /// Gets the time at which the certificate entered its previous state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "previousProvisioningStateTransitionTime")] + public System.DateTime? PreviousProvisioningStateTransitionTime {get; private set; } + + /// + /// Gets the public key of the certificate. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publicData")] + public string PublicData {get; private set; } + + /// + /// Gets this is only returned when the certificate provisioningState is + /// 'Failed'. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deleteCertificateError")] + public DeleteCertificateError DeleteCertificateError {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + if (this.DeleteCertificateError != null) + { + this.DeleteCertificateError.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateProvisioningState.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateProvisioningState.cs new file mode 100644 index 000000000000..764c23915126 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateProvisioningState.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for CertificateProvisioningState. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum CertificateProvisioningState + { + /// + /// The certificate is available for use in pools. + /// + [System.Runtime.Serialization.EnumMember(Value = "Succeeded")] + Succeeded, + /// + /// The user has requested that the certificate be deleted, but the delete + /// operation has not yet completed. You may not reference the certificate when + /// creating or updating pools. + /// + [System.Runtime.Serialization.EnumMember(Value = "Deleting")] + Deleting, + /// + /// The user requested that the certificate be deleted, but there are pools + /// that still have references to the certificate, or it is still installed on + /// one or more compute nodes. (The latter can occur if the certificate has + /// been removed from the pool, but the node has not yet restarted. Nodes + /// refresh their certificates only when they restart.) You may use the cancel + /// certificate delete operation to cancel the delete, or the delete + /// certificate operation to retry the delete. + /// + [System.Runtime.Serialization.EnumMember(Value = "Failed")] + Failed + } + internal static class CertificateProvisioningStateEnumExtension + { + internal static string ToSerializedValue(this CertificateProvisioningState? value) + { + return value == null ? null : ((CertificateProvisioningState)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this CertificateProvisioningState value) + { + switch( value ) + { + case CertificateProvisioningState.Succeeded: + return "Succeeded"; + case CertificateProvisioningState.Deleting: + return "Deleting"; + case CertificateProvisioningState.Failed: + return "Failed"; + } + return null; + } + internal static CertificateProvisioningState? ParseCertificateProvisioningState(this string value) + { + switch( value ) + { + case "Succeeded": + return CertificateProvisioningState.Succeeded; + case "Deleting": + return CertificateProvisioningState.Deleting; + case "Failed": + return CertificateProvisioningState.Failed; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateReference.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateReference.cs new file mode 100644 index 000000000000..c7a713bb6250 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateReference.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Warning: This object is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + /// + /// Warning: This object is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + public partial class CertificateReference + { + /// + /// Initializes a new instance of the CertificateReference class. + /// + public CertificateReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateReference class. + /// + + /// The fully qualified ID of the certificate to install on the pool. This must + /// be inside the same batch account as the pool. + /// + + /// The default value is currentUser. This property is applicable only for + /// pools configured with Windows nodes (that is, created with + /// cloudServiceConfiguration, or with virtualMachineConfiguration using a + /// Windows image reference). For Linux compute nodes, the certificates are + /// stored in a directory inside the task working directory and an environment + /// variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for + /// this location. For certificates with visibility of 'remoteUser', a 'certs' + /// directory is created in the user's home directory (e.g., + /// /home/{user-name}/certs) and certificates are placed in that directory. + /// Possible values include: 'CurrentUser', 'LocalMachine' + + /// This property is applicable only for pools configured with Windows nodes + /// (that is, created with cloudServiceConfiguration, or with + /// virtualMachineConfiguration using a Windows image reference). Common store + /// names include: My, Root, CA, Trust, Disallowed, TrustedPeople, + /// TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also + /// be used. The default value is My. + /// + + /// Which user accounts on the compute node should have access to the private + /// data of the certificate. + /// + public CertificateReference(string id, CertificateStoreLocation? storeLocation = default(CertificateStoreLocation?), string storeName = default(string), System.Collections.Generic.IList visibility = default(System.Collections.Generic.IList)) + + { + this.Id = id; + this.StoreLocation = storeLocation; + this.StoreName = storeName; + this.Visibility = visibility; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the fully qualified ID of the certificate to install on the + /// pool. This must be inside the same batch account as the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } + + /// + /// Gets or sets the default value is currentUser. This property is applicable + /// only for pools configured with Windows nodes (that is, created with + /// cloudServiceConfiguration, or with virtualMachineConfiguration using a + /// Windows image reference). For Linux compute nodes, the certificates are + /// stored in a directory inside the task working directory and an environment + /// variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for + /// this location. For certificates with visibility of 'remoteUser', a 'certs' + /// directory is created in the user's home directory (e.g., + /// /home/{user-name}/certs) and certificates are placed in that directory. Possible values include: 'CurrentUser', 'LocalMachine' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storeLocation")] + public CertificateStoreLocation? StoreLocation {get; set; } + + /// + /// Gets or sets this property is applicable only for pools configured with + /// Windows nodes (that is, created with cloudServiceConfiguration, or with + /// virtualMachineConfiguration using a Windows image reference). Common store + /// names include: My, Root, CA, Trust, Disallowed, TrustedPeople, + /// TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also + /// be used. The default value is My. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storeName")] + public string StoreName {get; set; } + + /// + /// Gets or sets which user accounts on the compute node should have access to + /// the private data of the certificate. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "visibility")] + public System.Collections.Generic.IList Visibility {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Id == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Id"); + } + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateStoreLocation.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateStoreLocation.cs new file mode 100644 index 000000000000..6da624728985 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateStoreLocation.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for CertificateStoreLocation. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum CertificateStoreLocation + { + /// + /// Certificates should be installed to the CurrentUser certificate store. + /// + [System.Runtime.Serialization.EnumMember(Value = "CurrentUser")] + CurrentUser, + /// + /// Certificates should be installed to the LocalMachine certificate store. + /// + [System.Runtime.Serialization.EnumMember(Value = "LocalMachine")] + LocalMachine + } + internal static class CertificateStoreLocationEnumExtension + { + internal static string ToSerializedValue(this CertificateStoreLocation? value) + { + return value == null ? null : ((CertificateStoreLocation)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this CertificateStoreLocation value) + { + switch( value ) + { + case CertificateStoreLocation.CurrentUser: + return "CurrentUser"; + case CertificateStoreLocation.LocalMachine: + return "LocalMachine"; + } + return null; + } + internal static CertificateStoreLocation? ParseCertificateStoreLocation(this string value) + { + switch( value ) + { + case "CurrentUser": + return CertificateStoreLocation.CurrentUser; + case "LocalMachine": + return CertificateStoreLocation.LocalMachine; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateUpdateHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateUpdateHeaders.cs new file mode 100644 index 000000000000..439df2baecaa --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateUpdateHeaders.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class CertificateUpdateHeaders + { + /// + /// Initializes a new instance of the CertificateUpdateHeaders class. + /// + public CertificateUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateUpdateHeaders class. + /// + + /// + /// + public CertificateUpdateHeaders(string eTag = default(string)) + + { + this.ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ETag")] + public string ETag {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateVisibility.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateVisibility.cs new file mode 100644 index 000000000000..f5df9c674e0c --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CertificateVisibility.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for CertificateVisibility. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum CertificateVisibility + { + /// + /// The certificate should be visible to the user account under which the start + /// task is run. Note that if AutoUser Scope is Pool for both the StartTask and + /// a Task, this certificate will be visible to the Task as well. + /// + [System.Runtime.Serialization.EnumMember(Value = "StartTask")] + StartTask, + /// + /// The certificate should be visible to the user accounts under which job + /// tasks are run. + /// + [System.Runtime.Serialization.EnumMember(Value = "Task")] + Task, + /// + /// The certificate should be visible to the user accounts under which users + /// remotely access the node. + /// + [System.Runtime.Serialization.EnumMember(Value = "RemoteUser")] + RemoteUser + } + internal static class CertificateVisibilityEnumExtension + { + internal static string ToSerializedValue(this CertificateVisibility? value) + { + return value == null ? null : ((CertificateVisibility)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this CertificateVisibility value) + { + switch( value ) + { + case CertificateVisibility.StartTask: + return "StartTask"; + case CertificateVisibility.Task: + return "Task"; + case CertificateVisibility.RemoteUser: + return "RemoteUser"; + } + return null; + } + internal static CertificateVisibility? ParseCertificateVisibility(this string value) + { + switch( value ) + { + case "StartTask": + return CertificateVisibility.StartTask; + case "Task": + return CertificateVisibility.Task; + case "RemoteUser": + return CertificateVisibility.RemoteUser; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CheckNameAvailabilityParameters.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CheckNameAvailabilityParameters.cs new file mode 100644 index 000000000000..60f0a998a9c6 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CheckNameAvailabilityParameters.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Parameters for a check name availability request. + /// + public partial class CheckNameAvailabilityParameters + { + /// + /// Initializes a new instance of the CheckNameAvailabilityParameters class. + /// + public CheckNameAvailabilityParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityParameters class. + /// + + /// The name to check for availability + /// + public CheckNameAvailabilityParameters(string name) + + { + this.Name = name; + CustomInit(); + } + /// + /// Static constructor for CheckNameAvailabilityParameters class. + /// + static CheckNameAvailabilityParameters() + { + Type = "Microsoft.Batch/batchAccounts"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name to check for availability + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + /// + /// Gets or sets the resource type. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public static string Type {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CheckNameAvailabilityResult.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CheckNameAvailabilityResult.cs new file mode 100644 index 000000000000..bc3ccbfad2e3 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CheckNameAvailabilityResult.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The CheckNameAvailability operation response. + /// + public partial class CheckNameAvailabilityResult + { + /// + /// Initializes a new instance of the CheckNameAvailabilityResult class. + /// + public CheckNameAvailabilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityResult class. + /// + + /// Gets a boolean value that indicates whether the name is available for you + /// to use. If true, the name is available. If false, the name has already been + /// taken or invalid and cannot be used. + /// + + /// Gets the reason that a Batch account name could not be used. The Reason + /// element is only returned if NameAvailable is false. + /// Possible values include: 'Invalid', 'AlreadyExists' + + /// Gets an error message explaining the Reason value in more detail. + /// + public CheckNameAvailabilityResult(bool? nameAvailable = default(bool?), NameAvailabilityReason? reason = default(NameAvailabilityReason?), string message = default(string)) + + { + this.NameAvailable = nameAvailable; + this.Reason = reason; + this.Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets gets a boolean value that indicates whether the name is available for + /// you to use. If true, the name is available. If false, the name has already + /// been taken or invalid and cannot be used. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable {get; private set; } + + /// + /// Gets gets the reason that a Batch account name could not be used. The + /// Reason element is only returned if NameAvailable is false. Possible values include: 'Invalid', 'AlreadyExists' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "reason")] + public NameAvailabilityReason? Reason {get; private set; } + + /// + /// Gets gets an error message explaining the Reason value in more detail. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/CloudServiceConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/CloudServiceConfiguration.cs new file mode 100644 index 000000000000..3d74c82058f7 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/CloudServiceConfiguration.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The configuration for nodes in a pool based on the Azure Cloud Services + /// platform. + /// + /// + /// The configuration for nodes in a pool based on the Azure Cloud Services + /// platform. + /// + public partial class CloudServiceConfiguration + { + /// + /// Initializes a new instance of the CloudServiceConfiguration class. + /// + public CloudServiceConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudServiceConfiguration class. + /// + + /// Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 + /// SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, + /// equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to + /// Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. + /// For more information, see Azure Guest OS Releases + /// (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + /// + + /// The default value is * which specifies the latest operating system version + /// for the specified OS family. + /// + public CloudServiceConfiguration(string osFamily, string osVersion = default(string)) + + { + this.OSFamily = osFamily; + this.OSVersion = osVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets possible values are: 2 - OS Family 2, equivalent to Windows + /// Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - + /// OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, + /// equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows + /// Server 2019. For more information, see Azure Guest OS Releases + /// (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osFamily")] + public string OSFamily {get; set; } + + /// + /// Gets or sets the default value is * which specifies the latest operating + /// system version for the specified OS family. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osVersion")] + public string OSVersion {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.OSFamily == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OSFamily"); + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeDeallocationOption.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeDeallocationOption.cs new file mode 100644 index 000000000000..5e3a40cf5f68 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeDeallocationOption.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for ComputeNodeDeallocationOption. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum ComputeNodeDeallocationOption + { + /// + /// Terminate running task processes and requeue the tasks. The tasks will run + /// again when a node is available. Remove nodes as soon as tasks have been + /// terminated. + /// + [System.Runtime.Serialization.EnumMember(Value = "Requeue")] + Requeue, + /// + /// Terminate running tasks. The tasks will be completed with failureInfo + /// indicating that they were terminated, and will not run again. Remove nodes + /// as soon as tasks have been terminated. + /// + [System.Runtime.Serialization.EnumMember(Value = "Terminate")] + Terminate, + /// + /// Allow currently running tasks to complete. Schedule no new tasks while + /// waiting. Remove nodes when all tasks have completed. + /// + [System.Runtime.Serialization.EnumMember(Value = "TaskCompletion")] + TaskCompletion, + /// + /// Allow currently running tasks to complete, then wait for all task data + /// retention periods to expire. Schedule no new tasks while waiting. Remove + /// nodes when all task retention periods have expired. + /// + [System.Runtime.Serialization.EnumMember(Value = "RetainedData")] + RetainedData + } + internal static class ComputeNodeDeallocationOptionEnumExtension + { + internal static string ToSerializedValue(this ComputeNodeDeallocationOption? value) + { + return value == null ? null : ((ComputeNodeDeallocationOption)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this ComputeNodeDeallocationOption value) + { + switch( value ) + { + case ComputeNodeDeallocationOption.Requeue: + return "Requeue"; + case ComputeNodeDeallocationOption.Terminate: + return "Terminate"; + case ComputeNodeDeallocationOption.TaskCompletion: + return "TaskCompletion"; + case ComputeNodeDeallocationOption.RetainedData: + return "RetainedData"; + } + return null; + } + internal static ComputeNodeDeallocationOption? ParseComputeNodeDeallocationOption(this string value) + { + switch( value ) + { + case "Requeue": + return ComputeNodeDeallocationOption.Requeue; + case "Terminate": + return ComputeNodeDeallocationOption.Terminate; + case "TaskCompletion": + return ComputeNodeDeallocationOption.TaskCompletion; + case "RetainedData": + return ComputeNodeDeallocationOption.RetainedData; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeFillType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeFillType.cs new file mode 100644 index 000000000000..f6fdc0315e01 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeFillType.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for ComputeNodeFillType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum ComputeNodeFillType + { + /// + /// Tasks should be assigned evenly across all nodes in the pool. + /// + [System.Runtime.Serialization.EnumMember(Value = "Spread")] + Spread, + /// + /// As many tasks as possible (taskSlotsPerNode) should be assigned to each + /// node in the pool before any tasks are assigned to the next node in the + /// pool. + /// + [System.Runtime.Serialization.EnumMember(Value = "Pack")] + Pack + } + internal static class ComputeNodeFillTypeEnumExtension + { + internal static string ToSerializedValue(this ComputeNodeFillType? value) + { + return value == null ? null : ((ComputeNodeFillType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this ComputeNodeFillType value) + { + switch( value ) + { + case ComputeNodeFillType.Spread: + return "Spread"; + case ComputeNodeFillType.Pack: + return "Pack"; + } + return null; + } + internal static ComputeNodeFillType? ParseComputeNodeFillType(this string value) + { + switch( value ) + { + case "Spread": + return ComputeNodeFillType.Spread; + case "Pack": + return ComputeNodeFillType.Pack; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeIdentityReference.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeIdentityReference.cs new file mode 100644 index 000000000000..13620ab015ec --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ComputeNodeIdentityReference.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The reference to a user assigned identity associated with the Batch pool + /// which a compute node will use. + /// + public partial class ComputeNodeIdentityReference + { + /// + /// Initializes a new instance of the ComputeNodeIdentityReference class. + /// + public ComputeNodeIdentityReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComputeNodeIdentityReference class. + /// + + /// The ARM resource id of the user assigned identity. + /// + public ComputeNodeIdentityReference(string resourceId = default(string)) + + { + this.ResourceId = resourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the ARM resource id of the user assigned identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceId")] + public string ResourceId {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerConfiguration.cs new file mode 100644 index 000000000000..029b3717d3f7 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerConfiguration.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The configuration for container-enabled pools. + /// + /// + /// The configuration for container-enabled pools. + /// + public partial class ContainerConfiguration + { + /// + /// Initializes a new instance of the ContainerConfiguration class. + /// + public ContainerConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerConfiguration class. + /// + + /// This is the full image reference, as would be specified to "docker pull". + /// An image will be sourced from the default Docker registry unless the image + /// is fully qualified with an alternative registry. + /// + + /// If any images must be downloaded from a private registry which requires + /// credentials, then those credentials must be provided here. + /// + public ContainerConfiguration(System.Collections.Generic.IList containerImageNames = default(System.Collections.Generic.IList), System.Collections.Generic.IList containerRegistries = default(System.Collections.Generic.IList)) + + { + this.ContainerImageNames = containerImageNames; + this.ContainerRegistries = containerRegistries; + CustomInit(); + } + /// + /// Static constructor for ContainerConfiguration class. + /// + static ContainerConfiguration() + { + Type = "DockerCompatible"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets this is the full image reference, as would be specified to + /// "docker pull". An image will be sourced from the default Docker registry + /// unless the image is fully qualified with an alternative registry. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "containerImageNames")] + public System.Collections.Generic.IList ContainerImageNames {get; set; } + + /// + /// Gets or sets if any images must be downloaded from a private registry which + /// requires credentials, then those credentials must be provided here. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "containerRegistries")] + public System.Collections.Generic.IList ContainerRegistries {get; set; } + /// + /// Gets or sets the container technology to be used. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public static string Type {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerRegistry.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerRegistry.cs new file mode 100644 index 000000000000..d69147f80061 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerRegistry.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A private container registry. + /// + /// + /// A private container registry. + /// + public partial class ContainerRegistry + { + /// + /// Initializes a new instance of the ContainerRegistry class. + /// + public ContainerRegistry() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerRegistry class. + /// + + /// The user name to log into the registry server. + /// + + /// The password to log into the registry server. + /// + + /// If omitted, the default is "docker.io". + /// + + /// The reference to a user assigned identity associated with the Batch pool + /// which a compute node will use. + /// + public ContainerRegistry(string userName = default(string), string password = default(string), string registryServer = default(string), ComputeNodeIdentityReference identityReference = default(ComputeNodeIdentityReference)) + + { + this.UserName = userName; + this.Password = password; + this.RegistryServer = registryServer; + this.IdentityReference = identityReference; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the user name to log into the registry server. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "username")] + public string UserName {get; set; } + + /// + /// Gets or sets the password to log into the registry server. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "password")] + public string Password {get; set; } + + /// + /// Gets or sets if omitted, the default is "docker.io". + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "registryServer")] + public string RegistryServer {get; set; } + + /// + /// Gets or sets the reference to a user assigned identity associated with the + /// Batch pool which a compute node will use. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identityReference")] + public ComputeNodeIdentityReference IdentityReference {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerType.cs new file mode 100644 index 000000000000..ea371c85547c --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerType.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for ContainerType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum ContainerType + { + /// + /// A Docker compatible container technology will be used to launch the + /// containers. + /// + [System.Runtime.Serialization.EnumMember(Value = "DockerCompatible")] + DockerCompatible + } + internal static class ContainerTypeEnumExtension + { + internal static string ToSerializedValue(this ContainerType? value) + { + return value == null ? null : ((ContainerType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this ContainerType value) + { + switch( value ) + { + case ContainerType.DockerCompatible: + return "DockerCompatible"; + } + return null; + } + internal static ContainerType? ParseContainerType(this string value) + { + switch( value ) + { + case "DockerCompatible": + return ContainerType.DockerCompatible; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerWorkingDirectory.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerWorkingDirectory.cs new file mode 100644 index 000000000000..b86ca7cda4da --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ContainerWorkingDirectory.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for ContainerWorkingDirectory. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum ContainerWorkingDirectory + { + /// + /// Use the standard Batch service task working directory, which will contain + /// the Task resource files populated by Batch. + /// + [System.Runtime.Serialization.EnumMember(Value = "TaskWorkingDirectory")] + TaskWorkingDirectory, + /// + /// Using container image defined working directory. Beware that this directory + /// will not contain the resource files downloaded by Batch. + /// + [System.Runtime.Serialization.EnumMember(Value = "ContainerImageDefault")] + ContainerImageDefault + } + internal static class ContainerWorkingDirectoryEnumExtension + { + internal static string ToSerializedValue(this ContainerWorkingDirectory? value) + { + return value == null ? null : ((ContainerWorkingDirectory)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this ContainerWorkingDirectory value) + { + switch( value ) + { + case ContainerWorkingDirectory.TaskWorkingDirectory: + return "TaskWorkingDirectory"; + case ContainerWorkingDirectory.ContainerImageDefault: + return "ContainerImageDefault"; + } + return null; + } + internal static ContainerWorkingDirectory? ParseContainerWorkingDirectory(this string value) + { + switch( value ) + { + case "TaskWorkingDirectory": + return ContainerWorkingDirectory.TaskWorkingDirectory; + case "ContainerImageDefault": + return ContainerWorkingDirectory.ContainerImageDefault; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/DataDisk.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/DataDisk.cs new file mode 100644 index 000000000000..231a8a36ddee --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/DataDisk.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Settings which will be used by the data disks associated to Compute Nodes + /// in the Pool. When using attached data disks, you need to mount and format + /// the disks from within a VM to use them. + /// + public partial class DataDisk + { + /// + /// Initializes a new instance of the DataDisk class. + /// + public DataDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataDisk class. + /// + + /// The lun is used to uniquely identify each data disk. If attaching multiple + /// disks, each should have a distinct lun. The value must be between 0 and 63, + /// inclusive. + /// + + /// Values are: + /// none - The caching mode for the disk is not enabled. + /// readOnly - The caching mode for the disk is read only. + /// readWrite - The caching mode for the disk is read and write. + /// The default value for caching is none. For information about the caching + /// options see: + /// https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + /// Possible values include: 'None', 'ReadOnly', 'ReadWrite' + + /// The initial disk size in GB when creating new data disk. + /// + + /// If omitted, the default is "Standard_LRS". Values are: + /// Standard_LRS - The data disk should use standard locally redundant storage. + /// Premium_LRS - The data disk should use premium locally redundant storage. + /// Possible values include: 'Standard_LRS', 'Premium_LRS' + public DataDisk(int lun, int diskSizeGb, CachingType? caching = default(CachingType?), StorageAccountType? storageAccountType = default(StorageAccountType?)) + + { + this.Lun = lun; + this.Caching = caching; + this.DiskSizeGb = diskSizeGb; + this.StorageAccountType = storageAccountType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the lun is used to uniquely identify each data disk. If + /// attaching multiple disks, each should have a distinct lun. The value must + /// be between 0 and 63, inclusive. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lun")] + public int Lun {get; set; } + + /// + /// Gets or sets values are: + /// none - The caching mode for the disk is not enabled. + /// readOnly - The caching mode for the disk is read only. + /// readWrite - The caching mode for the disk is read and write. + /// The default value for caching is none. For information about the caching + /// options see: + /// https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Possible values include: 'None', 'ReadOnly', 'ReadWrite' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "caching")] + public CachingType? Caching {get; set; } + + /// + /// Gets or sets the initial disk size in GB when creating new data disk. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskSizeGB")] + public int DiskSizeGb {get; set; } + + /// + /// Gets or sets if omitted, the default is "Standard_LRS". Values are: + /// Standard_LRS - The data disk should use standard locally redundant storage. + /// Premium_LRS - The data disk should use premium locally redundant storage. Possible values include: 'Standard_LRS', 'Premium_LRS' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageAccountType")] + public StorageAccountType? StorageAccountType {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/DeleteCertificateError.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/DeleteCertificateError.cs new file mode 100644 index 000000000000..2da62961de81 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/DeleteCertificateError.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// An error response from the Batch service. + /// + public partial class DeleteCertificateError + { + /// + /// Initializes a new instance of the DeleteCertificateError class. + /// + public DeleteCertificateError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeleteCertificateError class. + /// + + /// An identifier for the error. Codes are invariant and are intended to be + /// consumed programmatically. + /// + + /// A message describing the error, intended to be suitable for display in a + /// user interface. + /// + + /// The target of the particular error. For example, the name of the property + /// in error. + /// + + /// A list of additional details about the error. + /// + public DeleteCertificateError(string code, string message, string target = default(string), System.Collections.Generic.IList details = default(System.Collections.Generic.IList)) + + { + this.Code = code; + this.Message = message; + this.Target = target; + this.Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets an identifier for the error. Codes are invariant and are + /// intended to be consumed programmatically. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets a message describing the error, intended to be suitable for + /// display in a user interface. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + + /// + /// Gets or sets the target of the particular error. For example, the name of + /// the property in error. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "target")] + public string Target {get; set; } + + /// + /// Gets or sets a list of additional details about the error. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "details")] + public System.Collections.Generic.IList Details {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Code == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Code"); + } + if (this.Message == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Message"); + } + + + + if (this.Details != null) + { + foreach (var element in this.Details) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/DeploymentConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/DeploymentConfiguration.cs new file mode 100644 index 000000000000..1f9b22e7fa58 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/DeploymentConfiguration.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Deployment configuration properties. + /// + /// + /// Deployment configuration properties. + /// + public partial class DeploymentConfiguration + { + /// + /// Initializes a new instance of the DeploymentConfiguration class. + /// + public DeploymentConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeploymentConfiguration class. + /// + + /// This property and virtualMachineConfiguration are mutually exclusive and + /// one of the properties must be specified. This property cannot be specified + /// if the Batch account was created with its poolAllocationMode property set + /// to 'UserSubscription'. + /// + + /// This property and cloudServiceConfiguration are mutually exclusive and one + /// of the properties must be specified. + /// + public DeploymentConfiguration(CloudServiceConfiguration cloudServiceConfiguration = default(CloudServiceConfiguration), VirtualMachineConfiguration virtualMachineConfiguration = default(VirtualMachineConfiguration)) + + { + this.CloudServiceConfiguration = cloudServiceConfiguration; + this.VirtualMachineConfiguration = virtualMachineConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets this property and virtualMachineConfiguration are mutually + /// exclusive and one of the properties must be specified. This property cannot + /// be specified if the Batch account was created with its poolAllocationMode + /// property set to 'UserSubscription'. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "cloudServiceConfiguration")] + public CloudServiceConfiguration CloudServiceConfiguration {get; set; } + + /// + /// Gets or sets this property and cloudServiceConfiguration are mutually + /// exclusive and one of the properties must be specified. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "virtualMachineConfiguration")] + public VirtualMachineConfiguration VirtualMachineConfiguration {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.CloudServiceConfiguration != null) + { + this.CloudServiceConfiguration.Validate(); + } + if (this.VirtualMachineConfiguration != null) + { + this.VirtualMachineConfiguration.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/DetectorResponse.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/DetectorResponse.cs new file mode 100644 index 000000000000..6772c6ea28ca --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/DetectorResponse.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Contains the information for a detector. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class DetectorResponse : ProxyResource + { + /// + /// Initializes a new instance of the DetectorResponse class. + /// + public DetectorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DetectorResponse class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The ETag of the resource, used for concurrency statements. + /// + + /// A base64 encoded string that represents the content of a detector. + /// + public DetectorResponse(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string value = default(string)) + + : base(id, name, type, etag) + { + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets a base64 encoded string that represents the content of a + /// detector. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.value")] + public string Value {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/DetectorResponseProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/DetectorResponseProperties.cs new file mode 100644 index 000000000000..d477c844415b --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/DetectorResponseProperties.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Detector response properties. + /// + public partial class DetectorResponseProperties + { + /// + /// Initializes a new instance of the DetectorResponseProperties class. + /// + public DetectorResponseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DetectorResponseProperties class. + /// + + /// A base64 encoded string that represents the content of a detector. + /// + public DetectorResponseProperties(string value = default(string)) + + { + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets a base64 encoded string that represents the content of a + /// detector. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/DiffDiskPlacement.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/DiffDiskPlacement.cs new file mode 100644 index 000000000000..e2ab70a6b234 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/DiffDiskPlacement.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for DiffDiskPlacement. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum DiffDiskPlacement + { + /// + /// The Ephemeral OS Disk is stored on the VM cache. + /// + [System.Runtime.Serialization.EnumMember(Value = "CacheDisk")] + CacheDisk + } + internal static class DiffDiskPlacementEnumExtension + { + internal static string ToSerializedValue(this DiffDiskPlacement? value) + { + return value == null ? null : ((DiffDiskPlacement)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this DiffDiskPlacement value) + { + switch( value ) + { + case DiffDiskPlacement.CacheDisk: + return "CacheDisk"; + } + return null; + } + internal static DiffDiskPlacement? ParseDiffDiskPlacement(this string value) + { + switch( value ) + { + case "CacheDisk": + return DiffDiskPlacement.CacheDisk; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/DiffDiskSettings.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/DiffDiskSettings.cs new file mode 100644 index 000000000000..3251404abfc8 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/DiffDiskSettings.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Specifies the ephemeral Disk Settings for the operating system disk used by + /// the virtual machine. + /// + /// + /// Specifies the ephemeral Disk Settings for the operating system disk used by + /// the virtual machine. + /// + public partial class DiffDiskSettings + { + /// + /// Initializes a new instance of the DiffDiskSettings class. + /// + public DiffDiskSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiffDiskSettings class. + /// + + /// This property can be used by user in the request to choose which location + /// the operating system should be in. e.g., cache disk space for Ephemeral OS + /// disk provisioning. For more information on Ephemeral OS disk size + /// requirements, please refer to Ephemeral OS disk size requirements for + /// Windows VMs at + /// https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements + /// and Linux VMs at + /// https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. + /// Possible values include: 'CacheDisk' + public DiffDiskSettings(DiffDiskPlacement? placement = default(DiffDiskPlacement?)) + + { + this.Placement = placement; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets this property can be used by user in the request to choose + /// which location the operating system should be in. e.g., cache disk space + /// for Ephemeral OS disk provisioning. For more information on Ephemeral OS + /// disk size requirements, please refer to Ephemeral OS disk size requirements + /// for Windows VMs at + /// https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements + /// and Linux VMs at + /// https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. Possible values include: 'CacheDisk' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "placement")] + public DiffDiskPlacement? Placement {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/DiskEncryptionConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/DiskEncryptionConfiguration.cs new file mode 100644 index 000000000000..3b48b428f459 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/DiskEncryptionConfiguration.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The disk encryption configuration applied on compute nodes in the pool. + /// Disk encryption configuration is not supported on Linux pool created with + /// Virtual Machine Image or Shared Image Gallery Image. + /// + public partial class DiskEncryptionConfiguration + { + /// + /// Initializes a new instance of the DiskEncryptionConfiguration class. + /// + public DiskEncryptionConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskEncryptionConfiguration class. + /// + + /// On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" + /// and "TemporaryDisk" must be specified. + /// + public DiskEncryptionConfiguration(System.Collections.Generic.IList targets = default(System.Collections.Generic.IList)) + + { + this.Targets = targets; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets on Linux pool, only "TemporaryDisk" is supported; on Windows + /// pool, "OsDisk" and "TemporaryDisk" must be specified. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targets")] + public System.Collections.Generic.IList Targets {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/DiskEncryptionTarget.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/DiskEncryptionTarget.cs new file mode 100644 index 000000000000..dca798a215cb --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/DiskEncryptionTarget.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for DiskEncryptionTarget. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum DiskEncryptionTarget + { + /// + /// The OS Disk on the compute node is encrypted. + /// + [System.Runtime.Serialization.EnumMember(Value = "OsDisk")] + OsDisk, + /// + /// The temporary disk on the compute node is encrypted. On Linux this + /// encryption applies to other partitions (such as those on mounted data + /// disks) when encryption occurs at boot time. + /// + [System.Runtime.Serialization.EnumMember(Value = "TemporaryDisk")] + TemporaryDisk + } + internal static class DiskEncryptionTargetEnumExtension + { + internal static string ToSerializedValue(this DiskEncryptionTarget? value) + { + return value == null ? null : ((DiskEncryptionTarget)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this DiskEncryptionTarget value) + { + switch( value ) + { + case DiskEncryptionTarget.OsDisk: + return "OsDisk"; + case DiskEncryptionTarget.TemporaryDisk: + return "TemporaryDisk"; + } + return null; + } + internal static DiskEncryptionTarget? ParseDiskEncryptionTarget(this string value) + { + switch( value ) + { + case "OsDisk": + return DiskEncryptionTarget.OsDisk; + case "TemporaryDisk": + return DiskEncryptionTarget.TemporaryDisk; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/DynamicVNetAssignmentScope.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/DynamicVNetAssignmentScope.cs new file mode 100644 index 000000000000..6c230e6f51ef --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/DynamicVNetAssignmentScope.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for DynamicVNetAssignmentScope. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum DynamicVNetAssignmentScope + { + /// + /// No dynamic VNet assignment is enabled. + /// + [System.Runtime.Serialization.EnumMember(Value = "none")] + None, + /// + /// Dynamic VNet assignment is done per-job. If this value is set, the network + /// configuration subnet ID must also be set. This feature requires approval + /// before use, please contact support + /// + [System.Runtime.Serialization.EnumMember(Value = "job")] + Job + } + internal static class DynamicVNetAssignmentScopeEnumExtension + { + internal static string ToSerializedValue(this DynamicVNetAssignmentScope? value) + { + return value == null ? null : ((DynamicVNetAssignmentScope)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this DynamicVNetAssignmentScope value) + { + switch( value ) + { + case DynamicVNetAssignmentScope.None: + return "none"; + case DynamicVNetAssignmentScope.Job: + return "job"; + } + return null; + } + internal static DynamicVNetAssignmentScope? ParseDynamicVNetAssignmentScope(this string value) + { + switch( value ) + { + case "none": + return DynamicVNetAssignmentScope.None; + case "job": + return DynamicVNetAssignmentScope.Job; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ElevationLevel.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ElevationLevel.cs new file mode 100644 index 000000000000..972911eabda0 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ElevationLevel.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for ElevationLevel. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum ElevationLevel + { + /// + /// The user is a standard user without elevated access. + /// + [System.Runtime.Serialization.EnumMember(Value = "NonAdmin")] + NonAdmin, + /// + /// The user is a user with elevated access and operates with full + /// Administrator permissions. + /// + [System.Runtime.Serialization.EnumMember(Value = "Admin")] + Admin + } + internal static class ElevationLevelEnumExtension + { + internal static string ToSerializedValue(this ElevationLevel? value) + { + return value == null ? null : ((ElevationLevel)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this ElevationLevel value) + { + switch( value ) + { + case ElevationLevel.NonAdmin: + return "NonAdmin"; + case ElevationLevel.Admin: + return "Admin"; + } + return null; + } + internal static ElevationLevel? ParseElevationLevel(this string value) + { + switch( value ) + { + case "NonAdmin": + return ElevationLevel.NonAdmin; + case "Admin": + return ElevationLevel.Admin; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/EncryptionProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/EncryptionProperties.cs new file mode 100644 index 000000000000..90ec576673b6 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/EncryptionProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Configures how customer data is encrypted inside the Batch account. By + /// default, accounts are encrypted using a Microsoft managed key. For + /// additional control, a customer-managed key can be used instead. + /// + public partial class EncryptionProperties + { + /// + /// Initializes a new instance of the EncryptionProperties class. + /// + public EncryptionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionProperties class. + /// + + /// Type of the key source. + /// Possible values include: 'Microsoft.Batch', 'Microsoft.KeyVault' + + /// Additional details when using Microsoft.KeyVault + /// + public EncryptionProperties(KeySource? keySource = default(KeySource?), KeyVaultProperties keyVaultProperties = default(KeyVaultProperties)) + + { + this.KeySource = keySource; + this.KeyVaultProperties = keyVaultProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets type of the key source. Possible values include: 'Microsoft.Batch', 'Microsoft.KeyVault' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keySource")] + public KeySource? KeySource {get; set; } + + /// + /// Gets or sets additional details when using Microsoft.KeyVault + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyVaultProperties")] + public KeyVaultProperties KeyVaultProperties {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointAccessDefaultAction.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointAccessDefaultAction.cs new file mode 100644 index 000000000000..4b3491095ca2 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointAccessDefaultAction.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for EndpointAccessDefaultAction. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum EndpointAccessDefaultAction + { + /// + /// Allow client access. + /// + [System.Runtime.Serialization.EnumMember(Value = "Allow")] + Allow, + /// + /// Deny client access. + /// + [System.Runtime.Serialization.EnumMember(Value = "Deny")] + Deny + } + internal static class EndpointAccessDefaultActionEnumExtension + { + internal static string ToSerializedValue(this EndpointAccessDefaultAction? value) + { + return value == null ? null : ((EndpointAccessDefaultAction)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this EndpointAccessDefaultAction value) + { + switch( value ) + { + case EndpointAccessDefaultAction.Allow: + return "Allow"; + case EndpointAccessDefaultAction.Deny: + return "Deny"; + } + return null; + } + internal static EndpointAccessDefaultAction? ParseEndpointAccessDefaultAction(this string value) + { + switch( value ) + { + case "Allow": + return EndpointAccessDefaultAction.Allow; + case "Deny": + return EndpointAccessDefaultAction.Deny; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointAccessProfile.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointAccessProfile.cs new file mode 100644 index 000000000000..4e2c79010a14 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointAccessProfile.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Network access profile for Batch endpoint. + /// + public partial class EndpointAccessProfile + { + /// + /// Initializes a new instance of the EndpointAccessProfile class. + /// + public EndpointAccessProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointAccessProfile class. + /// + + /// Default action for endpoint access. It is only applicable when + /// publicNetworkAccess is enabled. + /// Possible values include: 'Allow', 'Deny' + + /// Array of IP ranges to filter client IP address. + /// + public EndpointAccessProfile(EndpointAccessDefaultAction defaultAction, System.Collections.Generic.IList ipRules = default(System.Collections.Generic.IList)) + + { + this.DefaultAction = defaultAction; + this.IPRules = ipRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets default action for endpoint access. It is only applicable when + /// publicNetworkAccess is enabled. Possible values include: 'Allow', 'Deny' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "defaultAction")] + public EndpointAccessDefaultAction DefaultAction {get; set; } + + /// + /// Gets or sets array of IP ranges to filter client IP address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ipRules")] + public System.Collections.Generic.IList IPRules {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.IPRules != null) + { + foreach (var element in this.IPRules) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointDependency.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointDependency.cs new file mode 100644 index 000000000000..3e6f6c9a4d62 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointDependency.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A domain name and connection details used to access a dependency. + /// + public partial class EndpointDependency + { + /// + /// Initializes a new instance of the EndpointDependency class. + /// + public EndpointDependency() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointDependency class. + /// + + /// The domain name of the dependency. Domain names may be fully qualified or + /// may contain a * wildcard. + /// + + /// Human-readable supplemental information about the dependency and when it is + /// applicable. + /// + + /// The list of connection details for this endpoint. + /// + public EndpointDependency(string domainName = default(string), string description = default(string), System.Collections.Generic.IList endpointDetails = default(System.Collections.Generic.IList)) + + { + this.DomainName = domainName; + this.Description = description; + this.EndpointDetails = endpointDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the domain name of the dependency. Domain names may be fully qualified + /// or may contain a * wildcard. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "domainName")] + public string DomainName {get; private set; } + + /// + /// Gets human-readable supplemental information about the dependency and when + /// it is applicable. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; private set; } + + /// + /// Gets the list of connection details for this endpoint. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endpointDetails")] + public System.Collections.Generic.IList EndpointDetails {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointDetail.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointDetail.cs new file mode 100644 index 000000000000..2ab4d85300f8 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/EndpointDetail.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Details about the connection between the Batch service and the endpoint. + /// + public partial class EndpointDetail + { + /// + /// Initializes a new instance of the EndpointDetail class. + /// + public EndpointDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointDetail class. + /// + + /// The port an endpoint is connected to. + /// + public EndpointDetail(int? port = default(int?)) + + { + this.Port = port; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the port an endpoint is connected to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "port")] + public int? Port {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/EnvironmentSetting.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/EnvironmentSetting.cs new file mode 100644 index 000000000000..917ba0ec5c7a --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/EnvironmentSetting.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// An environment variable to be set on a task process. + /// + /// + /// An environment variable to be set on a task process. + /// + public partial class EnvironmentSetting + { + /// + /// Initializes a new instance of the EnvironmentSetting class. + /// + public EnvironmentSetting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnvironmentSetting class. + /// + + /// The name of the environment variable. + /// + + /// The value of the environment variable. + /// + public EnvironmentSetting(string name, string value = default(string)) + + { + this.Name = name; + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the environment variable. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the value of the environment variable. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/FixedScaleSettings.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/FixedScaleSettings.cs new file mode 100644 index 000000000000..445a4d55f130 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/FixedScaleSettings.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Fixed scale settings for the pool. + /// + /// + /// Fixed scale settings for the pool. + /// + public partial class FixedScaleSettings + { + /// + /// Initializes a new instance of the FixedScaleSettings class. + /// + public FixedScaleSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FixedScaleSettings class. + /// + + /// The default value is 15 minutes. Timeout values use ISO 8601 format. For + /// example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you + /// specify a value less than 5 minutes, the Batch service rejects the request + /// with an error; if you are calling the REST API directly, the HTTP status + /// code is 400 (Bad Request). + /// + + /// At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. + /// + + /// At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. + /// + + /// If omitted, the default value is Requeue. + /// Possible values include: 'Requeue', 'Terminate', 'TaskCompletion', + /// 'RetainedData' + public FixedScaleSettings(System.TimeSpan? resizeTimeout = default(System.TimeSpan?), int? targetDedicatedNodes = default(int?), int? targetLowPriorityNodes = default(int?), ComputeNodeDeallocationOption? nodeDeallocationOption = default(ComputeNodeDeallocationOption?)) + + { + this.ResizeTimeout = resizeTimeout; + this.TargetDedicatedNodes = targetDedicatedNodes; + this.TargetLowPriorityNodes = targetLowPriorityNodes; + this.NodeDeallocationOption = nodeDeallocationOption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the default value is 15 minutes. Timeout values use ISO 8601 + /// format. For example, use PT10M for 10 minutes. The minimum value is 5 + /// minutes. If you specify a value less than 5 minutes, the Batch service + /// rejects the request with an error; if you are calling the REST API + /// directly, the HTTP status code is 400 (Bad Request). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resizeTimeout")] + public System.TimeSpan? ResizeTimeout {get; set; } + + /// + /// Gets or sets at least one of targetDedicatedNodes, targetLowPriorityNodes + /// must be set. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetDedicatedNodes")] + public int? TargetDedicatedNodes {get; set; } + + /// + /// Gets or sets at least one of targetDedicatedNodes, targetLowPriorityNodes + /// must be set. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetLowPriorityNodes")] + public int? TargetLowPriorityNodes {get; set; } + + /// + /// Gets or sets if omitted, the default value is Requeue. Possible values include: 'Requeue', 'Terminate', 'TaskCompletion', 'RetainedData' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nodeDeallocationOption")] + public ComputeNodeDeallocationOption? NodeDeallocationOption {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/IPAddressProvisioningType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/IPAddressProvisioningType.cs new file mode 100644 index 000000000000..60eb83e08931 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/IPAddressProvisioningType.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for IPAddressProvisioningType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum IPAddressProvisioningType + { + /// + /// A public IP will be created and managed by Batch. There may be multiple + /// public IPs depending on the size of the Pool. + /// + [System.Runtime.Serialization.EnumMember(Value = "BatchManaged")] + BatchManaged, + /// + /// Public IPs are provided by the user and will be used to provision the + /// Compute Nodes. + /// + [System.Runtime.Serialization.EnumMember(Value = "UserManaged")] + UserManaged, + /// + /// No public IP Address will be created for the Compute Nodes in the Pool. + /// + [System.Runtime.Serialization.EnumMember(Value = "NoPublicIPAddresses")] + NoPublicIPAddresses + } + internal static class IPAddressProvisioningTypeEnumExtension + { + internal static string ToSerializedValue(this IPAddressProvisioningType? value) + { + return value == null ? null : ((IPAddressProvisioningType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this IPAddressProvisioningType value) + { + switch( value ) + { + case IPAddressProvisioningType.BatchManaged: + return "BatchManaged"; + case IPAddressProvisioningType.UserManaged: + return "UserManaged"; + case IPAddressProvisioningType.NoPublicIPAddresses: + return "NoPublicIPAddresses"; + } + return null; + } + internal static IPAddressProvisioningType? ParseIPAddressProvisioningType(this string value) + { + switch( value ) + { + case "BatchManaged": + return IPAddressProvisioningType.BatchManaged; + case "UserManaged": + return IPAddressProvisioningType.UserManaged; + case "NoPublicIPAddresses": + return IPAddressProvisioningType.NoPublicIPAddresses; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/IPRule.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/IPRule.cs new file mode 100644 index 000000000000..d985832aa35b --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/IPRule.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Rule to filter client IP address. + /// + public partial class IPRule + { + /// + /// Initializes a new instance of the IPRule class. + /// + public IPRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IPRule class. + /// + + /// IPv4 address, or IPv4 address range in CIDR format. + /// + public IPRule(string value) + + { + this.Value = value; + CustomInit(); + } + /// + /// Static constructor for IPRule class. + /// + static IPRule() + { + Action = "Allow"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets iPv4 address, or IPv4 address range in CIDR format. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } + /// + /// Gets or sets action when client IP address is matched. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "action")] + public static string Action {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Value == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Value"); + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/IPRuleAction.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/IPRuleAction.cs new file mode 100644 index 000000000000..4de63cbe91c7 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/IPRuleAction.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for IPRuleAction. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum IPRuleAction + { + /// + /// Allow access for the matched client IP address. + /// + [System.Runtime.Serialization.EnumMember(Value = "Allow")] + Allow + } + internal static class IPRuleActionEnumExtension + { + internal static string ToSerializedValue(this IPRuleAction? value) + { + return value == null ? null : ((IPRuleAction)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this IPRuleAction value) + { + switch( value ) + { + case IPRuleAction.Allow: + return "Allow"; + } + return null; + } + internal static IPRuleAction? ParseIPRuleAction(this string value) + { + switch( value ) + { + case "Allow": + return IPRuleAction.Allow; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ImageReference.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ImageReference.cs new file mode 100644 index 000000000000..e4a5704db903 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ImageReference.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A reference to an Azure Virtual Machines Marketplace image or the Azure + /// Image resource of a custom Virtual Machine. To get the list of all + /// imageReferences verified by Azure Batch, see the 'List supported node agent + /// SKUs' operation. + /// + /// + /// A reference to an Azure Virtual Machines Marketplace image or the Azure + /// Image resource of a custom Virtual Machine. To get the list of all + /// imageReferences verified by Azure Batch, see the 'List supported node agent + /// SKUs' operation. + /// + public partial class ImageReference + { + /// + /// Initializes a new instance of the ImageReference class. + /// + public ImageReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageReference class. + /// + + /// For example, Canonical or MicrosoftWindowsServer. + /// + + /// For example, UbuntuServer or WindowsServer. + /// + + /// For example, 18.04-LTS or 2022-datacenter. + /// + + /// A value of 'latest' can be specified to select the latest version of an + /// image. If omitted, the default is 'latest'. + /// + + /// This property is mutually exclusive with other properties. The Shared Image + /// Gallery image must have replicas in the same region as the Azure Batch + /// account. For information about the firewall settings for the Batch node + /// agent to communicate with the Batch service see + /// https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + /// + public ImageReference(string publisher = default(string), string offer = default(string), string sku = default(string), string version = default(string), string id = default(string)) + + { + this.Publisher = publisher; + this.Offer = offer; + this.Sku = sku; + this.Version = version; + this.Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets for example, Canonical or MicrosoftWindowsServer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + public string Publisher {get; set; } + + /// + /// Gets or sets for example, UbuntuServer or WindowsServer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "offer")] + public string Offer {get; set; } + + /// + /// Gets or sets for example, 18.04-LTS or 2022-datacenter. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public string Sku {get; set; } + + /// + /// Gets or sets a value of 'latest' can be specified to select the latest + /// version of an image. If omitted, the default is 'latest'. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "version")] + public string Version {get; set; } + + /// + /// Gets or sets this property is mutually exclusive with other properties. The + /// Shared Image Gallery image must have replicas in the same region as the + /// Azure Batch account. For information about the firewall settings for the + /// Batch node agent to communicate with the Batch service see + /// https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/InboundEndpointProtocol.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/InboundEndpointProtocol.cs new file mode 100644 index 000000000000..15dd1018d32e --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/InboundEndpointProtocol.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for InboundEndpointProtocol. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum InboundEndpointProtocol + { + /// + /// Use TCP for the endpoint. + /// + [System.Runtime.Serialization.EnumMember(Value = "TCP")] + TCP, + /// + /// Use UDP for the endpoint. + /// + [System.Runtime.Serialization.EnumMember(Value = "UDP")] + UDP + } + internal static class InboundEndpointProtocolEnumExtension + { + internal static string ToSerializedValue(this InboundEndpointProtocol? value) + { + return value == null ? null : ((InboundEndpointProtocol)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this InboundEndpointProtocol value) + { + switch( value ) + { + case InboundEndpointProtocol.TCP: + return "TCP"; + case InboundEndpointProtocol.UDP: + return "UDP"; + } + return null; + } + internal static InboundEndpointProtocol? ParseInboundEndpointProtocol(this string value) + { + switch( value ) + { + case "TCP": + return InboundEndpointProtocol.TCP; + case "UDP": + return InboundEndpointProtocol.UDP; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/InboundNatPool.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/InboundNatPool.cs new file mode 100644 index 000000000000..34d0340ab5bd --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/InboundNatPool.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A inbound NAT pool that can be used to address specific ports on compute + /// nodes in a Batch pool externally. + /// + /// + /// A inbound NAT pool that can be used to address specific ports on compute + /// nodes in a Batch pool externally. + /// + public partial class InboundNatPool + { + /// + /// Initializes a new instance of the InboundNatPool class. + /// + public InboundNatPool() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InboundNatPool class. + /// + + /// The name must be unique within a Batch pool, can contain letters, numbers, + /// underscores, periods, and hyphens. Names must start with a letter or + /// number, must end with a letter, number, or underscore, and cannot exceed 77 + /// characters. If any invalid values are provided the request fails with HTTP + /// status code 400. + /// + + /// The protocol of the endpoint. + /// Possible values include: 'TCP', 'UDP' + + /// This must be unique within a Batch pool. Acceptable values are between 1 + /// and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If + /// any reserved values are provided the request fails with HTTP status code + /// 400. + /// + + /// Acceptable values range between 1 and 65534 except ports from 50000 to + /// 55000 which are reserved. All ranges within a pool must be distinct and + /// cannot overlap. If any reserved or overlapping values are provided the + /// request fails with HTTP status code 400. + /// + + /// Acceptable values range between 1 and 65534 except ports from 50000 to + /// 55000 which are reserved by the Batch service. All ranges within a pool + /// must be distinct and cannot overlap. If any reserved or overlapping values + /// are provided the request fails with HTTP status code 400. + /// + + /// The maximum number of rules that can be specified across all the endpoints + /// on a Batch pool is 25. If no network security group rules are specified, a + /// default rule will be created to allow inbound access to the specified + /// backendPort. If the maximum number of network security group rules is + /// exceeded the request fails with HTTP status code 400. + /// + public InboundNatPool(string name, InboundEndpointProtocol protocol, int backendPort, int frontendPortRangeStart, int frontendPortRangeEnd, System.Collections.Generic.IList networkSecurityGroupRules = default(System.Collections.Generic.IList)) + + { + this.Name = name; + this.Protocol = protocol; + this.BackendPort = backendPort; + this.FrontendPortRangeStart = frontendPortRangeStart; + this.FrontendPortRangeEnd = frontendPortRangeEnd; + this.NetworkSecurityGroupRules = networkSecurityGroupRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name must be unique within a Batch pool, can contain + /// letters, numbers, underscores, periods, and hyphens. Names must start with + /// a letter or number, must end with a letter, number, or underscore, and + /// cannot exceed 77 characters. If any invalid values are provided the + /// request fails with HTTP status code 400. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the protocol of the endpoint. Possible values include: 'TCP', 'UDP' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "protocol")] + public InboundEndpointProtocol Protocol {get; set; } + + /// + /// Gets or sets this must be unique within a Batch pool. Acceptable values are + /// between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are + /// reserved. If any reserved values are provided the request fails with HTTP + /// status code 400. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "backendPort")] + public int BackendPort {get; set; } + + /// + /// Gets or sets acceptable values range between 1 and 65534 except ports from + /// 50000 to 55000 which are reserved. All ranges within a pool must be + /// distinct and cannot overlap. If any reserved or overlapping values are + /// provided the request fails with HTTP status code 400. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "frontendPortRangeStart")] + public int FrontendPortRangeStart {get; set; } + + /// + /// Gets or sets acceptable values range between 1 and 65534 except ports from + /// 50000 to 55000 which are reserved by the Batch service. All ranges within a + /// pool must be distinct and cannot overlap. If any reserved or overlapping + /// values are provided the request fails with HTTP status code 400. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "frontendPortRangeEnd")] + public int FrontendPortRangeEnd {get; set; } + + /// + /// Gets or sets the maximum number of rules that can be specified across all + /// the endpoints on a Batch pool is 25. If no network security group rules are + /// specified, a default rule will be created to allow inbound access to the + /// specified backendPort. If the maximum number of network security group + /// rules is exceeded the request fails with HTTP status code 400. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkSecurityGroupRules")] + public System.Collections.Generic.IList NetworkSecurityGroupRules {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + } + + + if (this.NetworkSecurityGroupRules != null) + { + foreach (var element in this.NetworkSecurityGroupRules) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/InterNodeCommunicationState.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/InterNodeCommunicationState.cs new file mode 100644 index 000000000000..0444c79f3b4d --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/InterNodeCommunicationState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for InterNodeCommunicationState. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum InterNodeCommunicationState + { + /// + /// Enable network communication between virtual machines. + /// + [System.Runtime.Serialization.EnumMember(Value = "Enabled")] + Enabled, + /// + /// Disable network communication between virtual machines. + /// + [System.Runtime.Serialization.EnumMember(Value = "Disabled")] + Disabled + } + internal static class InterNodeCommunicationStateEnumExtension + { + internal static string ToSerializedValue(this InterNodeCommunicationState? value) + { + return value == null ? null : ((InterNodeCommunicationState)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this InterNodeCommunicationState value) + { + switch( value ) + { + case InterNodeCommunicationState.Enabled: + return "Enabled"; + case InterNodeCommunicationState.Disabled: + return "Disabled"; + } + return null; + } + internal static InterNodeCommunicationState? ParseInterNodeCommunicationState(this string value) + { + switch( value ) + { + case "Enabled": + return InterNodeCommunicationState.Enabled; + case "Disabled": + return InterNodeCommunicationState.Disabled; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/KeySource.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/KeySource.cs new file mode 100644 index 000000000000..a079b0e3cabb --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/KeySource.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for KeySource. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum KeySource + { + /// + /// Batch creates and manages the encryption keys used to protect the account + /// data. + /// + [System.Runtime.Serialization.EnumMember(Value = "Microsoft.Batch")] + MicrosoftBatch, + /// + /// The encryption keys used to protect the account data are stored in an + /// external key vault. If this is set then the Batch Account identity must be + /// set to `SystemAssigned` and a valid Key Identifier must also be supplied + /// under the keyVaultProperties. + /// + [System.Runtime.Serialization.EnumMember(Value = "Microsoft.KeyVault")] + MicrosoftKeyVault + } + internal static class KeySourceEnumExtension + { + internal static string ToSerializedValue(this KeySource? value) + { + return value == null ? null : ((KeySource)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this KeySource value) + { + switch( value ) + { + case KeySource.MicrosoftBatch: + return "Microsoft.Batch"; + case KeySource.MicrosoftKeyVault: + return "Microsoft.KeyVault"; + } + return null; + } + internal static KeySource? ParseKeySource(this string value) + { + switch( value ) + { + case "Microsoft.Batch": + return KeySource.MicrosoftBatch; + case "Microsoft.KeyVault": + return KeySource.MicrosoftKeyVault; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/KeyVaultProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/KeyVaultProperties.cs new file mode 100644 index 000000000000..88c6b8b6290f --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/KeyVaultProperties.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// KeyVault configuration when using an encryption KeySource of + /// Microsoft.KeyVault. + /// + public partial class KeyVaultProperties + { + /// + /// Initializes a new instance of the KeyVaultProperties class. + /// + public KeyVaultProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultProperties class. + /// + + /// Full path to the versioned secret. Example + /// https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. + /// To be usable the following prerequisites must be met: + /// The Batch Account has a System Assigned identity + /// The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap + /// permissions + /// The KeyVault has soft-delete and purge protection enabled + /// + public KeyVaultProperties(string keyIdentifier = default(string)) + + { + this.KeyIdentifier = keyIdentifier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets full path to the versioned secret. Example + /// https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. + /// To be usable the following prerequisites must be met: + /// The Batch Account has a System Assigned identity + /// The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap + /// permissions + /// The KeyVault has soft-delete and purge protection enabled + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyIdentifier")] + public string KeyIdentifier {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/KeyVaultReference.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/KeyVaultReference.cs new file mode 100644 index 000000000000..f6e6ab996fb6 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/KeyVaultReference.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Identifies the Azure key vault associated with a Batch account. + /// + public partial class KeyVaultReference + { + /// + /// Initializes a new instance of the KeyVaultReference class. + /// + public KeyVaultReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultReference class. + /// + + /// The resource ID of the Azure key vault associated with the Batch account. + /// + + /// The URL of the Azure key vault associated with the Batch account. + /// + public KeyVaultReference(string id, string url) + + { + this.Id = id; + this.Url = url; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the resource ID of the Azure key vault associated with the + /// Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } + + /// + /// Gets or sets the URL of the Azure key vault associated with the Batch + /// account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "url")] + public string Url {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Id == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Id"); + } + if (this.Url == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Url"); + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/LinuxUserConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/LinuxUserConfiguration.cs new file mode 100644 index 000000000000..a8b046b929ad --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/LinuxUserConfiguration.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Properties used to create a user account on a Linux node. + /// + /// + /// Properties used to create a user account on a Linux node. + /// + public partial class LinuxUserConfiguration + { + /// + /// Initializes a new instance of the LinuxUserConfiguration class. + /// + public LinuxUserConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinuxUserConfiguration class. + /// + + /// The uid and gid properties must be specified together or not at all. If not + /// specified the underlying operating system picks the uid. + /// + + /// The uid and gid properties must be specified together or not at all. If not + /// specified the underlying operating system picks the gid. + /// + + /// The private key must not be password protected. The private key is used to + /// automatically configure asymmetric-key based authentication for SSH between + /// nodes in a Linux pool when the pool's enableInterNodeCommunication property + /// is true (it is ignored if enableInterNodeCommunication is false). It does + /// this by placing the key pair into the user's .ssh directory. If not + /// specified, password-less SSH is not configured between nodes (no + /// modification of the user's .ssh directory is done). + /// + public LinuxUserConfiguration(int? uid = default(int?), int? gid = default(int?), string sshPrivateKey = default(string)) + + { + this.Uid = uid; + this.Gid = gid; + this.SshPrivateKey = sshPrivateKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the uid and gid properties must be specified together or not + /// at all. If not specified the underlying operating system picks the uid. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "uid")] + public int? Uid {get; set; } + + /// + /// Gets or sets the uid and gid properties must be specified together or not + /// at all. If not specified the underlying operating system picks the gid. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "gid")] + public int? Gid {get; set; } + + /// + /// Gets or sets the private key must not be password protected. The private + /// key is used to automatically configure asymmetric-key based authentication + /// for SSH between nodes in a Linux pool when the pool's + /// enableInterNodeCommunication property is true (it is ignored if + /// enableInterNodeCommunication is false). It does this by placing the key + /// pair into the user's .ssh directory. If not specified, password-less SSH is + /// not configured between nodes (no modification of the user's .ssh directory + /// is done). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sshPrivateKey")] + public string SshPrivateKey {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/LoginMode.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/LoginMode.cs new file mode 100644 index 000000000000..264185ca51b2 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/LoginMode.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for LoginMode. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum LoginMode + { + /// + /// The LOGON32_LOGON_BATCH Win32 login mode. The batch login mode is + /// recommended for long running parallel processes. + /// + [System.Runtime.Serialization.EnumMember(Value = "Batch")] + Batch, + /// + /// The LOGON32_LOGON_INTERACTIVE Win32 login mode. Some applications require + /// having permissions associated with the interactive login mode. If this is + /// the case for an application used in your task, then this option is + /// recommended. + /// + [System.Runtime.Serialization.EnumMember(Value = "Interactive")] + Interactive + } + internal static class LoginModeEnumExtension + { + internal static string ToSerializedValue(this LoginMode? value) + { + return value == null ? null : ((LoginMode)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this LoginMode value) + { + switch( value ) + { + case LoginMode.Batch: + return "Batch"; + case LoginMode.Interactive: + return "Interactive"; + } + return null; + } + internal static LoginMode? ParseLoginMode(this string value) + { + switch( value ) + { + case "Batch": + return LoginMode.Batch; + case "Interactive": + return LoginMode.Interactive; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/MetadataItem.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/MetadataItem.cs new file mode 100644 index 000000000000..7d2257d1ef07 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/MetadataItem.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The Batch service does not assign any meaning to this metadata; it is + /// solely for the use of user code. + /// + /// + /// The Batch service does not assign any meaning to this metadata; it is + /// solely for the use of user code. + /// + public partial class MetadataItem + { + /// + /// Initializes a new instance of the MetadataItem class. + /// + public MetadataItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataItem class. + /// + + /// The name of the metadata item. + /// + + /// The value of the metadata item. + /// + public MetadataItem(string name, string value) + + { + this.Name = name; + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the metadata item. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the value of the metadata item. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + } + if (this.Value == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Value"); + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/MountConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/MountConfiguration.cs new file mode 100644 index 000000000000..10af7b0948ca --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/MountConfiguration.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The file system to mount on each node. + /// + /// + /// The file system to mount on each node. + /// + public partial class MountConfiguration + { + /// + /// Initializes a new instance of the MountConfiguration class. + /// + public MountConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MountConfiguration class. + /// + + /// This property is mutually exclusive with all other properties. + /// + + /// This property is mutually exclusive with all other properties. + /// + + /// This property is mutually exclusive with all other properties. + /// + + /// This property is mutually exclusive with all other properties. + /// + public MountConfiguration(AzureBlobFileSystemConfiguration azureBlobFileSystemConfiguration = default(AzureBlobFileSystemConfiguration), NFSMountConfiguration nfsMountConfiguration = default(NFSMountConfiguration), CifsMountConfiguration cifsMountConfiguration = default(CifsMountConfiguration), AzureFileShareConfiguration azureFileShareConfiguration = default(AzureFileShareConfiguration)) + + { + this.AzureBlobFileSystemConfiguration = azureBlobFileSystemConfiguration; + this.NfsMountConfiguration = nfsMountConfiguration; + this.CifsMountConfiguration = cifsMountConfiguration; + this.AzureFileShareConfiguration = azureFileShareConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets this property is mutually exclusive with all other properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "azureBlobFileSystemConfiguration")] + public AzureBlobFileSystemConfiguration AzureBlobFileSystemConfiguration {get; set; } + + /// + /// Gets or sets this property is mutually exclusive with all other properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nfsMountConfiguration")] + public NFSMountConfiguration NfsMountConfiguration {get; set; } + + /// + /// Gets or sets this property is mutually exclusive with all other properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "cifsMountConfiguration")] + public CifsMountConfiguration CifsMountConfiguration {get; set; } + + /// + /// Gets or sets this property is mutually exclusive with all other properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "azureFileShareConfiguration")] + public AzureFileShareConfiguration AzureFileShareConfiguration {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.AzureBlobFileSystemConfiguration != null) + { + this.AzureBlobFileSystemConfiguration.Validate(); + } + if (this.NfsMountConfiguration != null) + { + this.NfsMountConfiguration.Validate(); + } + if (this.CifsMountConfiguration != null) + { + this.CifsMountConfiguration.Validate(); + } + if (this.AzureFileShareConfiguration != null) + { + this.AzureFileShareConfiguration.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/NFSMountConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/NFSMountConfiguration.cs new file mode 100644 index 000000000000..951db278575e --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/NFSMountConfiguration.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Information used to connect to an NFS file system. + /// + /// + /// Information used to connect to an NFS file system. + /// + public partial class NFSMountConfiguration + { + /// + /// Initializes a new instance of the NFSMountConfiguration class. + /// + public NFSMountConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NFSMountConfiguration class. + /// + + /// The URI of the file system to mount. + /// + + /// All file systems are mounted relative to the Batch mounts directory, + /// accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + /// + + /// These are 'net use' options in Windows and 'mount' options in Linux. + /// + public NFSMountConfiguration(string source, string relativeMountPath, string mountOptions = default(string)) + + { + this.Source = source; + this.RelativeMountPath = relativeMountPath; + this.MountOptions = mountOptions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the URI of the file system to mount. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "source")] + public string Source {get; set; } + + /// + /// Gets or sets all file systems are mounted relative to the Batch mounts + /// directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment + /// variable. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "relativeMountPath")] + public string RelativeMountPath {get; set; } + + /// + /// Gets or sets these are 'net use' options in Windows and 'mount' options in + /// Linux. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "mountOptions")] + public string MountOptions {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Source == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Source"); + } + if (this.RelativeMountPath == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "RelativeMountPath"); + } + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/NameAvailabilityReason.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/NameAvailabilityReason.cs new file mode 100644 index 000000000000..59e78c7600cf --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/NameAvailabilityReason.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for NameAvailabilityReason. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum NameAvailabilityReason + { + /// + /// The requested name is invalid. + /// + [System.Runtime.Serialization.EnumMember(Value = "Invalid")] + Invalid, + /// + /// The requested name is already in use. + /// + [System.Runtime.Serialization.EnumMember(Value = "AlreadyExists")] + AlreadyExists + } + internal static class NameAvailabilityReasonEnumExtension + { + internal static string ToSerializedValue(this NameAvailabilityReason? value) + { + return value == null ? null : ((NameAvailabilityReason)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this NameAvailabilityReason value) + { + switch( value ) + { + case NameAvailabilityReason.Invalid: + return "Invalid"; + case NameAvailabilityReason.AlreadyExists: + return "AlreadyExists"; + } + return null; + } + internal static NameAvailabilityReason? ParseNameAvailabilityReason(this string value) + { + switch( value ) + { + case "Invalid": + return NameAvailabilityReason.Invalid; + case "AlreadyExists": + return NameAvailabilityReason.AlreadyExists; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkConfiguration.cs new file mode 100644 index 000000000000..0606bd92da94 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkConfiguration.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The network configuration for a pool. + /// + public partial class NetworkConfiguration + { + /// + /// Initializes a new instance of the NetworkConfiguration class. + /// + public NetworkConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkConfiguration class. + /// + + /// The virtual network must be in the same region and subscription as the + /// Azure Batch account. The specified subnet should have enough free IP + /// addresses to accommodate the number of nodes in the pool. If the subnet + /// doesn't have enough free IP addresses, the pool will partially allocate + /// compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' + /// service principal must have the 'Classic Virtual Machine Contributor' + /// Role-Based Access Control (RBAC) role for the specified VNet. The specified + /// subnet must allow communication from the Azure Batch service to be able to + /// schedule tasks on the compute nodes. This can be verified by checking if + /// the specified VNet has any associated Network Security Groups (NSG). If + /// communication to the compute nodes in the specified subnet is denied by an + /// NSG, then the Batch service will set the state of the compute nodes to + /// unusable. If the specified VNet has any associated Network Security Groups + /// (NSG), then a few reserved system ports must be enabled for inbound + /// communication. For pools created with a virtual machine configuration, + /// enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 + /// for Windows. For pools created with a cloud service configuration, enable + /// ports 10100, 20100, and 30100. Also enable outbound connections to Azure + /// Storage on port 443. For cloudServiceConfiguration pools, only 'classic' + /// VNETs are supported. For more details see: + /// https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration + /// + + /// The scope of dynamic vnet assignment. + /// Possible values include: 'none', 'job' + + /// Pool endpoint configuration is only supported on pools with the + /// virtualMachineConfiguration property. + /// + + /// This property is only supported on Pools with the + /// virtualMachineConfiguration property. + /// + public NetworkConfiguration(string subnetId = default(string), DynamicVNetAssignmentScope? dynamicVnetAssignmentScope = default(DynamicVNetAssignmentScope?), PoolEndpointConfiguration endpointConfiguration = default(PoolEndpointConfiguration), PublicIPAddressConfiguration publicIPAddressConfiguration = default(PublicIPAddressConfiguration)) + + { + this.SubnetId = subnetId; + this.DynamicVnetAssignmentScope = dynamicVnetAssignmentScope; + this.EndpointConfiguration = endpointConfiguration; + this.PublicIPAddressConfiguration = publicIPAddressConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the virtual network must be in the same region and + /// subscription as the Azure Batch account. The specified subnet should have + /// enough free IP addresses to accommodate the number of nodes in the pool. If + /// the subnet doesn't have enough free IP addresses, the pool will partially + /// allocate compute nodes and a resize error will occur. The + /// 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual + /// Machine Contributor' Role-Based Access Control (RBAC) role for the + /// specified VNet. The specified subnet must allow communication from the + /// Azure Batch service to be able to schedule tasks on the compute nodes. This + /// can be verified by checking if the specified VNet has any associated + /// Network Security Groups (NSG). If communication to the compute nodes in the + /// specified subnet is denied by an NSG, then the Batch service will set the + /// state of the compute nodes to unusable. If the specified VNet has any + /// associated Network Security Groups (NSG), then a few reserved system ports + /// must be enabled for inbound communication. For pools created with a virtual + /// machine configuration, enable ports 29876 and 29877, as well as port 22 for + /// Linux and port 3389 for Windows. For pools created with a cloud service + /// configuration, enable ports 10100, 20100, and 30100. Also enable outbound + /// connections to Azure Storage on port 443. For cloudServiceConfiguration + /// pools, only 'classic' VNETs are supported. For more details see: + /// https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subnetId")] + public string SubnetId {get; set; } + + /// + /// Gets or sets the scope of dynamic vnet assignment. Possible values include: 'none', 'job' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dynamicVnetAssignmentScope")] + public DynamicVNetAssignmentScope? DynamicVnetAssignmentScope {get; set; } + + /// + /// Gets or sets pool endpoint configuration is only supported on pools with + /// the virtualMachineConfiguration property. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endpointConfiguration")] + public PoolEndpointConfiguration EndpointConfiguration {get; set; } + + /// + /// Gets or sets this property is only supported on Pools with the + /// virtualMachineConfiguration property. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publicIPAddressConfiguration")] + public PublicIPAddressConfiguration PublicIPAddressConfiguration {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + if (this.EndpointConfiguration != null) + { + this.EndpointConfiguration.Validate(); + } + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkProfile.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkProfile.cs new file mode 100644 index 000000000000..06597219dc95 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkProfile.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Network profile for Batch account, which contains network rule settings for + /// each endpoint. + /// + public partial class NetworkProfile + { + /// + /// Initializes a new instance of the NetworkProfile class. + /// + public NetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkProfile class. + /// + + /// Network access profile for batchAccount endpoint (Batch account data plane + /// API). + /// + + /// Network access profile for nodeManagement endpoint (Batch service managing + /// compute nodes for Batch pools). + /// + public NetworkProfile(EndpointAccessProfile accountAccess = default(EndpointAccessProfile), EndpointAccessProfile nodeManagementAccess = default(EndpointAccessProfile)) + + { + this.AccountAccess = accountAccess; + this.NodeManagementAccess = nodeManagementAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets network access profile for batchAccount endpoint (Batch + /// account data plane API). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountAccess")] + public EndpointAccessProfile AccountAccess {get; set; } + + /// + /// Gets or sets network access profile for nodeManagement endpoint (Batch + /// service managing compute nodes for Batch pools). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nodeManagementAccess")] + public EndpointAccessProfile NodeManagementAccess {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.AccountAccess != null) + { + this.AccountAccess.Validate(); + } + if (this.NodeManagementAccess != null) + { + this.NodeManagementAccess.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkSecurityGroupRule.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkSecurityGroupRule.cs new file mode 100644 index 000000000000..e6ec5dda51e1 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkSecurityGroupRule.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A network security group rule to apply to an inbound endpoint. + /// + /// + /// A network security group rule to apply to an inbound endpoint. + /// + public partial class NetworkSecurityGroupRule + { + /// + /// Initializes a new instance of the NetworkSecurityGroupRule class. + /// + public NetworkSecurityGroupRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkSecurityGroupRule class. + /// + + /// Priorities within a pool must be unique and are evaluated in order of + /// priority. The lower the number the higher the priority. For example, rules + /// could be specified with order numbers of 150, 250, and 350. The rule with + /// the order number of 150 takes precedence over the rule that has an order of + /// 250. Allowed priorities are 150 to 4096. If any reserved or duplicate + /// values are provided the request fails with HTTP status code 400. + /// + + /// The action that should be taken for a specified IP address, subnet range or + /// tag. + /// Possible values include: 'Allow', 'Deny' + + /// Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. + /// 192.168.1.0/24), default tag, or * (for all addresses). If any other + /// values are provided the request fails with HTTP status code 400. + /// + + /// Valid values are '*' (for all ports 0 - 65535) or arrays of ports or port + /// ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the + /// port ranges or ports can't overlap. If any other values are provided the + /// request fails with HTTP status code 400. Default value will be *. + /// + public NetworkSecurityGroupRule(int priority, NetworkSecurityGroupRuleAccess access, string sourceAddressPrefix, System.Collections.Generic.IList sourcePortRanges = default(System.Collections.Generic.IList)) + + { + this.Priority = priority; + this.Access = access; + this.SourceAddressPrefix = sourceAddressPrefix; + this.SourcePortRanges = sourcePortRanges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets priorities within a pool must be unique and are evaluated in + /// order of priority. The lower the number the higher the priority. For + /// example, rules could be specified with order numbers of 150, 250, and 350. + /// The rule with the order number of 150 takes precedence over the rule that + /// has an order of 250. Allowed priorities are 150 to 4096. If any reserved or + /// duplicate values are provided the request fails with HTTP status code 400. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "priority")] + public int Priority {get; set; } + + /// + /// Gets or sets the action that should be taken for a specified IP address, + /// subnet range or tag. Possible values include: 'Allow', 'Deny' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "access")] + public NetworkSecurityGroupRuleAccess Access {get; set; } + + /// + /// Gets or sets valid values are a single IP address (i.e. 10.10.10.10), IP + /// subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If + /// any other values are provided the request fails with HTTP status code 400. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sourceAddressPrefix")] + public string SourceAddressPrefix {get; set; } + + /// + /// Gets or sets valid values are '*' (for all ports 0 - 65535) or arrays of + /// ports or port ranges (i.e. 100-200). The ports should in the range of 0 to + /// 65535 and the port ranges or ports can't overlap. If any other values are + /// provided the request fails with HTTP status code 400. Default value will be + /// *. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sourcePortRanges")] + public System.Collections.Generic.IList SourcePortRanges {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.SourceAddressPrefix == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "SourceAddressPrefix"); + } + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkSecurityGroupRuleAccess.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkSecurityGroupRuleAccess.cs new file mode 100644 index 000000000000..392a950a7aee --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/NetworkSecurityGroupRuleAccess.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for NetworkSecurityGroupRuleAccess. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum NetworkSecurityGroupRuleAccess + { + /// + /// Allow access. + /// + [System.Runtime.Serialization.EnumMember(Value = "Allow")] + Allow, + /// + /// Deny access. + /// + [System.Runtime.Serialization.EnumMember(Value = "Deny")] + Deny + } + internal static class NetworkSecurityGroupRuleAccessEnumExtension + { + internal static string ToSerializedValue(this NetworkSecurityGroupRuleAccess? value) + { + return value == null ? null : ((NetworkSecurityGroupRuleAccess)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this NetworkSecurityGroupRuleAccess value) + { + switch( value ) + { + case NetworkSecurityGroupRuleAccess.Allow: + return "Allow"; + case NetworkSecurityGroupRuleAccess.Deny: + return "Deny"; + } + return null; + } + internal static NetworkSecurityGroupRuleAccess? ParseNetworkSecurityGroupRuleAccess(this string value) + { + switch( value ) + { + case "Allow": + return NetworkSecurityGroupRuleAccess.Allow; + case "Deny": + return NetworkSecurityGroupRuleAccess.Deny; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/NodeCommunicationMode.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/NodeCommunicationMode.cs new file mode 100644 index 000000000000..614b3c028010 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/NodeCommunicationMode.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for NodeCommunicationMode. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum NodeCommunicationMode + { + /// + /// The node communication mode is automatically set by the Batch service. + /// + [System.Runtime.Serialization.EnumMember(Value = "Default")] + Default, + /// + /// Nodes using the Classic communication mode require inbound TCP + /// communication on ports 29876 and 29877 from the + /// "BatchNodeManagement.{region}" service tag and outbound TCP communication + /// on port 443 to the "Storage.region" and "BatchNodeManagement.{region}" + /// service tags. + /// + [System.Runtime.Serialization.EnumMember(Value = "Classic")] + Classic, + /// + /// Nodes using the Simplified communication mode require outbound TCP + /// communication on port 443 to the "BatchNodeManagement.{region}" service + /// tag. No open inbound ports are required. + /// + [System.Runtime.Serialization.EnumMember(Value = "Simplified")] + Simplified + } + internal static class NodeCommunicationModeEnumExtension + { + internal static string ToSerializedValue(this NodeCommunicationMode? value) + { + return value == null ? null : ((NodeCommunicationMode)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this NodeCommunicationMode value) + { + switch( value ) + { + case NodeCommunicationMode.Default: + return "Default"; + case NodeCommunicationMode.Classic: + return "Classic"; + case NodeCommunicationMode.Simplified: + return "Simplified"; + } + return null; + } + internal static NodeCommunicationMode? ParseNodeCommunicationMode(this string value) + { + switch( value ) + { + case "Default": + return NodeCommunicationMode.Default; + case "Classic": + return NodeCommunicationMode.Classic; + case "Simplified": + return NodeCommunicationMode.Simplified; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/NodePlacementConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/NodePlacementConfiguration.cs new file mode 100644 index 000000000000..8f0ac4d59a88 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/NodePlacementConfiguration.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Allocation configuration used by Batch Service to provision the nodes. + /// + /// + /// Allocation configuration used by Batch Service to provision the nodes. + /// + public partial class NodePlacementConfiguration + { + /// + /// Initializes a new instance of the NodePlacementConfiguration class. + /// + public NodePlacementConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NodePlacementConfiguration class. + /// + + /// Allocation policy used by Batch Service to provision the nodes. If not + /// specified, Batch will use the regional policy. + /// Possible values include: 'Regional', 'Zonal' + public NodePlacementConfiguration(NodePlacementPolicyType? policy = default(NodePlacementPolicyType?)) + + { + this.Policy = policy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets allocation policy used by Batch Service to provision the + /// nodes. If not specified, Batch will use the regional policy. Possible values include: 'Regional', 'Zonal' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "policy")] + public NodePlacementPolicyType? Policy {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/NodePlacementPolicyType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/NodePlacementPolicyType.cs new file mode 100644 index 000000000000..5a81b095f809 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/NodePlacementPolicyType.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for NodePlacementPolicyType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum NodePlacementPolicyType + { + /// + /// All nodes in the pool will be allocated in the same region. + /// + [System.Runtime.Serialization.EnumMember(Value = "Regional")] + Regional, + /// + /// Nodes in the pool will be spread across different zones with best effort + /// balancing. + /// + [System.Runtime.Serialization.EnumMember(Value = "Zonal")] + Zonal + } + internal static class NodePlacementPolicyTypeEnumExtension + { + internal static string ToSerializedValue(this NodePlacementPolicyType? value) + { + return value == null ? null : ((NodePlacementPolicyType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this NodePlacementPolicyType value) + { + switch( value ) + { + case NodePlacementPolicyType.Regional: + return "Regional"; + case NodePlacementPolicyType.Zonal: + return "Zonal"; + } + return null; + } + internal static NodePlacementPolicyType? ParseNodePlacementPolicyType(this string value) + { + switch( value ) + { + case "Regional": + return NodePlacementPolicyType.Regional; + case "Zonal": + return NodePlacementPolicyType.Zonal; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/OSDisk.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/OSDisk.cs new file mode 100644 index 000000000000..f55a582a9387 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/OSDisk.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Settings for the operating system disk of the virtual machine. + /// + /// + /// Settings for the operating system disk of the virtual machine. + /// + public partial class OSDisk + { + /// + /// Initializes a new instance of the OSDisk class. + /// + public OSDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OSDisk class. + /// + + /// Specifies the ephemeral Disk Settings for the operating system disk used by + /// the virtual machine. + /// + public OSDisk(DiffDiskSettings ephemeralOSDiskSettings = default(DiffDiskSettings)) + + { + this.EphemeralOSDiskSettings = ephemeralOSDiskSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets specifies the ephemeral Disk Settings for the operating system + /// disk used by the virtual machine. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ephemeralOSDiskSettings")] + public DiffDiskSettings EphemeralOSDiskSettings {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/Operation.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/Operation.cs new file mode 100644 index 000000000000..131f25bcea40 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/Operation.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A REST API operation + /// + /// + /// A REST API operation + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + + /// This is of the format {provider}/{resource}/{operation} + /// + + /// Indicates whether the operation is a data action + /// + + /// The object that describes the operation. + /// + + /// The intended executor of the operation. + /// + + /// Properties of the operation. + /// + public Operation(string name = default(string), bool? isDataAction = default(bool?), OperationDisplay display = default(OperationDisplay), string origin = default(string), object properties = default(object)) + + { + this.Name = name; + this.IsDataAction = isDataAction; + this.Display = display; + this.Origin = origin; + this.Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets this is of the format {provider}/{resource}/{operation} + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets indicates whether the operation is a data action + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction {get; set; } + + /// + /// Gets or sets the object that describes the operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "display")] + public OperationDisplay Display {get; set; } + + /// + /// Gets or sets the intended executor of the operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "origin")] + public string Origin {get; set; } + + /// + /// Gets or sets properties of the operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public object Properties {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/OperationDisplay.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..252c2cca36d3 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/OperationDisplay.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The object that describes the operation. + /// + /// + /// The object that describes the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + + /// Friendly name of the resource provider. + /// + + /// For example: read, write, delete, or listKeys/action + /// + + /// The resource type on which the operation is performed. + /// + + /// The friendly name of the operation + /// + public OperationDisplay(string provider = default(string), string operation = default(string), string resource = default(string), string description = default(string)) + + { + this.Provider = provider; + this.Operation = operation; + this.Resource = resource; + this.Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets friendly name of the resource provider. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provider")] + public string Provider {get; set; } + + /// + /// Gets or sets for example: read, write, delete, or listKeys/action + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + public string Operation {get; set; } + + /// + /// Gets or sets the resource type on which the operation is performed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resource")] + public string Resource {get; set; } + + /// + /// Gets or sets the friendly name of the operation + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/OutboundEnvironmentEndpoint.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/OutboundEnvironmentEndpoint.cs new file mode 100644 index 000000000000..5f814affc516 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/OutboundEnvironmentEndpoint.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A collection of related endpoints from the same service for which the Batch + /// service requires outbound access. + /// + public partial class OutboundEnvironmentEndpoint + { + /// + /// Initializes a new instance of the OutboundEnvironmentEndpoint class. + /// + public OutboundEnvironmentEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OutboundEnvironmentEndpoint class. + /// + + /// The type of service that the Batch service connects to. + /// + + /// The endpoints for this service to which the Batch service makes outbound + /// calls. + /// + public OutboundEnvironmentEndpoint(string category = default(string), System.Collections.Generic.IList endpoints = default(System.Collections.Generic.IList)) + + { + this.Category = category; + this.Endpoints = endpoints; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the type of service that the Batch service connects to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "category")] + public string Category {get; private set; } + + /// + /// Gets the endpoints for this service to which the Batch service makes + /// outbound calls. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endpoints")] + public System.Collections.Generic.IList Endpoints {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PackageState.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PackageState.cs new file mode 100644 index 000000000000..d36e87b8ad61 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PackageState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for PackageState. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum PackageState + { + /// + /// The application package has been created but has not yet been activated. + /// + [System.Runtime.Serialization.EnumMember(Value = "Pending")] + Pending, + /// + /// The application package is ready for use. + /// + [System.Runtime.Serialization.EnumMember(Value = "Active")] + Active + } + internal static class PackageStateEnumExtension + { + internal static string ToSerializedValue(this PackageState? value) + { + return value == null ? null : ((PackageState)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this PackageState value) + { + switch( value ) + { + case PackageState.Pending: + return "Pending"; + case PackageState.Active: + return "Active"; + } + return null; + } + internal static PackageState? ParsePackageState(this string value) + { + switch( value ) + { + case "Pending": + return PackageState.Pending; + case "Active": + return PackageState.Active; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/Page.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/Page.cs new file mode 100644 index 000000000000..fc37fb0dde39 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/Page.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [Newtonsoft.Json.JsonObject] + public class Page : Microsoft.Rest.Azure.IPage + { + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("nextLink")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public System.Collections.Generic.IEnumerator GetEnumerator() + { + return (Items == null) ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/Pool.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/Pool.cs new file mode 100644 index 000000000000..c2b8172b2761 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/Pool.cs @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Contains information about a pool. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Pool : ProxyResource + { + /// + /// Initializes a new instance of the Pool class. + /// + public Pool() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Pool class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The ETag of the resource, used for concurrency statements. + /// + + /// The type of identity used for the Batch Pool. + /// + + /// Whether the pool is resizing. + /// Possible values include: 'Steady', 'Resizing', 'Stopping' + + /// Using CloudServiceConfiguration specifies that the nodes should be creating + /// using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses + /// Azure Virtual Machines (IaaS). + /// + + /// Defines the desired size of the pool. This can either be 'fixedScale' where + /// the requested targetDedicatedNodes is specified, or 'autoScale' which + /// defines a formula which is periodically reevaluated. If this property is + /// not specified, the pool will have a fixed scale with 0 + /// targetDedicatedNodes. + /// + + /// The network configuration for a pool. + /// + + /// In an PATCH (update) operation, this property can be set to an empty object + /// to remove the start task from the pool. + /// + + /// The display name need not be unique and can contain any Unicode characters + /// up to a maximum length of 1024. + /// + + /// This is the last time at which the pool level data, such as the + /// targetDedicatedNodes or autoScaleSettings, changed. It does not factor in + /// node-level changes such as a compute node changing state. + /// + + /// The creation time of the pool. + /// + + /// The current state of the pool. + /// Possible values include: 'Succeeded', 'Deleting' + + /// The time at which the pool entered its current state. + /// + + /// The time at which the pool entered its current allocation state. + /// + + /// For information about available sizes of virtual machines for Cloud + /// Services pools (pools created with cloudServiceConfiguration), see Sizes + /// for Cloud Services + /// (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). + /// Batch supports all Cloud Services VM sizes except ExtraSmall. For + /// information about available VM sizes for pools using images from the + /// Virtual Machines Marketplace (pools created with + /// virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) + /// (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) + /// or Sizes for Virtual Machines (Windows) + /// (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). + /// Batch supports all Azure VM sizes except STANDARD_A0 and those with premium + /// storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + /// + + /// The number of dedicated compute nodes currently in the pool. + /// + + /// The number of Spot/low-priority compute nodes currently in the pool. + /// + + /// This property is set only if the pool automatically scales, i.e. + /// autoScaleSettings are used. + /// + + /// This imposes restrictions on which nodes can be assigned to the pool. + /// Enabling this value can reduce the chance of the requested number of nodes + /// to be allocated in the pool. If not specified, this value defaults to + /// 'Disabled'. + /// Possible values include: 'Enabled', 'Disabled' + + /// The default value is 1. The maximum value is the smaller of 4 times the + /// number of cores of the vmSize of the pool or 256. + /// + + /// If not specified, the default is spread. + /// + + /// The list of user accounts to be created on each node in the pool. + /// + + /// The Batch service does not assign any meaning to metadata; it is solely for + /// the use of user code. + /// + + /// For Windows compute nodes, the Batch service installs the certificates to + /// the specified certificate store and location. For Linux compute nodes, the + /// certificates are stored in a directory inside the task working directory + /// and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the + /// task to query for this location. For certificates with visibility of + /// 'remoteUser', a 'certs' directory is created in the user's home directory + /// (e.g., /home/{user-name}/certs) and certificates are placed in that + /// directory. + /// Warning: This property is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + + /// Changes to application package references affect all new compute nodes + /// joining the pool, but do not affect compute nodes that are already in the + /// pool until they are rebooted or reimaged. There is a maximum of 10 + /// application package references on any given pool. + /// + + /// The list of application licenses must be a subset of available Batch + /// service application licenses. If a license is requested which is not + /// supported, pool creation will fail. + /// + + /// Describes either the current operation (if the pool AllocationState is + /// Resizing) or the previously completed operation (if the AllocationState is + /// Steady). + /// + + /// This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + /// + + /// If omitted, the default value is Default. + /// Possible values include: 'Default', 'Classic', 'Simplified' + + /// Determines how a pool communicates with the Batch service. + /// Possible values include: 'Default', 'Classic', 'Simplified' + public Pool(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), BatchPoolIdentity identity = default(BatchPoolIdentity), AllocationState? allocationState = default(AllocationState?), DeploymentConfiguration deploymentConfiguration = default(DeploymentConfiguration), ScaleSettings scaleSettings = default(ScaleSettings), NetworkConfiguration networkConfiguration = default(NetworkConfiguration), StartTask startTask = default(StartTask), string displayName = default(string), System.DateTime? lastModified = default(System.DateTime?), System.DateTime? creationTime = default(System.DateTime?), PoolProvisioningState? provisioningState = default(PoolProvisioningState?), System.DateTime? provisioningStateTransitionTime = default(System.DateTime?), System.DateTime? allocationStateTransitionTime = default(System.DateTime?), string vmSize = default(string), int? currentDedicatedNodes = default(int?), int? currentLowPriorityNodes = default(int?), AutoScaleRun autoScaleRun = default(AutoScaleRun), InterNodeCommunicationState? interNodeCommunication = default(InterNodeCommunicationState?), int? taskSlotsPerNode = default(int?), TaskSchedulingPolicy taskSchedulingPolicy = default(TaskSchedulingPolicy), System.Collections.Generic.IList userAccounts = default(System.Collections.Generic.IList), System.Collections.Generic.IList metadata = default(System.Collections.Generic.IList), System.Collections.Generic.IList certificates = default(System.Collections.Generic.IList), System.Collections.Generic.IList applicationPackages = default(System.Collections.Generic.IList), System.Collections.Generic.IList applicationLicenses = default(System.Collections.Generic.IList), ResizeOperationStatus resizeOperationStatus = default(ResizeOperationStatus), System.Collections.Generic.IList mountConfiguration = default(System.Collections.Generic.IList), NodeCommunicationMode? targetNodeCommunicationMode = default(NodeCommunicationMode?), NodeCommunicationMode? currentNodeCommunicationMode = default(NodeCommunicationMode?)) + + : base(id, name, type, etag) + { + this.Identity = identity; + this.AllocationState = allocationState; + this.DeploymentConfiguration = deploymentConfiguration; + this.ScaleSettings = scaleSettings; + this.NetworkConfiguration = networkConfiguration; + this.StartTask = startTask; + this.DisplayName = displayName; + this.LastModified = lastModified; + this.CreationTime = creationTime; + this.ProvisioningState = provisioningState; + this.ProvisioningStateTransitionTime = provisioningStateTransitionTime; + this.AllocationStateTransitionTime = allocationStateTransitionTime; + this.VMSize = vmSize; + this.CurrentDedicatedNodes = currentDedicatedNodes; + this.CurrentLowPriorityNodes = currentLowPriorityNodes; + this.AutoScaleRun = autoScaleRun; + this.InterNodeCommunication = interNodeCommunication; + this.TaskSlotsPerNode = taskSlotsPerNode; + this.TaskSchedulingPolicy = taskSchedulingPolicy; + this.UserAccounts = userAccounts; + this.Metadata = metadata; + this.Certificates = certificates; + this.ApplicationPackages = applicationPackages; + this.ApplicationLicenses = applicationLicenses; + this.ResizeOperationStatus = resizeOperationStatus; + this.MountConfiguration = mountConfiguration; + this.TargetNodeCommunicationMode = targetNodeCommunicationMode; + this.CurrentNodeCommunicationMode = currentNodeCommunicationMode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the type of identity used for the Batch Pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + public BatchPoolIdentity Identity {get; set; } + + /// + /// Gets whether the pool is resizing. Possible values include: 'Steady', 'Resizing', 'Stopping' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allocationState")] + public AllocationState? AllocationState {get; private set; } + + /// + /// Gets or sets using CloudServiceConfiguration specifies that the nodes + /// should be creating using Azure Cloud Services (PaaS), while + /// VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.deploymentConfiguration")] + public DeploymentConfiguration DeploymentConfiguration {get; set; } + + /// + /// Gets or sets defines the desired size of the pool. This can either be + /// 'fixedScale' where the requested targetDedicatedNodes is specified, or + /// 'autoScale' which defines a formula which is periodically reevaluated. If + /// this property is not specified, the pool will have a fixed scale with 0 + /// targetDedicatedNodes. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.scaleSettings")] + public ScaleSettings ScaleSettings {get; set; } + + /// + /// Gets or sets the network configuration for a pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.networkConfiguration")] + public NetworkConfiguration NetworkConfiguration {get; set; } + + /// + /// Gets or sets in an PATCH (update) operation, this property can be set to an + /// empty object to remove the start task from the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.startTask")] + public StartTask StartTask {get; set; } + + /// + /// Gets or sets the display name need not be unique and can contain any + /// Unicode characters up to a maximum length of 1024. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets this is the last time at which the pool level data, such as the + /// targetDedicatedNodes or autoScaleSettings, changed. It does not factor in + /// node-level changes such as a compute node changing state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lastModified")] + public System.DateTime? LastModified {get; private set; } + + /// + /// Gets the creation time of the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.creationTime")] + public System.DateTime? CreationTime {get; private set; } + + /// + /// Gets the current state of the pool. Possible values include: 'Succeeded', 'Deleting' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public PoolProvisioningState? ProvisioningState {get; private set; } + + /// + /// Gets the time at which the pool entered its current state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningStateTransitionTime")] + public System.DateTime? ProvisioningStateTransitionTime {get; private set; } + + /// + /// Gets the time at which the pool entered its current allocation state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.allocationStateTransitionTime")] + public System.DateTime? AllocationStateTransitionTime {get; private set; } + + /// + /// Gets or sets for information about available sizes of virtual machines for + /// Cloud Services pools (pools created with cloudServiceConfiguration), see + /// Sizes for Cloud Services + /// (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). + /// Batch supports all Cloud Services VM sizes except ExtraSmall. For + /// information about available VM sizes for pools using images from the + /// Virtual Machines Marketplace (pools created with + /// virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) + /// (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) + /// or Sizes for Virtual Machines (Windows) + /// (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). + /// Batch supports all Azure VM sizes except STANDARD_A0 and those with premium + /// storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.vmSize")] + public string VMSize {get; set; } + + /// + /// Gets the number of dedicated compute nodes currently in the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.currentDedicatedNodes")] + public int? CurrentDedicatedNodes {get; private set; } + + /// + /// Gets the number of Spot/low-priority compute nodes currently in the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.currentLowPriorityNodes")] + public int? CurrentLowPriorityNodes {get; private set; } + + /// + /// Gets this property is set only if the pool automatically scales, i.e. + /// autoScaleSettings are used. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.autoScaleRun")] + public AutoScaleRun AutoScaleRun {get; private set; } + + /// + /// Gets or sets this imposes restrictions on which nodes can be assigned to + /// the pool. Enabling this value can reduce the chance of the requested number + /// of nodes to be allocated in the pool. If not specified, this value defaults + /// to 'Disabled'. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.interNodeCommunication")] + public InterNodeCommunicationState? InterNodeCommunication {get; set; } + + /// + /// Gets or sets the default value is 1. The maximum value is the smaller of 4 + /// times the number of cores of the vmSize of the pool or 256. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.taskSlotsPerNode")] + public int? TaskSlotsPerNode {get; set; } + + /// + /// Gets or sets if not specified, the default is spread. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.taskSchedulingPolicy")] + public TaskSchedulingPolicy TaskSchedulingPolicy {get; set; } + + /// + /// Gets or sets the list of user accounts to be created on each node in the + /// pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userAccounts")] + public System.Collections.Generic.IList UserAccounts {get; set; } + + /// + /// Gets or sets the Batch service does not assign any meaning to metadata; it + /// is solely for the use of user code. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.metadata")] + public System.Collections.Generic.IList Metadata {get; set; } + + /// + /// Gets or sets for Windows compute nodes, the Batch service installs the + /// certificates to the specified certificate store and location. For Linux + /// compute nodes, the certificates are stored in a directory inside the task + /// working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is + /// supplied to the task to query for this location. For certificates with + /// visibility of 'remoteUser', a 'certs' directory is created in the user's + /// home directory (e.g., /home/{user-name}/certs) and certificates are placed + /// in that directory. + /// Warning: This property is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.certificates")] + public System.Collections.Generic.IList Certificates {get; set; } + + /// + /// Gets or sets changes to application package references affect all new + /// compute nodes joining the pool, but do not affect compute nodes that are + /// already in the pool until they are rebooted or reimaged. There is a maximum + /// of 10 application package references on any given pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.applicationPackages")] + public System.Collections.Generic.IList ApplicationPackages {get; set; } + + /// + /// Gets or sets the list of application licenses must be a subset of available + /// Batch service application licenses. If a license is requested which is not + /// supported, pool creation will fail. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.applicationLicenses")] + public System.Collections.Generic.IList ApplicationLicenses {get; set; } + + /// + /// Gets describes either the current operation (if the pool AllocationState is + /// Resizing) or the previously completed operation (if the AllocationState is + /// Steady). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resizeOperationStatus")] + public ResizeOperationStatus ResizeOperationStatus {get; private set; } + + /// + /// Gets or sets this supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.mountConfiguration")] + public System.Collections.Generic.IList MountConfiguration {get; set; } + + /// + /// Gets or sets if omitted, the default value is Default. Possible values include: 'Default', 'Classic', 'Simplified' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.targetNodeCommunicationMode")] + public NodeCommunicationMode? TargetNodeCommunicationMode {get; set; } + + /// + /// Gets determines how a pool communicates with the Batch service. Possible values include: 'Default', 'Classic', 'Simplified' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.currentNodeCommunicationMode")] + public NodeCommunicationMode? CurrentNodeCommunicationMode {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Identity != null) + { + this.Identity.Validate(); + } + + if (this.DeploymentConfiguration != null) + { + this.DeploymentConfiguration.Validate(); + } + if (this.ScaleSettings != null) + { + this.ScaleSettings.Validate(); + } + if (this.NetworkConfiguration != null) + { + this.NetworkConfiguration.Validate(); + } + if (this.StartTask != null) + { + this.StartTask.Validate(); + } + + + + if (this.AutoScaleRun != null) + { + this.AutoScaleRun.Validate(); + } + + if (this.TaskSchedulingPolicy != null) + { + this.TaskSchedulingPolicy.Validate(); + } + if (this.UserAccounts != null) + { + foreach (var element in this.UserAccounts) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.Metadata != null) + { + foreach (var element in this.Metadata) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.Certificates != null) + { + foreach (var element in this.Certificates) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.ApplicationPackages != null) + { + foreach (var element in this.ApplicationPackages) + { + if (element != null) + { + element.Validate(); + } + } + } + + + if (this.MountConfiguration != null) + { + foreach (var element in this.MountConfiguration) + { + if (element != null) + { + element.Validate(); + } + } + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolAllocationMode.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolAllocationMode.cs new file mode 100644 index 000000000000..b00dd64f1ef4 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolAllocationMode.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for PoolAllocationMode. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum PoolAllocationMode + { + /// + /// Pools will be allocated in subscriptions owned by the Batch service. + /// + [System.Runtime.Serialization.EnumMember(Value = "BatchService")] + BatchService, + /// + /// Pools will be allocated in a subscription owned by the user. + /// + [System.Runtime.Serialization.EnumMember(Value = "UserSubscription")] + UserSubscription + } + internal static class PoolAllocationModeEnumExtension + { + internal static string ToSerializedValue(this PoolAllocationMode? value) + { + return value == null ? null : ((PoolAllocationMode)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this PoolAllocationMode value) + { + switch( value ) + { + case PoolAllocationMode.BatchService: + return "BatchService"; + case PoolAllocationMode.UserSubscription: + return "UserSubscription"; + } + return null; + } + internal static PoolAllocationMode? ParsePoolAllocationMode(this string value) + { + switch( value ) + { + case "BatchService": + return PoolAllocationMode.BatchService; + case "UserSubscription": + return PoolAllocationMode.UserSubscription; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolCreateHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolCreateHeaders.cs new file mode 100644 index 000000000000..22334ee6361a --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolCreateHeaders.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class PoolCreateHeaders + { + /// + /// Initializes a new instance of the PoolCreateHeaders class. + /// + public PoolCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PoolCreateHeaders class. + /// + + /// + /// + public PoolCreateHeaders(string eTag = default(string)) + + { + this.ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ETag")] + public string ETag {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolDeleteHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolDeleteHeaders.cs new file mode 100644 index 000000000000..b466512a7582 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolDeleteHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class PoolDeleteHeaders + { + /// + /// Initializes a new instance of the PoolDeleteHeaders class. + /// + public PoolDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PoolDeleteHeaders class. + /// + + /// + /// + + /// + /// + public PoolDeleteHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolDisableAutoScaleHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolDisableAutoScaleHeaders.cs new file mode 100644 index 000000000000..f516cc5aa063 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolDisableAutoScaleHeaders.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class PoolDisableAutoScaleHeaders + { + /// + /// Initializes a new instance of the PoolDisableAutoScaleHeaders class. + /// + public PoolDisableAutoScaleHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PoolDisableAutoScaleHeaders class. + /// + + /// + /// + public PoolDisableAutoScaleHeaders(string eTag = default(string)) + + { + this.ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ETag")] + public string ETag {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolEndpointConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolEndpointConfiguration.cs new file mode 100644 index 000000000000..a1aaeb977158 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolEndpointConfiguration.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The endpoint configuration for a pool. + /// + /// + /// The endpoint configuration for a pool. + /// + public partial class PoolEndpointConfiguration + { + /// + /// Initializes a new instance of the PoolEndpointConfiguration class. + /// + public PoolEndpointConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PoolEndpointConfiguration class. + /// + + /// The maximum number of inbound NAT pools per Batch pool is 5. If the maximum + /// number of inbound NAT pools is exceeded the request fails with HTTP status + /// code 400. This cannot be specified if the IPAddressProvisioningType is + /// NoPublicIPAddresses. + /// + public PoolEndpointConfiguration(System.Collections.Generic.IList inboundNatPools) + + { + this.InboundNatPools = inboundNatPools; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the maximum number of inbound NAT pools per Batch pool is 5. + /// If the maximum number of inbound NAT pools is exceeded the request fails + /// with HTTP status code 400. This cannot be specified if the + /// IPAddressProvisioningType is NoPublicIPAddresses. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "inboundNatPools")] + public System.Collections.Generic.IList InboundNatPools {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.InboundNatPools == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "InboundNatPools"); + } + if (this.InboundNatPools != null) + { + foreach (var element in this.InboundNatPools) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolGetHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolGetHeaders.cs new file mode 100644 index 000000000000..7bab8311d7c3 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolGetHeaders.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class PoolGetHeaders + { + /// + /// Initializes a new instance of the PoolGetHeaders class. + /// + public PoolGetHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PoolGetHeaders class. + /// + + /// + /// + public PoolGetHeaders(string eTag = default(string)) + + { + this.ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ETag")] + public string ETag {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolIdentityType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolIdentityType.cs new file mode 100644 index 000000000000..75bef4a15ec5 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolIdentityType.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for PoolIdentityType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum PoolIdentityType + { + /// + /// Batch pool has user assigned identities with it. + /// + [System.Runtime.Serialization.EnumMember(Value = "UserAssigned")] + UserAssigned, + /// + /// Batch pool has no identity associated with it. Setting `None` in update + /// pool will remove existing identities. + /// + [System.Runtime.Serialization.EnumMember(Value = "None")] + None + } + internal static class PoolIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this PoolIdentityType? value) + { + return value == null ? null : ((PoolIdentityType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this PoolIdentityType value) + { + switch( value ) + { + case PoolIdentityType.UserAssigned: + return "UserAssigned"; + case PoolIdentityType.None: + return "None"; + } + return null; + } + internal static PoolIdentityType? ParsePoolIdentityType(this string value) + { + switch( value ) + { + case "UserAssigned": + return PoolIdentityType.UserAssigned; + case "None": + return PoolIdentityType.None; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolProperties.cs new file mode 100644 index 000000000000..ca5e18f1baa5 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolProperties.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Pool properties. + /// + public partial class PoolProperties + { + /// + /// Initializes a new instance of the PoolProperties class. + /// + public PoolProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PoolProperties class. + /// + + /// The display name need not be unique and can contain any Unicode characters + /// up to a maximum length of 1024. + /// + + /// This is the last time at which the pool level data, such as the + /// targetDedicatedNodes or autoScaleSettings, changed. It does not factor in + /// node-level changes such as a compute node changing state. + /// + + /// The creation time of the pool. + /// + + /// The current state of the pool. + /// Possible values include: 'Succeeded', 'Deleting' + + /// The time at which the pool entered its current state. + /// + + /// Whether the pool is resizing. + /// Possible values include: 'Steady', 'Resizing', 'Stopping' + + /// The time at which the pool entered its current allocation state. + /// + + /// For information about available sizes of virtual machines for Cloud + /// Services pools (pools created with cloudServiceConfiguration), see Sizes + /// for Cloud Services + /// (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). + /// Batch supports all Cloud Services VM sizes except ExtraSmall. For + /// information about available VM sizes for pools using images from the + /// Virtual Machines Marketplace (pools created with + /// virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) + /// (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) + /// or Sizes for Virtual Machines (Windows) + /// (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). + /// Batch supports all Azure VM sizes except STANDARD_A0 and those with premium + /// storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + /// + + /// Using CloudServiceConfiguration specifies that the nodes should be creating + /// using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses + /// Azure Virtual Machines (IaaS). + /// + + /// The number of dedicated compute nodes currently in the pool. + /// + + /// The number of Spot/low-priority compute nodes currently in the pool. + /// + + /// Defines the desired size of the pool. This can either be 'fixedScale' where + /// the requested targetDedicatedNodes is specified, or 'autoScale' which + /// defines a formula which is periodically reevaluated. If this property is + /// not specified, the pool will have a fixed scale with 0 + /// targetDedicatedNodes. + /// + + /// This property is set only if the pool automatically scales, i.e. + /// autoScaleSettings are used. + /// + + /// This imposes restrictions on which nodes can be assigned to the pool. + /// Enabling this value can reduce the chance of the requested number of nodes + /// to be allocated in the pool. If not specified, this value defaults to + /// 'Disabled'. + /// Possible values include: 'Enabled', 'Disabled' + + /// The network configuration for a pool. + /// + + /// The default value is 1. The maximum value is the smaller of 4 times the + /// number of cores of the vmSize of the pool or 256. + /// + + /// If not specified, the default is spread. + /// + + /// The list of user accounts to be created on each node in the pool. + /// + + /// The Batch service does not assign any meaning to metadata; it is solely for + /// the use of user code. + /// + + /// In an PATCH (update) operation, this property can be set to an empty object + /// to remove the start task from the pool. + /// + + /// For Windows compute nodes, the Batch service installs the certificates to + /// the specified certificate store and location. For Linux compute nodes, the + /// certificates are stored in a directory inside the task working directory + /// and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the + /// task to query for this location. For certificates with visibility of + /// 'remoteUser', a 'certs' directory is created in the user's home directory + /// (e.g., /home/{user-name}/certs) and certificates are placed in that + /// directory. + /// Warning: This property is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + + /// Changes to application package references affect all new compute nodes + /// joining the pool, but do not affect compute nodes that are already in the + /// pool until they are rebooted or reimaged. There is a maximum of 10 + /// application package references on any given pool. + /// + + /// The list of application licenses must be a subset of available Batch + /// service application licenses. If a license is requested which is not + /// supported, pool creation will fail. + /// + + /// Describes either the current operation (if the pool AllocationState is + /// Resizing) or the previously completed operation (if the AllocationState is + /// Steady). + /// + + /// This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + /// + + /// If omitted, the default value is Default. + /// Possible values include: 'Default', 'Classic', 'Simplified' + + /// Determines how a pool communicates with the Batch service. + /// Possible values include: 'Default', 'Classic', 'Simplified' + public PoolProperties(string displayName = default(string), System.DateTime? lastModified = default(System.DateTime?), System.DateTime? creationTime = default(System.DateTime?), PoolProvisioningState? provisioningState = default(PoolProvisioningState?), System.DateTime? provisioningStateTransitionTime = default(System.DateTime?), AllocationState? allocationState = default(AllocationState?), System.DateTime? allocationStateTransitionTime = default(System.DateTime?), string vmSize = default(string), DeploymentConfiguration deploymentConfiguration = default(DeploymentConfiguration), int? currentDedicatedNodes = default(int?), int? currentLowPriorityNodes = default(int?), ScaleSettings scaleSettings = default(ScaleSettings), AutoScaleRun autoScaleRun = default(AutoScaleRun), InterNodeCommunicationState? interNodeCommunication = default(InterNodeCommunicationState?), NetworkConfiguration networkConfiguration = default(NetworkConfiguration), int? taskSlotsPerNode = default(int?), TaskSchedulingPolicy taskSchedulingPolicy = default(TaskSchedulingPolicy), System.Collections.Generic.IList userAccounts = default(System.Collections.Generic.IList), System.Collections.Generic.IList metadata = default(System.Collections.Generic.IList), StartTask startTask = default(StartTask), System.Collections.Generic.IList certificates = default(System.Collections.Generic.IList), System.Collections.Generic.IList applicationPackages = default(System.Collections.Generic.IList), System.Collections.Generic.IList applicationLicenses = default(System.Collections.Generic.IList), ResizeOperationStatus resizeOperationStatus = default(ResizeOperationStatus), System.Collections.Generic.IList mountConfiguration = default(System.Collections.Generic.IList), NodeCommunicationMode? targetNodeCommunicationMode = default(NodeCommunicationMode?), NodeCommunicationMode? currentNodeCommunicationMode = default(NodeCommunicationMode?)) + + { + this.DisplayName = displayName; + this.LastModified = lastModified; + this.CreationTime = creationTime; + this.ProvisioningState = provisioningState; + this.ProvisioningStateTransitionTime = provisioningStateTransitionTime; + this.AllocationState = allocationState; + this.AllocationStateTransitionTime = allocationStateTransitionTime; + this.VMSize = vmSize; + this.DeploymentConfiguration = deploymentConfiguration; + this.CurrentDedicatedNodes = currentDedicatedNodes; + this.CurrentLowPriorityNodes = currentLowPriorityNodes; + this.ScaleSettings = scaleSettings; + this.AutoScaleRun = autoScaleRun; + this.InterNodeCommunication = interNodeCommunication; + this.NetworkConfiguration = networkConfiguration; + this.TaskSlotsPerNode = taskSlotsPerNode; + this.TaskSchedulingPolicy = taskSchedulingPolicy; + this.UserAccounts = userAccounts; + this.Metadata = metadata; + this.StartTask = startTask; + this.Certificates = certificates; + this.ApplicationPackages = applicationPackages; + this.ApplicationLicenses = applicationLicenses; + this.ResizeOperationStatus = resizeOperationStatus; + this.MountConfiguration = mountConfiguration; + this.TargetNodeCommunicationMode = targetNodeCommunicationMode; + this.CurrentNodeCommunicationMode = currentNodeCommunicationMode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the display name need not be unique and can contain any + /// Unicode characters up to a maximum length of 1024. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets this is the last time at which the pool level data, such as the + /// targetDedicatedNodes or autoScaleSettings, changed. It does not factor in + /// node-level changes such as a compute node changing state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastModified")] + public System.DateTime? LastModified {get; private set; } + + /// + /// Gets the creation time of the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "creationTime")] + public System.DateTime? CreationTime {get; private set; } + + /// + /// Gets the current state of the pool. Possible values include: 'Succeeded', 'Deleting' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public PoolProvisioningState? ProvisioningState {get; private set; } + + /// + /// Gets the time at which the pool entered its current state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningStateTransitionTime")] + public System.DateTime? ProvisioningStateTransitionTime {get; private set; } + + /// + /// Gets whether the pool is resizing. Possible values include: 'Steady', 'Resizing', 'Stopping' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allocationState")] + public AllocationState? AllocationState {get; private set; } + + /// + /// Gets the time at which the pool entered its current allocation state. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "allocationStateTransitionTime")] + public System.DateTime? AllocationStateTransitionTime {get; private set; } + + /// + /// Gets or sets for information about available sizes of virtual machines for + /// Cloud Services pools (pools created with cloudServiceConfiguration), see + /// Sizes for Cloud Services + /// (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). + /// Batch supports all Cloud Services VM sizes except ExtraSmall. For + /// information about available VM sizes for pools using images from the + /// Virtual Machines Marketplace (pools created with + /// virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) + /// (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) + /// or Sizes for Virtual Machines (Windows) + /// (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). + /// Batch supports all Azure VM sizes except STANDARD_A0 and those with premium + /// storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "vmSize")] + public string VMSize {get; set; } + + /// + /// Gets or sets using CloudServiceConfiguration specifies that the nodes + /// should be creating using Azure Cloud Services (PaaS), while + /// VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "deploymentConfiguration")] + public DeploymentConfiguration DeploymentConfiguration {get; set; } + + /// + /// Gets the number of dedicated compute nodes currently in the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "currentDedicatedNodes")] + public int? CurrentDedicatedNodes {get; private set; } + + /// + /// Gets the number of Spot/low-priority compute nodes currently in the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "currentLowPriorityNodes")] + public int? CurrentLowPriorityNodes {get; private set; } + + /// + /// Gets or sets defines the desired size of the pool. This can either be + /// 'fixedScale' where the requested targetDedicatedNodes is specified, or + /// 'autoScale' which defines a formula which is periodically reevaluated. If + /// this property is not specified, the pool will have a fixed scale with 0 + /// targetDedicatedNodes. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "scaleSettings")] + public ScaleSettings ScaleSettings {get; set; } + + /// + /// Gets this property is set only if the pool automatically scales, i.e. + /// autoScaleSettings are used. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoScaleRun")] + public AutoScaleRun AutoScaleRun {get; private set; } + + /// + /// Gets or sets this imposes restrictions on which nodes can be assigned to + /// the pool. Enabling this value can reduce the chance of the requested number + /// of nodes to be allocated in the pool. If not specified, this value defaults + /// to 'Disabled'. Possible values include: 'Enabled', 'Disabled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "interNodeCommunication")] + public InterNodeCommunicationState? InterNodeCommunication {get; set; } + + /// + /// Gets or sets the network configuration for a pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "networkConfiguration")] + public NetworkConfiguration NetworkConfiguration {get; set; } + + /// + /// Gets or sets the default value is 1. The maximum value is the smaller of 4 + /// times the number of cores of the vmSize of the pool or 256. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "taskSlotsPerNode")] + public int? TaskSlotsPerNode {get; set; } + + /// + /// Gets or sets if not specified, the default is spread. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "taskSchedulingPolicy")] + public TaskSchedulingPolicy TaskSchedulingPolicy {get; set; } + + /// + /// Gets or sets the list of user accounts to be created on each node in the + /// pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userAccounts")] + public System.Collections.Generic.IList UserAccounts {get; set; } + + /// + /// Gets or sets the Batch service does not assign any meaning to metadata; it + /// is solely for the use of user code. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "metadata")] + public System.Collections.Generic.IList Metadata {get; set; } + + /// + /// Gets or sets in an PATCH (update) operation, this property can be set to an + /// empty object to remove the start task from the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "startTask")] + public StartTask StartTask {get; set; } + + /// + /// Gets or sets for Windows compute nodes, the Batch service installs the + /// certificates to the specified certificate store and location. For Linux + /// compute nodes, the certificates are stored in a directory inside the task + /// working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is + /// supplied to the task to query for this location. For certificates with + /// visibility of 'remoteUser', a 'certs' directory is created in the user's + /// home directory (e.g., /home/{user-name}/certs) and certificates are placed + /// in that directory. + /// Warning: This property is deprecated and will be removed after February, + /// 2024. Please use the [Azure KeyVault + /// Extension](https://learn.microsoft.com/azure/batch/batch-certificate-migration-guide) + /// instead. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "certificates")] + public System.Collections.Generic.IList Certificates {get; set; } + + /// + /// Gets or sets changes to application package references affect all new + /// compute nodes joining the pool, but do not affect compute nodes that are + /// already in the pool until they are rebooted or reimaged. There is a maximum + /// of 10 application package references on any given pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "applicationPackages")] + public System.Collections.Generic.IList ApplicationPackages {get; set; } + + /// + /// Gets or sets the list of application licenses must be a subset of available + /// Batch service application licenses. If a license is requested which is not + /// supported, pool creation will fail. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "applicationLicenses")] + public System.Collections.Generic.IList ApplicationLicenses {get; set; } + + /// + /// Gets describes either the current operation (if the pool AllocationState is + /// Resizing) or the previously completed operation (if the AllocationState is + /// Steady). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resizeOperationStatus")] + public ResizeOperationStatus ResizeOperationStatus {get; private set; } + + /// + /// Gets or sets this supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "mountConfiguration")] + public System.Collections.Generic.IList MountConfiguration {get; set; } + + /// + /// Gets or sets if omitted, the default value is Default. Possible values include: 'Default', 'Classic', 'Simplified' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetNodeCommunicationMode")] + public NodeCommunicationMode? TargetNodeCommunicationMode {get; set; } + + /// + /// Gets determines how a pool communicates with the Batch service. Possible values include: 'Default', 'Classic', 'Simplified' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "currentNodeCommunicationMode")] + public NodeCommunicationMode? CurrentNodeCommunicationMode {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + + if (this.DeploymentConfiguration != null) + { + this.DeploymentConfiguration.Validate(); + } + if (this.ScaleSettings != null) + { + this.ScaleSettings.Validate(); + } + if (this.AutoScaleRun != null) + { + this.AutoScaleRun.Validate(); + } + + if (this.NetworkConfiguration != null) + { + this.NetworkConfiguration.Validate(); + } + if (this.TaskSchedulingPolicy != null) + { + this.TaskSchedulingPolicy.Validate(); + } + if (this.UserAccounts != null) + { + foreach (var element in this.UserAccounts) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.Metadata != null) + { + foreach (var element in this.Metadata) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.StartTask != null) + { + this.StartTask.Validate(); + } + if (this.Certificates != null) + { + foreach (var element in this.Certificates) + { + if (element != null) + { + element.Validate(); + } + } + } + if (this.ApplicationPackages != null) + { + foreach (var element in this.ApplicationPackages) + { + if (element != null) + { + element.Validate(); + } + } + } + + + if (this.MountConfiguration != null) + { + foreach (var element in this.MountConfiguration) + { + if (element != null) + { + element.Validate(); + } + } + } + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolProvisioningState.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolProvisioningState.cs new file mode 100644 index 000000000000..32e5cfbfbbec --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolProvisioningState.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for PoolProvisioningState. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum PoolProvisioningState + { + /// + /// The pool is available to run tasks subject to the availability of compute + /// nodes. + /// + [System.Runtime.Serialization.EnumMember(Value = "Succeeded")] + Succeeded, + /// + /// The user has requested that the pool be deleted, but the delete operation + /// has not yet completed. + /// + [System.Runtime.Serialization.EnumMember(Value = "Deleting")] + Deleting + } + internal static class PoolProvisioningStateEnumExtension + { + internal static string ToSerializedValue(this PoolProvisioningState? value) + { + return value == null ? null : ((PoolProvisioningState)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this PoolProvisioningState value) + { + switch( value ) + { + case PoolProvisioningState.Succeeded: + return "Succeeded"; + case PoolProvisioningState.Deleting: + return "Deleting"; + } + return null; + } + internal static PoolProvisioningState? ParsePoolProvisioningState(this string value) + { + switch( value ) + { + case "Succeeded": + return PoolProvisioningState.Succeeded; + case "Deleting": + return PoolProvisioningState.Deleting; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolStopResizeHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolStopResizeHeaders.cs new file mode 100644 index 000000000000..3d0a5667517c --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolStopResizeHeaders.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class PoolStopResizeHeaders + { + /// + /// Initializes a new instance of the PoolStopResizeHeaders class. + /// + public PoolStopResizeHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PoolStopResizeHeaders class. + /// + + /// + /// + public PoolStopResizeHeaders(string eTag = default(string)) + + { + this.ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ETag")] + public string ETag {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PoolUpdateHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolUpdateHeaders.cs new file mode 100644 index 000000000000..d0326c975b07 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PoolUpdateHeaders.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class PoolUpdateHeaders + { + /// + /// Initializes a new instance of the PoolUpdateHeaders class. + /// + public PoolUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PoolUpdateHeaders class. + /// + + /// + /// + public PoolUpdateHeaders(string eTag = default(string)) + + { + this.ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ETag")] + public string ETag {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpoint.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 000000000000..a8129d9eac25 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpoint.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The private endpoint of the private endpoint connection. + /// + public partial class PrivateEndpoint + { + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + public PrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + + /// The ARM resource identifier of the private endpoint. This is of the form + /// /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/privateEndpoints/{privateEndpoint}. + /// + public PrivateEndpoint(string id = default(string)) + + { + this.Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the ARM resource identifier of the private endpoint. This is of the + /// form + /// /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/privateEndpoints/{privateEndpoint}. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..4d64a0b175fd --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Contains information about a private link resource. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class PrivateEndpointConnection : ProxyResource + { + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + public PrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The ETag of the resource, used for concurrency statements. + /// + + /// The private endpoint of the private endpoint connection. + /// + + /// The provisioning state of the private endpoint connection. + /// Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + /// 'Failed', 'Cancelled' + + /// The value has one and only one group id. + /// + + /// The private link service connection state of the private endpoint + /// connection + /// + public PrivateEndpointConnection(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), PrivateEndpointConnectionProvisioningState provisioningState = default(PrivateEndpointConnectionProvisioningState), System.Collections.Generic.IList groupIds = default(System.Collections.Generic.IList), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState)) + + : base(id, name, type, etag) + { + this.PrivateEndpoint = privateEndpoint; + this.ProvisioningState = provisioningState; + this.GroupIds = groupIds; + this.PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the private endpoint of the private endpoint connection. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.privateEndpoint")] + public PrivateEndpoint PrivateEndpoint {get; private set; } + + /// + /// Gets the provisioning state of the private endpoint connection. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Cancelled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public PrivateEndpointConnectionProvisioningState ProvisioningState {get; private set; } + + /// + /// Gets the value has one and only one group id. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.groupIds")] + public System.Collections.Generic.IList GroupIds {get; private set; } + + /// + /// Gets or sets the private link service connection state of the private + /// endpoint connection + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + if (this.PrivateLinkServiceConnectionState != null) + { + this.PrivateLinkServiceConnectionState.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionDeleteHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionDeleteHeaders.cs new file mode 100644 index 000000000000..d9d2f51cddb6 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionDeleteHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class PrivateEndpointConnectionDeleteHeaders + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionDeleteHeaders class. + /// + public PrivateEndpointConnectionDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnectionDeleteHeaders class. + /// + + /// + /// + + /// + /// + public PrivateEndpointConnectionDeleteHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionProperties.cs new file mode 100644 index 000000000000..0f049a75b7b6 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Private endpoint connection properties. + /// + public partial class PrivateEndpointConnectionProperties + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionProperties class. + /// + public PrivateEndpointConnectionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnectionProperties class. + /// + + /// The provisioning state of the private endpoint connection. + /// Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', + /// 'Failed', 'Cancelled' + + /// The private endpoint of the private endpoint connection. + /// + + /// The value has one and only one group id. + /// + + /// The private link service connection state of the private endpoint + /// connection + /// + public PrivateEndpointConnectionProperties(PrivateEndpointConnectionProvisioningState provisioningState = default(PrivateEndpointConnectionProvisioningState), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), System.Collections.Generic.IList groupIds = default(System.Collections.Generic.IList), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState)) + + { + this.ProvisioningState = provisioningState; + this.PrivateEndpoint = privateEndpoint; + this.GroupIds = groupIds; + this.PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the provisioning state of the private endpoint connection. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Cancelled' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public PrivateEndpointConnectionProvisioningState ProvisioningState {get; private set; } + + /// + /// Gets the private endpoint of the private endpoint connection. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "privateEndpoint")] + public PrivateEndpoint PrivateEndpoint {get; private set; } + + /// + /// Gets the value has one and only one group id. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "groupIds")] + public System.Collections.Generic.IList GroupIds {get; private set; } + + /// + /// Gets or sets the private link service connection state of the private + /// endpoint connection + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + if (this.PrivateLinkServiceConnectionState != null) + { + this.PrivateLinkServiceConnectionState.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionProvisioningState.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 000000000000..5f74012779c9 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionProvisioningState.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for PrivateEndpointConnectionProvisioningState. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum PrivateEndpointConnectionProvisioningState + { + /// + /// The connection is creating. + /// + [System.Runtime.Serialization.EnumMember(Value = "Creating")] + Creating, + /// + /// The user has requested that the connection status be updated, but the + /// update operation has not yet completed. You may not reference the + /// connection when connecting the Batch account. + /// + [System.Runtime.Serialization.EnumMember(Value = "Updating")] + Updating, + /// + /// The connection is deleting. + /// + [System.Runtime.Serialization.EnumMember(Value = "Deleting")] + Deleting, + /// + /// The connection status is final and is ready for use if Status is Approved. + /// + [System.Runtime.Serialization.EnumMember(Value = "Succeeded")] + Succeeded, + /// + /// The user requested that the connection be updated and it failed. You may + /// retry the update operation. + /// + [System.Runtime.Serialization.EnumMember(Value = "Failed")] + Failed, + /// + /// The user has cancelled the connection creation. + /// + [System.Runtime.Serialization.EnumMember(Value = "Cancelled")] + Cancelled + } + internal static class PrivateEndpointConnectionProvisioningStateEnumExtension + { + internal static string ToSerializedValue(this PrivateEndpointConnectionProvisioningState? value) + { + return value == null ? null : ((PrivateEndpointConnectionProvisioningState)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this PrivateEndpointConnectionProvisioningState value) + { + switch( value ) + { + case PrivateEndpointConnectionProvisioningState.Creating: + return "Creating"; + case PrivateEndpointConnectionProvisioningState.Updating: + return "Updating"; + case PrivateEndpointConnectionProvisioningState.Deleting: + return "Deleting"; + case PrivateEndpointConnectionProvisioningState.Succeeded: + return "Succeeded"; + case PrivateEndpointConnectionProvisioningState.Failed: + return "Failed"; + case PrivateEndpointConnectionProvisioningState.Cancelled: + return "Cancelled"; + } + return null; + } + internal static PrivateEndpointConnectionProvisioningState? ParsePrivateEndpointConnectionProvisioningState(this string value) + { + switch( value ) + { + case "Creating": + return PrivateEndpointConnectionProvisioningState.Creating; + case "Updating": + return PrivateEndpointConnectionProvisioningState.Updating; + case "Deleting": + return PrivateEndpointConnectionProvisioningState.Deleting; + case "Succeeded": + return PrivateEndpointConnectionProvisioningState.Succeeded; + case "Failed": + return PrivateEndpointConnectionProvisioningState.Failed; + case "Cancelled": + return PrivateEndpointConnectionProvisioningState.Cancelled; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionUpdateHeaders.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionUpdateHeaders.cs new file mode 100644 index 000000000000..e919628803bb --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateEndpointConnectionUpdateHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + public partial class PrivateEndpointConnectionUpdateHeaders + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionUpdateHeaders class. + /// + public PrivateEndpointConnectionUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnectionUpdateHeaders class. + /// + + /// + /// + + /// + /// + public PrivateEndpointConnectionUpdateHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkResource.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 000000000000..d4a5fd1a64fc --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Contains information about a private link resource. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class PrivateLinkResource : ProxyResource + { + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + public PrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The ETag of the resource, used for concurrency statements. + /// + + /// The group id is used to establish the private link connection. + /// + + /// The list of required members that are used to establish the private link + /// connection. + /// + + /// The list of required zone names for the private DNS resource name + /// + public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string groupId = default(string), System.Collections.Generic.IList requiredMembers = default(System.Collections.Generic.IList), System.Collections.Generic.IList requiredZoneNames = default(System.Collections.Generic.IList)) + + : base(id, name, type, etag) + { + this.GroupId = groupId; + this.RequiredMembers = requiredMembers; + this.RequiredZoneNames = requiredZoneNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the group id is used to establish the private link connection. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.groupId")] + public string GroupId {get; private set; } + + /// + /// Gets the list of required members that are used to establish the private + /// link connection. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.requiredMembers")] + public System.Collections.Generic.IList RequiredMembers {get; private set; } + + /// + /// Gets the list of required zone names for the private DNS resource name + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.requiredZoneNames")] + public System.Collections.Generic.IList RequiredZoneNames {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkResourceProperties.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..f1558ac0db50 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkResourceProperties.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Private link resource properties. + /// + public partial class PrivateLinkResourceProperties + { + /// + /// Initializes a new instance of the PrivateLinkResourceProperties class. + /// + public PrivateLinkResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceProperties class. + /// + + /// The group id is used to establish the private link connection. + /// + + /// The list of required members that are used to establish the private link + /// connection. + /// + + /// The list of required zone names for the private DNS resource name + /// + public PrivateLinkResourceProperties(string groupId = default(string), System.Collections.Generic.IList requiredMembers = default(System.Collections.Generic.IList), System.Collections.Generic.IList requiredZoneNames = default(System.Collections.Generic.IList)) + + { + this.GroupId = groupId; + this.RequiredMembers = requiredMembers; + this.RequiredZoneNames = requiredZoneNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the group id is used to establish the private link connection. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "groupId")] + public string GroupId {get; private set; } + + /// + /// Gets the list of required members that are used to establish the private + /// link connection. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "requiredMembers")] + public System.Collections.Generic.IList RequiredMembers {get; private set; } + + /// + /// Gets the list of required zone names for the private DNS resource name + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "requiredZoneNames")] + public System.Collections.Generic.IList RequiredZoneNames {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionState.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..ff15fbcfe401 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionState.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The private link service connection state of the private endpoint + /// connection + /// + public partial class PrivateLinkServiceConnectionState + { + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState class. + /// + public PrivateLinkServiceConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState class. + /// + + /// The status of the Batch private endpoint connection + /// Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' + + /// Description of the private Connection state + /// + + /// Action required on the private connection state + /// + public PrivateLinkServiceConnectionState(PrivateLinkServiceConnectionStatus status, string description = default(string), string actionsRequired = default(string)) + + { + this.Status = status; + this.Description = description; + this.ActionsRequired = actionsRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the status of the Batch private endpoint connection Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public PrivateLinkServiceConnectionStatus Status {get; set; } + + /// + /// Gets or sets description of the private Connection state + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets action required on the private connection state + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStatus.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStatus.cs new file mode 100644 index 000000000000..2db32135b4de --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PrivateLinkServiceConnectionStatus.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for PrivateLinkServiceConnectionStatus. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum PrivateLinkServiceConnectionStatus + { + /// + /// The private endpoint connection is approved and can be used to access Batch + /// account + /// + [System.Runtime.Serialization.EnumMember(Value = "Approved")] + Approved, + /// + /// The private endpoint connection is pending and cannot be used to access + /// Batch account + /// + [System.Runtime.Serialization.EnumMember(Value = "Pending")] + Pending, + /// + /// The private endpoint connection is rejected and cannot be used to access + /// Batch account + /// + [System.Runtime.Serialization.EnumMember(Value = "Rejected")] + Rejected, + /// + /// The private endpoint connection is disconnected and cannot be used to + /// access Batch account + /// + [System.Runtime.Serialization.EnumMember(Value = "Disconnected")] + Disconnected + } + internal static class PrivateLinkServiceConnectionStatusEnumExtension + { + internal static string ToSerializedValue(this PrivateLinkServiceConnectionStatus? value) + { + return value == null ? null : ((PrivateLinkServiceConnectionStatus)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this PrivateLinkServiceConnectionStatus value) + { + switch( value ) + { + case PrivateLinkServiceConnectionStatus.Approved: + return "Approved"; + case PrivateLinkServiceConnectionStatus.Pending: + return "Pending"; + case PrivateLinkServiceConnectionStatus.Rejected: + return "Rejected"; + case PrivateLinkServiceConnectionStatus.Disconnected: + return "Disconnected"; + } + return null; + } + internal static PrivateLinkServiceConnectionStatus? ParsePrivateLinkServiceConnectionStatus(this string value) + { + switch( value ) + { + case "Approved": + return PrivateLinkServiceConnectionStatus.Approved; + case "Pending": + return PrivateLinkServiceConnectionStatus.Pending; + case "Rejected": + return PrivateLinkServiceConnectionStatus.Rejected; + case "Disconnected": + return PrivateLinkServiceConnectionStatus.Disconnected; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ProvisioningState.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..5a72ad70837d --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ProvisioningState.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum ProvisioningState + { + /// + /// The account is in an invalid state. + /// + [System.Runtime.Serialization.EnumMember(Value = "Invalid")] + Invalid, + /// + /// The account is being created. + /// + [System.Runtime.Serialization.EnumMember(Value = "Creating")] + Creating, + /// + /// The account is being deleted. + /// + [System.Runtime.Serialization.EnumMember(Value = "Deleting")] + Deleting, + /// + /// The account has been created and is ready for use. + /// + [System.Runtime.Serialization.EnumMember(Value = "Succeeded")] + Succeeded, + /// + /// The last operation for the account is failed. + /// + [System.Runtime.Serialization.EnumMember(Value = "Failed")] + Failed, + /// + /// The last operation for the account is cancelled. + /// + [System.Runtime.Serialization.EnumMember(Value = "Cancelled")] + Cancelled + } + internal static class ProvisioningStateEnumExtension + { + internal static string ToSerializedValue(this ProvisioningState? value) + { + return value == null ? null : ((ProvisioningState)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this ProvisioningState value) + { + switch( value ) + { + case ProvisioningState.Invalid: + return "Invalid"; + case ProvisioningState.Creating: + return "Creating"; + case ProvisioningState.Deleting: + return "Deleting"; + case ProvisioningState.Succeeded: + return "Succeeded"; + case ProvisioningState.Failed: + return "Failed"; + case ProvisioningState.Cancelled: + return "Cancelled"; + } + return null; + } + internal static ProvisioningState? ParseProvisioningState(this string value) + { + switch( value ) + { + case "Invalid": + return ProvisioningState.Invalid; + case "Creating": + return ProvisioningState.Creating; + case "Deleting": + return ProvisioningState.Deleting; + case "Succeeded": + return ProvisioningState.Succeeded; + case "Failed": + return ProvisioningState.Failed; + case "Cancelled": + return ProvisioningState.Cancelled; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ProxyResource.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..e7f09870da88 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ProxyResource.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A definition of an Azure resource. + /// + public partial class ProxyResource : Microsoft.Rest.Azure.IResource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The ETag of the resource, used for concurrency statements. + /// + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + + { + this.Id = id; + this.Name = name; + this.Type = type; + this.Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the ID of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } + + /// + /// Gets the name of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + + /// + /// Gets the type of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } + + /// + /// Gets the ETag of the resource, used for concurrency statements. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "etag")] + public string Etag {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PublicIPAddressConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PublicIPAddressConfiguration.cs new file mode 100644 index 000000000000..254718ca3823 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PublicIPAddressConfiguration.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The public IP Address configuration of the networking configuration of a + /// Pool. + /// + public partial class PublicIPAddressConfiguration + { + /// + /// Initializes a new instance of the PublicIPAddressConfiguration class. + /// + public PublicIPAddressConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PublicIPAddressConfiguration class. + /// + + /// The default value is BatchManaged + /// Possible values include: 'BatchManaged', 'UserManaged', + /// 'NoPublicIPAddresses' + + /// The number of IPs specified here limits the maximum size of the Pool - 100 + /// dedicated nodes or 100 Spot/low-priority nodes can be allocated for each + /// public IP. For example, a pool needing 250 dedicated VMs would need at + /// least 3 public IPs specified. Each element of this collection is of the + /// form: + /// /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. + /// + public PublicIPAddressConfiguration(IPAddressProvisioningType? provision = default(IPAddressProvisioningType?), System.Collections.Generic.IList ipAddressIds = default(System.Collections.Generic.IList)) + + { + this.Provision = provision; + this.IPAddressIds = ipAddressIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the default value is BatchManaged Possible values include: 'BatchManaged', 'UserManaged', 'NoPublicIPAddresses' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provision")] + public IPAddressProvisioningType? Provision {get; set; } + + /// + /// Gets or sets the number of IPs specified here limits the maximum size of + /// the Pool - 100 dedicated nodes or 100 Spot/low-priority nodes can be + /// allocated for each public IP. For example, a pool needing 250 dedicated VMs + /// would need at least 3 public IPs specified. Each element of this collection + /// is of the form: + /// /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "ipAddressIds")] + public System.Collections.Generic.IList IPAddressIds {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/PublicNetworkAccessType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/PublicNetworkAccessType.cs new file mode 100644 index 000000000000..b5ad2a4843e6 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/PublicNetworkAccessType.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for PublicNetworkAccessType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum PublicNetworkAccessType + { + /// + /// Enables connectivity to Azure Batch through public DNS. + /// + [System.Runtime.Serialization.EnumMember(Value = "Enabled")] + Enabled, + /// + /// Disables public connectivity and enables private connectivity to Azure + /// Batch Service through private endpoint resource. + /// + [System.Runtime.Serialization.EnumMember(Value = "Disabled")] + Disabled + } + internal static class PublicNetworkAccessTypeEnumExtension + { + internal static string ToSerializedValue(this PublicNetworkAccessType? value) + { + return value == null ? null : ((PublicNetworkAccessType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this PublicNetworkAccessType value) + { + switch( value ) + { + case PublicNetworkAccessType.Enabled: + return "Enabled"; + case PublicNetworkAccessType.Disabled: + return "Disabled"; + } + return null; + } + internal static PublicNetworkAccessType? ParsePublicNetworkAccessType(this string value) + { + switch( value ) + { + case "Enabled": + return PublicNetworkAccessType.Enabled; + case "Disabled": + return PublicNetworkAccessType.Disabled; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ResizeError.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ResizeError.cs new file mode 100644 index 000000000000..ce229265669c --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ResizeError.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// An error that occurred when resizing a pool. + /// + /// + /// An error that occurred when resizing a pool. + /// + public partial class ResizeError + { + /// + /// Initializes a new instance of the ResizeError class. + /// + public ResizeError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResizeError class. + /// + + /// An identifier for the error. Codes are invariant and are intended to be + /// consumed programmatically. + /// + + /// A message describing the error, intended to be suitable for display in a + /// user interface. + /// + + /// Additional details about the error. + /// + public ResizeError(string code, string message, System.Collections.Generic.IList details = default(System.Collections.Generic.IList)) + + { + this.Code = code; + this.Message = message; + this.Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets an identifier for the error. Codes are invariant and are + /// intended to be consumed programmatically. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets a message describing the error, intended to be suitable for + /// display in a user interface. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + + /// + /// Gets or sets additional details about the error. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "details")] + public System.Collections.Generic.IList Details {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Code == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Code"); + } + if (this.Message == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Message"); + } + + + if (this.Details != null) + { + foreach (var element in this.Details) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ResizeOperationStatus.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ResizeOperationStatus.cs new file mode 100644 index 000000000000..c0975393843f --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ResizeOperationStatus.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Describes either the current operation (if the pool AllocationState is + /// Resizing) or the previously completed operation (if the AllocationState is + /// Steady). + /// + /// + /// Describes either the current operation (if the pool AllocationState is + /// Resizing) or the previously completed operation (if the AllocationState is + /// Steady). + /// + public partial class ResizeOperationStatus + { + /// + /// Initializes a new instance of the ResizeOperationStatus class. + /// + public ResizeOperationStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResizeOperationStatus class. + /// + + /// The desired number of dedicated compute nodes in the pool. + /// + + /// The desired number of Spot/low-priority compute nodes in the pool. + /// + + /// The default value is 15 minutes. The minimum value is 5 minutes. If you + /// specify a value less than 5 minutes, the Batch service returns an error; if + /// you are calling the REST API directly, the HTTP status code is 400 (Bad + /// Request). + /// + + /// The default value is requeue. + /// Possible values include: 'Requeue', 'Terminate', 'TaskCompletion', + /// 'RetainedData' + + /// The time when this resize operation was started. + /// + + /// This property is set only if an error occurred during the last pool resize, + /// and only when the pool allocationState is Steady. + /// + public ResizeOperationStatus(int? targetDedicatedNodes = default(int?), int? targetLowPriorityNodes = default(int?), System.TimeSpan? resizeTimeout = default(System.TimeSpan?), ComputeNodeDeallocationOption? nodeDeallocationOption = default(ComputeNodeDeallocationOption?), System.DateTime? startTime = default(System.DateTime?), System.Collections.Generic.IList errors = default(System.Collections.Generic.IList)) + + { + this.TargetDedicatedNodes = targetDedicatedNodes; + this.TargetLowPriorityNodes = targetLowPriorityNodes; + this.ResizeTimeout = resizeTimeout; + this.NodeDeallocationOption = nodeDeallocationOption; + this.StartTime = startTime; + this.Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the desired number of dedicated compute nodes in the pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetDedicatedNodes")] + public int? TargetDedicatedNodes {get; set; } + + /// + /// Gets or sets the desired number of Spot/low-priority compute nodes in the + /// pool. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetLowPriorityNodes")] + public int? TargetLowPriorityNodes {get; set; } + + /// + /// Gets or sets the default value is 15 minutes. The minimum value is 5 + /// minutes. If you specify a value less than 5 minutes, the Batch service + /// returns an error; if you are calling the REST API directly, the HTTP status + /// code is 400 (Bad Request). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resizeTimeout")] + public System.TimeSpan? ResizeTimeout {get; set; } + + /// + /// Gets or sets the default value is requeue. Possible values include: 'Requeue', 'Terminate', 'TaskCompletion', 'RetainedData' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nodeDeallocationOption")] + public ComputeNodeDeallocationOption? NodeDeallocationOption {get; set; } + + /// + /// Gets or sets the time when this resize operation was started. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime {get; set; } + + /// + /// Gets or sets this property is set only if an error occurred during the last + /// pool resize, and only when the pool allocationState is Steady. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "errors")] + public System.Collections.Generic.IList Errors {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/Resource.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/Resource.cs new file mode 100644 index 000000000000..25175ff79f3c --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/Resource.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A definition of an Azure resource. + /// + public partial class Resource : Microsoft.Rest.Azure.IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + + /// The ID of the resource. + /// + + /// The name of the resource. + /// + + /// The type of the resource. + /// + + /// The location of the resource. + /// + + /// The tags of the resource. + /// + public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + + { + this.Id = id; + this.Name = name; + this.Type = type; + this.Location = location; + this.Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the ID of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } + + /// + /// Gets the name of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + + /// + /// Gets the type of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } + + /// + /// Gets the location of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; private set; } + + /// + /// Gets the tags of the resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ResourceFile.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ResourceFile.cs new file mode 100644 index 000000000000..c8995b2f9835 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ResourceFile.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A single file or multiple files to be downloaded to a compute node. + /// + /// + /// A single file or multiple files to be downloaded to a compute node. + /// + public partial class ResourceFile + { + /// + /// Initializes a new instance of the ResourceFile class. + /// + public ResourceFile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceFile class. + /// + + /// The autoStorageContainerName, storageContainerUrl and httpUrl properties + /// are mutually exclusive and one of them must be specified. + /// + + /// The autoStorageContainerName, storageContainerUrl and httpUrl properties + /// are mutually exclusive and one of them must be specified. This URL must be + /// readable and listable from compute nodes. There are three ways to get such + /// a URL for a container in Azure storage: include a Shared Access Signature + /// (SAS) granting read and list permissions on the container, use a managed + /// identity with read and list permissions, or set the ACL for the container + /// to allow public access. + /// + + /// The autoStorageContainerName, storageContainerUrl and httpUrl properties + /// are mutually exclusive and one of them must be specified. If the URL points + /// to Azure Blob Storage, it must be readable from compute nodes. There are + /// three ways to get such a URL for a blob in Azure storage: include a Shared + /// Access Signature (SAS) granting read permissions on the blob, use a managed + /// identity with read permission, or set the ACL for the blob or its container + /// to allow public access. + /// + + /// The property is valid only when autoStorageContainerName or + /// storageContainerUrl is used. This prefix can be a partial filename or a + /// subdirectory. If a prefix is not specified, all the files in the container + /// will be downloaded. + /// + + /// If the httpUrl property is specified, the filePath is required and + /// describes the path which the file will be downloaded to, including the + /// filename. Otherwise, if the autoStorageContainerName or storageContainerUrl + /// property is specified, filePath is optional and is the directory to + /// download the files to. In the case where filePath is used as a directory, + /// any directory structure already associated with the input data will be + /// retained in full and appended to the specified filePath directory. The + /// specified relative path cannot break out of the task's working directory + /// (for example by using '..'). + /// + + /// This property applies only to files being downloaded to Linux compute + /// nodes. It will be ignored if it is specified for a resourceFile which will + /// be downloaded to a Windows node. If this property is not specified for a + /// Linux node, then a default value of 0770 is applied to the file. + /// + + /// The reference to a user assigned identity associated with the Batch pool + /// which a compute node will use. + /// + public ResourceFile(string autoStorageContainerName = default(string), string storageContainerUrl = default(string), string httpUrl = default(string), string blobPrefix = default(string), string filePath = default(string), string fileMode = default(string), ComputeNodeIdentityReference identityReference = default(ComputeNodeIdentityReference)) + + { + this.AutoStorageContainerName = autoStorageContainerName; + this.StorageContainerUrl = storageContainerUrl; + this.HttpUrl = httpUrl; + this.BlobPrefix = blobPrefix; + this.FilePath = filePath; + this.FileMode = fileMode; + this.IdentityReference = identityReference; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the autoStorageContainerName, storageContainerUrl and httpUrl + /// properties are mutually exclusive and one of them must be specified. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoStorageContainerName")] + public string AutoStorageContainerName {get; set; } + + /// + /// Gets or sets the autoStorageContainerName, storageContainerUrl and httpUrl + /// properties are mutually exclusive and one of them must be specified. This + /// URL must be readable and listable from compute nodes. There are three ways + /// to get such a URL for a container in Azure storage: include a Shared Access + /// Signature (SAS) granting read and list permissions on the container, use a + /// managed identity with read and list permissions, or set the ACL for the + /// container to allow public access. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "storageContainerUrl")] + public string StorageContainerUrl {get; set; } + + /// + /// Gets or sets the autoStorageContainerName, storageContainerUrl and httpUrl + /// properties are mutually exclusive and one of them must be specified. If the + /// URL points to Azure Blob Storage, it must be readable from compute nodes. + /// There are three ways to get such a URL for a blob in Azure storage: include + /// a Shared Access Signature (SAS) granting read permissions on the blob, use + /// a managed identity with read permission, or set the ACL for the blob or its + /// container to allow public access. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "httpUrl")] + public string HttpUrl {get; set; } + + /// + /// Gets or sets the property is valid only when autoStorageContainerName or + /// storageContainerUrl is used. This prefix can be a partial filename or a + /// subdirectory. If a prefix is not specified, all the files in the container + /// will be downloaded. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "blobPrefix")] + public string BlobPrefix {get; set; } + + /// + /// Gets or sets if the httpUrl property is specified, the filePath is required + /// and describes the path which the file will be downloaded to, including the + /// filename. Otherwise, if the autoStorageContainerName or storageContainerUrl + /// property is specified, filePath is optional and is the directory to + /// download the files to. In the case where filePath is used as a directory, + /// any directory structure already associated with the input data will be + /// retained in full and appended to the specified filePath directory. The + /// specified relative path cannot break out of the task's working directory + /// (for example by using '..'). + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "filePath")] + public string FilePath {get; set; } + + /// + /// Gets or sets this property applies only to files being downloaded to Linux + /// compute nodes. It will be ignored if it is specified for a resourceFile + /// which will be downloaded to a Windows node. If this property is not + /// specified for a Linux node, then a default value of 0770 is applied to the + /// file. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "fileMode")] + public string FileMode {get; set; } + + /// + /// Gets or sets the reference to a user assigned identity associated with the + /// Batch pool which a compute node will use. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "identityReference")] + public ComputeNodeIdentityReference IdentityReference {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ResourceIdentityType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..3102ad037fa3 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for ResourceIdentityType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum ResourceIdentityType + { + /// + /// Batch account has a system assigned identity with it. + /// + [System.Runtime.Serialization.EnumMember(Value = "SystemAssigned")] + SystemAssigned, + /// + /// Batch account has user assigned identities with it. + /// + [System.Runtime.Serialization.EnumMember(Value = "UserAssigned")] + UserAssigned, + /// + /// Batch account has no identity associated with it. Setting `None` in update + /// account will remove existing identities. + /// + [System.Runtime.Serialization.EnumMember(Value = "None")] + None + } + internal static class ResourceIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceIdentityType? value) + { + return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this ResourceIdentityType value) + { + switch( value ) + { + case ResourceIdentityType.SystemAssigned: + return "SystemAssigned"; + case ResourceIdentityType.UserAssigned: + return "UserAssigned"; + case ResourceIdentityType.None: + return "None"; + } + return null; + } + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + case "UserAssigned": + return ResourceIdentityType.UserAssigned; + case "None": + return ResourceIdentityType.None; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ResourceType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ResourceType.cs new file mode 100644 index 000000000000..a62717813dcb --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ResourceType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for ResourceType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum ResourceType + { + /// + /// The Batch account resource type. + /// + [System.Runtime.Serialization.EnumMember(Value = "Microsoft.Batch/batchAccounts")] + BatchAccounts + } + internal static class ResourceTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceType? value) + { + return value == null ? null : ((ResourceType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this ResourceType value) + { + switch( value ) + { + case ResourceType.BatchAccounts: + return "Microsoft.Batch/batchAccounts"; + } + return null; + } + internal static ResourceType? ParseResourceType(this string value) + { + switch( value ) + { + case "Microsoft.Batch/batchAccounts": + return ResourceType.BatchAccounts; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/ScaleSettings.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/ScaleSettings.cs new file mode 100644 index 000000000000..753de27149a0 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/ScaleSettings.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Defines the desired size of the pool. This can either be 'fixedScale' where + /// the requested targetDedicatedNodes is specified, or 'autoScale' which + /// defines a formula which is periodically reevaluated. If this property is + /// not specified, the pool will have a fixed scale with 0 + /// targetDedicatedNodes. + /// + /// + /// Defines the desired size of the pool. This can either be 'fixedScale' where + /// the requested targetDedicatedNodes is specified, or 'autoScale' which + /// defines a formula which is periodically reevaluated. If this property is + /// not specified, the pool will have a fixed scale with 0 + /// targetDedicatedNodes. + /// + public partial class ScaleSettings + { + /// + /// Initializes a new instance of the ScaleSettings class. + /// + public ScaleSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScaleSettings class. + /// + + /// This property and autoScale are mutually exclusive and one of the + /// properties must be specified. + /// + + /// This property and fixedScale are mutually exclusive and one of the + /// properties must be specified. + /// + public ScaleSettings(FixedScaleSettings fixedScale = default(FixedScaleSettings), AutoScaleSettings autoScale = default(AutoScaleSettings)) + + { + this.FixedScale = fixedScale; + this.AutoScale = autoScale; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets this property and autoScale are mutually exclusive and one of + /// the properties must be specified. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "fixedScale")] + public FixedScaleSettings FixedScale {get; set; } + + /// + /// Gets or sets this property and fixedScale are mutually exclusive and one of + /// the properties must be specified. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoScale")] + public AutoScaleSettings AutoScale {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.AutoScale != null) + { + this.AutoScale.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/SkuCapability.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/SkuCapability.cs new file mode 100644 index 000000000000..50a751570f92 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/SkuCapability.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A SKU capability, such as the number of cores. + /// + public partial class SkuCapability + { + /// + /// Initializes a new instance of the SkuCapability class. + /// + public SkuCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuCapability class. + /// + + /// The name of the feature. + /// + + /// The value of the feature. + /// + public SkuCapability(string name = default(string), string value = default(string)) + + { + this.Name = name; + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the name of the feature. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + + /// + /// Gets the value of the feature. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public string Value {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/StartTask.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/StartTask.cs new file mode 100644 index 000000000000..eaee7172f115 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/StartTask.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// In some cases the start task may be re-run even though the node was not + /// rebooted. Due to this, start tasks should be idempotent and exit gracefully + /// if the setup they're performing has already been done. Special care should + /// be taken to avoid start tasks which create breakaway process or + /// install/launch services from the start task working directory, as this will + /// block Batch from being able to re-run the start task. + /// + /// + /// In some cases the start task may be re-run even though the node was not + /// rebooted. Due to this, start tasks should be idempotent and exit gracefully + /// if the setup they're performing has already been done. Special care should + /// be taken to avoid start tasks which create breakaway process or + /// install/launch services from the start task working directory, as this will + /// block Batch from being able to re-run the start task. + /// + public partial class StartTask + { + /// + /// Initializes a new instance of the StartTask class. + /// + public StartTask() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StartTask class. + /// + + /// The command line does not run under a shell, and therefore cannot take + /// advantage of shell features such as environment variable expansion. If you + /// want to take advantage of such features, you should invoke the shell in the + /// command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh + /// -c MyCommand" in Linux. Required if any other properties of the startTask + /// are specified. + /// + + /// A list of files that the Batch service will download to the compute node + /// before running the command line. + /// + + /// A list of environment variable settings for the start task. + /// + + /// If omitted, the task runs as a non-administrative user unique to the task. + /// + + /// The Batch service retries a task if its exit code is nonzero. Note that + /// this value specifically controls the number of retries. The Batch service + /// will try the task once, and may then retry up to this limit. For example, + /// if the maximum retry count is 3, Batch tries the task up to 4 times (one + /// initial try and 3 retries). If the maximum retry count is 0, the Batch + /// service does not retry the task. If the maximum retry count is -1, the + /// Batch service retries the task without limit. + /// + + /// If true and the start task fails on a compute node, the Batch service + /// retries the start task up to its maximum retry count (maxTaskRetryCount). + /// If the task has still not completed successfully after all retries, then + /// the Batch service marks the compute node unusable, and will not schedule + /// tasks to it. This condition can be detected via the node state and + /// scheduling error detail. If false, the Batch service will not wait for the + /// start task to complete. In this case, other tasks can start executing on + /// the compute node while the start task is still running; and even if the + /// start task fails, new tasks will continue to be scheduled on the node. The + /// default is true. + /// + + /// When this is specified, all directories recursively below the + /// AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) + /// are mapped into the container, all task environment variables are mapped + /// into the container, and the task command line is executed in the container. + /// + public StartTask(string commandLine = default(string), System.Collections.Generic.IList resourceFiles = default(System.Collections.Generic.IList), System.Collections.Generic.IList environmentSettings = default(System.Collections.Generic.IList), UserIdentity userIdentity = default(UserIdentity), int? maxTaskRetryCount = default(int?), bool? waitForSuccess = default(bool?), TaskContainerSettings containerSettings = default(TaskContainerSettings)) + + { + this.CommandLine = commandLine; + this.ResourceFiles = resourceFiles; + this.EnvironmentSettings = environmentSettings; + this.UserIdentity = userIdentity; + this.MaxTaskRetryCount = maxTaskRetryCount; + this.WaitForSuccess = waitForSuccess; + this.ContainerSettings = containerSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the command line does not run under a shell, and therefore + /// cannot take advantage of shell features such as environment variable + /// expansion. If you want to take advantage of such features, you should + /// invoke the shell in the command line, for example using "cmd /c MyCommand" + /// in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other + /// properties of the startTask are specified. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "commandLine")] + public string CommandLine {get; set; } + + /// + /// Gets or sets a list of files that the Batch service will download to the + /// compute node before running the command line. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resourceFiles")] + public System.Collections.Generic.IList ResourceFiles {get; set; } + + /// + /// Gets or sets a list of environment variable settings for the start task. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "environmentSettings")] + public System.Collections.Generic.IList EnvironmentSettings {get; set; } + + /// + /// Gets or sets if omitted, the task runs as a non-administrative user unique + /// to the task. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userIdentity")] + public UserIdentity UserIdentity {get; set; } + + /// + /// Gets or sets the Batch service retries a task if its exit code is nonzero. + /// Note that this value specifically controls the number of retries. The Batch + /// service will try the task once, and may then retry up to this limit. For + /// example, if the maximum retry count is 3, Batch tries the task up to 4 + /// times (one initial try and 3 retries). If the maximum retry count is 0, the + /// Batch service does not retry the task. If the maximum retry count is -1, + /// the Batch service retries the task without limit. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "maxTaskRetryCount")] + public int? MaxTaskRetryCount {get; set; } + + /// + /// Gets or sets if true and the start task fails on a compute node, the Batch + /// service retries the start task up to its maximum retry count + /// (maxTaskRetryCount). If the task has still not completed successfully after + /// all retries, then the Batch service marks the compute node unusable, and + /// will not schedule tasks to it. This condition can be detected via the node + /// state and scheduling error detail. If false, the Batch service will not + /// wait for the start task to complete. In this case, other tasks can start + /// executing on the compute node while the start task is still running; and + /// even if the start task fails, new tasks will continue to be scheduled on + /// the node. The default is true. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "waitForSuccess")] + public bool? WaitForSuccess {get; set; } + + /// + /// Gets or sets when this is specified, all directories recursively below the + /// AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) + /// are mapped into the container, all task environment variables are mapped + /// into the container, and the task command line is executed in the container. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "containerSettings")] + public TaskContainerSettings ContainerSettings {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + if (this.EnvironmentSettings != null) + { + foreach (var element in this.EnvironmentSettings) + { + if (element != null) + { + element.Validate(); + } + } + } + + if (this.ContainerSettings != null) + { + this.ContainerSettings.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/StorageAccountType.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/StorageAccountType.cs new file mode 100644 index 000000000000..599307db3e5e --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/StorageAccountType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + + /// + /// Defines values for StorageAccountType. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum StorageAccountType + { + /// + /// The data disk should use standard locally redundant storage. + /// + [System.Runtime.Serialization.EnumMember(Value = "Standard_LRS")] + StandardLRS, + /// + /// The data disk should use premium locally redundant storage. + /// + [System.Runtime.Serialization.EnumMember(Value = "Premium_LRS")] + PremiumLRS + } + internal static class StorageAccountTypeEnumExtension + { + internal static string ToSerializedValue(this StorageAccountType? value) + { + return value == null ? null : ((StorageAccountType)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this StorageAccountType value) + { + switch( value ) + { + case StorageAccountType.StandardLRS: + return "Standard_LRS"; + case StorageAccountType.PremiumLRS: + return "Premium_LRS"; + } + return null; + } + internal static StorageAccountType? ParseStorageAccountType(this string value) + { + switch( value ) + { + case "Standard_LRS": + return StorageAccountType.StandardLRS; + case "Premium_LRS": + return StorageAccountType.PremiumLRS; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/SupportedSku.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/SupportedSku.cs new file mode 100644 index 000000000000..c93883d4f01f --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/SupportedSku.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Describes a Batch supported SKU. + /// + public partial class SupportedSku + { + /// + /// Initializes a new instance of the SupportedSku class. + /// + public SupportedSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SupportedSku class. + /// + + /// The name of the SKU. + /// + + /// The family name of the SKU. + /// + + /// A collection of capabilities which this SKU supports. + /// + public SupportedSku(string name = default(string), string familyName = default(string), System.Collections.Generic.IList capabilities = default(System.Collections.Generic.IList)) + + { + this.Name = name; + this.FamilyName = familyName; + this.Capabilities = capabilities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the name of the SKU. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + + /// + /// Gets the family name of the SKU. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "familyName")] + public string FamilyName {get; private set; } + + /// + /// Gets a collection of capabilities which this SKU supports. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "capabilities")] + public System.Collections.Generic.IList Capabilities {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/TaskContainerSettings.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/TaskContainerSettings.cs new file mode 100644 index 000000000000..df502c074326 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/TaskContainerSettings.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The container settings for a task. + /// + /// + /// The container settings for a task. + /// + public partial class TaskContainerSettings + { + /// + /// Initializes a new instance of the TaskContainerSettings class. + /// + public TaskContainerSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TaskContainerSettings class. + /// + + /// These additional options are supplied as arguments to the "docker create" + /// command, in addition to those controlled by the Batch Service. + /// + + /// This is the full image reference, as would be specified to "docker pull". + /// If no tag is provided as part of the image name, the tag ":latest" is used + /// as a default. + /// + + /// This setting can be omitted if was already provided at pool creation. + /// + + /// A flag to indicate where the container task working directory is. The + /// default is 'taskWorkingDirectory'. + /// Possible values include: 'TaskWorkingDirectory', 'ContainerImageDefault' + public TaskContainerSettings(string imageName, string containerRunOptions = default(string), ContainerRegistry registry = default(ContainerRegistry), ContainerWorkingDirectory? workingDirectory = default(ContainerWorkingDirectory?)) + + { + this.ContainerRunOptions = containerRunOptions; + this.ImageName = imageName; + this.Registry = registry; + this.WorkingDirectory = workingDirectory; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets these additional options are supplied as arguments to the + /// "docker create" command, in addition to those controlled by the Batch + /// Service. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "containerRunOptions")] + public string ContainerRunOptions {get; set; } + + /// + /// Gets or sets this is the full image reference, as would be specified to + /// "docker pull". If no tag is provided as part of the image name, the tag + /// ":latest" is used as a default. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "imageName")] + public string ImageName {get; set; } + + /// + /// Gets or sets this setting can be omitted if was already provided at pool + /// creation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "registry")] + public ContainerRegistry Registry {get; set; } + + /// + /// Gets or sets a flag to indicate where the container task working directory + /// is. The default is 'taskWorkingDirectory'. Possible values include: 'TaskWorkingDirectory', 'ContainerImageDefault' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "workingDirectory")] + public ContainerWorkingDirectory? WorkingDirectory {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.ImageName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ImageName"); + } + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/TaskSchedulingPolicy.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/TaskSchedulingPolicy.cs new file mode 100644 index 000000000000..3a7066e553bf --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/TaskSchedulingPolicy.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Specifies how tasks should be distributed across compute nodes. + /// + /// + /// Specifies how tasks should be distributed across compute nodes. + /// + public partial class TaskSchedulingPolicy + { + /// + /// Initializes a new instance of the TaskSchedulingPolicy class. + /// + public TaskSchedulingPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TaskSchedulingPolicy class. + /// + + /// How tasks should be distributed across compute nodes. + /// Possible values include: 'Spread', 'Pack' + public TaskSchedulingPolicy(ComputeNodeFillType nodeFillType) + + { + this.NodeFillType = nodeFillType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets how tasks should be distributed across compute nodes. Possible values include: 'Spread', 'Pack' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nodeFillType")] + public ComputeNodeFillType NodeFillType {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/UserAccount.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/UserAccount.cs new file mode 100644 index 000000000000..b65ca339c1e2 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/UserAccount.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Properties used to create a user on an Azure Batch node. + /// + /// + /// Properties used to create a user on an Azure Batch node. + /// + public partial class UserAccount + { + /// + /// Initializes a new instance of the UserAccount class. + /// + public UserAccount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAccount class. + /// + + /// The name of the user account. Names can contain any Unicode characters up + /// to a maximum length of 20. + /// + + /// The password for the user account. + /// + + /// nonAdmin - The auto user is a standard user without elevated access. admin + /// - The auto user is a user with elevated access and operates with full + /// Administrator permissions. The default value is nonAdmin. + /// Possible values include: 'NonAdmin', 'Admin' + + /// This property is ignored if specified on a Windows pool. If not specified, + /// the user is created with the default options. + /// + + /// This property can only be specified if the user is on a Windows pool. If + /// not specified and on a Windows pool, the user is created with the default + /// options. + /// + public UserAccount(string name, string password, ElevationLevel? elevationLevel = default(ElevationLevel?), LinuxUserConfiguration linuxUserConfiguration = default(LinuxUserConfiguration), WindowsUserConfiguration windowsUserConfiguration = default(WindowsUserConfiguration)) + + { + this.Name = name; + this.Password = password; + this.ElevationLevel = elevationLevel; + this.LinuxUserConfiguration = linuxUserConfiguration; + this.WindowsUserConfiguration = windowsUserConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the user account. Names can contain any Unicode + /// characters up to a maximum length of 20. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the password for the user account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "password")] + public string Password {get; set; } + + /// + /// Gets or sets nonAdmin - The auto user is a standard user without elevated + /// access. admin - The auto user is a user with elevated access and operates + /// with full Administrator permissions. The default value is nonAdmin. Possible values include: 'NonAdmin', 'Admin' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "elevationLevel")] + public ElevationLevel? ElevationLevel {get; set; } + + /// + /// Gets or sets this property is ignored if specified on a Windows pool. If + /// not specified, the user is created with the default options. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "linuxUserConfiguration")] + public LinuxUserConfiguration LinuxUserConfiguration {get; set; } + + /// + /// Gets or sets this property can only be specified if the user is on a + /// Windows pool. If not specified and on a Windows pool, the user is created + /// with the default options. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "windowsUserConfiguration")] + public WindowsUserConfiguration WindowsUserConfiguration {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + } + if (this.Password == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Password"); + } + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/UserAssignedIdentities.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/UserAssignedIdentities.cs new file mode 100644 index 000000000000..24c43744595b --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/UserAssignedIdentities.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The list of associated user identities. + /// + public partial class UserAssignedIdentities + { + /// + /// Initializes a new instance of the UserAssignedIdentities class. + /// + public UserAssignedIdentities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAssignedIdentities class. + /// + + /// The principal id of user assigned identity. + /// + + /// The client id of user assigned identity. + /// + public UserAssignedIdentities(string principalId = default(string), string clientId = default(string)) + + { + this.PrincipalId = principalId; + this.ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the principal id of user assigned identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; private set; } + + /// + /// Gets the client id of user assigned identity. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "clientId")] + public string ClientId {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/UserIdentity.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/UserIdentity.cs new file mode 100644 index 000000000000..dbc344f13bfd --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/UserIdentity.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Specify either the userName or autoUser property, but not both. + /// + /// + /// Specify either the userName or autoUser property, but not both. + /// + public partial class UserIdentity + { + /// + /// Initializes a new instance of the UserIdentity class. + /// + public UserIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserIdentity class. + /// + + /// The userName and autoUser properties are mutually exclusive; you must + /// specify one but not both. + /// + + /// The userName and autoUser properties are mutually exclusive; you must + /// specify one but not both. + /// + public UserIdentity(string userName = default(string), AutoUserSpecification autoUser = default(AutoUserSpecification)) + + { + this.UserName = userName; + this.AutoUser = autoUser; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the userName and autoUser properties are mutually exclusive; + /// you must specify one but not both. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userName")] + public string UserName {get; set; } + + /// + /// Gets or sets the userName and autoUser properties are mutually exclusive; + /// you must specify one but not both. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoUser")] + public AutoUserSpecification AutoUser {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/VMExtension.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/VMExtension.cs new file mode 100644 index 000000000000..19bd78635852 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/VMExtension.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The configuration for virtual machine extensions. + /// + /// + /// The configuration for virtual machine extensions. + /// + public partial class VMExtension + { + /// + /// Initializes a new instance of the VMExtension class. + /// + public VMExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VMExtension class. + /// + + /// The name of the virtual machine extension. + /// + + /// The name of the extension handler publisher. + /// + + /// The type of the extensions. + /// + + /// The version of script handler. + /// + + /// Indicates whether the extension should use a newer minor version if one is + /// available at deployment time. Once deployed, however, the extension will + /// not upgrade minor versions unless redeployed, even with this property set + /// to true. + /// + + /// JSON formatted public settings for the extension. + /// + + /// The extension can contain either protectedSettings or + /// protectedSettingsFromKeyVault or no protected settings at all. + /// + + /// Collection of extension names after which this extension needs to be + /// provisioned. + /// + public VMExtension(string name, string publisher, string type, string typeHandlerVersion = default(string), bool? autoUpgradeMinorVersion = default(bool?), object settings = default(object), object protectedSettings = default(object), System.Collections.Generic.IList provisionAfterExtensions = default(System.Collections.Generic.IList)) + + { + this.Name = name; + this.Publisher = publisher; + this.Type = type; + this.TypeHandlerVersion = typeHandlerVersion; + this.AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + this.Settings = settings; + this.ProtectedSettings = protectedSettings; + this.ProvisionAfterExtensions = provisionAfterExtensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the virtual machine extension. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + public string Publisher {get; set; } + + /// + /// Gets or sets the type of the extensions. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } + + /// + /// Gets or sets the version of script handler. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "typeHandlerVersion")] + public string TypeHandlerVersion {get; set; } + + /// + /// Gets or sets indicates whether the extension should use a newer minor + /// version if one is available at deployment time. Once deployed, however, the + /// extension will not upgrade minor versions unless redeployed, even with this + /// property set to true. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion {get; set; } + + /// + /// Gets or sets jSON formatted public settings for the extension. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "settings")] + public object Settings {get; set; } + + /// + /// Gets or sets the extension can contain either protectedSettings or + /// protectedSettingsFromKeyVault or no protected settings at all. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "protectedSettings")] + public object ProtectedSettings {get; set; } + + /// + /// Gets or sets collection of extension names after which this extension needs + /// to be provisioned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisionAfterExtensions")] + public System.Collections.Generic.IList ProvisionAfterExtensions {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + } + if (this.Publisher == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Publisher"); + } + if (this.Type == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Type"); + } + + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/VirtualMachineConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/VirtualMachineConfiguration.cs new file mode 100644 index 000000000000..66e5b1cea964 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/VirtualMachineConfiguration.cs @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// The configuration for compute nodes in a pool based on the Azure Virtual + /// Machines infrastructure. + /// + /// + /// The configuration for compute nodes in a pool based on the Azure Virtual + /// Machines infrastructure. + /// + public partial class VirtualMachineConfiguration + { + /// + /// Initializes a new instance of the VirtualMachineConfiguration class. + /// + public VirtualMachineConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineConfiguration class. + /// + + /// A reference to an Azure Virtual Machines Marketplace image or the Azure + /// Image resource of a custom Virtual Machine. To get the list of all + /// imageReferences verified by Azure Batch, see the 'List supported node agent + /// SKUs' operation. + /// + + /// The Batch node agent is a program that runs on each node in the pool, and + /// provides the command-and-control interface between the node and the Batch + /// service. There are different implementations of the node agent, known as + /// SKUs, for different operating systems. You must specify a node agent SKU + /// which matches the selected image reference. To get the list of supported + /// node agent SKUs along with their list of verified image references, see the + /// 'List supported node agent SKUs' operation. + /// + + /// This property must not be specified if the imageReference specifies a Linux + /// OS image. + /// + + /// This property must be specified if the compute nodes in the pool need to + /// have empty data disks attached to them. + /// + + /// This only applies to images that contain the Windows operating system, and + /// should only be used when you hold valid on-premises licenses for the nodes + /// which will be deployed. If omitted, no on-premises licensing discount is + /// applied. Values are: + /// Windows_Server - The on-premises license is for Windows Server. + /// Windows_Client - The on-premises license is for Windows Client. + /// + + /// If specified, setup is performed on each node in the pool to allow tasks to + /// run in containers. All regular tasks and job manager tasks run on this pool + /// must specify the containerSettings property, and all other tasks may + /// specify it. + /// + + /// If specified, encryption is performed on each node in the pool during node + /// provisioning. + /// + + /// This configuration will specify rules on how nodes in the pool will be + /// physically allocated. + /// + + /// If specified, the extensions mentioned in this configuration will be + /// installed on each node. + /// + + /// Contains configuration for ephemeral OSDisk settings. + /// + public VirtualMachineConfiguration(ImageReference imageReference, string nodeAgentSkuId, WindowsConfiguration windowsConfiguration = default(WindowsConfiguration), System.Collections.Generic.IList dataDisks = default(System.Collections.Generic.IList), string licenseType = default(string), ContainerConfiguration containerConfiguration = default(ContainerConfiguration), DiskEncryptionConfiguration diskEncryptionConfiguration = default(DiskEncryptionConfiguration), NodePlacementConfiguration nodePlacementConfiguration = default(NodePlacementConfiguration), System.Collections.Generic.IList extensions = default(System.Collections.Generic.IList), OSDisk osDisk = default(OSDisk)) + + { + this.ImageReference = imageReference; + this.NodeAgentSkuId = nodeAgentSkuId; + this.WindowsConfiguration = windowsConfiguration; + this.DataDisks = dataDisks; + this.LicenseType = licenseType; + this.ContainerConfiguration = containerConfiguration; + this.DiskEncryptionConfiguration = diskEncryptionConfiguration; + this.NodePlacementConfiguration = nodePlacementConfiguration; + this.Extensions = extensions; + this.OSDisk = osDisk; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets a reference to an Azure Virtual Machines Marketplace image or + /// the Azure Image resource of a custom Virtual Machine. To get the list of + /// all imageReferences verified by Azure Batch, see the 'List supported node + /// agent SKUs' operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "imageReference")] + public ImageReference ImageReference {get; set; } + + /// + /// Gets or sets the Batch node agent is a program that runs on each node in + /// the pool, and provides the command-and-control interface between the node + /// and the Batch service. There are different implementations of the node + /// agent, known as SKUs, for different operating systems. You must specify a + /// node agent SKU which matches the selected image reference. To get the list + /// of supported node agent SKUs along with their list of verified image + /// references, see the 'List supported node agent SKUs' operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nodeAgentSkuId")] + public string NodeAgentSkuId {get; set; } + + /// + /// Gets or sets this property must not be specified if the imageReference + /// specifies a Linux OS image. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "windowsConfiguration")] + public WindowsConfiguration WindowsConfiguration {get; set; } + + /// + /// Gets or sets this property must be specified if the compute nodes in the + /// pool need to have empty data disks attached to them. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dataDisks")] + public System.Collections.Generic.IList DataDisks {get; set; } + + /// + /// Gets or sets this only applies to images that contain the Windows operating + /// system, and should only be used when you hold valid on-premises licenses + /// for the nodes which will be deployed. If omitted, no on-premises licensing + /// discount is applied. Values are: + /// Windows_Server - The on-premises license is for Windows Server. + /// Windows_Client - The on-premises license is for Windows Client. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "licenseType")] + public string LicenseType {get; set; } + + /// + /// Gets or sets if specified, setup is performed on each node in the pool to + /// allow tasks to run in containers. All regular tasks and job manager tasks + /// run on this pool must specify the containerSettings property, and all other + /// tasks may specify it. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "containerConfiguration")] + public ContainerConfiguration ContainerConfiguration {get; set; } + + /// + /// Gets or sets if specified, encryption is performed on each node in the pool + /// during node provisioning. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "diskEncryptionConfiguration")] + public DiskEncryptionConfiguration DiskEncryptionConfiguration {get; set; } + + /// + /// Gets or sets this configuration will specify rules on how nodes in the pool + /// will be physically allocated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nodePlacementConfiguration")] + public NodePlacementConfiguration NodePlacementConfiguration {get; set; } + + /// + /// Gets or sets if specified, the extensions mentioned in this configuration + /// will be installed on each node. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "extensions")] + public System.Collections.Generic.IList Extensions {get; set; } + + /// + /// Gets or sets contains configuration for ephemeral OSDisk settings. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "osDisk")] + public OSDisk OSDisk {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.ImageReference == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ImageReference"); + } + if (this.NodeAgentSkuId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "NodeAgentSkuId"); + } + + + + if (this.DataDisks != null) + { + foreach (var element in this.DataDisks) + { + if (element != null) + { + element.Validate(); + } + } + } + + + + + if (this.Extensions != null) + { + foreach (var element in this.Extensions) + { + if (element != null) + { + element.Validate(); + } + } + } + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/VirtualMachineFamilyCoreQuota.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/VirtualMachineFamilyCoreQuota.cs new file mode 100644 index 000000000000..ab926d45f209 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/VirtualMachineFamilyCoreQuota.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// A VM Family and its associated core quota for the Batch account. + /// + public partial class VirtualMachineFamilyCoreQuota + { + /// + /// Initializes a new instance of the VirtualMachineFamilyCoreQuota class. + /// + public VirtualMachineFamilyCoreQuota() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualMachineFamilyCoreQuota class. + /// + + /// The Virtual Machine family name. + /// + + /// The core quota for the VM family for the Batch account. + /// + public VirtualMachineFamilyCoreQuota(string name = default(string), int coreQuota = default(int)) + + { + this.Name = name; + this.CoreQuota = coreQuota; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the Virtual Machine family name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + + /// + /// Gets the core quota for the VM family for the Batch account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "coreQuota")] + public int CoreQuota {get; private set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/WindowsConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/WindowsConfiguration.cs new file mode 100644 index 000000000000..dc176ce0860b --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/WindowsConfiguration.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Windows operating system settings to apply to the virtual machine. + /// + /// + /// Windows operating system settings to apply to the virtual machine. + /// + public partial class WindowsConfiguration + { + /// + /// Initializes a new instance of the WindowsConfiguration class. + /// + public WindowsConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsConfiguration class. + /// + + /// If omitted, the default value is true. + /// + public WindowsConfiguration(bool? enableAutomaticUpdates = default(bool?)) + + { + this.EnableAutomaticUpdates = enableAutomaticUpdates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets if omitted, the default value is true. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enableAutomaticUpdates")] + public bool? EnableAutomaticUpdates {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Models/WindowsUserConfiguration.cs b/src/Batch/Batch.Management.Sdk/Generated/Models/WindowsUserConfiguration.cs new file mode 100644 index 000000000000..15971a578e48 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Models/WindowsUserConfiguration.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch.Models +{ + using System.Linq; + + /// + /// Properties used to create a user account on a Windows node. + /// + /// + /// Properties used to create a user account on a Windows node. + /// + public partial class WindowsUserConfiguration + { + /// + /// Initializes a new instance of the WindowsUserConfiguration class. + /// + public WindowsUserConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsUserConfiguration class. + /// + + /// Specifies login mode for the user. The default value for + /// VirtualMachineConfiguration pools is interactive mode and for + /// CloudServiceConfiguration pools is batch mode. + /// Possible values include: 'Batch', 'Interactive' + public WindowsUserConfiguration(LoginMode? loginMode = default(LoginMode?)) + + { + this.LoginMode = loginMode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets specifies login mode for the user. The default value for + /// VirtualMachineConfiguration pools is interactive mode and for + /// CloudServiceConfiguration pools is batch mode. Possible values include: 'Batch', 'Interactive' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "loginMode")] + public LoginMode? LoginMode {get; set; } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/Operations.cs b/src/Batch/Batch.Management.Sdk/Generated/Operations.cs new file mode 100644 index 000000000000..70eb30d2fbdd --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/Operations.cs @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// Operations operations. + /// + internal partial class Operations : Microsoft.Rest.IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations (BatchManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BatchManagementClient + /// + public BatchManagementClient Client { get; private set; } + + /// + /// Lists available operations for the Microsoft.Batch provider + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Batch/operations").ToString(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists available operations for the Microsoft.Batch provider + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/OperationsExtensions.cs b/src/Batch/Batch.Management.Sdk/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..f4e6df70c5c8 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/OperationsExtensions.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for Operations + /// + public static partial class OperationsExtensions + { + /// + /// Lists available operations for the Microsoft.Batch provider + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IOperations operations) + { + return ((IOperations)operations).ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists available operations for the Microsoft.Batch provider + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists available operations for the Microsoft.Batch provider + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IOperations operations, string nextPageLink) + { + return ((IOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists available operations for the Microsoft.Batch provider + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Batch/Batch.Management.Sdk/Generated/PoolOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/PoolOperations.cs new file mode 100644 index 000000000000..9f11a31237d4 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/PoolOperations.cs @@ -0,0 +1,2162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// PoolOperations operations. + /// + internal partial class PoolOperations : Microsoft.Rest.IServiceOperations, IPoolOperations + { + /// + /// Initializes a new instance of the PoolOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PoolOperations (BatchManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BatchManagementClient + /// + public BatchManagementClient Client { get; private set; } + + /// + /// Lists all of the pools in the specified account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Comma separated list of properties that should be returned. e.g. + /// "properties/provisioningState". Only top level properties under properties/ + /// are valid for selection. + /// + /// + /// OData filter expression. Valid properties for filtering are: + /// name + /// properties/allocationState + /// properties/allocationStateTransitionTime + /// properties/creationTime + /// properties/provisioningState + /// properties/provisioningStateTransitionTime + /// properties/lastModified + /// properties/vmSize + /// properties/interNodeCommunication + /// properties/scaleSettings/autoScale + /// properties/scaleSettings/fixedScale + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBatchAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxresults = default(int?), string select = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("maxresults", maxresults); + tracingParameters.Add("select", select); + tracingParameters.Add("filter", filter); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBatchAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (maxresults != null) + { + _queryParameters.Add(string.Format("maxresults={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(maxresults, this.Client.SerializationSettings).Trim('"')))); + } + if (select != null) + { + _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Creates a new pool inside the specified account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The entity state (ETag) version of the pool to update. A value of "*" can + /// be used to apply the operation only if the pool already exists. If omitted, + /// this operation will always be applied. + /// + /// + /// Set to '*' to allow a new pool to be created, but to prevent updating an + /// existing pool. Other values will be ignored. + /// + /// + /// Additional parameters for pool creation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (poolName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9_-]+$"); + } + } + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("ifNoneMatch", ifNoneMatch); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + if (_httpRequest.Headers.Contains("If-None-Match")) + { + _httpRequest.Headers.Remove("If-None-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates the properties of an existing pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The entity state (ETag) version of the pool to update. This value can be + /// omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// Pool properties that should be updated. Properties that are supplied will + /// be updated, any property not supplied will be unchanged. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (poolName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9_-]+$"); + } + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("ifMatch", ifMatch); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes the specified pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, poolName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets information about the specified pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (poolName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9_-]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Disables automatic scaling for a pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> DisableAutoScaleWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (poolName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9_-]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DisableAutoScale", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/disableAutoScale").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// This does not restore the pool to its previous state before the resize + /// operation: it only stops any further changes being made, and the pool + /// maintains its current state. After stopping, the pool stabilizes at the + /// number of nodes it was at when the stop operation was done. During the stop + /// operation, the pool allocation state changes first to stopping and then to + /// steady. A resize operation need not be an explicit resize pool request; + /// this API can also be used to halt the initial sizing of the pool when it is + /// created. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> StopResizeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (poolName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9_-]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "StopResize", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}/stopResize").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes the specified pool. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (poolName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9_-]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9_-]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists all of the pools in the specified account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBatchAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBatchAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/PoolOperationsExtensions.cs b/src/Batch/Batch.Management.Sdk/Generated/PoolOperationsExtensions.cs new file mode 100644 index 000000000000..01412a507eb2 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/PoolOperationsExtensions.cs @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for PoolOperations + /// + public static partial class PoolOperationsExtensions + { + /// + /// Lists all of the pools in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Comma separated list of properties that should be returned. e.g. + /// "properties/provisioningState". Only top level properties under properties/ + /// are valid for selection. + /// + /// + /// OData filter expression. Valid properties for filtering are: + /// name + /// properties/allocationState + /// properties/allocationStateTransitionTime + /// properties/creationTime + /// properties/provisioningState + /// properties/provisioningStateTransitionTime + /// properties/lastModified + /// properties/vmSize + /// properties/interNodeCommunication + /// properties/scaleSettings/autoScale + /// properties/scaleSettings/fixedScale + /// + public static Microsoft.Rest.Azure.IPage ListByBatchAccount(this IPoolOperations operations, string resourceGroupName, string accountName, int? maxresults = default(int?), string select = default(string), string filter = default(string)) + { + return ((IPoolOperations)operations).ListByBatchAccountAsync(resourceGroupName, accountName, maxresults, select, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the pools in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Comma separated list of properties that should be returned. e.g. + /// "properties/provisioningState". Only top level properties under properties/ + /// are valid for selection. + /// + /// + /// OData filter expression. Valid properties for filtering are: + /// name + /// properties/allocationState + /// properties/allocationStateTransitionTime + /// properties/creationTime + /// properties/provisioningState + /// properties/provisioningStateTransitionTime + /// properties/lastModified + /// properties/vmSize + /// properties/interNodeCommunication + /// properties/scaleSettings/autoScale + /// properties/scaleSettings/fixedScale + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBatchAccountAsync(this IPoolOperations operations, string resourceGroupName, string accountName, int? maxresults = default(int?), string select = default(string), string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBatchAccountWithHttpMessagesAsync(resourceGroupName, accountName, maxresults, select, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates a new pool inside the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The entity state (ETag) version of the pool to update. A value of "*" can + /// be used to apply the operation only if the pool already exists. If omitted, + /// this operation will always be applied. + /// + /// + /// Set to '*' to allow a new pool to be created, but to prevent updating an + /// existing pool. Other values will be ignored. + /// + public static Pool Create(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), string ifNoneMatch = default(string)) + { + return ((IPoolOperations)operations).CreateAsync(resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch).GetAwaiter().GetResult(); + } + + /// + /// Creates a new pool inside the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The entity state (ETag) version of the pool to update. A value of "*" can + /// be used to apply the operation only if the pool already exists. If omitted, + /// this operation will always be applied. + /// + /// + /// Set to '*' to allow a new pool to be created, but to prevent updating an + /// existing pool. Other values will be ignored. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates the properties of an existing pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The entity state (ETag) version of the pool to update. This value can be + /// omitted or set to "*" to apply the operation unconditionally. + /// + public static Pool Update(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string)) + { + return ((IPoolOperations)operations).UpdateAsync(resourceGroupName, accountName, poolName, parameters, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Updates the properties of an existing pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The entity state (ETag) version of the pool to update. This value can be + /// omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, Pool parameters, string ifMatch = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, poolName, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes the specified pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + public static PoolDeleteHeaders Delete(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName) + { + return ((IPoolOperations)operations).DeleteAsync(resourceGroupName, accountName, poolName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, poolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + /// + /// Gets information about the specified pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + public static Pool Get(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName) + { + return ((IPoolOperations)operations).GetAsync(resourceGroupName, accountName, poolName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the specified pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, poolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Disables automatic scaling for a pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + public static Pool DisableAutoScale(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName) + { + return ((IPoolOperations)operations).DisableAutoScaleAsync(resourceGroupName, accountName, poolName).GetAwaiter().GetResult(); + } + + /// + /// Disables automatic scaling for a pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DisableAutoScaleAsync(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DisableAutoScaleWithHttpMessagesAsync(resourceGroupName, accountName, poolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// This does not restore the pool to its previous state before the resize + /// operation: it only stops any further changes being made, and the pool + /// maintains its current state. After stopping, the pool stabilizes at the + /// number of nodes it was at when the stop operation was done. During the stop + /// operation, the pool allocation state changes first to stopping and then to + /// steady. A resize operation need not be an explicit resize pool request; + /// this API can also be used to halt the initial sizing of the pool when it is + /// created. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + public static Pool StopResize(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName) + { + return ((IPoolOperations)operations).StopResizeAsync(resourceGroupName, accountName, poolName).GetAwaiter().GetResult(); + } + + /// + /// This does not restore the pool to its previous state before the resize + /// operation: it only stops any further changes being made, and the pool + /// maintains its current state. After stopping, the pool stabilizes at the + /// number of nodes it was at when the stop operation was done. During the stop + /// operation, the pool allocation state changes first to stopping and then to + /// steady. A resize operation need not be an explicit resize pool request; + /// this API can also be used to halt the initial sizing of the pool when it is + /// created. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task StopResizeAsync(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.StopResizeWithHttpMessagesAsync(resourceGroupName, accountName, poolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes the specified pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + public static PoolDeleteHeaders BeginDelete(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName) + { + return ((IPoolOperations)operations).BeginDeleteAsync(resourceGroupName, accountName, poolName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The pool name. This must be unique within the account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IPoolOperations operations, string resourceGroupName, string accountName, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, poolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + /// + /// Lists all of the pools in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBatchAccountNext(this IPoolOperations operations, string nextPageLink) + { + return ((IPoolOperations)operations).ListByBatchAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the pools in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBatchAccountNextAsync(this IPoolOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBatchAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Batch/Batch.Management.Sdk/Generated/PrivateEndpointConnectionOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/PrivateEndpointConnectionOperations.cs new file mode 100644 index 000000000000..9b5f9c18a875 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/PrivateEndpointConnectionOperations.cs @@ -0,0 +1,1311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// PrivateEndpointConnectionOperations operations. + /// + internal partial class PrivateEndpointConnectionOperations : Microsoft.Rest.IServiceOperations, IPrivateEndpointConnectionOperations + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateEndpointConnectionOperations (BatchManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BatchManagementClient + /// + public BatchManagementClient Client { get; private set; } + + /// + /// Lists all of the private endpoint connections in the specified account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBatchAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxresults = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("maxresults", maxresults); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBatchAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (maxresults != null) + { + _queryParameters.Add(string.Format("maxresults={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(maxresults, this.Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the specified private endpoint connection. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (privateEndpointConnectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (privateEndpointConnectionName != null) + { + if (privateEndpointConnectionName.Length > 101) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "privateEndpointConnectionName", 101); + } + if (privateEndpointConnectionName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "privateEndpointConnectionName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(privateEndpointConnectionName, "^[a-zA-Z0-9_-]+\\.?[a-fA-F0-9-]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "privateEndpointConnectionName", "^[a-zA-Z0-9_-]+\\.?[a-fA-F0-9-]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates the properties of an existing private endpoint connection. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The state (ETag) version of the private endpoint connection to update. This + /// value can be omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// The private link service connection state of the private endpoint + /// connection + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateLinkServiceConnectionState, ifMatch, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the specified private endpoint connection. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the properties of an existing private endpoint connection. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The state (ETag) version of the private endpoint connection to update. This + /// value can be omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// The private link service connection state of the private endpoint + /// connection + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (privateEndpointConnectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (privateEndpointConnectionName != null) + { + if (privateEndpointConnectionName.Length > 101) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "privateEndpointConnectionName", 101); + } + if (privateEndpointConnectionName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "privateEndpointConnectionName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(privateEndpointConnectionName, "^[a-zA-Z0-9_-]+\\.?[a-fA-F0-9-]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "privateEndpointConnectionName", "^[a-zA-Z0-9_-]+\\.?[a-fA-F0-9-]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + PrivateEndpointConnection parameters = new PrivateEndpointConnection(); + if(privateLinkServiceConnectionState != null) + { + parameters.PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("ifMatch", ifMatch); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes the specified private endpoint connection. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (privateEndpointConnectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (privateEndpointConnectionName != null) + { + if (privateEndpointConnectionName.Length > 101) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "privateEndpointConnectionName", 101); + } + if (privateEndpointConnectionName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "privateEndpointConnectionName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(privateEndpointConnectionName, "^[a-zA-Z0-9_-]+\\.?[a-fA-F0-9-]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "privateEndpointConnectionName", "^[a-zA-Z0-9_-]+\\.?[a-fA-F0-9-]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists all of the private endpoint connections in the specified account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBatchAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBatchAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/PrivateEndpointConnectionOperationsExtensions.cs b/src/Batch/Batch.Management.Sdk/Generated/PrivateEndpointConnectionOperationsExtensions.cs new file mode 100644 index 000000000000..f899f7b19201 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/PrivateEndpointConnectionOperationsExtensions.cs @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for PrivateEndpointConnectionOperations + /// + public static partial class PrivateEndpointConnectionOperationsExtensions + { + /// + /// Lists all of the private endpoint connections in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + public static Microsoft.Rest.Azure.IPage ListByBatchAccount(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, int? maxresults = default(int?)) + { + return ((IPrivateEndpointConnectionOperations)operations).ListByBatchAccountAsync(resourceGroupName, accountName, maxresults).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the private endpoint connections in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBatchAccountAsync(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, int? maxresults = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBatchAccountWithHttpMessagesAsync(resourceGroupName, accountName, maxresults, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets information about the specified private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName) + { + return ((IPrivateEndpointConnectionOperations)operations).GetAsync(resourceGroupName, accountName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the specified private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates the properties of an existing private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The state (ETag) version of the private endpoint connection to update. This + /// value can be omitted or set to "*" to apply the operation unconditionally. + /// + public static PrivateEndpointConnection Update(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string ifMatch = default(string)) + { + return ((IPrivateEndpointConnectionOperations)operations).UpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateLinkServiceConnectionState, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Updates the properties of an existing private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The state (ETag) version of the private endpoint connection to update. This + /// value can be omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string ifMatch = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateLinkServiceConnectionState, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes the specified private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + public static PrivateEndpointConnectionDeleteHeaders Delete(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName) + { + return ((IPrivateEndpointConnectionOperations)operations).DeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + /// + /// Updates the properties of an existing private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The state (ETag) version of the private endpoint connection to update. This + /// value can be omitted or set to "*" to apply the operation unconditionally. + /// + public static PrivateEndpointConnection BeginUpdate(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string ifMatch = default(string)) + { + return ((IPrivateEndpointConnectionOperations)operations).BeginUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateLinkServiceConnectionState, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Updates the properties of an existing private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The state (ETag) version of the private endpoint connection to update. This + /// value can be omitted or set to "*" to apply the operation unconditionally. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginUpdateAsync(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string ifMatch = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateLinkServiceConnectionState, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes the specified private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + public static PrivateEndpointConnectionDeleteHeaders BeginDelete(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName) + { + return ((IPrivateEndpointConnectionOperations)operations).BeginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private endpoint connection name. This must be unique within the + /// account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IPrivateEndpointConnectionOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + /// + /// Lists all of the private endpoint connections in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBatchAccountNext(this IPrivateEndpointConnectionOperations operations, string nextPageLink) + { + return ((IPrivateEndpointConnectionOperations)operations).ListByBatchAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the private endpoint connections in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBatchAccountNextAsync(this IPrivateEndpointConnectionOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBatchAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Batch/Batch.Management.Sdk/Generated/PrivateLinkResourceOperations.cs b/src/Batch/Batch.Management.Sdk/Generated/PrivateLinkResourceOperations.cs new file mode 100644 index 000000000000..d557ba592b30 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/PrivateLinkResourceOperations.cs @@ -0,0 +1,711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Batch +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// PrivateLinkResourceOperations operations. + /// + internal partial class PrivateLinkResourceOperations : Microsoft.Rest.IServiceOperations, IPrivateLinkResourceOperations + { + /// + /// Initializes a new instance of the PrivateLinkResourceOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateLinkResourceOperations (BatchManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BatchManagementClient + /// + public BatchManagementClient Client { get; private set; } + + /// + /// Lists all of the private link resources in the specified account. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBatchAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, int? maxresults = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("maxresults", maxresults); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBatchAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (maxresults != null) + { + _queryParameters.Add(string.Format("maxresults={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(maxresults, this.Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets information about the specified private link resource. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private link resource name. This must be unique within the account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateLinkResourceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (accountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "accountName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(accountName, "^[a-zA-Z0-9]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "accountName", "^[a-zA-Z0-9]+$"); + } + } + if (privateLinkResourceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "privateLinkResourceName"); + } + if (privateLinkResourceName != null) + { + if (privateLinkResourceName.Length > 101) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "privateLinkResourceName", 101); + } + if (privateLinkResourceName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "privateLinkResourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(privateLinkResourceName, "^[a-zA-Z0-9_-]+\\.?[a-fA-F0-9-]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "privateLinkResourceName", "^[a-zA-Z0-9_-]+\\.?[a-fA-F0-9-]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateLinkResourceName", privateLinkResourceName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateLinkResourceName}", System.Uri.EscapeDataString(privateLinkResourceName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists all of the private link resources in the specified account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBatchAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBatchAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/Generated/PrivateLinkResourceOperationsExtensions.cs b/src/Batch/Batch.Management.Sdk/Generated/PrivateLinkResourceOperationsExtensions.cs new file mode 100644 index 000000000000..3cc442579c60 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Generated/PrivateLinkResourceOperationsExtensions.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Batch +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for PrivateLinkResourceOperations + /// + public static partial class PrivateLinkResourceOperationsExtensions + { + /// + /// Lists all of the private link resources in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + public static Microsoft.Rest.Azure.IPage ListByBatchAccount(this IPrivateLinkResourceOperations operations, string resourceGroupName, string accountName, int? maxresults = default(int?)) + { + return ((IPrivateLinkResourceOperations)operations).ListByBatchAccountAsync(resourceGroupName, accountName, maxresults).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the private link resources in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The maximum number of items to return in the response. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBatchAccountAsync(this IPrivateLinkResourceOperations operations, string resourceGroupName, string accountName, int? maxresults = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBatchAccountWithHttpMessagesAsync(resourceGroupName, accountName, maxresults, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets information about the specified private link resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private link resource name. This must be unique within the account. + /// + public static PrivateLinkResource Get(this IPrivateLinkResourceOperations operations, string resourceGroupName, string accountName, string privateLinkResourceName) + { + return ((IPrivateLinkResourceOperations)operations).GetAsync(resourceGroupName, accountName, privateLinkResourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about the specified private link resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the Batch account. + /// + /// + /// The name of the Batch account. + /// + /// + /// The private link resource name. This must be unique within the account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IPrivateLinkResourceOperations operations, string resourceGroupName, string accountName, string privateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, privateLinkResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists all of the private link resources in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBatchAccountNext(this IPrivateLinkResourceOperations operations, string nextPageLink) + { + return ((IPrivateLinkResourceOperations)operations).ListByBatchAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the private link resources in the specified account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBatchAccountNextAsync(this IPrivateLinkResourceOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBatchAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Batch/Batch.Management.Sdk/Properties/AssemblyInfo.cs b/src/Batch/Batch.Management.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..55a82015179a --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - Batch Management SDK")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] + +[assembly: AssemblyVersion("15.0.0")] +[assembly: AssemblyFileVersion("15.0.0")] \ No newline at end of file diff --git a/src/Batch/Batch.Management.Sdk/README.md b/src/Batch/Batch.Management.Sdk/README.md new file mode 100644 index 000000000000..698c27486b07 --- /dev/null +++ b/src/Batch/Batch.Management.Sdk/README.md @@ -0,0 +1,96 @@ +# Overall +This directory contains management plane service clients of Az.Storage module. + +## Run Generation +In this directory, run AutoRest: +``` +autorest --reset +autorest --use:@autorest/powershell@4.x +``` + +### AutoRest Configuration +> see https://aka.ms/autorest +``` yaml +isSdkGenerator: true +powershell: true +clear-output-folder: true +reflect-api-versions: true +openapi-type: arm +azure-arm: true +license-header: MICROSOFT_MIT_NO_VERSION +payload-flattening-threshold: 1 +# title: BatchManagementClient + +commit: 19aa8ab5d14b22bdeb67eab31c65b47c5380fd06 +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/batch/resource-manager/Microsoft.Batch/stable/2022-10-01/BatchManagement.json + +output-folder: Generated + +namespace: Microsoft.Azure.Management.Batch + +directive: + - suppress: R2001 + where: $.definitions.Operation.properties.properties + reason: Breaking change. + + - suppress: R2017 + where: + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"].put + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"].put + reason: Matching service response. + + - suppress: R2063 + reason: Bug in linter + + - suppress: R2066 + where: + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}/cancelDelete"].post.operationId + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/listKeys"].post.operationId + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/regenerateKeys"].post.operationId + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/syncAutoStorageKeys"].post.operationId + reason: This is fine as long as the OperationIds are all unique (as they presently are), and fixing it would likely involve a breaking change. + + - suppress: R3018 + where: + - $.definitions.ApplicationProperties.properties.allowUpdates + - $.definitions.BatchAccountProperties.properties.dedicatedCoreQuotaPerVMFamilyEnforced + - $.definitions.CheckNameAvailabilityResult.properties.nameAvailable + - $.definitions.StartTask.properties.waitForSuccess + - $.definitions.VMExtension.properties.autoUpgradeMinorVersion + - $.definitions.WindowsConfiguration.properties.enableAutomaticUpdates + reason: Breaking change. + + - suppress: R3018 + where: + - $.definitions.Operation.properties.isDataAction + reason: Boolean required for operations schema. + + - suppress: R4009 + where: + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"].get + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"].patch + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}"].put + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"].get + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"].patch + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}"].put + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"].get + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/applications/{applicationName}/versions/{versionName}"].put + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"].get + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"].patch + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/certificates/{certificateName}"].put + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}"].get + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}"].patch + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/detectors/{detectorId}"].put + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"].get + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"].put + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}"].patch + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"].patch + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}"].get + - $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/privateLinkResources/{privateLinkResourceName}"].get + reason: Service missing headers. + + - suppress: OBJECT_MISSING_REQUIRED_PROPERTY + where: $.definitions.UserAccount + reason: This field contains a secret (password) and is not returned on a get (but is required on a PUT/PATCH). Previous discussions with the modelling team had said that this was the correct way to model this type of field. +``` \ No newline at end of file diff --git a/src/Batch/Batch.Test/Batch.Test.csproj b/src/Batch/Batch.Test/Batch.Test.csproj index 930edda9004a..31ac7612207f 100644 --- a/src/Batch/Batch.Test/Batch.Test.csproj +++ b/src/Batch/Batch.Test/Batch.Test.csproj @@ -14,11 +14,11 @@ - + diff --git a/src/Batch/Batch.sln b/src/Batch/Batch.sln index c982e4e05ce9..a932ddea9c8b 100644 --- a/src/Batch/Batch.sln +++ b/src/Batch/Batch.sln @@ -5,40 +5,39 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accounts", "Accounts", "{017F1277-0280-4544-AF22-231768874D1E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{CFD5CF9A-B2E3-4F69-9759-7DE4980936B6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{CFD5CF9A-B2E3-4F69-9759-7DE4980936B6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{8F310D80-52AF-4E89-B61E-1FD596D2B83D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{8F310D80-52AF-4E89-B61E-1FD596D2B83D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{4A5E29D5-749A-46B7-AB0E-9AA0E4977ED1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{4A5E29D5-749A-46B7-AB0E-9AA0E4977ED1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{08E02681-4D96-4A95-BA2C-A32A3354AEFB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{08E02681-4D96-4A95-BA2C-A32A3354AEFB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{E169C6A2-58DC-4FCE-8E91-2AC4F0CDA7E5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{E169C6A2-58DC-4FCE-8E91-2AC4F0CDA7E5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{1AB99293-F381-41C6-9F22-ED6FF4E93C51}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{1AB99293-F381-41C6-9F22-ED6FF4E93C51}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{50EAAC73-162C-4060-A28B-592C9FD3FA1E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Batch.Test", "Batch.Test\Batch.Test.csproj", "{F2419995-1E08-4EC6-A620-F165C144D4A1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Batch.Test", "Batch.Test\Batch.Test.csproj", "{F2419995-1E08-4EC6-A620-F165C144D4A1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Batch", "Batch\Batch.csproj", "{639E4290-A6D6-4FFC-9D41-E823CE427E73}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Batch", "Batch\Batch.csproj", "{639E4290-A6D6-4FFC-9D41-E823CE427E73}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DependentModules", "DependentModules", "{7129077A-5BF9-4F8B-9795-BAF3E08F1860}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Network.Management.Sdk", "..\Network\Network.Management.Sdk\Network.Management.Sdk.csproj", "{90A86F6C-9D58-43C2-A534-9C621410D221}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Network.Management.Sdk", "..\Network\Network.Management.Sdk\Network.Management.Sdk.csproj", "{90A86F6C-9D58-43C2-A534-9C621410D221}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Network", "..\Network\Network\Network.csproj", "{B93529F5-43E7-4DF5-BCE1-08E7D0A187E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Network", "..\Network\Network\Network.csproj", "{B93529F5-43E7-4DF5-BCE1-08E7D0A187E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{8568021D-0F10-4F0A-9C2D-42669DCD3A3F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{8568021D-0F10-4F0A-9C2D-42669DCD3A3F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Batch.Management.Sdk", "Batch.Management.Sdk\Batch.Management.Sdk.csproj", "{01E1634E-4210-4869-9F13-7B093E7BD85E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {CFD5CF9A-B2E3-4F69-9759-7DE4980936B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CFD5CF9A-B2E3-4F69-9759-7DE4980936B6}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -84,6 +83,13 @@ Global {8568021D-0F10-4F0A-9C2D-42669DCD3A3F}.Debug|Any CPU.Build.0 = Debug|Any CPU {8568021D-0F10-4F0A-9C2D-42669DCD3A3F}.Release|Any CPU.ActiveCfg = Release|Any CPU {8568021D-0F10-4F0A-9C2D-42669DCD3A3F}.Release|Any CPU.Build.0 = Release|Any CPU + {01E1634E-4210-4869-9F13-7B093E7BD85E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {01E1634E-4210-4869-9F13-7B093E7BD85E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {01E1634E-4210-4869-9F13-7B093E7BD85E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {01E1634E-4210-4869-9F13-7B093E7BD85E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {CFD5CF9A-B2E3-4F69-9759-7DE4980936B6} = {017F1277-0280-4544-AF22-231768874D1E} diff --git a/src/Batch/Batch/Az.Batch.psd1 b/src/Batch/Batch/Az.Batch.psd1 index b338f9046f9f..9f46d2d137b4 100644 --- a/src/Batch/Batch/Az.Batch.psd1 +++ b/src/Batch/Batch/Az.Batch.psd1 @@ -57,7 +57,7 @@ RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '3.0.4'; }) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = 'Microsoft.AspNetCore.WebUtilities.dll', - 'Microsoft.Azure.Batch.dll', 'Microsoft.Azure.Management.Batch.dll', + 'Microsoft.Azure.Batch.dll', 'Microsoft.Azure.PowerShell.Batch.Management.Sdk.dll', 'Microsoft.Extensions.Primitives.dll', 'Microsoft.Net.Http.Headers.dll', 'Microsoft.WindowsAzure.Storage.dll', diff --git a/src/Batch/Batch/Batch.csproj b/src/Batch/Batch/Batch.csproj index 1728c19a7afe..6054ea798036 100644 --- a/src/Batch/Batch/Batch.csproj +++ b/src/Batch/Batch/Batch.csproj @@ -13,10 +13,13 @@ - + + + + True diff --git a/src/Batch/Batch/ChangeLog.md b/src/Batch/Batch/ChangeLog.md index c42a25ae76c4..4cbec43f8b63 100644 --- a/src/Batch/Batch/ChangeLog.md +++ b/src/Batch/Batch/ChangeLog.md @@ -18,6 +18,9 @@ - Additional information about change #1 --> ## Upcoming Release +* Migrate Batch SDK to generated SDK + - Removed "Microsoft.Azure.Management.Batch" Version="15.0.0" PackageReference + - Added Batch.Management.Sdk ProjectReference ## Version 3.6.3 * Fixed secrets exposure in example documentation. diff --git a/src/Batch/Batch/Models/BatchClient.PrivateEndpointConnection.cs b/src/Batch/Batch/Models/BatchClient.PrivateEndpointConnection.cs index 9b35d8f0c143..3dcd7f8e6582 100644 --- a/src/Batch/Batch/Models/BatchClient.PrivateEndpointConnection.cs +++ b/src/Batch/Batch/Models/BatchClient.PrivateEndpointConnection.cs @@ -93,7 +93,7 @@ public virtual void UpdatePrivateEndpointConnection(string resourceGroup, string PrivateLinkServiceConnectionState state = new PrivateLinkServiceConnectionState(status: status, description: description); - BatchManagementClient.PrivateEndpointConnection.Update(resourceGroup, accountName, name, default, state); + BatchManagementClient.PrivateEndpointConnection.Update(resourceGroup, accountName, name, state, default); } internal IEnumerable ListAllPrivateEndpointConnections(string resourceGroup, string accountName, int? maxResults = null)