protected PSCluster SendPatchRequest(ClusterUpdateParameters request) { WriteVerboseWithTimestamp("Begin to update the cluster"); Cluster cluster = StartRequestAndWait <Cluster>( () => this.SFRPClient.Clusters.BeginUpdateWithHttpMessagesAsync(this.ResourceGroupName, this.Name, request), () => string.Format(ServiceFabricProperties.Resources.ClusterStateVerbose, GetCurrentClusterState())); return(new PSCluster(cluster)); }
protected PSCluster SendPatchRequest(ClusterUpdateParameters request, bool runOnSameThread = true) { if (runOnSameThread) { WriteVerboseWithTimestamp("Begin to update the cluster"); } Cluster cluster = null; var tokenSource = new CancellationTokenSource(); try { var patchRequest = Task.Factory.StartNew(() => { try { cluster = this.SFRPClient.Clusters.Update(this.ResourceGroupName, this.Name, request); } finally { tokenSource.Cancel(); } }); while (!tokenSource.IsCancellationRequested) { if (runOnSameThread) { if (!RunningTest) { var c = SafeGetResource(() => this.GetCurrentCluster(), true); if (c != null) { WriteVerboseWithTimestamp( string.Format( ServiceFabricProperties.Resources.ClusterStateVerbose, c.ClusterState)); } } } Thread.Sleep(TimeSpan.FromSeconds(WriteVerboseIntervalInSec)); } if (patchRequest.IsFaulted) { throw patchRequest.Exception; } } catch (Exception e) { PrintSdkExceptionDetail(e); throw GetInnerException(e); } return(new PSCluster(cluster)); }
public override void ExecuteCmdlet() { var cluster = SFRPClient.Clusters.Get(ResourceGroupName, Name); if (ShouldProcess(target: this.Name, action: string.Format("Add client certificate"))) { switch (ParameterSetName) { case SingleUpdateWithThumbprintSet: case MultipleUpdatesWithThumbprintSet: { var oldCertThumbprints = cluster.ClientCertificateThumbprints; var allCertThumbprints = ParseArgumentsForThumbprint(); if (oldCertThumbprints != null) { allCertThumbprints.AddRange(oldCertThumbprints); } var patchRequest = new ClusterUpdateParameters { ClientCertificateThumbprints = allCertThumbprints, ClientCertificateCommonNames = cluster.ClientCertificateCommonNames }; var psCluster = SendPatchRequest(patchRequest); WriteObject(psCluster, true); break; } case SingleUpdateWithCommonNameSet: case MultipleUpdatesWithCommonNameSet: { var oldCommonNames = cluster.ClientCertificateCommonNames; var allNewCommonNames = ParseArgumentsForCommonName(false); if (oldCommonNames != null) { allNewCommonNames.AddRange(oldCommonNames); } var patchRequest = new ClusterUpdateParameters { ClientCertificateCommonNames = allNewCommonNames, ClientCertificateThumbprints = cluster.ClientCertificateThumbprints }; var psCluster = SendPatchRequest(patchRequest); WriteObject(psCluster, true); break; } } } }
public override void ExecuteCmdlet() { var clusterResource = GetCurrentCluster(); var clusterType = GetClusterType(clusterResource); if (clusterType == ClusterType.Unsecure) { throw new PSInvalidOperationException( string.Format( ServiceFabricProperties.Resources.RemoveCertFromUnsecureCluster, this.Name)); } if (clusterResource.Certificate.ThumbprintSecondary == null) { throw new InvalidOperationException( ServiceFabricProperties.Resources.OnlyOneClusterCertificate); } var patchRequest = new ClusterUpdateParameters { Certificate = clusterResource.Certificate }; if (this.Thumbprint.Equals( clusterResource.Certificate.ThumbprintSecondary, StringComparison.OrdinalIgnoreCase)) { patchRequest.Certificate.ThumbprintSecondary = null; } else if (this.Thumbprint.Equals( clusterResource.Certificate.Thumbprint, StringComparison.OrdinalIgnoreCase)) { patchRequest.Certificate.Thumbprint = clusterResource.Certificate.ThumbprintSecondary; clusterResource.Certificate.ThumbprintSecondary = null; } else { throw new InvalidOperationException( string.Format( ServiceFabricProperties.Resources.CannotFindThumbprintInTheCluster, this.Thumbprint)); } if (ShouldProcess(target: this.Name, action: string.Format("Remove a cluster certificate"))) { var cluster = SendPatchRequest(patchRequest); WriteObject(cluster, true); } }
public override void ExecuteCmdlet() { var patchRequest = new ClusterUpdateParameters(); if (UpgradeMode == ClusterUpgradeMode.Manual) { patchRequest.ClusterCodeVersion = this.Version; } patchRequest.UpgradeMode = UpgradeMode.ToString(); if (ShouldProcess(target: this.Name, action: string.Format("Set fabric upgrade type to {0} ", this.UpgradeMode))) { var cluster = SendPatchRequest(patchRequest); WriteObject(cluster, true); } }
public override void ExecuteCmdlet() { var cluster = GetCurrentCluster(); var existingNodeType = GetNodeType(cluster, this.NodeType, ignoreErrors: true); if (existingNodeType == null) { throw new PSArgumentException( string.Format( ServiceFabricProperties.Resources.CannotFindTheNodeType, this.NodeType)); } if (ShouldProcess(target: this.NodeType, action: string.Format("Update nodetype {0}", this.NodeType))) { if (cluster.NodeTypes == null) { throw new PSInvalidOperationException(ServiceFabricProperties.Resources.NodeTypesNotDefinedInCluster); } bool isPatchRequired = false; if (this.IsPrimaryNodeType.HasValue && this.IsPrimaryNodeType.Value != existingNodeType.IsPrimary) { existingNodeType.IsPrimary = this.IsPrimaryNodeType.Value; isPatchRequired = true; } if (isPatchRequired) { var patchRequest = new ClusterUpdateParameters { NodeTypes = cluster.NodeTypes }; var psCluster = SendPatchRequest(patchRequest); WriteObject(psCluster, true); } else { WriteVerbose(string.Format(ServiceFabricProperties.Resources.NodeTypeUpdateIsNoOp, this.NodeType)); WriteObject(new PSCluster(cluster), true); } } }
public override void ExecuteCmdlet() { var cluster = GetCurrentCluster(); if (ShouldProcess(target: this.Name, action: string.Format("Remove a client certificate"))) { switch (ParameterSetName) { case SingleUpdateWithThumbprintSet: case MultipleUpdatesWithThumbprintSet: { var oldCertThumbprints = cluster.ClientCertificateThumbprints.Select( c => c.CertificateThumbprint).ToDictionary( c => c, StringComparer.OrdinalIgnoreCase); var toRemoveThumbprints = ParseArgumentsForThumbprint(); if (oldCertThumbprints.Any()) { var notExist = toRemoveThumbprints.SingleOrDefault( c => !oldCertThumbprints.ContainsKey( c.CertificateThumbprint)); if (notExist != null) { throw new PSArgumentException( string.Format( ServiceFabricProperties.Resources.CannotFindCertificateInCluster, notExist.CertificateThumbprint)); } } else { throw new PSArgumentException( string.Format( ServiceFabricProperties.Resources.NoneCertificateFound)); } var thumbprintList = cluster.ClientCertificateThumbprints.ToList(); foreach (var thumbprint in toRemoveThumbprints) { thumbprintList.RemoveAll(c => string.Equals( c.CertificateThumbprint, thumbprint.CertificateThumbprint, StringComparison.InvariantCultureIgnoreCase)); } var patchRequest = new ClusterUpdateParameters { ClientCertificateThumbprints = thumbprintList, ClientCertificateCommonNames = cluster.ClientCertificateCommonNames }; var psCluster = SendPatchRequest(patchRequest); WriteObject(psCluster, true); break; } case SingleUpdateWithCommonNameSet: case MultipleUpdatesWithCommonNameSet: { var oldCommonNames = cluster.ClientCertificateCommonNames .GroupBy(c => c.CertificateCommonName + c.CertificateIssuerThumbprint, StringComparer.OrdinalIgnoreCase) .ToDictionary(c => c.Key, c => c.First(), StringComparer.OrdinalIgnoreCase); var toRemoveCommonName = ParseArgumentsForCommonName(true); if (oldCommonNames.Any()) { var notExist = toRemoveCommonName.SingleOrDefault( c => !oldCommonNames.ContainsKey( c.CertificateCommonName + c.CertificateIssuerThumbprint)); if (notExist != null) { throw new PSArgumentException( string.Format( ServiceFabricProperties.Resources.CannotFindCommonNameAndIssuer, notExist.CertificateCommonName, notExist.CertificateIssuerThumbprint)); } } else { throw new PSArgumentException(string.Format( ServiceFabricProperties.Resources.NoneCertificateFound)); } var commonNames = cluster.ClientCertificateCommonNames.ToList(); foreach (var commonName in toRemoveCommonName) { commonNames.RemoveAll(c => string.Equals( commonName.CertificateCommonName + commonName.CertificateIssuerThumbprint, c.CertificateCommonName + c.CertificateIssuerThumbprint, StringComparison.OrdinalIgnoreCase)); } var patchRequest = new ClusterUpdateParameters { ClientCertificateCommonNames = commonNames, ClientCertificateThumbprints = cluster.ClientCertificateThumbprints }; var psCluster = SendPatchRequest(patchRequest); WriteObject(psCluster, true); break; } } } }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var clusterResource = GetCurrentCluster(); var clusterType = GetClusterType(clusterResource); if (clusterType == ClusterType.Unsecure) { throw new PSInvalidOperationException( string.Format( ServiceFabricProperties.Resources.AddCertToUnsecureCluster, this.Name)); } if (ShouldProcess(target: this.Name, action: string.Format("Add cluster certificate"))) { var certInformations = base.GetOrCreateCertificateInformation(); var certInformation = certInformations[0]; var allTasks = new List <Task>(); var vmssPages = ComputeClient.VirtualMachineScaleSets.List(this.ResourceGroupName); if (vmssPages == null || !vmssPages.Any()) { throw new PSArgumentException(string.Format( ServiceFabricProperties.Resources.NoneNodeTypeFound, this.ResourceGroupName)); } do { if (!vmssPages.Any()) { break; } foreach (var vmss in vmssPages) { var ext = FindFabricVmExt(vmss.VirtualMachineProfile.ExtensionProfile.Extensions); var extConfig = (JObject)ext.Settings; var input = string.Format( @"{{""thumbprint"":""{0}"",""x509StoreName"":""{1}""}}", certInformation.CertificateThumbprint, Constants.DefaultCertificateStore); extConfig["certificateSecondary"] = JObject.Parse(input); vmss.VirtualMachineProfile.ExtensionProfile.Extensions.Single( extension => extension.Name.Equals(ext.Name, StringComparison.OrdinalIgnoreCase)).Settings = extConfig; allTasks.Add(AddCertToVmssTask(vmss, certInformation)); } } while (!string.IsNullOrEmpty(vmssPages.NextPageLink) && (vmssPages = ComputeClient.VirtualMachineScaleSets.ListNext(vmssPages.NextPageLink)) != null); WriteClusterAndVmssVerboseWhenUpdate(allTasks, false); var patchRequest = new ClusterUpdateParameters { Certificate = clusterResource.Certificate }; patchRequest.Certificate.ThumbprintSecondary = certInformation.CertificateThumbprint; var cluster = SendPatchRequest(patchRequest); WriteObject(cluster); } }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var clusterResource = GetCurrentCluster(); var clusterType = GetClusterType(clusterResource); if (clusterType == ClusterType.Unsecure) { throw new PSInvalidOperationException( string.Format( ServiceFabricProperties.Resources.AddCertToUnsecureCluster, this.Name)); } if ((this.CertificateCommonName != null && clusterResource.Certificate != null) || (this.CertificateCommonName == null && clusterResource.CertificateCommonNames != null)) { throw new PSInvalidOperationException( string.Format( ServiceFabricProperties.Resources.CertificateMixTPAndCN, this.Name)); } if (ShouldProcess(target: this.Name, action: string.Format("Add cluster certificate"))) { var certInformations = base.GetOrCreateCertificateInformation(); var certInformation = certInformations[0]; if (this.CertificateCommonName != null && this.CertificateCommonName != certInformation.CertificateCommonName) { throw new PSArgumentException( string.Format(ServiceFabricProperties.Resources.CertificateCommonNameMismatch, this.CertificateCommonName, certInformation.CertificateCommonName)); } var addTasks = CreateAddOrRemoveCertVMSSTasks(certInformation, clusterResource.ClusterId, true); try { WriteClusterAndVmssVerboseWhenUpdate(addTasks, false); } catch (AggregateException) { WriteWarning("Exception while performing operation. Rollingback..."); var removeTasks = CreateAddOrRemoveCertVMSSTasks(certInformation, clusterResource.ClusterId, true, false); WriteClusterAndVmssVerboseWhenUpdate(removeTasks, false); WriteWarning("Operation rolled back, the certificate was removed from VMSS model."); throw; } var patchRequest = new ClusterUpdateParameters(); if (this.CertificateCommonName != null) { string issuerTP = this.CertificateIssuerThumbprint != null ? this.CertificateIssuerThumbprint : String.Empty; patchRequest.CertificateCommonNames = clusterResource.CertificateCommonNames; patchRequest.CertificateCommonNames.CommonNames.Add(new ServerCertificateCommonName(this.CertificateCommonName, issuerTP)); } else { patchRequest.Certificate = clusterResource.Certificate; patchRequest.Certificate.ThumbprintSecondary = certInformation.CertificateThumbprint; } var cluster = SendPatchRequest(patchRequest); WriteObject(cluster); } }
public override void ExecuteCmdlet() { var cluster = GetCurrentCluster(); var oldReliabilityLevel = GetReliabilityLevel(cluster); if (this.ReliabilityLevel == oldReliabilityLevel) { WriteObject(new PSCluster(cluster), true); return; } var primaryNodeType = GetPrimaryNodeType(cluster, this.NodeType); var primaryVmss = GetPrimaryVmss(cluster, primaryNodeType); var instanceNumber = (int)ReliabilityLevel; if (primaryVmss.Sku.Capacity == null) { throw new PSInvalidOperationException(ServiceFabricProperties.Resources.SkuCapacityIsNull); } if (ShouldProcess(target: this.Name, action: string.Format("Update fabric reliability level to {0}", this.ReliabilityLevel))) { if ((int)this.ReliabilityLevel >= (int)oldReliabilityLevel) { if (instanceNumber > primaryVmss.Sku.Capacity && !this.AutoAddNode.IsPresent) { throw new InvalidOperationException( string.Format( ServiceFabricProperties.Resources.UseAutoToIncreaseNodesCount, primaryVmss.Sku.Capacity, instanceNumber )); } if (primaryVmss.Sku.Capacity < instanceNumber) { primaryVmss.Sku.Capacity = instanceNumber; var updateVmssTask = ComputeClient.VirtualMachineScaleSets.CreateOrUpdateAsync( this.ResourceGroupName, primaryVmss.Name, primaryVmss); WriteClusterAndVmssVerboseWhenUpdate(new List <Task>() { updateVmssTask }, false); } } primaryNodeType.VmInstanceCount = Convert.ToInt32(primaryVmss.Sku.Capacity); var request = new ClusterUpdateParameters { ReliabilityLevel = this.ReliabilityLevel.ToString(), NodeTypes = cluster.NodeTypes }; var psCluster = SendPatchRequest(request); WriteObject(psCluster, true); } }
/// <summary> /// Updates properties of a compute. This call will overwrite a compute if it /// exists. This is a nonrecoverable operation. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// Name of the resource group in which workspace is located. /// </param> /// <param name='workspaceName'> /// Name of Azure Machine Learning workspace. /// </param> /// <param name='computeName'> /// Name of the Azure Machine Learning compute. /// </param> /// <param name='parameters'> /// Additional parameters for cluster update. /// </param> public static ComputeResource BeginUpdate(this IMachineLearningComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ClusterUpdateParameters parameters) { return(operations.BeginUpdateAsync(resourceGroupName, workspaceName, computeName, parameters).GetAwaiter().GetResult()); }
public override void ExecuteCmdlet() { var vmss = GetVmss(this.NodeType); var ext = FindFabricVmExt(vmss.VirtualMachineProfile.ExtensionProfile.Extensions); var cluster = GetCurrentCluster(); var nodeType = GetNodeType(cluster, this.NodeType); var oldDurabilityLevel = GetDurabilityLevel(nodeType.DurabilityLevel); var newDurabilityLevel = this.DurabilityLevel; var isMismatched = oldDurabilityLevel != GetDurabilityLevel(vmss); if (newDurabilityLevel == oldDurabilityLevel && !isMismatched) { WriteObject(new PSCluster(cluster), true); return; } if (isMismatched) { WriteWarning(ServiceFabricProperties.Resources.DurabilityLevelMismatches); } if (!ChangeAllowed(oldDurabilityLevel, newDurabilityLevel, vmss.Sku.Name)) { throw new PSInvalidOperationException( string.Format( ServiceFabricProperties.Resources.CannotChangeDurabilityFrom, oldDurabilityLevel, newDurabilityLevel)); } if (newDurabilityLevel == DurabilityLevel.Bronze && !string.IsNullOrEmpty(this.Sku) && !this.Sku.Equals(vmss.Sku.Name)) { throw new PSInvalidOperationException( ServiceFabricProperties.Resources.CannotUpdateSkuWithBronzeDurability); } if (!string.IsNullOrEmpty(Sku)) { vmss.Sku = new Sku(this.Sku, Constants.DefaultTier, vmss.Sku.Capacity); } ((JObject)ext.Settings)["durabilityLevel"] = this.DurabilityLevel.ToString(); ((JObject)ext.Settings)["enableParallelJobs"] = true; if (ShouldProcess(target: this.Name, action: string.Format("Update fabric durability level to {0} of {1}", this.DurabilityLevel, this.NodeType))) { var vmssTask = ComputeClient.VirtualMachineScaleSets.CreateOrUpdateAsync( ResourceGroupName, vmss.Name, vmss); nodeType.DurabilityLevel = this.DurabilityLevel.ToString(); var patchArg = new ClusterUpdateParameters { NodeTypes = cluster.NodeTypes }; var patchTask = PatchAsync(patchArg); WriteClusterAndVmssVerboseWhenUpdate(new List <Task>() { vmssTask, patchTask }, true, this.NodeType); var psCluster = new PSCluster(patchTask.Result); WriteObject(psCluster, true); } }
/// <summary> /// Updates the configuration of a Service Fabric cluster resource. /// </summary> /// <remarks> /// Update the configuration of a Service Fabric cluster resource with the /// specified name. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='clusterName'> /// The name of the cluster resource. /// </param> /// <param name='parameters'> /// The parameters which contains the property value and property name which /// used to update the cluster configuration. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Cluster> BeginUpdateAsync(this IClustersOperations operations, string resourceGroupName, string clusterName, ClusterUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, clusterName, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Updates the configuration of a Service Fabric cluster resource. /// </summary> /// <remarks> /// Update the configuration of a Service Fabric cluster resource with the /// specified name. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='clusterName'> /// The name of the cluster resource. /// </param> /// <param name='parameters'> /// The parameters which contains the property value and property name which /// used to update the cluster configuration. /// </param> public static Cluster BeginUpdate(this IClustersOperations operations, string resourceGroupName, string clusterName, ClusterUpdateParameters parameters) { return(operations.BeginUpdateAsync(resourceGroupName, clusterName, parameters).GetAwaiter().GetResult()); }
public override void ExecuteCmdlet() { WriteWarning("After the NodeType is removed, you may see the nodes of the NodeType are in error state. " + "Run 'Remove-ServiceFabricNodeState' on those nodes to fix them. Read this document for details: " + "https://docs.microsoft.com/powershell/module/servicefabric/remove-servicefabricnodestate?view=azureservicefabricps"); var cluster = GetCurrentCluster(); var vmssExists = VmssExists(); var existingNodeType = GetNodeType(cluster, this.NodeType, ignoreErrors: true); if (existingNodeType != null) { if (existingNodeType.IsPrimary) { throw new PSInvalidOperationException( string.Format( ServiceFabricProperties.Resources.CannotDeletePrimaryNodeType, this.NodeType)); } var durabilityLevel = GetDurabilityLevel(existingNodeType.DurabilityLevel); if (durabilityLevel == DurabilityLevel.Bronze && vmssExists) { var vmss = GetVmss(existingNodeType.Name, cluster.ClusterId); VirtualMachineScaleSetExtension sfExtension; if (TryGetFabricVmExt(vmss.VirtualMachineProfile.ExtensionProfile?.Extensions, out sfExtension)) { string vmssDurabilityLevel = GetDurabilityLevelFromExtension(sfExtension); if (!string.Equals(DurabilityLevel.Bronze.ToString(), vmssDurabilityLevel, StringComparison.InvariantCultureIgnoreCase)) { throw new PSInvalidOperationException(string.Format( ServiceFabricProperties.Resources.CannotRemoveMismatchedDurabilityNodeType, this.NodeType)); } } } } if (!vmssExists && existingNodeType == null) { throw new PSArgumentException( string.Format( ServiceFabricProperties.Resources.CannotFindTheNodeType, this.NodeType)); } if (ShouldProcess(target: this.NodeType, action: string.Format("Remove a nodetype {0}", this.NodeType))) { if (vmssExists) { this.ComputeClient.VirtualMachineScaleSets.Delete(this.ResourceGroupName, this.NodeType); } if (cluster.NodeTypes == null) { throw new PSInvalidOperationException(ServiceFabricProperties.Resources.NodeTypesNotDefinedInCluster); } if (existingNodeType != null) { cluster.NodeTypes.Remove(existingNodeType); /** * * Pulled this out after discussion with Justin. Opened Issue #6246 to track the Null Ptr Exception. * cluster.UpgradeDescription.DeltaHealthPolicy = new ClusterUpgradeDeltaHealthPolicy() * { * MaxPercentDeltaUnhealthyApplications = 0, * MaxPercentDeltaUnhealthyNodes = 0, * MaxPercentUpgradeDomainDeltaUnhealthyNodes = 0 * };**/ var patchRequest = new ClusterUpdateParameters { NodeTypes = cluster.NodeTypes }; var psCluster = SendPatchRequest(patchRequest); WriteObject(psCluster, true); } else { WriteObject(new PSCluster(cluster), true); } } }
/// <summary> /// Updates properties of a compute. This call will overwrite a compute if it /// exists. This is a nonrecoverable operation. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// Name of the resource group in which workspace is located. /// </param> /// <param name='workspaceName'> /// Name of Azure Machine Learning workspace. /// </param> /// <param name='computeName'> /// Name of the Azure Machine Learning compute. /// </param> /// <param name='parameters'> /// Additional parameters for cluster update. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ComputeResource> BeginUpdateAsync(this IMachineLearningComputeOperations operations, string resourceGroupName, string workspaceName, string computeName, ClusterUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, computeName, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
protected Task <Cluster> PatchAsync(ClusterUpdateParameters request) { return(this.SFRPClient.Clusters.UpdateAsync(this.ResourceGroupName, this.Name, request)); }
public virtual MachineLearningComputeUpdateOperation StartUpdate(string resourceGroupName, string workspaceName, string computeName, ClusterUpdateParameters parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (workspaceName == null) { throw new ArgumentNullException(nameof(workspaceName)); } if (computeName == null) { throw new ArgumentNullException(nameof(computeName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("MachineLearningComputeOperations.StartUpdate"); scope.Start(); try { var originalResponse = RestClient.Update(resourceGroupName, workspaceName, computeName, parameters, cancellationToken); return(new MachineLearningComputeUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGroupName, workspaceName, computeName, parameters).Request, originalResponse)); } catch (Exception e) { scope.Failed(e); throw; } }